[CivUP 2.2.7/GEM 1.11.5] City screen messes up

skodkim

Deity
Joined
Jan 16, 2004
Messages
2,497
Location
Denmark
Hi

I've found that the city screen (list of buildings, wonders, ... can mess up badly with CivUP 2.2.7/GEM 1.11.5 (screenshot attached).

I've got a feeling it's related to the new Building_Addons table but I haven't tested enough to be sure yet.

Haven't noticed any errors in log-files.

\Skodkim
 
Sees it does have something to do with buildings affected by the new Building_Addons table.

If I build other buildings, e.g. a monument, the city screen is displayed fine. If I build a Library it messes up. In the modmod libraries are affected the the Building_Addons system in the manner that you can build additions to them, e.g. using the code:

Code:
		<Row>
			<BuildingType>BUILDING_ADD_PUBLIC_LIBRARY</BuildingType>
			<ParentBuildingClass>BUILDINGCLASS_LIBRARY</ParentBuildingClass>
		</Row>

\Skodkim

PS Actually I just noticed the following in lua.log:

Spoiler :
[12407.352] CivilopediaScreen: CivilopediaCategory[CategoryBuildings].DisplayList
[12410.675] CivilopediaScreen: CivilopediaCategory[CategoryBuildings].SelectArticle
[12413.748] CivilopediaScreen: CivilopediaCategory[CategoryBuildings].SelectArticle
[12494.073] Runtime Error: [string "C:\Users\hollenbo\Documents\My Games\Sid Me..."]:369: bad argument #2 to '?' (Key must be of type 'number' or 'string'.)
[12498.113] Runtime Error: [string "C:\Users\hollenbo\Documents\My Games\Sid Me..."]:369: bad argument #2 to '?' (Key must be of type 'number' or 'string'.)
[12500.484] Runtime Error: [string "C:\Users\hollenbo\Documents\My Games\Sid Me..."]:369: bad argument #2 to '?' (Key must be of type 'number' or 'string'.)
[12503.448] Runtime Error: [string "C:\Users\hollenbo\Documents\My Games\Sid Me..."]:369: bad argument #2 to '?' (Key must be of type 'number' or 'string'.)
[12503.870] Runtime Error: [string "C:\Users\hollenbo\Documents\My Games\Sid Me..."]:369: bad argument #2 to '?' (Key must be of type 'number' or 'string'.)
[12507.068] Runtime Error: [string "C:\Users\hollenbo\Documents\My Games\Sid Me..."]:369: bad argument #2 to '?' (Key must be of type 'number' or 'string'.)
[12508.768] Runtime Error: [string "C:\Users\hollenbo\Documents\My Games\Sid Me..."]:369: bad argument #2 to '?' (Key must be of type 'number' or 'string'.)
[12528.627] Runtime Error: [string "C:\Users\hollenbo\Documents\My Games\Sid Me..."]:369: bad argument #2 to '?' (Key must be of type 'number' or 'string'.)
[12528.658] Runtime Error: [string "C:\Users\hollenbo\Documents\My Games\Sid Me..."]:369: bad argument #2 to '?' (Key must be of type 'number' or 'string'.)
[12531.076] Runtime Error: [string "C:\Users\hollenbo\Documents\My Games\Sid Me..."]:369: bad argument #2 to '?' (Key must be of type 'number' or 'string'.)
[12531.154] Runtime Error: [string "C:\Users\hollenbo\Documents\My Games\Sid Me..."]:369: bad argument #2 to '?' (Key must be of type 'number' or 'string'.)
[12531.653] Runtime Error: [string "C:\Users\hollenbo\Documents\My Games\Sid Me..."]:369: bad argument #2 to '?' (Key must be of type 'number' or 'string'.)
[12531.731] Runtime Error: [string "C:\Users\hollenbo\Documents\My Games\Sid Me..."]:369: bad argument #2 to '?' (Key must be of type 'number' or 'string'.)
[12561.793] Runtime Error: [string "C:\Users\hollenbo\Documents\My Games\Sid Me..."]:369: bad argument #2 to '?' (Key must be of type 'number' or 'string'.)
[12753.752] Runtime Error: [string "C:\Users\hollenbo\Documents\My Games\Sid Me..."]:369: bad argument #2 to '?' (Key must be of type 'number' or 'string'.)
 
I moved some things around, so check if your Civup/Interface/Cities/CityView.lua line 369 is this:

if city:IsHasBuilding(GameInfo.Buildings[buildingType].ID) then​

Change it to:

if city:IsHasBuilding(buildingID) then​
 
Hi Thal

Just tried this with GEM 1.11.6 and CivUp 2.2.8 and the result is unfortunately the same - the city screen messes up in exactly the same way as shown in post 1 if I build a building that is affected by the Building_Addons system.

\Skodkim

More Info:

And now I got the following in lua.log:
[2203.280] Runtime Error: [string "C:\Users\hollenbo\Documents\My Games\Sid Me..."]:1532: bad argument #2 to '?' (Key must be of type 'number' or 'string'.)

I didn't see that the first time I tried. It may have something to do with expanding the wonders and building lists in the city screen - possibly a combination og expanding both at the same time..?
 
The first version stopped loading the city screen when it encountered the error on line 369. We fixed that, so the code now continues to line 1532, and finds another error. This happens a lot when debugging. :)

In CityView.lua do a find-replace changing all occurrences of this:
GameInfo.Buildings[BuildingType]

to this:
GameInfo.Buildings[buildingAddon.BuildingType]

I usually find dozens of errors like this in alpha testing before releasing mod updates to the public. The bugs which actually show error messages are easier to solve than most bugs on this forum, since the ones that get past me often produce no error messages. I would give you an updated version of the file, but it's changed in other ways since your version.
 
Hi Thal

After replacing the lines in Cityview.lua I get two instances of the building addon when I place one using the fire tuner. See screenshot. I also included my files using the building_Addons system so you can check it yourself if it makes it any easier. It should contain everything you need.

\Skodkim
 
Now we've solved the syntax errors (which produce an error message), and arrived at the logic bugs, which cause incorrect results without any helpful error messages. :crazyeye:

Try changing this code around line 1504:
if city:IsHasBuilding(buildingID) and not Building_IsWonder(building.Type) then

to this:
if city:IsHasBuilding(buildingID) and not Building_IsWonder(building.Type) and not Game.HasValue({ParentBuildingClass=buildingClass}, GameInfo.Building_Addons) then

If that does not work, cCould you attach your entire modmod? Logic errors are more difficult to debug, and experimentation will help me figure out what's going on. What is the "IsMarketplace" flag used for? This code was written by Sneaks IIRC and it's unfamiliar to me.
 
Just tried changing the line and the result is the same as before: Apparently I get two instances of the buildong addon. It might be a glitch though as the addition doesn't seem to provide double bonusses, e.g. two specialist slots.

Actually if I use the fire tuner to give me a addon the normal library but not the library building itself I see only one addon building in the list so there's definately some weird UI things going on here...

Modmod attached. Look in additions\science.xml


\Skodkim
 
I'm also seeing this problem. It appears to occur at the same time as when the research tree stops loading correctly.

I think this primarily occurs when you do in ingame quickload. Otherwise I haven't really seen it occur.
 
Do you use the Building_Addons system?

Otherwise I suspect its not exactly the same problem as I can 100% reproduce this with the fire tuner by adding or removing a building affected by the system.

\Skodkim
 
I'm doing another round of bugfixing now. I took a break from debugging for a while to avoid burnout. I'm investigating this particular problem at the moment. :)
 
Try it with the attached update. I think I got it working.
 

Attachments

Back
Top Bottom