no message

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@731 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
driAn
2006-11-25 22:19:04 +00:00
parent 890141c706
commit d478059945
5 changed files with 24 additions and 27 deletions
+9 -9
View File
@@ -86,12 +86,12 @@ struct sline { string s; };
vector<sline> scorelines;
int menu = 0;
void renderscore(playerent *d)
void renderscore(playerent *d, int cn)
{
s_sprintfd(lag)("%d", d->plag);
s_sprintfd(name) ("(%s)", d->name);
if(m_ctf) s_sprintf(scorelines.add().s)("%d\t%d\t%s\t%d\t%s\t%s", d->flagscore, d->frags, d->state==CS_LAGGED ? "LAG" : lag, d->ping, d->team, d->state==CS_DEAD ? name : d->name);
else s_sprintf(scorelines.add().s)("%d\t%s\t%d\t%s\t%s", d->frags, d->state==CS_LAGGED ? "LAG" : lag, d->ping, m_teammode ? d->team : "", d->state==CS_DEAD ? name : d->name);
if(m_ctf) s_sprintf(scorelines.add().s)("%s%d\t%d\t%s\t%d\t%s\t%s (%d)", d->ismaster ? "\f0" : "", d->flagscore, d->frags, d->state==CS_LAGGED ? "LAG" : lag, d->ping, d->team, d->state==CS_DEAD ? name : d->name, cn);
else s_sprintf(scorelines.add().s)("%s%d\t%s\t%d\t%s\t%s (%d)", d->ismaster ? "\f0" : "", d->frags, d->state==CS_LAGGED ? "LAG" : lag, d->ping, m_teammode ? d->team : "", d->state==CS_DEAD ? name : d->name, cn);
menumanual(menu, scorelines.length()-1, scorelines.last().s);
};
@@ -131,8 +131,8 @@ void renderscores()
if(!scoreson) return;
menu = m_ctf ? 2 : 0;
scorelines.setsize(0);
if(!demoplayback) renderscore(player1);
loopv(players) if(players[i]) renderscore(players[i]);
if(!demoplayback) renderscore(player1, getclientnum());
loopv(players) if(players[i]) renderscore(players[i], i);
sortmenu(menu, 0, scorelines.length());
if(m_teammode)
@@ -142,17 +142,17 @@ void renderscores()
loopv(players) addteamscore(players[i]);
if(!demoplayback) addteamscore(player1);
teamscores.sort(teamscorecmp);
string &teamline = scorelines.add().s;
teamline[0] = 0;
loopv(teamscores)
{
if(i>=4) break;
//if(i>=4) break;
string &teamline = scorelines.add().s;
teamline[0] = 0;
string s;
if(m_ctf) s_sprintf(s)("[ %s: %d flags %d frags ]", teamscores[i].team, teamscores[i].flagscore, teamscores[i].score);
else s_sprintf(s)("[ %s: %d ]", teamscores[i].team, teamscores[i].score);
s_strcat(teamline, s);
menumanual(menu, scorelines.length(), teamline);
};
menumanual(menu, scorelines.length(), teamline);
};
};
+9 -1
View File
@@ -408,7 +408,6 @@ void parsemessages(int cn, playerent *d, ucharbuf &p)
conoutf("%s", text);
break;
// EDIT: AH
case SV_FLAGINFO:
{
int flag = getint(p);
@@ -460,6 +459,15 @@ void parsemessages(int cn, playerent *d, ucharbuf &p)
d->flagscore = getint(p);
break;
};
case SV_MASTERINFO:
{
playerent *pl;
int m = getint(p);
if(m == -1) loopv(players) { players[i]->ismaster = false; }
else if((pl = getclient(m)) != NULL) pl->ismaster = true;
break;
};
/* demo recording compat */
case SV_PING:
+4 -3
View File
@@ -142,10 +142,10 @@ struct playerent : dynent
int lastupdate, plag, ping;
int lifesequence; // sequence id for each respawn, used in damage test
int frags, flagscore;
int health, armour; //armourtype, quadmillis;
int akimbomillis;
int health, armour;
int gunselect, gunwait;
int lastaction, lastattackgun, lastmove, lastpain;
bool ismaster;
bool attacking;
int ammo[NUMGUNS];
int mag[NUMGUNS];
@@ -162,10 +162,11 @@ struct playerent : dynent
struct bounceent *inhandnade;
int akimbo;
int akimbolastaction[2];
int akimbomillis;
poshist history; // Previous stored locations of this player
playerent() : plag(0), ping(0), lifesequence(0), frags(0), flagscore(0), lastpain(0),
playerent() : plag(0), ping(0), lifesequence(0), frags(0), flagscore(0), lastpain(0), ismaster(false),
shots(0), reloading(false), primary(GUN_ASSAULT), nextprimary(GUN_ASSAULT),
skin(0), nextskin(0), inhandnade(NULL)
{
+1 -1
View File
@@ -18,7 +18,7 @@ enum
SV_SENDMAP, SV_RECVMAP, SV_SERVMSG, SV_ITEMLIST, SV_WEAPCHANGE,
SV_MODELSKIN,
SV_FLAGPICKUP, SV_FLAGDROP, SV_FLAGRETURN, SV_FLAGSCORE, SV_FLAGINFO, SV_FLAGS, //EDIT: AH
SV_SETMASTER, SV_SETMASTERLOGIN, SV_MASTERCMD,
SV_SETMASTER, SV_SETMASTERLOGIN, SV_MASTERINFO, SV_MASTERCMD,
SV_PWD,
SV_CLIENT,
};
+1 -13
View File
@@ -490,17 +490,6 @@ bool isbanned(int cn)
return false;
};
/*void getmaster(int sender, char *pwd)
{
if(!pwd[0] || !isdedicated) return;
if(masterpasswd && !strcmp(masterpasswd, pwd))
{
clients[sender]->ismaster = true;
sendservmsg("master login successful", sender);
}
else disconnect_client(sender, DISC_MLOGINFAIL);
};*/
int master()
{
loopv(clients) if(clients[i]->type!=ST_EMPTY && clients[i]->ismaster) return i;
@@ -514,9 +503,8 @@ void setmaster(int client, bool claim, char *pwd = NULL)
int curmaster = master();
if((curmaster == -1 || curmaster == client) || (pwd && pwd[0] && masterpasswd && !strcmp(masterpasswd, pwd)))
{
if(claim) sendservmsg("you claimed the master status", client);
else if(clients[client]->ismaster) sendservmsg("you gave up the master status", client);
loopv(clients) if(clients[i]->type!=ST_EMPTY) clients[i]->ismaster = (i == client);
sendf(-1, 1, "rii", SV_MASTERINFO, client);
}
else if(pwd && pwd[0])
{