From 001baa1731f7dbc6fb0716ca0c67a8ac08c69d03 Mon Sep 17 00:00:00 2001 From: Rafael Barreto Date: Tue, 10 Aug 2010 04:54:16 +0000 Subject: [PATCH] bug fix: disconnect when ignoring or mute, disrupt password connection force attempts; adds: whereami and go_to (useful for edit), logs about items (allowing the clips to be 3 cubes distant), and clean up git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@5593 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- config/docs.cfg | 7 +++++++ source/src/client.cpp | 15 +++++++++++++++ source/src/clients2c.cpp | 4 ++-- source/src/renderhud.cpp | 10 +++++----- source/src/serveractions.h | 26 +++++++++++++------------- source/src/serverfiles.h | 14 +++++++++++--- 6 files changed, 53 insertions(+), 23 deletions(-) diff --git a/config/docs.cfg b/config/docs.cfg index c5c25cd1..8cd04c10 100644 --- a/config/docs.cfg +++ b/config/docs.cfg @@ -597,6 +597,11 @@ docremark [Will be reset when you issue a 'recalc'. Only works in edit mode.]; docident [getentattr] []; docident [getenttype] []; docident [getmapmsg] [Returns the map message of the current map.]; +docident [go_to] [teleport to some xy position when editing]; +docargument [X] [x position] [] [0]; +docargument [Y] [y position] [] [0]; +docremark [managed to be used with whereami, only works at edit mode]; +docexample [go_to 150 20] []; docident [heightfield] [Marks the current selection as a heightfield.]; docargument [T] [an integer denoting the type] [0 (floor), 2 (ceiling)] [0]; docremark [marks the current selection as a heightfield, with T being floor or ceiling, as above. A surface marked as heightfield will use the vdelta values (see below) of its 4 corners to create a sloped surface. To mark a heightfield as normal again (ignoring vdelta values, set or not) use "solid 0". Default keys are h (floor) and i (ceiling).]; @@ -767,6 +772,8 @@ docident [waterlevel] [Sets the global water level for the map.]; docargument [H] [the water level] [integer] [0]; docremark [Every cube that has a lower floor than the water level will be rendered with a nice wavy water alpha texture. Water physics will be applied to any entity located below it.]; docremark [Performance notes: water is rendered for a whole square encapsulating all visible water areas in the map (try flying above the map in edit mode to see how). So the most efficient water is a single body of water, or multiple water areas that are mostly not visible from each other. Players can influence how accurate the water is rendered using the "watersubdiv" command (map config).]; +docident [whereami] [Tells your position in the map]; +docremark [managed to be used with go_to and check item positions]; docident [wpclear] []; docident [wpflood] []; docident [wpinfo] [makes waypoints visible and either turns on or off the waypoint information display.]; diff --git a/source/src/client.cpp b/source/src/client.cpp index e2b9c077..4c4c98eb 100644 --- a/source/src/client.cpp +++ b/source/src/client.cpp @@ -152,6 +152,19 @@ void modlanconnect() connectserv_(NULL); } +void whereami() +{ + conoutf("you are at (%.2f,%.2f)",player1->o.x,player1->o.y); +} + +void go_to(char *x, char *y) +{ + if ( player1->state != CS_EDITING ) return; + player1->newpos.x=(float)atoi(x); + player1->newpos.y=(float)atoi(y); + conoutf("you are going to (%.2f,%.2f)",(float)atoi(x),(float)atoi(y)); +} + void disconnect(int onlyclean, int async) { bool cleanup = onlyclean!=0; @@ -260,6 +273,8 @@ COMMANDN(modconnect, modconnectserv, ARG_3STR); COMMAND(modconnectadmin, ARG_3STR); COMMAND(modlanconnect, ARG_NONE); COMMANDN(disconnect, trydisconnect, ARG_NONE); +COMMAND(whereami, ARG_NONE); +COMMAND(go_to, ARG_2STR); void cleanupclient() { diff --git a/source/src/clients2c.cpp b/source/src/clients2c.cpp index 254d9011..92a90f49 100644 --- a/source/src/clients2c.cpp +++ b/source/src/clients2c.cpp @@ -367,18 +367,18 @@ void parsemessages(int cn, playerent *d, ucharbuf &p) { playerent *d = getclient(getint(p)); if(d) d->lastvoicecom = lastmillis; + int t = getint(p); if(!d || !(d->muted || d->ignored)) { - int t = getint(p); if ( voicecomsounds == 1 || (voicecomsounds == 2 && m_teammode) ) audiomgr.playsound(t, SP_HIGH); } break; } case SV_VOICECOM: { + int t = getint(p); if(!d || !(d->muted || d->ignored)) { - int t = getint(p); if ( voicecomsounds == 1 ) audiomgr.playsound(t, SP_HIGH); } if(d) d->lastvoicecom = lastmillis; diff --git a/source/src/renderhud.cpp b/source/src/renderhud.cpp index f9f5b044..7d7a7410 100644 --- a/source/src/renderhud.cpp +++ b/source/src/renderhud.cpp @@ -736,19 +736,19 @@ void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwat bool menu = menuvisible(); bool command = getcurcommand() ? true : false; if((p->state==CS_ALIVE || p->state==CS_EDITING) && !p->weaponsel->reloading) - { - bool drawteamwarning = crosshairteamsign && targetplayer && isteam(targetplayer->team, p->team) && targetplayer->state==CS_ALIVE; - p->weaponsel->renderaimhelp(drawteamwarning); - } + { + bool drawteamwarning = crosshairteamsign && targetplayer && isteam(targetplayer->team, p->team) && targetplayer->state==CS_ALIVE; + p->weaponsel->renderaimhelp(drawteamwarning); + } drawdmgindicator(); if(p->state==CS_ALIVE && !hidehudequipment) drawequipicons(p); + if(/*!menu &&*/ (!hideradar || showmap)) drawradar(p, w, h); if(!editmode) { glMatrixMode(GL_MODELVIEW); - if(/*!menu &&*/ (!hideradar || showmap)) drawradar(p, w, h); if(!hideteam && m_teammode) drawteamicons(w, h); glMatrixMode(GL_PROJECTION); } diff --git a/source/src/serveractions.h b/source/src/serveractions.h index 4fc84f19..19c194a7 100644 --- a/source/src/serveractions.h +++ b/source/src/serveractions.h @@ -64,7 +64,7 @@ bool mapisok(mapstats *ms) short *q = &ms->entposs[j*3]; float r2 = 0; loopk(3){ r2 += (p[k]-q[k])*(p[k]-q[k]); } - if ( r2 == 0.0f ) return false; + if ( r2 == 0.0f ) { logline(ACLOG_INFO, "Items too close %s %s (%hd,%hd)", entnames[v], entnames[w],p[0],p[1]); return false; } r2 = 1/r2; if (r2 < 0.0025f) continue; if (w != v) @@ -76,20 +76,20 @@ bool mapisok(mapstats *ms) } /* if (hdensity > 0.0f) { logline(ACLOG_INFO, "ITEM CHECK H %s %f", entnames[v], hdensity); } if (density > 0.0f) { logline(ACLOG_INFO, "ITEM CHECK D %s %f", entnames[v], density); }*/ - if ( hdensity > 0.5f ) return false; - if (v==I_HEALTH) + if ( hdensity > 0.5f ) { logline(ACLOG_INFO, "Items too close %s %.2f (%hd,%hd)", entnames[v],hdensity,p[0],p[1]); return false; } + switch(v) { - if( density > 0.24f ) return false; +#define LOGTHISSWITCH(X) if( density > X ) { logline(ACLOG_INFO, "Items too close %s %.2f (%hd,%hd)", entnames[v],density,p[0],p[1]); return false; } + case I_CLIPS: + case I_HEALTH: LOGTHISSWITCH(0.24f); break; + case I_AMMO: LOGTHISSWITCH(0.04f); break; + case I_HELMET: LOGTHISSWITCH(0.02f); break; + case I_ARMOUR: + case I_GRENADE: + case I_AKIMBO: LOGTHISSWITCH(0.005f); break; + default: break; +#undef LOGTHISSWITCH } - else if (v==I_GRENADE) - { - if( density > 0.005f ) return false; - } - else - { - if( density > 0.04f ) return false; - } - } return Mheight < MAXMHEIGHT && (Mopen = checkarea(testlayout_factor, testlayout)) < MAXMAREA && FlagFlag > MINFF; } diff --git a/source/src/serverfiles.h b/source/src/serverfiles.h index 7be8cd71..01ab87a3 100644 --- a/source/src/serverfiles.h +++ b/source/src/serverfiles.h @@ -696,16 +696,24 @@ struct serverpasswords : serverconfigfile bool found = false; if (address && passguy == address) { - if (passtime + 1000 > servmillis || ( passtries > 10 && passtime + 10000 > servmillis )) + if (passtime + 3000 > servmillis || ( passtries > 5 && passtime + 10000 > servmillis )) { + passtries++; passtime = servmillis; return false; } + else + { + if ( passtime + 60000 < servmillis ) passtries = 0; + } passtries++; } - passtries = 0; - passtime = servmillis; + else + { + passtries = 0; + } passguy = address; + passtime = servmillis; loopv(adminpwds) { if(!strcmp(genpwdhash(name, adminpwds[i].pwd, salt), pwd))