Invisible units capturing cities bug

RetroA

Chieftain
Joined
Sep 15, 2015
Messages
25
Location
UK
Been a long time since I've posted anything here so apologies if this should be in a more specific place.

I've long been dealing with a strange bug when modding new units into Civ5 (with all expansions) where they cannot capture cities but can still attack them and when the city is down to 0 health, they will enter the city tile, eliminating any garrisoned unit, but not actually change the city's ownership (even though there is a notification onscreen saying "Your unit X has captured City of Y"). The city still belongs to the opponent and can still launch ranged attacks even though the unit is occupying the city tile.

After whittling down possibilities, I think I've determined that it's because I've given these particular units a promotion that makes them invisible (using the <Invisible>INVISIBLE_SUBMARINE</Invisible> promotion tag).

I'm just curious if this is a known issue to anyone or if anyone can corroborate this (or indeed if anyone knows a fix). I've searched the forums but haven't seen this mentioned anywhere so could be of note to others. Kind of pain as I've added quite a few invisible units through various mods, guess I'll have to update them and turn this into a balancing feature that they can't capture cities but can sneak in!
 
It's not an issue but by design; although the notification is a bug and you could argue the design is flawed. Invisible units can co-exist with some enemy "units" and cities are one of the things they can co-exist with.
 
Thanks for the quick response. Good to know but wish I had known sooner! Very strange design, does make me wonder what enemy entities submarines are supposed to be able to share tiles with in the base game since they can't attack cities.
 
It could have been some half-baked idea that never made it into the final product, or (more likely IMHO) it was a junior programmer not fully understanding the full mechanics of the game and getting it wrong ;)

Edit: If you want to follow the "logic" search for "acquireCity" in CvUnit.cpp then search backwards for "canCoexistWithEnemyUnit" - that's where the problems start.
 
Top Bottom