garten

view environment.c @ 14:bbc214c6fa6f

fixed the result of an unchecked rename ...
author meillo@marmaro.de
date Wed, 23 Jul 2008 16:39:06 +0200
parents 176ee28e7464
children 5e6c9260913a
line source
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include "db.h"
4 #include "game.h"
7 void set_environment() {
8 int groundwater, slugs, earthworms;
10 /* get weather and last environments to calculate the next one *
11 sprintf(query, "select time from simulation");
12 db_query(query);
13 result = mysql_store_result(conn);
14 if (mysql_num_rows(result)) {
15 row = mysql_fetch_row(result);
16 time = atoi(row[0]);
17 }
18 mysql_free_result(result);
19 */
21 groundwater = 20;
22 slugs = 5;
23 earthworms = 10;
26 /* set weather */
27 sprintf(query, " insert into environment \
28 (tick, groundwater, slugs, earthworms) \
29 values ('%d', '%d', '%d', '%d') ",
30 gametime, groundwater, slugs, earthworms);
31 if (!db_update(query)) {
32 printf("error: environment insertion failed: %s\n", sqlite3_errmsg(db));
33 }
35 }
38 void environment(void) {
39 set_environment();
40 }