Jules,
For your specific example, you could use:
Code:
|
HandleEvent(GrantAdvance) 'BuildingExpires' post {
advance[0]=value[0];
if (value[0] == AdvanceDB(ADVANCE_ECONOMICS)) {
Message(player[0], 'BUILDING_OBSOLETE_1_MSG');
}
} |
with:
BUILDING_OBSOLETE_1 "Our knowledge of {advance[0].name} has made the improvement {BuildingDB(IMPROVE_BAZAAR)} obsolete. However we can now build the {BuildingDB(IMPROVE_BROKERAGE)} improvement instead."
But you'll then have to do this over again for each advance that makes a building obsolete. As there's quite a few of them you might want to set up a mapping from advances to buildings via a system of arrays. This is what I did in my UnitUpdater. In your case it would look something like this:
obsadv[0]=AdvanceDB(ADVANCE_ECONOMICS) ;
OBS_BUILDING_TYPE[0]= BuildingDB(IMPROVE_BAZAAR);
NEW_BUILDING_TYPE[0]= BuildingDB(IMPROVE_BROKERAGE);
obsadv[1]=AdvanceDB(ADVANCE_whatever) ;
OBS_BUILDING_TYPE[1]= BuildingDB(IMPROVE_whatever);
NEW_BUILDING_TYPE[1]= BuildingDB(IMPROVE_whatever);
obsadv[2]=AdvanceDB(ADVANCE_and so on) ;
OBS_BUILDING_TYPE[2]= BuildingDB(IMPROVE_and so on);
NEW_BUILDING_TYPE[2]= BuildingDB(IMPROVE_and so on);
Your handler would then look like:
Code:
|
// Globals:
int_t BUILDING_INDEX;
int_t OBS_BUILDING_TYPE[];
int_t NEW_BUILDING_TYPE[];
HandleEvent(GrantAdvance) 'BuildingExpires' post {
int_t i;
int_t obsadv[];
// the above data arrays can go here
for(i=0; i |
with:
BUILDING_OBSOLETE_1 "Our knowledge of {advance[0].name} has made the improvement {BuildingDB(OBS_BUILDING_TYPE[BUILDING_INDEX])} obsolete. However we can now build the {BuildingDB(NEW_BUILDING_TYPE[BUILDING_INDEX])} improvement instead."
This is assuming that no advance obsoletes more than one type of building. It's a bit more complicated if you allow that to happen. No guarentees the above code will work as it stands; I might have forgotten something.