garten
diff environment.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 |
line diff
1.1 --- a/environment.c Wed Jul 23 17:14:38 2008 +0200 1.2 +++ b/environment.c Wed Jul 23 17:40:55 2008 +0200 1.3 @@ -1,10 +1,9 @@ 1.4 #include <stdio.h> 1.5 #include <stdlib.h> 1.6 #include "db.h" 1.7 -#include "game.h" 1.8 1.9 1.10 -void set_environment() { 1.11 +int set_environment() { 1.12 int groundwater, slugs, earthworms; 1.13 1.14 /* get weather and last environments to calculate the next one * 1.15 @@ -22,7 +21,6 @@ 1.16 slugs = 5; 1.17 earthworms = 10; 1.18 1.19 - 1.20 /* set weather */ 1.21 sprintf(query, 1.22 "insert into environment " 1.23 @@ -35,11 +33,12 @@ 1.24 ); 1.25 if (!db_update(query)) { 1.26 db_error("environment insertion"); 1.27 + return 0; 1.28 } 1.29 - 1.30 + return 1; 1.31 } 1.32 1.33 1.34 -void environment(void) { 1.35 - set_environment(); 1.36 +int environment(void) { 1.37 + return set_environment(); 1.38 }