garten

diff environment.c @ 12:8db6497d6065

merged everything to only one program
author meillo@marmaro.de
date Wed, 23 Jul 2008 15:19:45 +0200
parents 176ee28e7464
children 5e6c9260913a
line diff
     1.1 --- a/environment.c	Wed Jul 23 11:41:38 2008 +0200
     1.2 +++ b/environment.c	Wed Jul 23 15:19:45 2008 +0200
     1.3 @@ -1,12 +1,9 @@
     1.4  #include <stdio.h>
     1.5  #include <stdlib.h>
     1.6 -
     1.7  #include "db.h"
     1.8  #include "game.h"
     1.9  
    1.10  
    1.11 -
    1.12 -
    1.13  void set_environment() {
    1.14  	int groundwater, slugs, earthworms;
    1.15  
    1.16 @@ -31,34 +28,13 @@
    1.17  			(tick, groundwater, slugs, earthworms) \
    1.18  			values ('%d', '%d', '%d', '%d') ",
    1.19  			gametime, groundwater, slugs, earthworms);
    1.20 -	db_query(query);
    1.21 -	if (sqlite3_step(stmt) == SQLITE_DONE) {
    1.22 -		printf("environment successful inserted\n");
    1.23 -	} else {
    1.24 +	if (!db_update(query)) {
    1.25  		printf("error: environment insertion failed: %s\n", sqlite3_errmsg(db));
    1.26  	}
    1.27  
    1.28  }
    1.29  
    1.30  
    1.31 -int main(int argc, char* argv[]) {
    1.32 -	printf("  --> environment\n");
    1.33 -
    1.34 -	/* init */
    1.35 -	if (argc != 2) {
    1.36 -		printf("usage: %s <database>\n", argv[0]);
    1.37 -		exit(1);
    1.38 -	}
    1.39 -	database = argv[1];
    1.40 -
    1.41 -	db_connect();
    1.42 -	read_time();
    1.43 -
    1.44 +void environment(void) {
    1.45  	set_environment();
    1.46 -
    1.47 -
    1.48 -	db_close();
    1.49 -
    1.50 -	printf("  --< environment\n");
    1.51 -	return 0;
    1.52  }