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

@@ -322,8 +322,7 @@ def pbEncounterTypeEditor(enc_data, enc_type)
need_refresh = true
when 2 # Delete
if pbConfirmMessage(_INTL("Delete this encounter slot?"))
enc_data.types[enc_type][ret - 2] = nil
enc_data.types[enc_type].compact!
enc_data.types[enc_type].delete_at(ret - 2)
need_refresh = true
end
end
@@ -1298,8 +1297,7 @@ def pbRegionalDexEditorMain
cmd[1] = dex_lists.length
refresh_list = true
when 2 # Delete
dex_lists[cmd[1] - 1] = nil
dex_lists.compact!
dex_lists.delete_at(cmd[1] - 1)
cmd[1] = [cmd[1], dex_lists.length].min
refresh_list = true
end

View File

@@ -215,7 +215,7 @@ class PokemonTilesetScene
end
val = pbMessage(_INTL("\\l[1]\\ts[]Set the terrain tag."), cmds, -1, nil, old_idx)
if val >= 0 && val != old_tag
set_terrain_tag_for_tile_ID(selected, val)
set_terrain_tag_for_tile_ID(selected, ids[val])
draw_overlay
end
end

View File

@@ -218,11 +218,8 @@ class MapScreenScene
return false
end
def removeOldConnections(ret,mapid)
for i in 0...ret.length
ret[i]=nil if ret[i][0]==mapid || ret[i][3]==mapid
end
ret.compact!
def removeOldConnections(ret, mapid)
ret.delete_if { |conn| conn[0] == mapid || conn[3] == mapid}
end
# Returns the maps within _keys_ that are directly connected to this map, _map_.