if (mutator_returnvalue) {
// mutator prevents resetting teams+score
} else {
- int oldteam = this.team;
+ int old_team_index = Team_TeamToIndex(this.team);
this.team = -1; // move this as it is needed to log the player spectating in eventlog
- MUTATOR_CALLHOOK(Player_ChangedTeam, this, oldteam, this.team);
+ MUTATOR_CALLHOOK(Player_ChangedTeam, this, old_team_index, -1);
this.frags = FRAGS_SPECTATOR;
PlayerScore_Clear(this); // clear scores when needed
}
* Called before player changes their team. Return true to block team change.
*/
#define EV_Player_ChangeTeam(i, o) \
- /** player */ i(entity, MUTATOR_ARGV_0_entity) \
- /** current team */ i(float, MUTATOR_ARGV_1_float) \
- /** new team */ i(float, MUTATOR_ARGV_2_float) \
+ /** player */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** current team index */ i(float, MUTATOR_ARGV_1_float) \
+ /** new team index */ i(float, MUTATOR_ARGV_2_float) \
/**/
MUTATOR_HOOKABLE(Player_ChangeTeam, EV_Player_ChangeTeam);
* Called after player has changed their team.
*/
#define EV_Player_ChangedTeam(i, o) \
- /** player */ i(entity, MUTATOR_ARGV_0_entity) \
- /** old team */ i(float, MUTATOR_ARGV_1_float) \
- /** current team */ i(float, MUTATOR_ARGV_2_float) \
+ /** player */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** old team index */ i(float, MUTATOR_ARGV_1_float) \
+ /** current team index */ i(float, MUTATOR_ARGV_2_float) \
/**/
MUTATOR_HOOKABLE(Player_ChangedTeam, EV_Player_ChangedTeam);
SetPlayerColors(player, team_num - 1);
return true;
}
- if (MUTATOR_CALLHOOK(Player_ChangeTeam, player, Team_TeamToIndex(
- player.team), Team_TeamToIndex(team_num)) == true)
+ int old_team_index = Team_TeamToIndex(player.team);
+ int new_team_index = Team_TeamToIndex(team_num);
+ if (MUTATOR_CALLHOOK(Player_ChangeTeam, player, old_team_index,
+ new_team_index) == true)
{
// Mutator has blocked team change.
return false;
}
- int old_team_num = player.team;
SetPlayerColors(player, team_num - 1);
- MUTATOR_CALLHOOK(Player_ChangedTeam, player, old_team_num, player.team);
+ MUTATOR_CALLHOOK(Player_ChangedTeam, player, old_team_index,
+ new_team_index);
return true;
}