Mercurial > garten
annotate growth.c @ 20:17b2bcc42d72 default tip
added check for empty result; minor stuff
author | meillo@marmaro.de |
---|---|
date | Sun, 27 Jul 2008 21:34:54 +0200 |
parents | 5937504619f2 |
children |
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 |
b1e309dc0b98
added growth module (quite static and limited implementation)
meillo@marmaro.de
parents:
diff
changeset
|
5 |
18
5937504619f2
rename game.h -> modules.h; added some error handling; and more
meillo@marmaro.de
parents:
17
diff
changeset
|
6 int grow_plants() { |
17 | 7 sprintf(query, |
8 "update field " | |
9 "set age = age+1, size = size+1 " | |
10 ); | |
12 | 11 if (!db_update(query)) { |
17 | 12 db_error("grow plants"); |
18
5937504619f2
rename game.h -> modules.h; added some error handling; and more
meillo@marmaro.de
parents:
17
diff
changeset
|
13 return 0; |
7
b1e309dc0b98
added growth module (quite static and limited implementation)
meillo@marmaro.de
parents:
diff
changeset
|
14 } |
18
5937504619f2
rename game.h -> modules.h; added some error handling; and more
meillo@marmaro.de
parents:
17
diff
changeset
|
15 return 1; |
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 |
18
5937504619f2
rename game.h -> modules.h; added some error handling; and more
meillo@marmaro.de
parents:
17
diff
changeset
|
19 int growth(void) { |
5937504619f2
rename game.h -> modules.h; added some error handling; and more
meillo@marmaro.de
parents:
17
diff
changeset
|
20 return grow_plants(); |
7
b1e309dc0b98
added growth module (quite static and limited implementation)
meillo@marmaro.de
parents:
diff
changeset
|
21 } |