Mercurial > garten
comparison 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 |
comparison
equal
deleted
inserted
replaced
11:176ee28e7464 | 12:8db6497d6065 |
---|---|
1 #include <stdio.h> | 1 #include <stdio.h> |
2 #include <stdlib.h> | 2 #include <stdlib.h> |
3 | |
4 #include "db.h" | 3 #include "db.h" |
5 #include "game.h" | 4 #include "game.h" |
6 | |
7 | |
8 | 5 |
9 | 6 |
10 void set_environment() { | 7 void set_environment() { |
11 int groundwater, slugs, earthworms; | 8 int groundwater, slugs, earthworms; |
12 | 9 |
29 /* set weather */ | 26 /* set weather */ |
30 sprintf(query, " insert into environment \ | 27 sprintf(query, " insert into environment \ |
31 (tick, groundwater, slugs, earthworms) \ | 28 (tick, groundwater, slugs, earthworms) \ |
32 values ('%d', '%d', '%d', '%d') ", | 29 values ('%d', '%d', '%d', '%d') ", |
33 gametime, groundwater, slugs, earthworms); | 30 gametime, groundwater, slugs, earthworms); |
34 db_query(query); | 31 if (!db_update(query)) { |
35 if (sqlite3_step(stmt) == SQLITE_DONE) { | |
36 printf("environment successful inserted\n"); | |
37 } else { | |
38 printf("error: environment insertion failed: %s\n", sqlite3_errmsg(db)); | 32 printf("error: environment insertion failed: %s\n", sqlite3_errmsg(db)); |
39 } | 33 } |
40 | 34 |
41 } | 35 } |
42 | 36 |
43 | 37 |
44 int main(int argc, char* argv[]) { | 38 void environment(void) { |
45 printf(" --> environment\n"); | |
46 | |
47 /* init */ | |
48 if (argc != 2) { | |
49 printf("usage: %s <database>\n", argv[0]); | |
50 exit(1); | |
51 } | |
52 database = argv[1]; | |
53 | |
54 db_connect(); | |
55 read_time(); | |
56 | |
57 set_environment(); | 39 set_environment(); |
58 | |
59 | |
60 db_close(); | |
61 | |
62 printf(" --< environment\n"); | |
63 return 0; | |
64 } | 40 } |