From b68e254bc04f3a24009c7c377d7d4f50d87d0ae3 Mon Sep 17 00:00:00 2001 From: Wingthor Date: Thu, 6 Feb 2020 15:36:54 +0100 Subject: [PATCH 1/2] Fixes issue #1258 WAREHOUSE:onafterChangeCountry() --- .gitignore | 4 ++++ Moose Development/Moose/Functional/Warehouse.lua | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index f908db72e..5e42c0c93 100644 --- a/.gitignore +++ b/.gitignore @@ -222,3 +222,7 @@ _gsdata_/ .gitignore Moose Test Missions/MOOSE_Test_Template.miz Moose Development/Moose/.vscode/launch.json +MooseCodeWS.code-workspace +.gitignore +.gitignore +/.gitignore diff --git a/Moose Development/Moose/Functional/Warehouse.lua b/Moose Development/Moose/Functional/Warehouse.lua index bd98267cb..9c25b50f5 100644 --- a/Moose Development/Moose/Functional/Warehouse.lua +++ b/Moose Development/Moose/Functional/Warehouse.lua @@ -4894,8 +4894,14 @@ function WAREHOUSE:onafterChangeCountry(From, Event, To, Country) self.queue={} -- Airbase could have been captured before and already belongs to the new coalition. - local airbase=AIRBASE:FindByName(self.airbasename) - local airbasecoaltion=airbase:GetCoalition() + -- Check if Warehouse has a arbiase atthached + local airbasecoaltion + if self.airbasse ~= nil then + local airbase=AIRBASE:FindByName(self.airbasename) + airbasecoaltion=airbase:GetCoalition() + else -- Warehouse has no airbase attached so just keep whatever, self.airbase will still be nil since CoalitionNew will not be nil if Warehouse have a airbse attacjed. + airbasecoaltion = nil + end if CoalitionNew==airbasecoaltion then -- Airbase already owned by the coalition that captured the warehouse. Airbase can be used by this warehouse. From f685064c0c6efee4ffe2970f7fd6a9f6569a5f41 Mon Sep 17 00:00:00 2001 From: Wingthor Date: Sat, 8 Feb 2020 12:44:50 +0100 Subject: [PATCH 2/2] fixed the typo on self.airbasse to self.airbase. Tested with and without this line `SetAirbase(AIRBASE:FindByName(AIRBASE.Caucasus.Kutaisi))` in the test script. Resolves issue #1258 --- Moose Development/Moose/Functional/Warehouse.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Functional/Warehouse.lua b/Moose Development/Moose/Functional/Warehouse.lua index 9c25b50f5..999eb97c9 100644 --- a/Moose Development/Moose/Functional/Warehouse.lua +++ b/Moose Development/Moose/Functional/Warehouse.lua @@ -4896,7 +4896,7 @@ function WAREHOUSE:onafterChangeCountry(From, Event, To, Country) -- Airbase could have been captured before and already belongs to the new coalition. -- Check if Warehouse has a arbiase atthached local airbasecoaltion - if self.airbasse ~= nil then + if self.airbase ~= nil then local airbase=AIRBASE:FindByName(self.airbasename) airbasecoaltion=airbase:GetCoalition() else -- Warehouse has no airbase attached so just keep whatever, self.airbase will still be nil since CoalitionNew will not be nil if Warehouse have a airbse attacjed.