From 9ec9a121da67d53a42a373d1d7a952c39258aed0 Mon Sep 17 00:00:00 2001 From: Richard Helgeby Date: Mon, 5 Apr 2010 00:57:41 +0200 Subject: [PATCH] Imported fix from dev: 687:5d695a55d80e - Fixed saved classes not validated by team id when restoring from cookies. --- src/zr/playerclasses/playerclasses.inc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/zr/playerclasses/playerclasses.inc b/src/zr/playerclasses/playerclasses.inc index 6f2eb7a..66edea6 100644 --- a/src/zr/playerclasses/playerclasses.inc +++ b/src/zr/playerclasses/playerclasses.inc @@ -1022,9 +1022,12 @@ ClassClientSetDefaultIndexes(client = -1) // class index when restored. // Check if class indexes are set and that the client pass the filter. + // Also check that the saved class' team id match with the loaded class. // If not, fall back to default class indexes. Otherwise substract // index by one. - if (zombieindex <= 0 || !ClassFilterMatch(zombieindex - 1, filter)) + if (zombieindex <= 0 || + !(ClassGetTeamID(zombieindex - 1) == ZR_CLASS_TEAM_ZOMBIES) || + !ClassFilterMatch(zombieindex - 1, filter)) { zombieindex = ClassGetDefaultSpawnClass(ZR_CLASS_TEAM_ZOMBIES, filter); } @@ -1034,7 +1037,9 @@ ClassClientSetDefaultIndexes(client = -1) haszombie = true; } - if (humanindex <= 0 || !ClassFilterMatch(humanindex - 1, filter)) + if (humanindex <= 0 || + !(ClassGetTeamID(humanindex - 1) == ZR_CLASS_TEAM_HUMANS) || + !ClassFilterMatch(humanindex - 1, filter)) { humanindex = ClassGetDefaultSpawnClass(ZR_CLASS_TEAM_HUMANS, filter); } @@ -1044,7 +1049,9 @@ ClassClientSetDefaultIndexes(client = -1) hashuman = true; } - if (adminindex <= 0 || !ClassFilterMatch(adminindex - 1, filter)) + if (adminindex <= 0 || + !(ClassGetTeamID(adminindex - 1) == ZR_CLASS_TEAM_ADMINS) || + !ClassFilterMatch(adminindex - 1, filter)) { adminindex = ClassGetDefaultSpawnClass(ZR_CLASS_TEAM_ADMINS, filter); }