annotate growth.c @ 14:bbc214c6fa6f

fixed the result of an unchecked rename ...
author meillo@marmaro.de
date Wed, 23 Jul 2008 16:39:06 +0200
parents 8db6497d6065
children 5e6c9260913a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
b1e309dc0b98 added growth module (quite static and limited implementation)
meillo@marmaro.de
parents:
diff changeset
1 #include <stdio.h>
b1e309dc0b98 added growth module (quite static and limited implementation)
meillo@marmaro.de
parents:
diff changeset
2 #include <stdlib.h>
b1e309dc0b98 added growth module (quite static and limited implementation)
meillo@marmaro.de
parents:
diff changeset
3 #include "db.h"
b1e309dc0b98 added growth module (quite static and limited implementation)
meillo@marmaro.de
parents:
diff changeset
4 #include "game.h"
b1e309dc0b98 added growth module (quite static and limited implementation)
meillo@marmaro.de
parents:
diff changeset
5
b1e309dc0b98 added growth module (quite static and limited implementation)
meillo@marmaro.de
parents:
diff changeset
6
b1e309dc0b98 added growth module (quite static and limited implementation)
meillo@marmaro.de
parents:
diff changeset
7 void grow_plants() {
b1e309dc0b98 added growth module (quite static and limited implementation)
meillo@marmaro.de
parents:
diff changeset
8 /* get weather and last environments to calculate the next one */
12
8db6497d6065 merged everything to only one program
meillo@marmaro.de
parents: 11
diff changeset
9 sprintf(query, "update field \
8db6497d6065 merged everything to only one program
meillo@marmaro.de
parents: 11
diff changeset
10 set age = age+1, size = size+1 ");
8db6497d6065 merged everything to only one program
meillo@marmaro.de
parents: 11
diff changeset
11 stmt = db_query(query);
8db6497d6065 merged everything to only one program
meillo@marmaro.de
parents: 11
diff changeset
12 if (!db_update(query)) {
8db6497d6065 merged everything to only one program
meillo@marmaro.de
parents: 11
diff changeset
13 printf("E: update failed ++ %s\n", sqlite3_errmsg(db));
7
b1e309dc0b98 added growth module (quite static and limited implementation)
meillo@marmaro.de
parents:
diff changeset
14 }
11
176ee28e7464 switched from mysql to sqlite; (+ some cleanups)
meillo@marmaro.de
parents: 7
diff changeset
15 sqlite3_finalize(stmt);
7
b1e309dc0b98 added growth module (quite static and limited implementation)
meillo@marmaro.de
parents:
diff changeset
16 }
b1e309dc0b98 added growth module (quite static and limited implementation)
meillo@marmaro.de
parents:
diff changeset
17
b1e309dc0b98 added growth module (quite static and limited implementation)
meillo@marmaro.de
parents:
diff changeset
18
12
8db6497d6065 merged everything to only one program
meillo@marmaro.de
parents: 11
diff changeset
19 void growth(void) {
7
b1e309dc0b98 added growth module (quite static and limited implementation)
meillo@marmaro.de
parents:
diff changeset
20 grow_plants();
b1e309dc0b98 added growth module (quite static and limited implementation)
meillo@marmaro.de
parents:
diff changeset
21 }