So, anyway... the old map rotation system is bulky and stupid... so I pretty much started over and came up with the following (most likely incredibly buggy) code... its ugly looking, cause i haven't put everything in nice little functions, and I can streamline it later when i have time. (and when I learn a bit more about C) ... its my first real sort of coding thing so... whatever.
The point of this thing below, is to pretty much allow a server to pick a map based on who is winning, and the server population... e.g. if aliens are on a winning spree... don't pick tremor... if the server has 4 people playing... don't pick transit. The old (rather neat) text reader system... is not smart enough for what i wanted it to do... so this is why i (attempted to) do this... so my clan's server can have a "smarter" map rotation.
It has some bugs... for instance... i think the compiler might have issues with "string (array);" (not sure how to fix this IF its an issue) and one certain variable is missing (can someone fill it in?)... I have not put "static" in here anywhere, and I probably need to (as soon as i learn how to correctly use "static") and many, many others that I have not seen that are probably painfully obvious to you... and you can flame me all you want for them because then you have pointed them out to me, and I can fix it. (which is why i am posting it here)
Since this is a sort of a rough draft... it is here, and not in the "mod showing off" place... here it is.
int g_maprotationwarmup( ); // these are defined somewhere in the server turnon code or something (ideas where exactly?)
int warmup = 0;
//everything below is placed into g_maprotation.c
G_AdvanceMapRotation( ) //only using this name so i dont have to edit main.
{
string thenextmap[9][63];
if(warmup != 1)
{
g_maprotationwarmup( ) //initilizes most varibles
}
if(level.numConnectedClients < 10) //this section picks a "list" depending on server size, and who is winning.
{
x = 0;
}
if(level.numConnectedClients < 20)
{
x = 1;
}
if(level.numConnectedClients >= 20)
{
x = 2;
}
if(level.lastwin == PTE_ALIENS)
{
if(bias < 2) bias++;
}
else if(level.lastwin == PTE_HUMANS)
{
if(bias > 0) bias--;
}
if(bias = 1) x=x+3;
if(bias = 2) x=x+6;
switch(x) //this section picks the next map in the "list" chosen
{
case 0:
y = previous0y;
previous0y = (y + 1);
if(previous0y = numberOmaps0) previous0y = 0;
break;
case 1:
y = previous1y;
previous1y = (y + 1);
if(previous1y = numberOmaps1) previous1y = 0;
break;
case 2:
y = previous2y;
previous2y = (y + 1);
if(previous2y = numberOmaps2) previous2y = 0;
break;
case 3:
y = previous3y;
previous3y = (y + 1);
if(previous3y = numberOmaps3) previous3y = 0;
break;
case 4:
y = previous4y;
previous4y = (y + 1);
if(previous4y = numberOmaps4) previous4y = 0;
break;
case 5:
y = previous5y;
previous5y = (y + 1);
if(previous5y = numberOmaps5) previous5y = 0;
break;
case 6:
y = previous6y;
previous6y = (y + 1);
if(previous6y = numberOmaps6) previous6y = 0;
break;
case 7:
y = previous7y;
previous7y = (y + 1);
if(previous7y = numberOmaps7) previous7y = 0;
break;
case 8:
y = previous8y;
previous8y = (y + 1);
if(previous8y = numberOmaps8) previous8y = 0;
break;
}
if(thelastmap == (thenextmap[x][y]||<insert varible to call current map incase voted on here>) //I need this function/variable. (help?)
{
G_AdvanceMapRotation( ); //ya, it calls itself... dont create situations where "thelastmap" allways = "thenextmap[x][y]"
}
thelastmap = thenextmap[x][y];
trap_SendConsoleCommand( EXEC_APPEND, va( "map %s\n",
thenextmap[x][y] )
}
int g_maprotationwarmup( )
{
int x = 0;
int y = 0;
int previous0y = 0;
int previous1y = 0;
int previous2y = 0;
int previous3y = 0;
int previous4y = 0;
int previous5y = 0;
int previous6y = 0;
int previous7y = 0;
int previous8y = 0;
int bias = 1
string thelastmap = "dontnameyourmapthis"
//IMPORTANT!!! if you added or removed maps from the rotation,
//MAKE SURE you change these!
int numberOmaps0 = 3;
int numberOmaps1 = 3;
int numberOmaps2 = 3;
int numberOmaps3 = 3;
int numberOmaps4 = 3;
int numberOmaps5 = 3;
int numberOmaps6 = 2;
int numberOmaps7 = 3;
int numberOmaps8 = 3;
//got maps you want in rotation? put them in here! this puts all the information into the array.
// NOTE: placing maps in more than one list will tend to increase the amount of times that map is played.
// Also, if lists are different sizes... the maps in the smaller sized lists will be picked more
// ONE more thing: maps in the neutral lists will be called more than the biased lists, do to the code.
// (I lied) you can put maps multiple times in the same list if you feel they arent getting picked enough
// aaaannnnd... the bigger the lists, the better the system will work.
//put small alien biased maps here
thenextmap[0][0] = "atcs"
thenextmap[0][1] = "tremor"
thenextmap[0][2] = "utcsb2"
//put small neutral maps here
thenextmap[1][0] = "atcs"
thenextmap[1][1] = "tremor"
thenextmap[1][2] = "pushcannon_b3"
//put small humman biased maps here
thenextmap[2][0] = "atcs"
thenextmap[2][1] = "wth"
thenextmap[2][2] = "pushcannon_b3"
/put medium alien biased maps here
thenextmap[3][0] = "tremor"
thenextmap[3][1] = "rotcannon_b11"
thenextmap[3][2] = "karith"
//put medium neutral maps here
thenextmap[4][0] = "niveus"
thenextmap[4][1] = "tremor"
thenextmap[4][2] = "rotcannon_b11"
//put medium humman biased maps here
thenextmap[5][0] = "niveus"
thenextmap[5][1] = "mancannon_b3"
thenextmap[5][1] = "gloom2beta2"
/put large alien biased maps here
thenextmap[7][0] = "transit"
thenextmap[6][1] = "pulse"
//put large neutral maps here
thenextmap[7][0] = "transit"
thenextmap[7][1] = "rotcannon_garbage1"
thenextmap[7][2] = "thermal"
//put large humman biased maps here
thenextmap[8][0] = "proycyon"
thenextmap[8][1] = "induction_b3"
warmup = 1 //
}
please post thoughts and bugs and such! thanks.