Misplaced Special maps

nadeauhugo

Author of FOT mod THE SUM
Modder
Have anyone experienced this bug? Could it be appening because of Melindil's Special maps encounter fix? Nothing is certain, but from experience, I can tell you the game engine sometimes (quite often actually) get totally lost in its Special map encounters locations, sometimes even show me like 5 special maps encounter around the same line of travel, even if none have been place in that worldmap area! It also sometimes seems to forget the rightfull place of some Special encounter maps I deliberately placed in a square or another, or replace them with some other special map. The behaviour seem to happen at random, but when it happends, the engine seem completely lost within itself.

It is pretty stupid as sometimes, a "sea shore" Special map can appear in the middle of the desert. DAH!!....

If anyone could isolate this behaviour and find a way to solve it, that would be AMAZING..

Hugo
 
Image
 

Attachments

  • Encounters.jpg
    Encounters.jpg
    700.3 KB · Views: 367
Have anyone experienced this bug? Could it be appening because of Melindil's Special maps encounter fix? Nothing is certain, but from experience, I can tell you the game engine sometimes (quite often actually) get totally lost in its Special map encounters locations, sometimes even show me like 5 special maps encounter around the same line of travel, even if none have been place in that worldmap area! It also sometimes seems to forget the rightfull place of some Special encounter maps I deliberately placed in a square or another, or replace them with some other special map. The behaviour seem to happen at random, but when it happends, the engine seem completely lost within itself.

It is pretty stupid as sometimes, a "sea shore" Special map can appear in the middle of the desert. DAH!!....

If anyone could isolate this behaviour and find a way to solve it, that would be AMAZING..

Hugo

I'm not sure I can explain the first part (special encounters happening where none were listed), but I can explain the second (wrong encounters appearing).

The game keeps track of special encounters in an array (or, more accurately, a C++ vector) in the World object. At the start of a campaign, all special encounters are listed there, and locations on the map are indexed based on the position in the array. So, the first encounter in the array is numbered 1 (or 0, can't remember), and is marked on the world map with that corresponding ID.

However, once a special encounter is triggered, that encounter is actually removed from the array/vector. When this happens, all others with a higher index / ID are shifted down by 1. But the IDs assigned on the world map don't change, so now each map location is pointing to a different, wrong encounter. And whenever the ID in a map location is greater than the maximum index left in the array, the last entry in the array is used.

My fix should only take effect once the array becomes empty, bypassing code that dereferences the first entry in the array (as this causes a crash with an empty array). To confirm, you might check if the odd every-square-has-an-encounter issue still occurs with this patch disabled. If it does, then it's unrelated to the fix.

Fixing this will be non-trivial, as I haven't decoded anything in the campaign map structure, and so I can't yet go in and shift all the encounter location IDs down by one when an encounter triggers. Best-case workaround would be to have the earliest anticipated encounters for the player to hit at the end of the encounter list. This way, fewer encounters will be shifted when the player hits one.
 
Thanks, this is very informative of what's might be going down there. I made several tests with and without your fix and I was not able to trigger back the even I described. My strong feeling about this is that some sort of campaign data might get corrupted sometimes, or the savegame itself might get corrupted for some reason, bringning the two strange behaviour together (all the random map suddently appearing on the squad path for no reason, most of them being (obviously) misplaced.

All my tests with fresh game (no save/load) show no error in special maps location and ID, even after opening 4-5-6 different special maps at random.

Only notable thing happened is that I experienced a game crash without your fix, but as I have about 50 special maps, it might not be the behaviour you fixed that caused the crash. I experienced a similar crash around 2 times in the last months or so, again without emptying the special maps array.

It feels like we are looking at possibly two new bugs here other the one you fixed, I don't know for sure, but it might be.
 
Back
Top