From 91865c33da8df050165d8e692e22dde9048572ed Mon Sep 17 00:00:00 2001 From: frosch Date: Tue, 24 Nov 2009 17:56:45 +0000 Subject: [PATCH] (svn r18276) -Fix: [NoAI] Make AIIndustryType::GetConstructionCost() return -1, if the industry is neither buildable nor prospectable. --- bin/ai/regression/regression.txt | 12 ++++++------ src/ai/api/ai_industrytype.cpp | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/bin/ai/regression/regression.txt b/bin/ai/regression/regression.txt index 2a60fd8de4..4b70aa11e0 100644 --- a/bin/ai/regression/regression.txt +++ b/bin/ai/regression/regression.txt @@ -6934,7 +6934,7 @@ Id: 9 IsRawIndustry(): true ProductionCanIncrease(): true - GetConstructionCost(): 747070 + GetConstructionCost(): -1 GetName(): Farm CanBuildIndustry(): false CanProspectIndustry(): false @@ -6944,7 +6944,7 @@ Id: 5 IsRawIndustry(): true ProductionCanIncrease(): true - GetConstructionCost(): 747070 + GetConstructionCost(): -1 GetName(): Oil Rig CanBuildIndustry(): false CanProspectIndustry(): false @@ -6964,7 +6964,7 @@ Id: 11 IsRawIndustry(): true ProductionCanIncrease(): false - GetConstructionCost(): 747070 + GetConstructionCost(): -1 GetName(): Oil Wells CanBuildIndustry(): false CanProspectIndustry(): false @@ -6984,7 +6984,7 @@ Id: 3 IsRawIndustry(): true ProductionCanIncrease(): true - GetConstructionCost(): 747070 + GetConstructionCost(): -1 GetName(): Forest CanBuildIndustry(): false CanProspectIndustry(): false @@ -7004,7 +7004,7 @@ Id: 18 IsRawIndustry(): true ProductionCanIncrease(): true - GetConstructionCost(): 747070 + GetConstructionCost(): -1 GetName(): Iron Ore Mine CanBuildIndustry(): false CanProspectIndustry(): false @@ -7014,7 +7014,7 @@ Id: 0 IsRawIndustry(): true ProductionCanIncrease(): true - GetConstructionCost(): 747070 + GetConstructionCost(): -1 GetName(): Coal Mine CanBuildIndustry(): false CanProspectIndustry(): false diff --git a/src/ai/api/ai_industrytype.cpp b/src/ai/api/ai_industrytype.cpp index 1f20845651..8bf892c8eb 100644 --- a/src/ai/api/ai_industrytype.cpp +++ b/src/ai/api/ai_industrytype.cpp @@ -39,7 +39,8 @@ /* static */ Money AIIndustryType::GetConstructionCost(IndustryType industry_type) { - if (!IsValidIndustryType(industry_type)) return false; + if (!IsValidIndustryType(industry_type)) return -1; + if (::GetIndustrySpec(industry_type)->IsRawIndustry() && _settings_game.construction.raw_industry_construction == 0) return -1; return ::GetIndustrySpec(industry_type)->GetConstructionCost(); }