diff weather.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/weather.c	Wed Jul 23 17:14:38 2008 +0200
+++ b/weather.c	Wed Jul 23 17:40:55 2008 +0200
@@ -2,7 +2,6 @@
 #include <stdlib.h>
 #include <time.h>
 #include "db.h"
-#include "game.h"
 
 
 enum {
@@ -68,7 +67,7 @@
 }
 
 
-void setweather(struct weather* w) {
+int setweather(struct weather* w) {
 	char query[512];
 	sprintf(query,
 			" insert into weather "
@@ -78,15 +77,18 @@
 			);
 	if (!db_update(query)) {
 		db_error("weather insertion");
+		return 0;
 	}
+	return 1;
 }
 
 
-void weather(void) {
+int weather(void) {
 	struct weather w;
 	struct weather lastn[Nlast];
 
 	getlastweather(lastn, Nlast);
 	genweather(&w, lastn, Nlast, May);
-	setweather(&w);
+	return setweather(&w);
+	/* FIXME: include all functions in return value */
 }