diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-02-02 12:38:36 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-02-02 12:38:36 +0000 |
| commit | 1fe3202f0b7e2f52e50c430caa744b029fd5bcef (patch) | |
| tree | e238b0f211badb35fecdc3f87fe32978fd512b5e /src/engine/client/ec_client.c | |
| parent | 307c2cfae8fd678b10235bdc0c1a8cfc7da6adae (diff) | |
| download | zcatch-1fe3202f0b7e2f52e50c430caa744b029fd5bcef.tar.gz zcatch-1fe3202f0b7e2f52e50c430caa744b029fd5bcef.zip | |
cleaned up the console code. added the ability to tune the game in runtime.
Diffstat (limited to 'src/engine/client/ec_client.c')
| -rw-r--r-- | src/engine/client/ec_client.c | 40 |
1 files changed, 35 insertions, 5 deletions
diff --git a/src/engine/client/ec_client.c b/src/engine/client/ec_client.c index b1399645..3c0180b9 100644 --- a/src/engine/client/ec_client.c +++ b/src/engine/client/ec_client.c @@ -18,6 +18,7 @@ #include <engine/e_packer.h> #include <engine/e_memheap.h> #include <engine/e_datafile.h> +#include <engine/e_console.h> #include <mastersrv/mastersrv.h> @@ -1207,20 +1208,49 @@ static void client_run() snd_shutdown(); } +static void connect_command(void *result, void *user_data) +{ + const char *address; + console_result_string(result, 1, &address); + client_connect(address); +} + +static void disconnect_command(void *result, void *user_data) +{ + client_disconnect(); +} + +static void quit_command(void *result, void *user_data) +{ + client_quit(); +} + +static void client_register_commands() +{ + MACRO_REGISTER_COMMAND("quit", "", quit_command, 0x0); + MACRO_REGISTER_COMMAND("connect", "s", connect_command, 0x0); + MACRO_REGISTER_COMMAND("disconnect", "", disconnect_command, 0x0); +} int editor_main(int argc, char **argv); int main(int argc, char **argv) { - /* preinit the mod */ - modc_preinit(); - /* init the engine */ dbg_msg("client", "starting..."); - engine_init("Teewars", argc, argv); + engine_init("Teewars"); + /* register all console commands */ + client_register_commands(); + modc_console_init(); + + /* parse the command line arguments */ + engine_parse_arguments(argc, argv); + + /* run the client*/ client_run(); - + + /* write down the config and quit */ engine_writeconfig(); return 0; } |