Androrc the Orc
Emperor
I made the following alteration in CityView.lua (changes in red):
It is supposed to make it so buildings that belong to building classes that have the "Hidden" field set to true not appear in the city screen. However, this code is making it so ZERO non-specialist buildings appear in the city view screen. Does anybody have any idea of what might be wrong with it?
This is my SQL alteration that adds the "Hidden" field to building classes, by the way:
Strangely enough, I wrote very similar code for the civilopedia screen (to exclude "Hidden" building classes' buildings from showing up in the civilopedia), and that worked perfectly.
Code:
sortedList = {};
thisId = 1;
for building in GameInfo.Buildings() do
local thisBuildingClass = GameInfo.BuildingClasses[building.BuildingClass];
[COLOR="Red"] -- Androrc
-- if thisBuildingClass.MaxGlobalInstances <= 0 and thisBuildingClass.MaxPlayerInstances ~= 1 and thisBuildingClass.MaxTeamInstances <= 0 then
if thisBuildingClass.MaxGlobalInstances <= 0 and thisBuildingClass.MaxPlayerInstances ~= 1 and thisBuildingClass.MaxTeamInstances <= 0 and not thisBuildingClass.Hidden then
-- Androrc End
[/COLOR] local buildingID= building.ID;
if pCity:GetNumSpecialistsAllowedByBuilding(buildingID) <= 0 then
if (pCity:IsHasBuilding(buildingID)) then
numBuildingsInThisCity = numBuildingsInThisCity + 1;
local element = {};
local name = Locale.ConvertTextKey( building.Description )
element.name = name;
element.ID = building.ID;
sortedList[thisId] = element;
thisId = thisId + 1;
end
end
end
end
It is supposed to make it so buildings that belong to building classes that have the "Hidden" field set to true not appear in the city screen. However, this code is making it so ZERO non-specialist buildings appear in the city view screen. Does anybody have any idea of what might be wrong with it?
This is my SQL alteration that adds the "Hidden" field to building classes, by the way:
Code:
ALTER TABLE BuildingClasses ADD COLUMN 'Hidden' TEXT DEFAULT false;
Strangely enough, I wrote very similar code for the civilopedia screen (to exclude "Hidden" building classes' buildings from showing up in the civilopedia), and that worked perfectly.