Improper building scrapping
Moderator: Oberlus
Improper building scrapping
Somehow, FO thinks any scrapped building still exists. The outpost in the pic had a scanning facility on it, but it was scrapped just before it was captured. When I recaptured it, the building is gone but its effects remained. I also tried scrapping the imperial palace and building it elsewhere, but it was not possible because the game thinks it's still there (I don't remember checking if the palace's bonuses still remained or not though).
- Attachments
-
- BuildingSac.png (52.88 KiB) Viewed 411 times
- Geoff the Medio
- Programming, Design, Admin
- Posts: 12818
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: Improper building scrapping
This is probably because the code implementing scrapping is passing a TemporaryPtr<Building> to a function that takes an int, and the compiler is accepting it, casting the TemporaryPtr<Building> to an int (somehow... maybe through the bool operator() function?), probably with value 0 or 1, then using that as the id of the building to scrap. This does nothing, as object ids 0 and 1 are usually systems, and buildings don't get scrapped.
I'm not sure how to disable such automatic casting... it's come up a few times causing similar errors.
Edit: Looks like just declaring a private conversion function does it at compile time...
I'm not sure how to disable such automatic casting... it's come up a few times causing similar errors.
Edit: Looks like just declaring a private conversion function does it at compile time...
Code: Select all
operator int() const;