Refactoring and Bugfixes (#127)

* Replacing nil + compact! with delete, delete_at and delete_if wherever possible
* Fixed Terrain Tag editor not setting the correct terrain
* Fixed Text Cursor in Animation Editor not going right
This commit is contained in:
Golisopod-User
2021-08-23 02:55:29 +05:30
committed by GitHub
parent e57e1f4a1e
commit ecc5a040cd
21 changed files with 40 additions and 171 deletions

View File

@@ -387,25 +387,15 @@ class PokemonMapFactory
def updateMapsInternal
return if $game_player.moving?
if !MapFactoryHelper.hasConnections?($game_map.map_id)
return if @maps.length==1
for i in 0...@maps.length
@maps[i] = nil if $game_map.map_id!=@maps[i].map_id
end
@maps.compact!
return if @maps.length == 1
@maps.delete_if { |map| $game_map.map_id != map.map_id }
@mapIndex = getMapIndex($game_map.map_id)
return
end
setMapsInRange
deleted = false
for i in 0...@maps.length
next if MapFactoryHelper.mapInRange?(@maps[i])
@maps[i] = nil
deleted = true
end
if deleted
@maps.compact!
@mapIndex = getMapIndex($game_map.map_id)
end
deleted = @maps.delete_if { |map| !MapFactoryHelper.mapInRange?(map) }
@mapIndex = getMapIndex($game_map.map_id) if deleted
end
end