garten
changeset 13:f1d43b52ed36
and here now is the main program
author | meillo@marmaro.de |
---|---|
date | Wed, 23 Jul 2008 15:20:35 +0200 |
parents | 8db6497d6065 |
children | bbc214c6fa6f |
files | .hgignore main.c |
diffstat | 2 files changed, 43 insertions(+), 0 deletions(-) [+] |
line diff
1.1 --- a/.hgignore Wed Jul 23 15:19:45 2008 +0200 1.2 +++ b/.hgignore Wed Jul 23 15:20:35 2008 +0200 1.3 @@ -8,3 +8,6 @@ 1.4 1.5 *.tar.gz 1.6 ChangeLog 1.7 +bu 1.8 +sql 1.9 +garten
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/main.c Wed Jul 23 15:20:35 2008 +0200 2.3 @@ -0,0 +1,40 @@ 2.4 +#include <stdio.h> 2.5 +#include <stdlib.h> 2.6 +#include "db.h" 2.7 +#include "game.h" 2.8 + 2.9 + 2.10 +void run_module(char* name, void (*module)(void)) { 2.11 + printf(" --> %s\n", name); 2.12 + module(); 2.13 + printf(" --< %s\n", name); 2.14 +} 2.15 + 2.16 + 2.17 +int main(int argc, char* argv[]) { 2.18 + if (argc != 2) { 2.19 + printf("usage: %s <database>\n", argv[0]); 2.20 + exit(1); 2.21 + } 2.22 + database = argv[1]; 2.23 + printf("database '%s'\n", database); 2.24 + 2.25 + /* echo "started backend cycle at `date +%F\ %H:%M:%S`" */ 2.26 + db_connect(); 2.27 + read_time(); 2.28 + 2.29 + 2.30 + /* modules */ 2.31 + run_module("clock", worldclock); 2.32 + run_module("weather", weather); 2.33 + run_module("environment", environment); 2.34 + /* run_module("market", market); */ 2.35 + run_module("growth", growth); 2.36 + /* run_module("orderexec", orderexec); */ 2.37 + 2.38 + 2.39 + db_close(); 2.40 + /* echo "finished backend cycle at `date +%F\ %H:%M:%S`" */ 2.41 + 2.42 + return 0; 2.43 +}