Skip to content

Commit

Permalink
Starting the refactoring.
Browse files Browse the repository at this point in the history
--HG--
branch : refactoring
  • Loading branch information
Ze PilOt@ZePilOt-PC authored and Ze PilOt@ZePilOt-PC committed May 11, 2012
1 parent 2ebb423 commit 1278c38
Show file tree
Hide file tree
Showing 387 changed files with 6,815 additions and 44,631 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,32 @@
do
#***************************************************************************
#*
#** File : /lua/ai/AIAddBuilderTable.lua
#**
#** Summary : Default economic builders for skirmish
#**
#** Copyright © 2005 Gas Powered Games, Inc. All rights reserved.
#****************************************************************************

function AddGlobalBaseTemplate(aiBrain, locationType, baseBuilderName)
if not BaseBuilderTemplates[baseBuilderName] then
ERROR('*AI ERROR: Invalid BaseBuilderTemplate: none found named - ' .. baseBuilderName)
end
for k,v in BaseBuilderTemplates[baseBuilderName].Builders do
AddGlobalBuilderGroup(aiBrain, locationType, v)
end
if not aiBrain.CheatEnabled and BaseBuilderTemplates[baseBuilderName].NonCheatBuilders then
for k,v in BaseBuilderTemplates[baseBuilderName].NonCheatBuilders do
AddGlobalBuilderGroup(aiBrain, locationType, v)
end
end
aiBrain.BuilderManagers[locationType].BaseSettings = BaseBuilderTemplates[baseBuilderName].BaseSettings
end

function AddGlobalBuilderGroup(aiBrain, locationType, builderGroupName)
if BuilderGroups[builderGroupName] then
AddBuilderTable( aiBrain, locationType, BuilderGroups[builderGroupName], builderGroupName)
end
end

function AddBuilderTable(aiBrain, locationType, builderTable, tableName)
aiBrain.BuilderManagers[locationType].BuilderHandles = aiBrain.BuilderManagers[locationType].BuilderHandles or {}
Expand Down Expand Up @@ -34,5 +62,3 @@ function AddBuilderTable(aiBrain, locationType, builderTable, tableName)
end
end
end

end
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,49 @@
do
#****************************************************************************
#**
#** File : /lua/AI/aiarchetype-rushland.lua
#**
#** Summary : Rush AI
#**
#** Copyright © 2005 Gas Powered Games, Inc. All rights reserved.
#****************************************************************************

local AIBuildUnits = import('/lua/ai/aibuildunits.lua')
local AIUtils = import('/lua/ai/aiutilities.lua')

local AIAddBuilderTable = import('/lua/ai/AIAddBuilderTable.lua')

function GetHighestBuilder(aiBrain)
local returnVal = -1
local base = false

local returnVal = 0
local aiType = false

for k,v in BaseBuilderTemplates do
if v.FirstBaseFunction then
local baseVal, baseType = v.FirstBaseFunction(aiBrain)
#LOG( '*DEBUG: testing ' .. k .. ' - Val ' .. baseVal )
if baseVal > returnVal then
returnVal = baseVal
base = k
aiType = baseType
end
end
end

if base then
return base, returnVal, aiType
end

return false
end

function EvaluatePlan( aiBrain )
local base, returnVal = GetHighestBuilder(aiBrain)

return returnVal
end


function ExecutePlan(aiBrain)
aiBrain:SetConstantEvaluate(false)
Expand Down Expand Up @@ -117,5 +162,3 @@ function GetAIUnderUnitCap(aiBrain, num, checkCat, killCat)
WaitTicks(1)
return false
end

end
File renamed without changes.
Loading

0 comments on commit 1278c38

Please sign in to comment.