if-else alike statements in maprot

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@3576 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
ac_stef
2008-11-17 01:29:55 +00:00
parent 6c83e4af80
commit ff837d37fe
2 changed files with 80 additions and 35 deletions
+61 -26
View File
@@ -2,7 +2,7 @@
// WARNING: You can NOT use CubeScript in here!!
// Use the following scheme...
// map:mode:time:allowVote[:minplayer[:maxplayer]]
// map:mode:time:allowVote[:minplayer[:maxplayer[:skiplines]]]
// map will be skipped, if minplayer/maxplayer requirements are failed
// map: map filename without extension
@@ -23,34 +23,69 @@
// maxplayer: if set, the server will skip the map, if more than allowed players are connected
// skiplines: lines to skip in maprot.cfg, after this map got actually played
// this can be used to select one of several lines, instead of playing all lines
// minplayer and maxplayer numbers are only checked when a new game is picked from the map rotation.
// If the player number changes during gameplay, no action will be taken.
ac_scaffold:0:10:1:3 // tdm, 10 minutes, >2 players
ac_power:5:12:1:4:15 // ctf, 12 minutes, 4..15 players
ac_desert:2:8:1:0:6 // dm, 8 minutes, <7 players
ac_keller:13:12:1:9 // htf, 12 minutes, >8 players
ac_arctic:11:10:1:7 // tosok, 10 minutes, >6 players
ac_elevation:5:12:1:4:10 // ctf, 12 minutes, 4..10 players
ac_toxic:0:10:1:4 // tdm, 10 minutes, >3 players
ac_urban:0:10:1:5 // tdm, 10 minutes, >4 players
ac_power:13:12:1:9 // htf, 12 minutes, >8 players
ac_desert3:5:12:1:4:10 // ctf, 12 minutes, 4..10 players
ac_mines:13:12:1:9 // htf, 12 minutes, >8 players
ac_desert2:0:10:1:3 // tdm, 10 minutes, >2 players
ac_depot:5:12:1:4:12 // ctf, 12 minutes, 4..12 players
ac_snow:10:8:1:0:5 // osok, 8 minutes, <6 players
ac_shine:5:12:1:4:10 // ctf, 12 minutes, 4..10 players
ac_complex:0:10:1:3 // tdm, 10 minutes, >2 players
ac_scaffold:11:10:1:6 // tosok, 10 minutes, >5 players
ac_snow:2:8:1:0:6 // dm, 8 minutes, <7 players
ac_keller:5:12:1:4:15 // ctf, 12 minutes, 4..15 players
ac_arctic:0:10:1:4 // tdm, 10 minutes, >3 players
ac_mines:5:12:1:4:10 // ctf, 12 minutes, 4..10 players
ac_desert:9:8:1:0:5 // lss, 8 minutes, <6 players
ac_sunset:5:12:1:4:10 // ctf, 12 minutes, 4..10 players
ac_shine:13:12:1:9 // htf, 12 minutes, >8 players
ac_desert:11:10:1:6 // tosok, 10 minutes, >5 players
ac_scaffold : 2: 8: 1: 0: 3: 1 // dm, 8 minutes, 0..3 players
ac_scaffold : 0:10: 1: 4:11: 0 // tdm, 10 minutes, 4..11 players
ac_power : 5:12: 1: 4:12: 1 // ctf, 12 minutes, 4..12 players
ac_power :13:12: 1:13: 0: 0 // htf, 12 minutes, 13.. players
ac_desert : 2: 8: 1: 0: 4: 1 // dm, 8 minutes, 0..4 players
ac_desert :11:10: 1: 5:11: 0 // tosok, 10 minutes, 5..11 players
ac_keller : 5:12: 1: 4:12: 1 // ctf, 12 minutes, 4..12 players
ac_keller :13:12: 1:13: 0: 0 // htf, 12 minutes, 13.. players
ac_arctic : 0:10: 1: 4: 7: 1 // tdm, 10 minutes, 4..7 players
ac_arctic :11:10: 1: 7: 0: 0 // tosok, 10 minutes, 8.. players
ac_shine : 5:12: 1: 4:13: 1 // ctf, 12 minutes, 4..13 players
ac_shine :13:12: 1:14: 0: 0 // htf, 12 minutes, 14.. players
ac_elevation :15: 8: 1: 2: 5: 2 // ktf, 8 minutes, 2..5 players
ac_elevation : 5:12: 1: 6:10: 1 // ctf, 12 minutes, 6..10 players
ac_elevation :14:10: 1:11:14: 0 // tktf, 10 minutes, 11..14 players
ac_desert : 9: 8: 1: 0: 5: 0 // lss, 8 minutes, 0..5 players
ac_toxic : 2: 8: 1: 2: 5: 1 // dm, 8 minutes, 2..5 players
ac_toxic : 0:10: 1: 6: 0: 0 // tdm, 10 minutes, 6.. players
ac_mines :15: 6: 1: 2: 3: 2 // ktf, 6 minutes, 2..3 players
ac_mines : 5:12: 1: 4:11: 1 // ctf, 12 minutes, 4..11 players
ac_mines :13:10: 1:12:13: 0 // htf, 10 minutes, 12..13 players
ac_scaffold :11: 8: 1: 6: 9: 0 // tosok, 8 minutes, 6..9 players
ac_urban : 0:10: 1: 5: 0: 0 // tdm, 10 minutes, 5.. players
ac_desert3 : 5:12: 1: 4:10: 1 // ctf, 12 minutes, 4..10 players
ac_desert3 :14:10: 1:11: 0: 1 // tktf, 10 minutes, 11.. players
ac_depot : 5:12: 1: 4:12: 0 // ctf, 12 minutes, 4..12 players
ac_desert2 : 0:10: 1: 3: 7: 2 // tdm, 10 minutes, 3..7 players
ac_desert2 :11: 8: 1: 8:10: 1 // tosok, 8 minutes, 8..10 players
ac_desert2 :13:10: 1:11: 0: 0 // htf, 10 minutes, 11.. players
// one short game on ac_snow, either osok or deathmatch (pseudorandom)
ac_snow :10: 6: 1: 0: 1: 7 // osok, 6 minutes, 0..1 players
ac_snow : 2: 6: 1: 2: 2: 6 // dm, 6 minutes, 2 players
ac_snow :10: 6: 1: 3: 3: 5 // osok, 6 minutes, 3 players
ac_snow : 2: 6: 1: 4: 4: 4 // dm, 6 minutes, 4 players
ac_snow :10: 6: 1: 5: 5: 3 // osok, 6 minutes, 5 players
ac_snow : 2: 6: 1: 6: 6: 2 // dm, 6 minutes, 6 players
ac_snow :10: 6: 1: 7: 7: 1 // osok, 6 minutes, 7 players
ac_snow : 0: 6: 1: 8:11: 0 // tdm, 6 minutes, 8..11 players
ac_sunset : 5:12: 1: 4:12: 0 // ctf, 12 minutes, 4..12 players
ac_complex : 0:10: 1: 3:13: 0 // tdm, 10 minutes, 3..13 players
// Change this file to make the map rotation different and add more..
// do only use standard maps and maps from your packages/maps/servermaps folder!
+19 -9
View File
@@ -1441,6 +1441,7 @@ struct configset
bool vote;
int minplayer;
int maxplayer;
int skiplines;
};
vector<configset> configsets;
@@ -1468,7 +1469,7 @@ char *loadcfgfile(char *cfg, const char *name, int *len)
return buf;
}
#define CONFIG_MAXPAR 5
#define CONFIG_MAXPAR 6
extern const char *fullmodestr(int n);
@@ -1495,7 +1496,7 @@ void readscfg(const char *name)
if(l)
{
s_strcpy(c.mapname, l);
par[3] = par[4] = 0; // default values
par[3] = par[4] = par[5] = 0; // default values
for(i = 0; i < CONFIG_MAXPAR; i++)
{
if((l = strtok(NULL, sep)) != NULL)
@@ -1510,8 +1511,9 @@ void readscfg(const char *name)
c.vote = par[2] > 0;
c.minplayer = par[3];
c.maxplayer = par[4];
c.skiplines = par[5];
configsets.add(c);
if(verbose) logger->writeline(log::info," %s, %s, %d minutes, vote:%d, minplayer:%d, maxplayer:%d", c.mapname, fullmodestr(c.mode), c.time, c.vote, c.minplayer, c.maxplayer);
if(verbose) logger->writeline(log::info," %s, %s, %d minutes, vote:%d, minplayer:%d, maxplayer:%d, skiplines:%d", c.mapname, fullmodestr(c.mode), c.time, c.vote, c.minplayer, c.maxplayer, c.skiplines);
}
}
}
@@ -1910,18 +1912,26 @@ void resetmap(const char *newname, int newmode, int newtime, bool notify)
if(notify && m_ktf) sendflaginfo();
}
void nextcfgset(bool notify = true) // load next maprotation set
int nextcfgset(bool notify = true, bool nochange = false) // load next maprotation set
{
int n = numclients();
int csl = configsets.length();
int ccs = curcfgset;
if(ccs >= 0 && ccs < csl) ccs += configsets[ccs].skiplines;
configset *c = NULL;
loopi(configsets.length())
loopi(csl)
{
curcfgset++;
if(curcfgset>=configsets.length() || curcfgset<0) curcfgset=0;
c = &configsets[curcfgset];
ccs++;
if(ccs >= csl || ccs < 0) ccs = 0;
c = &configsets[ccs];
if(n >= c->minplayer && (!c->maxplayer || n <= c->maxplayer)) break;
}
resetmap(c->mapname, c->mode, c->time, notify);
if(!nochange)
{
curcfgset = ccs;
resetmap(c->mapname, c->mode, c->time, notify);
}
return ccs;
}
bool isbanned(int cn)