garten

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 diff
     1.1 --- a/weather.c	Wed Jul 23 17:14:38 2008 +0200
     1.2 +++ b/weather.c	Wed Jul 23 17:40:55 2008 +0200
     1.3 @@ -2,7 +2,6 @@
     1.4  #include <stdlib.h>
     1.5  #include <time.h>
     1.6  #include "db.h"
     1.7 -#include "game.h"
     1.8  
     1.9  
    1.10  enum {
    1.11 @@ -68,7 +67,7 @@
    1.12  }
    1.13  
    1.14  
    1.15 -void setweather(struct weather* w) {
    1.16 +int setweather(struct weather* w) {
    1.17  	char query[512];
    1.18  	sprintf(query,
    1.19  			" insert into weather "
    1.20 @@ -78,15 +77,18 @@
    1.21  			);
    1.22  	if (!db_update(query)) {
    1.23  		db_error("weather insertion");
    1.24 +		return 0;
    1.25  	}
    1.26 +	return 1;
    1.27  }
    1.28  
    1.29  
    1.30 -void weather(void) {
    1.31 +int weather(void) {
    1.32  	struct weather w;
    1.33  	struct weather lastn[Nlast];
    1.34  
    1.35  	getlastweather(lastn, Nlast);
    1.36  	genweather(&w, lastn, Nlast, May);
    1.37 -	setweather(&w);
    1.38 +	return setweather(&w);
    1.39 +	/* FIXME: include all functions in return value */
    1.40  }