blocking bad maps in client side, and beginning the work with the medal system

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@5031 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Rafael Barreto
2010-05-24 17:24:33 +00:00
parent 02da74afdf
commit bc01595024
9 changed files with 129 additions and 26 deletions
+20 -14
View File
@@ -212,6 +212,19 @@ void parsepositions(ucharbuf &p)
}
}
extern int checkarea(int maplayout_factor, char *maplayout);
char *mlayout = NULL;
int Mv = 0, Ma = 0, MA = 0;
float Mh = 0;
extern int connected;
bool good_map()
{
bool checked = ((MA = checkarea(sfactor, mlayout)) < MAXMAREA && Mh < MAXMHEIGHT);
if (!connected) return true;
return checked;
}
void parsemessages(int cn, playerent *d, ucharbuf &p)
{
static char text[MAXTRANS];
@@ -369,7 +382,7 @@ void parsemessages(int cn, playerent *d, ucharbuf &p)
if(d) d->setskin(i, skin);
}
break;
case SV_INITCLIENT: // another client either connected or changed name/team
{
int cn = getint(p);
@@ -443,6 +456,12 @@ void parsemessages(int cn, playerent *d, ucharbuf &p)
case SV_SPAWNSTATE:
{
if (!good_map()) {
loopi(6+2*NUMGUNS) getint(p);
break;
}
if(editmode) toggleedit(true);
showscores(false);
setscope(false);
@@ -469,19 +488,6 @@ void parsemessages(int cn, playerent *d, ucharbuf &p)
player1->weaponswitch(player1->primweap);
player1->weaponchanging -= weapon::weaponchangetime/2;
int A = 0, V = 0, h;
for ( int i = 0 ; i < ssize ; i++ ) {
for ( int j = 0 ; j < ssize ; j++ ) {
sqr *s = S(i, j);
if( s->type!=SOLID && (h = s->ceil - s->floor) > 6 ) {
A++;
V+=h;
}
}
}
float H = (float)V/A;
// conoutf("Map height density information (ssize = %d): H = %.2f, V = %d and A = %d", ssize, H,V,A);
break;
}