Fixed SystemStackError when loading a connected map with an event at its edge facing away from that edge

This commit is contained in:
Maruno17
2022-06-03 14:42:04 +01:00
parent b441411b2e
commit ff1f9633f3
2 changed files with 4 additions and 4 deletions

View File

@@ -65,8 +65,8 @@ class PokemonMapFactory
return getMap(id, false)
end
def getNewMap(playerX, playerY)
id = $game_map.map_id
def getNewMap(playerX, playerY, map_id = nil)
id = map_id || $game_map.map_id
MapFactoryHelper.eachConnectionForMap(id) do |conn|
mapidB = nil
newx = 0

View File

@@ -211,8 +211,8 @@ class Game_Character
end
xbehind = @x + (@direction == 4 ? 1 : @direction == 6 ? -1 : 0)
ybehind = @y + (@direction == 8 ? 1 : @direction == 2 ? -1 : 0)
this_map = (self.map.valid?(@x, @y)) ? [self.map, @x, @y] : $map_factory&.getNewMap(@x, @y)
behind_map = (self.map.valid?(xbehind, ybehind)) ? [self.map, xbehind, ybehind] : $map_factory&.getNewMap(xbehind, ybehind)
this_map = (self.map.valid?(@x, @y)) ? [self.map, @x, @y] : $map_factory&.getNewMap(@x, @y, self.map.map_id)
behind_map = (self.map.valid?(xbehind, ybehind)) ? [self.map, xbehind, ybehind] : $map_factory&.getNewMap(xbehind, ybehind, self.map.map_id)
if this_map && this_map[0].deepBush?(this_map[1], this_map[2]) &&
(!behind_map || behind_map[0].deepBush?(behind_map[1], behind_map[2]))
@bush_depth = Game_Map::TILE_HEIGHT