Use player team's control scheme for all teams if there's a mission team
authorWuzzy <Wuzzy2@mail.ru>
Thu, 10 Jan 2019 03:14:02 +0100
changeset 14558 ce40351e0690
parent 14557 181509fe1ae8
child 14559 1dab5d92aca7
Use player team's control scheme for all teams if there's a mission team
ChangeLog.txt
hedgewars/uScript.pas
--- a/ChangeLog.txt	Thu Jan 10 02:50:01 2019 +0100
+++ b/ChangeLog.txt	Thu Jan 10 03:14:02 2019 +0100
@@ -6,11 +6,13 @@
  + Slightly longer delays between turns to make it easier to follow the game
  + Track high scores in singleplayer challenges
  + Show check mark for completed scenarios, challenges and trainings
+ + Training/challenge/scenario menu now supports team selection
  * Fix various minor bugs in campaigns and missions
  * Fix hedgehogs being pushed around (and other collision bugs) when they overlap
  * Fix homing bee flying weird if passing wrap world edge or target was placed beyond it
  * Fix poison damage not working in first round
  * Use player-chosen team identity in campaigns and singleplayer missions
+ * Fix player-chosen teams ignoring custom team controls in campaigns
 
 Styles and schemes:
  + The Specialists: Unlock game scheme
--- a/hedgewars/uScript.pas	Thu Jan 10 02:50:01 2019 +0100
+++ b/hedgewars/uScript.pas	Thu Jan 10 03:14:02 2019 +0100
@@ -2300,7 +2300,13 @@
         ParseCommand('fort ' + lua_tostring(L, 4), true, true);
         ParseCommand('voicepack ' + lua_tostring(L, 5), true, true);
         if (np = 6) then ParseCommand('flag ' + lua_tostring(L, 6), true, true);
-        CurrentTeam^.Binds:= DefaultBinds;
+        // If there's a mission team, copy it's control scheme.
+        // So in singleplayer missions, all teams use the player team's controls.
+        if MissionTeam <> nil then
+            CurrentTeam^.Binds:= MissionTeam^.Binds
+        // Default keys otherwise
+        else
+            CurrentTeam^.Binds:= DefaultBinds;
         // push team name and index
         lua_pushstring(L, str2pchar(CurrentTeam^.TeamName));
         lua_pushnumber(L, TeamsCount - 1);