Fix gonext command and do it random

Commit fixes broken "gonext" command, among other things reading time
from maprot, and it does random result of this command.
It also removes get_next() function, because it messes up the maprot,
so shouldn't be used.
This commit is contained in:
aurhat
2014-11-05 19:19:33 +01:00
parent 6ede08d011
commit 170f377262
2 changed files with 2 additions and 13 deletions
+2 -1
View File
@@ -3458,12 +3458,13 @@ void process(ENetPacket *packet, int sender, int chan)
time = min(time, 60);
if (vi->gonext)
{
int ccs = mode ? maprot.next(false,false) : maprot.get_next();
int ccs = rnd(maprot.configsets.length());
configset *c = maprot.get(ccs);
if(c)
{
strcpy(vi->text,c->mapname);
mode = vi->num1 = c->mode;
time = vi->num2 = c->time;
}
else fatal("unable to get next map in maprot");
}
-12
View File
@@ -398,18 +398,6 @@ struct servermaprot : serverconfigfile
configset *current() { return configsets.inrange(curcfgset) ? &configsets[curcfgset] : NULL; }
configset *get(int ccs) { return configsets.inrange(ccs) ? &configsets[ccs] : NULL; }
int get_next()
{
int ccs = curcfgset;
while(!strcmp(configsets[curcfgset].mapname,configsets[ccs].mapname))
{
ccs++;
if(!configsets.inrange(ccs)) ccs=0;
if (ccs == curcfgset) break;
}
curcfgset = ccs;
return ccs;
}
};
// serverblacklist.cfg