From 7e687112b67c667a690581e09eb1b635deb1a0cd Mon Sep 17 00:00:00 2001 From: driAn Date: Sat, 2 Jun 2007 16:09:55 +0000 Subject: [PATCH] no message git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@1088 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/clients2c.cpp | 14 +++++++++++--- source/src/protocol.h | 2 +- source/src/renderhud.cpp | 9 ++++++--- source/src/server.cpp | 3 ++- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/source/src/clients2c.cpp b/source/src/clients2c.cpp index d33256f3..37745234 100644 --- a/source/src/clients2c.cpp +++ b/source/src/clients2c.cpp @@ -519,10 +519,10 @@ void parsemessages(int cn, playerent *d, ucharbuf &p) if(cl >= 0 && r >= 0) { playerent *pl = (cl == getclientnum() ? player1 : newclient(cl)); - if(pl && pl->name[0]) + if(pl) { pl->clientrole = r; - conoutf("%s claimed %s status", pl == player1 ? "you" : pl->name, r == CR_ADMIN ? "admin" : "master"); + if(pl->name[0]) conoutf("%s claimed %s status", pl == player1 ? "you" : pl->name, r == CR_ADMIN ? "admin" : "master"); } } break; @@ -531,12 +531,12 @@ void parsemessages(int cn, playerent *d, ucharbuf &p) case SV_SERVOPCMD: { int cmd = getint(p), arg = getint(p); + playerent *pl = (arg == getclientnum() ? NULL : getclient(arg)); switch(cmd) { case SOPCMD_KICK: case SOPCMD_BAN: { - playerent *pl = (arg == getclientnum() ? NULL : getclient(arg)); if(pl) conoutf("%s has been %s", pl->name, cmd == SOPCMD_KICK ? "kicked" : "banned"); break; } @@ -552,6 +552,14 @@ void parsemessages(int cn, playerent *d, ucharbuf &p) autoteambalance = arg == 1; if(!joining) conoutf("autoteam is %s", autoteambalance ? "enabled" : "disabled"); break; + + case SOPCMD_GIVEMASTER: + if(pl) conoutf("the admin gave master state to %s", pl->name); + break; + + case SOPCMD_FORCETEAM: + if(pl) conoutf("player %s was forced to change the team", pl->name); + break; } break; } diff --git a/source/src/protocol.h b/source/src/protocol.h index aa1b38b5..ba3bcd15 100644 --- a/source/src/protocol.h +++ b/source/src/protocol.h @@ -31,7 +31,7 @@ enum { SOPCMD_KICK = 0, SOPCMD_BAN, SOPCMD_REMBANS, SOPCMD_MASTERMODE, SOPCMD_AU #define DAF 1.0f #define DVF 100.0f -enum { DISC_NONE = 0, DISC_EOP, DISC_CN, DISC_MKICK, DISC_MBAN, DISC_TAGT, DISC_BANREFUSE, DISC_WRONGPW, DISC_MLOGINFAIL, DISC_MAXCLIENTS, DISC_MASTERMODE, DISC_AUTOKICK, DISC_NUM }; +enum { DISC_NONE = 0, DISC_EOP, DISC_CN, DISC_MKICK, DISC_MBAN, DISC_TAGT, DISC_BANREFUSE, DISC_WRONGPW, DISC_SOPLOGINFAIL, DISC_MAXCLIENTS, DISC_MASTERMODE, DISC_AUTOKICK, DISC_NUM }; /* Gamemodes 0 tdm diff --git a/source/src/renderhud.cpp b/source/src/renderhud.cpp index beb7c7d9..9e6877da 100644 --- a/source/src/renderhud.cpp +++ b/source/src/renderhud.cpp @@ -205,8 +205,11 @@ void drawradar(int w, int h) entity *e = f.flag; if(!e) continue; float yaw = showmap ? 0 : player1->yaw; - if(f.state==CTFF_STOLEN && f.actor && insideradar(centerpos, res/2, f.actor->o)) - drawradarent(f.actor->o.x*coordtrans+iconsize/2, f.actor->o.y*coordtrans+iconsize/2, yaw, 3, f.team, iconsize, true); // draw near flag thief + if(f.state==CTFF_STOLEN) + { + if(f.actor && i != team_int(player1->team) && insideradar(centerpos, res/2, f.actor->o)) + drawradarent(f.actor->o.x*coordtrans+iconsize/2, f.actor->o.y*coordtrans+iconsize/2, yaw, 3, f.team, iconsize, true); // draw near flag thief + } else if(insideradar(centerpos, res/2, vec(e->x, e->y, centerpos.z))) drawradarent(e->x*coordtrans, e->y*coordtrans, yaw, 3, f.team, iconsize, false); // draw on entitiy pos } } @@ -232,7 +235,7 @@ void drawteamicons(int w, int h) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glColor3f(1, 1, 1); static Texture *icons = NULL; - if(!icons) icons = textureload("packages/misc/teamicons.png", 3); + if(!icons) icons = textureload("packages/misc/teamicons.png"); quad(icons->id, VIRTW-VIRTH/12-10, 10, VIRTH/12, team_int(player1->team) ? 0.5f : 0, 0, 0.5f, 0.5f); glEnable(GL_CULL_FACE); } diff --git a/source/src/server.cpp b/source/src/server.cpp index fc821da9..735b3899 100644 --- a/source/src/server.cpp +++ b/source/src/server.cpp @@ -662,11 +662,12 @@ void changeclientrole(int client, int role, char *pwd = NULL, bool force=false) int serverop = serveroperator(); if(force || role == CR_DEFAULT || (role == CR_MASTER && serverop < 0) || (role == CR_ADMIN && pwd && pwd[0] && adminpasswd && !strcmp(adminpasswd, pwd))) { + if(role == clients[client]->role) return; if(role > CR_DEFAULT) loopv(clients) clients[i]->role = CR_DEFAULT; clients[client]->role = role; sendserveropinfo(-1); } - else if(pwd && pwd[0]) disconnect_client(client, DISC_MLOGINFAIL); // avoid brute-force + else if(pwd && pwd[0]) disconnect_client(client, DISC_SOPLOGINFAIL); // avoid brute-force } void serveropcmddenied(int receiver, int requiredrole)