[ToME 1.5.10] Wrong enemy units during ambush.

Where bugs go to lie down and rest

Moderator: Moderator

Post Reply
Message
Author
BugReporter
Higher
Posts: 62
Joined: Wed Jun 06, 2018 10:53 am

[ToME 1.5.10] Wrong enemy units during ambush.

#1 Post by BugReporter »

Short description.
World map patrols may spawn ambushes with enemies from a different patrol.

Actual result.
Ambush map generates with wrong enemy units.

Expected result.
Ambush map generates with correct enemy units.

Steps to reproduce.
A. Human patrols, normal play (see comment).
1. Create a magic character.
2. Find adventurers party and attack them to start ambush.
3. Exit to the World map.
4. Find ziguranth patrol and attack them to start ambush.

B. Human and orc patrols, normal play (see comment)
1. Get to the point where you have portals to travel East->West and West->East.
2. West. Find and attack human (adventurers, ziguranth) patrol. Exit to the World map.
3. Go to Last Hope and use the portal to travel East.
4. East. Find and attack orcs patrol.

C. Human and orc patrols, debug mode (see comment)
1. Create a magic character.
2. Find and attack human patrol. Exit to the World map.
3. Use Ctrl+LMB to get to Far East.
4. Find and attack orcs patrol.

Game version.
1.5.10 for windows from ToME site.

Comment.
I believe A, B and C are the same issue.
Terrain also seems to be affected. Example: sand tiles instead of grass.
This issue disappears after save and load. It also seems to go away after doing several dungeons (needs more testing).
It appears to be related to persistent zones. Changes: file engine/Zone.lua, function _M:init(short_name, dynamic), excluded ambush with 'if' condition. Seems wrong to do this in engine, but I couldn't figure out how to do that in mod.

Code: Select all

function _M:init(short_name, dynamic)
	__zone_store[self] = true

	if _M.persist_last_zones and _M.persist_last_zones[short_name] then
        -- TEST: Exclude ambush to prevent reusing possibly inappropriate
        -- persisted version that may differ from the required version.
        if short_name ~= 'ambush' then
            local zone = _M.persist_last_zones[short_name]
            forceprint("[ZONE] loading from last persistent", short_name, zone)
            _M:removeLastPersistZone(short_name)
            self:replaceWith(zone)
            _M:addLastPersistZone(self)
            return
        end
	end
Maybe it is possible to check what parts of persisted ambush data can be reused and what parts need to be loaded to update the persisted data.

Post Reply