diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/game/game_variables.h | 2 | ||||
| -rw-r--r-- | src/game/server/game_server.cpp | 85 | ||||
| -rw-r--r-- | src/game/server/srv_common.h | 2 |
3 files changed, 68 insertions, 21 deletions
diff --git a/src/game/game_variables.h b/src/game/game_variables.h index 889b8786..59af7246 100644 --- a/src/game/game_variables.h +++ b/src/game/game_variables.h @@ -25,6 +25,8 @@ MACRO_CONFIG_STR(gametype, 32, "dm") MACRO_CONFIG_INT(dbg_bots, 0, 0, 7) MACRO_CONFIG_INT(cl_predict, 1, 0, 1) +MACRO_CONFIG_STR(sv_maprotation, 512, "") + MACRO_CONFIG_INT(dynamic_camera, 1, 0, 1) diff --git a/src/game/server/game_server.cpp b/src/game/server/game_server.cpp index 95b01967..f72b5be5 100644 --- a/src/game/server/game_server.cpp +++ b/src/game/server/game_server.cpp @@ -284,6 +284,7 @@ gameobject::gameobject() game_over_tick = -1; sudden_death = 0; round_start_tick = server_tick(); + round_count = 0; } void gameobject::endround() @@ -298,16 +299,56 @@ void gameobject::resetgame() world->reset_requested = true; } +static bool is_separator(char c) +{ + return c == ';' || c == ' ' || c == ',' || c == '\t'; +} + void gameobject::startround() { resetgame(); + if(strlen(config.sv_maprotation)) + { + char buf[512]; + const char *s = strstr(config.sv_maprotation, config.sv_map); + if(s == 0) + s = config.sv_maprotation; // restart rotation + else + { + s += strlen(config.sv_map); // skip this map + while(is_separator(s[0])) + s++; + if(s[0] == 0) + s = config.sv_maprotation; // restart rotation + } + + int i = 0; + for(; i < 512; i++) + { + buf[i] = s[i]; + if(is_separator(s[i]) || s[i] == 0) + { + buf[i] = 0; + break; + } + } + + i = 0; // skip spaces + while(is_separator(buf[i])) + i++; + + dbg_msg("game", "rotating map to %s", &buf[i]); + strcpy(config.sv_map, &buf[i]); + } + round_start_tick = server_tick(); sudden_death = 0; game_over_tick = -1; world->paused = false; teamscore[0] = 0; teamscore[1] = 0; + round_count++; } void gameobject::post_reset() @@ -1416,27 +1457,6 @@ void mods_tick() if(world->paused) // make sure that the game object always updates gameobj->tick(); - - if(config.dbg_bots) - { - static int count = 0; - if(count >= 0) - { - count++; - if(count == 10) - { - for(int i = 0; i < config.dbg_bots ; i++) - { - mods_client_enter(MAX_CLIENTS-i-1); - strcpy(players[MAX_CLIENTS-i-1].name, "(bot)"); - if(gameobj->gametype != GAMETYPE_DM) - players[MAX_CLIENTS-i-1].team = i&1; - } - - count = -1; - } - } - } } void mods_snap(int client_id) @@ -1696,6 +1716,29 @@ void mods_init() } world->insert_entity(gameobj); + + + if(config.dbg_bots) + { + /* + static int count = 0; + if(count >= 0) + { + count++; + if(count == 10) + {*/ + for(int i = 0; i < config.dbg_bots ; i++) + { + mods_client_enter(MAX_CLIENTS-i-1); + strcpy(players[MAX_CLIENTS-i-1].name, "(bot)"); + if(gameobj->gametype != GAMETYPE_DM) + players[MAX_CLIENTS-i-1].team = i&1; + } + /* + count = -1; + } + }*/ + } } void mods_shutdown() diff --git a/src/game/server/srv_common.h b/src/game/server/srv_common.h index 22aa4535..f01dd39c 100644 --- a/src/game/server/srv_common.h +++ b/src/game/server/srv_common.h @@ -119,6 +119,8 @@ protected: int teamscore[2]; + int round_count; + public: int gametype; gameobject(); |