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:
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user