Skip to content

Commit

Permalink
Remove more instances of GetUnitBeingBuilt() (FAForever#1578)
Browse files Browse the repository at this point in the history
  • Loading branch information
speed2CZ authored and aeoncleanse committed Oct 4, 2016
1 parent bb437e4 commit bf22a0d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lua/AI/OpAI/BaseManager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,7 @@ BaseManager = Class {
upgrading = false
if unit and not unit:IsDead() then
if not newUnit then
newUnit = unit:GetUnitBeingBuilt()
newUnit = unit.UnitBeingBuilt
end
upgrading = true
end
Expand Down
10 changes: 5 additions & 5 deletions lua/AI/OpAI/BaseManagerPlatoonThreads.lua
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ function DoConditionalBuild(singleEngineerPlatoon)
while aiBrain:PlatoonExists(singleEngineerPlatoon) do

if not unitInstance then
unitInstance = engineer:GetUnitBeingBuilt()
unitInstance = engineer.UnitBeingBuilt

if unitInstance then
-- Store the unit
Expand Down Expand Up @@ -597,7 +597,7 @@ function BaseManagerAssistThread( platoon )
if not constructionUnit:IsDead() and constructionUnit:IsUnitState('Building') then

-- Check to make sure unit being built is of proper category
local buildingUnit = constructionUnit:GetUnitBeingBuilt()
local buildingUnit = constructionUnit.UnitBeingBuilt
if buildingUnit and not buildingUnit:IsDead() and EntityCategoryContains( buildCat, buildingUnit ) then

-- If the unit building is a factory make sure its in the right PBM Location Type
Expand Down Expand Up @@ -835,11 +835,11 @@ function BaseManagerEngineerThread(platoon)
if not aiBrain:PlatoonExists(platoon) then
return
end
if not markedUnfinished and eng:GetUnitBeingBuilt() then
if not markedUnfinished and eng.UnitBeingBuilt then
baseManager.UnfinishedBuildings[unitName] = true
end
if not nameSet then
local buildingUnit = eng:GetUnitBeingBuilt()
local buildingUnit = eng.UnitBeingBuilt
if unitName and buildingUnit and not buildingUnit:IsDead() then
nameSet = true
local armyIndex = aiBrain:GetArmyIndex()
Expand Down Expand Up @@ -930,7 +930,7 @@ function BuildUnfinishedStructures(platoon)
local buildingEngs = aiBrain:GetListOfUnits( categories.ENGINEER, false )
-- Find all engineers building structures
for k,v in buildingEngs do
local buildingUnit = v:GetUnitBeingBuilt()
local buildingUnit = v.UnitBeingBuilt
if buildingUnit and buildingUnit.UnitName then
beingBuiltList[buildingUnit.UnitName] = true
end
Expand Down
4 changes: 2 additions & 2 deletions lua/editor/BaseManagerBuildConditions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ function CategoriesBeingBuilt(aiBrain, baseName, catTable)
local unitsBuilding = aiBrain:GetListOfUnits( categories.CONSTRUCTION, false )
for unitNum, unit in unitsBuilding do
if not unit:IsDead() and unit:IsUnitState('Building') then
local buildingUnit = unit:GetUnitBeingBuilt()
local buildingUnit = unit.UnitBeingBuilt
if buildingUnit and not buildingUnit:IsDead() then
for catNum, buildeeCat in catTable do
local buildCat = ParseEntityCategory(buildeeCat)
Expand Down Expand Up @@ -365,7 +365,7 @@ function UnfinishedBuildingsCheck( aiBrain, baseName )
local beingBuiltList = {}
local buildingEngs = bManager.AIBrain:GetListOfUnits( categories.ENGINEER, false )
for k,v in buildingEngs do
local buildingUnit = v:GetUnitBeingBuilt()
local buildingUnit = v.UnitBeingBuilt
if buildingUnit and buildingUnit.UnitName then
beingBuiltList[buildingUnit.UnitName] = true
end
Expand Down

0 comments on commit bf22a0d

Please sign in to comment.