fix ctf race condition
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@4561 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
@@ -338,12 +338,13 @@ void flagpickup(int fln)
|
||||
{
|
||||
if(flagdropmillis && flagdropmillis>lastmillis) return;
|
||||
flaginfo &f = flaginfos[fln];
|
||||
int action = f.state == CTFF_INBASE ? FA_STEAL : FA_PICKUP;
|
||||
f.flagent->spawned = false;
|
||||
f.state = CTFF_STOLEN;
|
||||
f.actor = player1; // do this although we don't know if we picked the flag to avoid getting it after a possible respawn
|
||||
f.actor_cn = getclientnum();
|
||||
f.ack = false;
|
||||
addmsg(SV_FLAGACTION, "rii", FA_PICKUP, f.team);
|
||||
addmsg(SV_FLAGACTION, "rii", action, f.team);
|
||||
}
|
||||
|
||||
void tryflagdrop(bool manual)
|
||||
|
||||
@@ -76,7 +76,7 @@ enum { VOTE_NEUTRAL = 0, VOTE_YES, VOTE_NO, VOTE_NUM };
|
||||
enum { VOTEE_DISABLED = 0, VOTEE_CUR, VOTEE_MUL, VOTEE_MAX, VOTEE_AREA, VOTEE_PERMISSION, VOTEE_INVALID, VOTEE_NUM };
|
||||
enum { MM_OPEN = 0, MM_PRIVATE, MM_MATCH, MM_NUM };
|
||||
enum { AT_DISABLED = 0, AT_ENABLED, AT_SHUFFLE, AT_NUM };
|
||||
enum { FA_PICKUP = 0, FA_DROP, FA_LOST, FA_RETURN, FA_SCORE, FA_NUM, FA_RESET };
|
||||
enum { FA_PICKUP = 0, FA_STEAL, FA_DROP, FA_LOST, FA_RETURN, FA_SCORE, FA_NUM, FA_RESET };
|
||||
enum { FM_PICKUP = 0, FM_DROP, FM_LOST, FM_RETURN, FM_SCORE, FM_KTFSCORE, FM_SCOREFAIL, FM_RESET, FM_NUM };
|
||||
|
||||
#define DMF 16.0f
|
||||
|
||||
@@ -717,8 +717,9 @@ void flagaction(int flag, int action, int actor)
|
||||
switch(action)
|
||||
{
|
||||
case FA_PICKUP: // ctf: f = enemy team htf: f = own team
|
||||
case FA_STEAL:
|
||||
{
|
||||
if(deadactor || f.state == CTFF_STOLEN) return;
|
||||
if(deadactor || f.state != (action == FA_STEAL ? CTFF_INBASE : CTFF_DROPPED)) return;
|
||||
flagdistance(f, actor);
|
||||
int team = team_base(clients[actor]->team);
|
||||
if(m_ctf) team = team_opposite(team);
|
||||
@@ -770,7 +771,7 @@ void flagaction(int flag, int action, int actor)
|
||||
{
|
||||
switch(action)
|
||||
{
|
||||
case FA_PICKUP:
|
||||
case FA_STEAL:
|
||||
if(deadactor || f.state != CTFF_INBASE) return;
|
||||
flagdistance(f, actor);
|
||||
f.state = CTFF_STOLEN;
|
||||
@@ -814,7 +815,7 @@ void flagaction(int flag, int action, int actor)
|
||||
switch(message)
|
||||
{
|
||||
case FM_PICKUP:
|
||||
logline(ACLOG_INFO,"[%s] %s stole the flag", c.hostname, c.name);
|
||||
logline(ACLOG_INFO,"[%s] %s %s the flag", c.hostname, c.name, action == FA_STEAL ? "stole" : "picked up");
|
||||
break;
|
||||
case FM_DROP:
|
||||
case FM_LOST:
|
||||
|
||||
Reference in New Issue
Block a user