CQUI-Org / cqui

Civilization 6 - Chao's Quick UI. Reduce clicks and manage your empire faster!
MIT License
318 stars 64 forks source link

Real housing from improvements #545

Closed bollbas closed 7 years ago

bollbas commented 7 years ago

248 resolved finally! :smile:

bollbas commented 7 years ago

I've made changes and left the same function for all 4 files but I still can't reuse it from one file to all these 4 files. I've added it to civ6common.lua then tried to Initialize it in these files and use it's value. But it didn't work. Can you explain how to do so? Fixed function is in commit above

SpaceOgre commented 7 years ago

I can try to. If you look at the top in cqui_settingselement.lua you will see this row include("Civ6Common") this means that you can use functions from this file in the current one (might not be totally correct I'm not that good at Lua), like PopulateCheckBox and so on.

So try and add a function to Civ6Common and then call it from another file that have it included to start with. If you want to add a completely new file then it needs to be added in the modinfo file.

Did it clear it up somewhat?

bollbas commented 7 years ago

Civ6Common is already included to city panel, overview, citybanner and reportscreen files. I tried to add a function to Civ6Common and simply call it from these files but it didn't work.

SpaceOgre commented 7 years ago

Did you try it with return value instead of global variable? The included file can't access the global variable from the calling file.

Do you get any errors in the logs/firetuner when trying this?

bollbas commented 7 years ago

The last attached file uses local variable: local CQUI_HousingFromImprovements = CQUI_RealHousingFromImprovements(selectedCity);

bollbas commented 7 years ago

@SpaceOgre it works now. The problem was I forgot to rename a variable in one row. Thanks! :+1:

bollbas commented 7 years ago

Something wrong with citybannermanager code changes. It works when start a game, on next turn, when load a saved game but when loading autosaves all citybanners miss.

SpaceOgre commented 7 years ago

Can't help you anymore but point out that logs and firetuner are your friends in these situations. My computer with Civ on it is unplugged because of renovation and will be for a couple of days.

JHCD commented 7 years ago

Sounds like a missing initialisation... Could be, that there is a different behaviour between "load game" and "continious game".

bollbas commented 7 years ago

Yes, it seems so because after disabling/enabling smartbanner settings it works again

JHCD commented 7 years ago

I remember something similar within another functionality... Update: Take a look here: #489

SpaceOgre commented 7 years ago

Yeah it might be that the citybanner is initialized before some of the things needed for the new functions and thus it crashes. As long as you can figure out what is causing the crash you should hopefully be able to create a check for it so init on load can run and after that is done it should work as intended.

Could be tricky to track down the offending party though.