X-Git-Url: http://deadsoftware.ru/gitweb?p=d2df-sdl.git;a=blobdiff_plain;f=src%2Fgame%2Fg_game.pas;h=1d5767065eaac6518d332b5e259be800d234f655;hp=2cf72c1bcc17dc8ceb2cb1b7f2ef140a2500a803;hb=886be406b752b92fc9ba2064a5cb5d1bcd981d61;hpb=a9b641b6421fe1ab2ae3ffdf6a7fb41c56df1970 diff --git a/src/game/g_game.pas b/src/game/g_game.pas index 2cf72c1..1d57670 100644 --- a/src/game/g_game.pas +++ b/src/game/g_game.pas @@ -5744,6 +5744,17 @@ end; procedure PlayerSettingsCVars(P: SSArray); var cmd: string; + team: Byte; + + function ParseTeam(s: string): Byte; + begin + result := 0; + case s of + 'red', '1': result := TEAM_RED; + 'blue', '2': result := TEAM_BLUE; + else result := TEAM_NONE; + end; + end; begin cmd := LowerCase(P[0]); case cmd of @@ -5837,6 +5848,34 @@ begin end; end; end; + 'p1_team': + begin + // TODO: switch teams if in game or store this separately + if (Length(P) > 1) then + begin + team := ParseTeam(P[1]); + if team = TEAM_NONE then + g_Console_Add('expected ''red'', ''blue'', 1 or 2') + else if not gGameOn and not g_Game_IsNet then + gPlayer1Settings.Team := team + else + g_Console_Add(_lc[I_MSG_ONMAPCHANGE]); + end; + end; + 'p2_team': + begin + // TODO: switch teams if in game or store this separately + if (Length(P) > 1) then + begin + team := ParseTeam(P[1]); + if team = TEAM_NONE then + g_Console_Add('expected ''red'', ''blue'', 1 or 2') + else if not gGameOn and not g_Game_IsNet then + gPlayer2Settings.Team := team + else + g_Console_Add(_lc[I_MSG_ONMAPCHANGE]); + end; + end; end; end;