Skip to content

Commit

Permalink
Remove unused personality calls in default skirmish AI code (#6602)
Browse files Browse the repository at this point in the history
  • Loading branch information
relent0r authored Jan 25, 2025
1 parent e2ab8e5 commit fbceb4c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
1 change: 1 addition & 0 deletions changelog/snippets/fix.6602.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- (#6602) Removed unused personalty function calls in default AI factory manager and platoon former manager.
16 changes: 10 additions & 6 deletions engine/Sim/CPlatoon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ end

--- TODO.
-- Example: local formIt = poolPlatoon:CanFormPlatoon(template, personality:GetPlatoonSize(), self.Location, radius)
---@param template table
---@param size number
---@param location Vector
---@param radius number
function CPlatoon:CanFormPlatoon(template, size, location, radius)
---@param template table The template table for the faction, see platoontemplates for more details.
---@param multiplier number Multiplies the squad max size in the template by this number.
---@param location Vector The position vector to search for units from.
---@param radius number The radius to search for units.
function CPlatoon:CanFormPlatoon(template, multiplier, location, radius)
end

--- Destroys the platoon including all its units.
Expand Down Expand Up @@ -121,8 +121,12 @@ end

--- TODO.
-- Example: local hndl = poolPlatoon:FormPlatoon(template, personality:GetPlatoonSize(), self.Location, radius)
---@param template table The template table for the faction, see platoontemplates for more details.
---@param multiplier number Multiplies the squad max size in the template by this number.
---@param position Vector The position vector to search for units from.
---@param radius number The radius to search for units.
-- @return Formed platoon
function CPlatoon:FormPlatoon()
function CPlatoon:FormPlatoon(template, multiplier, position, radius)
end

--- TODO.
Expand Down
3 changes: 0 additions & 3 deletions lua/sim/FactoryBuilderManager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -497,9 +497,6 @@ FactoryBuilderManager = Class(BuilderManager) {
return false
end

local personality = self.Brain:GetPersonality()
local ptnSize = personality:GetPlatoonSize()

-- This function takes a table of factories to determine if it can build
return self.Brain:CanBuildPlatoon(template, params)
end,
Expand Down
5 changes: 2 additions & 3 deletions lua/sim/PlatoonFormManager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ PlatoonFormManager = Class(BuilderManager) {
BuilderManager.ManagerLoopBody(self,builder,bType)
-- Try to form all builders that pass
if self.Brain.BuilderManagers[self.LocationType] and builder.Priority >= 1 and builder:CheckInstanceCount() then
local personality = self.Brain:GetPersonality()
local poolPlatoon = self.Brain:GetPlatoonUniquelyNamed('ArmyPool')
local template = self:GetPlatoonTemplate(builder:GetPlatoonTemplate())
builder:FormDebug()
Expand All @@ -139,9 +138,9 @@ PlatoonFormManager = Class(BuilderManager) {
WARN('*Platoon Form: Could not find template named: ' .. builder:GetPlatoonTemplate())
return
end
local formIt = poolPlatoon:CanFormPlatoon(template, personality:GetPlatoonSize(), self.Location, radius)
local formIt = poolPlatoon:CanFormPlatoon(template, 1, self.Location, radius)
if formIt and builder:GetBuilderStatus() then
local hndl = poolPlatoon:FormPlatoon(template, personality:GetPlatoonSize(), self.Location, radius)
local hndl = poolPlatoon:FormPlatoon(template, 1, self.Location, radius)

--LOG('*AI DEBUG: ARMY ', repr(self.Brain:GetArmyIndex()),': Platoon Form Manager Forming - ',repr(builder.BuilderName),': Location = ',self.LocationType)
--LOG('*AI DEBUG: ARMY ', repr(self.Brain:GetArmyIndex()),': Platoon Form Manager - Platoon Size = ', table.getn(hndl:GetPlatoonUnits()))
Expand Down

0 comments on commit fbceb4c

Please sign in to comment.