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 wrap: on
line diff
--- a/environment.c	Wed Jul 23 17:14:38 2008 +0200
+++ b/environment.c	Wed Jul 23 17:40:55 2008 +0200
@@ -1,10 +1,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include "db.h"
-#include "game.h"
 
 
-void set_environment() {
+int set_environment() {
 	int groundwater, slugs, earthworms;
 
 	/* get weather and last environments to calculate the next one *
@@ -22,7 +21,6 @@
 	slugs = 5;
 	earthworms = 10;
 
-
 	/* set weather */
 	sprintf(query,
 			"insert into environment "
@@ -35,11 +33,12 @@
 			);
 	if (!db_update(query)) {
 		db_error("environment insertion");
+		return 0;
 	}
-
+	return 1;
 }
 
 
-void environment(void) {
-	set_environment();
+int environment(void) {
+	return set_environment();
 }