We-the-People-civ4col-mod / Mod

This is the repository where the mod resides.
86 stars 36 forks source link

XML flag to switch between detailed and summarized customs house messages #101

Open ShadesOT opened 5 years ago

ShadesOT commented 5 years ago

The Global Context needs a XML flag to switch between detailed and summarized customs house messages. It would replace this code in CvCity::doYields()

bool bPrintDetailedCustomsHouseMessages = false;//Implement a XML flag for this one. Currently only the summarized message can be printed,

I opened the ticket because I found outlined, but working code for detailed customs house messages. So why throw away something, if all you need is a new key to open it?

Nightinggale commented 5 years ago

For something like this, add a new index in xml/GlobalDefineAlt

<Define>
    <DefineName>THE_NAME_I_PICKED_AT_RANDOM</DefineName>
    <iDefineIntVal>32</iDefineIntVal>
</Define>

Reading it in the code you write

GC.getDefineINT("THE_NAME_I_PICKED_AT_RANDOM");

No extra code is needed. getDefineINT is rather slow though, meaning if you need it for anywhere where performance is needed (like code frequently used by AI), cache the int value.

While there are references to adding bools in the DLL reading code, no bools can be found in the xml schema file. However using an int of value ==0 and !=0 translates into a bool just fine.