longflags = 0;
for(i = 0, p = 1; i < MAX_TEAMSCORE; ++i, p *= 2)
- if(self.(teamscores[i]) > 127 || self.(teamscores[i]) <= -128)
+ if(this.(teamscores[i]) > 127 || this.(teamscores[i]) <= -128)
longflags |= p;
#if MAX_TEAMSCORE <= 8
if(sendflags & p)
{
if(longflags & p)
- WriteInt24_t(MSG_ENTITY, self.(teamscores[i]));
+ WriteInt24_t(MSG_ENTITY, this.(teamscores[i]));
else
- WriteChar(MSG_ENTITY, self.(teamscores[i]));
+ WriteChar(MSG_ENTITY, this.(teamscores[i]));
}
return true;
void TeamScore_Spawn(float t, string name)
{
- entity ts = new(csqc_score_team);
- make_pure(ts);
+ entity ts = new_pure(csqc_score_team);
ts.netname = name; // not used yet, FIXME
ts.team = t;
Net_LinkEntity(ts, false, 0, TeamScore_SendEntity);
}
else
{
- scores_initialized = new(ent_client_scoreinfo);
- make_pure(scores_initialized);
+ scores_initialized = new_pure(ent_client_scoreinfo);
Net_LinkEntity(scores_initialized, false, 0, ScoreInfo_SendEntity);
}
if(teams >= 1)
float i, p, longflags;
WriteHeader(MSG_ENTITY, ENT_CLIENT_SCORES);
- WriteByte(MSG_ENTITY, etof(self.owner));
+ WriteByte(MSG_ENTITY, etof(this.owner));
longflags = 0;
for(i = 0, p = 1; i < MAX_SCORE; ++i, p *= 2)
- if(self.(scores[i]) > 127 || self.(scores[i]) <= -128)
+ if(this.(scores[i]) > 127 || this.(scores[i]) <= -128)
longflags |= p;
#if MAX_SCORE <= 8
if(sendflags & p)
{
if(longflags & p)
- WriteInt24_t(MSG_ENTITY, self.(scores[i]));
+ WriteInt24_t(MSG_ENTITY, this.(scores[i]));
else
- WriteChar(MSG_ENTITY, self.(scores[i]));
+ WriteChar(MSG_ENTITY, this.(scores[i]));
}
return true;
void Score_ClearAll()
{
- entity p, sk;
- float i, t;
- FOR_EACH_CLIENTSLOT(p)
+ entity sk;
+ float t;
+ FOREACH_CLIENTSLOT(true,
{
- sk = p.scorekeeper;
+ sk = it.scorekeeper;
if(!sk)
continue;
- for(i = 0; i < MAX_SCORE; ++i)
+ for(int j = 0; j < MAX_SCORE; ++j)
{
- if(sk.(scores[i]) != 0)
- if(scores_label[i] != "")
- sk.SendFlags |= pow(2, i);
- sk.(scores[i]) = 0;
+ if(sk.(scores[j]) != 0)
+ if(scores_label[j] != "")
+ sk.SendFlags |= pow(2, j);
+ sk.(scores[j]) = 0;
}
- }
+ });
for(t = 0; t < 16; ++t)
{
sk = teamscorekeepers[t];
if(!sk)
continue;
- for(i = 0; i < MAX_TEAMSCORE; ++i)
+ for(int j = 0; j < MAX_TEAMSCORE; ++j)
{
- if(sk.(teamscores[i]) != 0)
- if(teamscores_label[i] != "")
- sk.SendFlags |= pow(2, i);
- sk.(teamscores[i]) = 0;
+ if(sk.(teamscores[j]) != 0)
+ if(teamscores_label[j] != "")
+ sk.SendFlags |= pow(2, j);
+ sk.(teamscores[j]) = 0;
}
}
}
{
if(player.scorekeeper)
error("player already has a scorekeeper");
- entity sk = new(scorekeeper);
- make_pure(sk);
+ entity sk = new_pure(scorekeeper);
sk.owner = player;
Net_LinkEntity(sk, false, 0, PlayerScore_SendEntity);
player.scorekeeper = sk;
float PlayerScore_Add(entity player, float scorefield, float score)
{
- bool mutator_returnvalue = MUTATOR_CALLHOOK(AddPlayerScore, scorefield, score);
- score = ret_float;
+ bool mutator_returnvalue = MUTATOR_CALLHOOK(AddPlayerScore, scorefield, score, player);
+ score = M_ARGV(1, float);
if(gameover)
if(!mutator_returnvalue)
{
if(gameover)
return 0;
- backtrace("Adding score to unknown player!");
+ LOG_WARNING("Adding score to unknown player!");
return 0;
}
if(score)
return result.x;
}
-void WinningConditionHelper()
+void WinningConditionHelper(entity this)
{
float c;
string s;
s = GetGametype();
s = strcat(s, ":", autocvar_g_xonoticversion);
s = strcat(s, ":P", ftos(cvar_purechanges_count));
- s = strcat(s, ":S", ftos(nJoinAllowed(self, world)));
+ s = strcat(s, ":S", ftos(nJoinAllowed(this, world)));
s = strcat(s, ":F", ftos(serverflags));
s = strcat(s, ":M", modname);
s = strcat(s, "::", GetPlayerScoreString(world, (fullstatus ? 1 : 2)));
{
s = GetPlayerScoreString(it, 1);
s = strcat(s, IS_REAL_CLIENT(it) ? ":human" : ":bot");
- ret_string = string_null;
- if(!IS_PLAYER(it) && !MUTATOR_CALLHOOK(GetPlayerStatus, it, s))
+ if(!IS_PLAYER(it) && !MUTATOR_CALLHOOK(GetPlayerStatus, it))
s = strcat(s, ":spectator");
- if (ret_string) s = strcat(s, ret_string);
}
else
{
- ret_string = string_null;
- if (IS_PLAYER(it) || MUTATOR_CALLHOOK(GetPlayerStatus, it, s))
+ if (IS_PLAYER(it) || MUTATOR_CALLHOOK(GetPlayerStatus, it))
s = GetPlayerScoreString(it, 2);
else
s = "-666";
- if (ret_string) s = strcat(s, ret_string);
}
if(it.clientstatus)
FOREACH_CLIENT(true, LAMBDA(it.(field) = 0));
- FOR_EACH_CLIENT(p) if(p.scorekeeper)
+ FOREACH_CLIENT(it.scorekeeper,
{
if(nospectators)
- if(p.frags == FRAGS_SPECTATOR)
+ if(it.frags == FRAGS_SPECTATOR)
continue;
- p.chain = plist;
- plist = p;
- }
+ it.chain = plist;
+ plist = it;
+ });
// Now plist points to the whole list.
pfirst = plast = world;