diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-03-01 20:21:34 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-03-01 20:21:34 +0000 |
| commit | 6f608ed4627184e1ceed166b138320945517aaa2 (patch) | |
| tree | 8399a7fbd9286454f4d640c44d810b6312fa8709 /src | |
| parent | c36819b18d6e1b11f8bda1bdeb979df5c96bd2ce (diff) | |
| download | zcatch-6f608ed4627184e1ceed166b138320945517aaa2.tar.gz zcatch-6f608ed4627184e1ceed166b138320945517aaa2.zip | |
fixed so that the map rotation works like it should
Diffstat (limited to 'src')
| -rw-r--r-- | src/game/client/gc_hooks.cpp | 1 | ||||
| -rw-r--r-- | src/game/server/gs_game.cpp | 51 |
2 files changed, 34 insertions, 18 deletions
diff --git a/src/game/client/gc_hooks.cpp b/src/game/client/gc_hooks.cpp index e85a7e7f..e1644f36 100644 --- a/src/game/client/gc_hooks.cpp +++ b/src/game/client/gc_hooks.cpp @@ -50,7 +50,6 @@ static void load_sounds_thread(void *) extern "C" void modc_init() { static FONT_SET default_font; - int64 start = time_get(); int before = gfx_memory_usage(); diff --git a/src/game/server/gs_game.cpp b/src/game/server/gs_game.cpp index 228ae828..74bb8569 100644 --- a/src/game/server/gs_game.cpp +++ b/src/game/server/gs_game.cpp @@ -115,33 +115,50 @@ void gameobject::cyclemap() { if(!strlen(config.sv_maprotation)) return; - + // handle maprotation - char buf[512]; - const char *s = strstr(config.sv_maprotation, config.sv_map); - if(s == 0) - s = config.sv_maprotation; // restart rotation - else + const char *map_rotation = config.sv_maprotation; + const char *current_map = config.sv_map; + + int current_map_len = strlen(current_map); + const char *next_map = map_rotation; + while(*next_map) { - 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 wordlen = 0; + while(next_map[wordlen] && !is_separator(next_map[wordlen])) + wordlen++; - int i = 0; - for(; i < 512; i++) + if(wordlen == current_map_len && strncmp(next_map, current_map, current_map_len) == 0) + { + // map found + next_map += current_map_len; + while(*next_map && is_separator(*next_map)) + next_map++; + + break; + } + + next_map++; + } + + // restart rotation + if(next_map[0] == 0) + next_map = map_rotation; + + // cut out the next map + char buf[512]; + for(int i = 0; i < 512; i++) { - buf[i] = s[i]; - if(is_separator(s[i]) || s[i] == 0) + buf[i] = next_map[i]; + if(is_separator(next_map[i]) || next_map[i] == 0) { buf[i] = 0; break; } } - i = 0; // skip spaces + // skip spaces + int i = 0; while(is_separator(buf[i])) i++; |