mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-14 03:58:18 +00:00
fixed so that the map rotation works like it should
This commit is contained in:
parent
c36819b18d
commit
6f608ed462
|
@ -50,7 +50,6 @@ static void load_sounds_thread(void *)
|
||||||
extern "C" void modc_init()
|
extern "C" void modc_init()
|
||||||
{
|
{
|
||||||
static FONT_SET default_font;
|
static FONT_SET default_font;
|
||||||
|
|
||||||
int64 start = time_get();
|
int64 start = time_get();
|
||||||
|
|
||||||
int before = gfx_memory_usage();
|
int before = gfx_memory_usage();
|
||||||
|
|
|
@ -117,31 +117,48 @@ void gameobject::cyclemap()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// handle maprotation
|
// handle maprotation
|
||||||
char buf[512];
|
const char *map_rotation = config.sv_maprotation;
|
||||||
const char *s = strstr(config.sv_maprotation, config.sv_map);
|
const char *current_map = config.sv_map;
|
||||||
if(s == 0)
|
|
||||||
s = config.sv_maprotation; // restart rotation
|
int current_map_len = strlen(current_map);
|
||||||
else
|
const char *next_map = map_rotation;
|
||||||
|
while(*next_map)
|
||||||
{
|
{
|
||||||
s += strlen(config.sv_map); // skip this map
|
int wordlen = 0;
|
||||||
while(is_separator(s[0]))
|
while(next_map[wordlen] && !is_separator(next_map[wordlen]))
|
||||||
s++;
|
wordlen++;
|
||||||
if(s[0] == 0)
|
|
||||||
s = config.sv_maprotation; // restart rotation
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
int i = 0;
|
next_map++;
|
||||||
for(; i < 512; i++)
|
}
|
||||||
|
|
||||||
|
// 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];
|
buf[i] = next_map[i];
|
||||||
if(is_separator(s[i]) || s[i] == 0)
|
if(is_separator(next_map[i]) || next_map[i] == 0)
|
||||||
{
|
{
|
||||||
buf[i] = 0;
|
buf[i] = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
i = 0; // skip spaces
|
// skip spaces
|
||||||
|
int i = 0;
|
||||||
while(is_separator(buf[i]))
|
while(is_separator(buf[i]))
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue