Impaler[WrG]
Civ4:Col UI programmer
I have often heard people ask if its possible for a Civic, Wonder or Tech to change the effect of a building, say for example If you had Monarchy Tech your Castles would produce +1 Happiness, or if you Built NotraDam wonder all your Cathedrals would get +25% additional Culture for a total of +75% bonus.
In addition many people might like to create effects similar to the Virtual World ala SMAC inwhich building A gains the additional effect of and substitues for Building B. So for example all Libraries could act as Observatories and have the combined effects of each, onece the city has a Library its like getting the observatory for free.
Any individual one of these example could easily be done in Python or the SDK layer but it would be specific the the combination desired, I have a plan that may alow moders to alter a buildings effects with any effect that a building can have or might have in the future. Its realy a rather simple system based on technices peple have been using in Python for some time now, create a phantom building in XML which holds the desired changes and set a new tag I will create <bPhantom> to true and its cost to -1 (unbuildable) to designate the building as a phantom. The UI and Pedia will be modified to simply not display building which are Phantoms so they will not clutter things up. Then in the Tech/Wonder/Civic pair up the real building and the Phantom under a <BuildingModifications> element wich will be added. The player object CvPlayer will hold an array of [NumBuildingInfos] that initializes with -1 to all elements which constitutes an empty state. On Processing of Techs/Civis and Wonders the code will detect any BuildingModifications and set the Player Array with the linkage. For example Building number 17 is going to gain an effect which is encapsulated as building 24 we just do a BuildingModifier[17] = 24. This establishes the linkage of building 24 piggybacking on 17. We then call the CvCity:
rocessBuilding function which will be modifed to detect this linkage and call itself recursivly with the piggybacking building as its argument. A simple check function will detect if a dumb moder has created some kind of infinite loop before the recursion begins and if so abort. The Primary building will now carry the new effects and they will apear and disapear with it as if they had always been part of it. The UI will need some modification to display the new effects with the mouse over of the primary building but this should be rather simple as we just append the effects mouse over info to the primary. The same system will handle piggybacking a real non-phantom building as well but this will require some additional checks to make shure effects arn't duplicated and the CvCity::canBuild must return false in an existing building is already acting as the desired building. Even better when more effects are added to buildings (as I have already beed doing) these will get folded in without any additional work (so long as they trigger through ProcessBuildings which anyone with half a brain would do.
So to summarize modifications to buildings that can include any effect that a building has or will have and it should be doable entirely in XML. Sound like a good plan?
In addition many people might like to create effects similar to the Virtual World ala SMAC inwhich building A gains the additional effect of and substitues for Building B. So for example all Libraries could act as Observatories and have the combined effects of each, onece the city has a Library its like getting the observatory for free.
Any individual one of these example could easily be done in Python or the SDK layer but it would be specific the the combination desired, I have a plan that may alow moders to alter a buildings effects with any effect that a building can have or might have in the future. Its realy a rather simple system based on technices peple have been using in Python for some time now, create a phantom building in XML which holds the desired changes and set a new tag I will create <bPhantom> to true and its cost to -1 (unbuildable) to designate the building as a phantom. The UI and Pedia will be modified to simply not display building which are Phantoms so they will not clutter things up. Then in the Tech/Wonder/Civic pair up the real building and the Phantom under a <BuildingModifications> element wich will be added. The player object CvPlayer will hold an array of [NumBuildingInfos] that initializes with -1 to all elements which constitutes an empty state. On Processing of Techs/Civis and Wonders the code will detect any BuildingModifications and set the Player Array with the linkage. For example Building number 17 is going to gain an effect which is encapsulated as building 24 we just do a BuildingModifier[17] = 24. This establishes the linkage of building 24 piggybacking on 17. We then call the CvCity:

So to summarize modifications to buildings that can include any effect that a building has or will have and it should be doable entirely in XML. Sound like a good plan?