comparison growth.c @ 18:5937504619f2

rename game.h -> modules.h; added some error handling; and more
author meillo@marmaro.de
date Wed, 23 Jul 2008 17:40:55 +0200
parents 5e6c9260913a
children
comparison
equal deleted inserted replaced
17:5e6c9260913a 18:5937504619f2
1 #include <stdio.h> 1 #include <stdio.h>
2 #include <stdlib.h> 2 #include <stdlib.h>
3 #include "db.h" 3 #include "db.h"
4 #include "game.h"
5 4
6 5
7 void grow_plants() { 6 int grow_plants() {
8 sprintf(query, 7 sprintf(query,
9 "update field " 8 "update field "
10 "set age = age+1, size = size+1 " 9 "set age = age+1, size = size+1 "
11 ); 10 );
12 if (!db_update(query)) { 11 if (!db_update(query)) {
13 db_error("grow plants"); 12 db_error("grow plants");
13 return 0;
14 } 14 }
15 return 1;
15 } 16 }
16 17
17 18
18 void growth(void) { 19 int growth(void) {
19 grow_plants(); 20 return grow_plants();
20 } 21 }