mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-08 05:34:58 +00:00
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:
@@ -515,8 +515,7 @@ class PokemonBoxPartySprite < SpriteWrapper
|
||||
sprite = @pokemonsprites[index]
|
||||
if sprite
|
||||
arrow.grab(sprite)
|
||||
@pokemonsprites[index] = nil
|
||||
@pokemonsprites.compact!
|
||||
@pokemonsprites.delete_at(index)
|
||||
refresh
|
||||
end
|
||||
end
|
||||
@@ -539,10 +538,7 @@ class PokemonBoxPartySprite < SpriteWrapper
|
||||
xvalues.push(18 + 72 * (i % 2))
|
||||
yvalues.push(2 + 16 * (i % 2) + 64 * (i / 2))
|
||||
end
|
||||
for j in 0...Settings::MAX_PARTY_SIZE
|
||||
@pokemonsprites[j] = nil if @pokemonsprites[j] && @pokemonsprites[j].disposed?
|
||||
end
|
||||
@pokemonsprites.compact!
|
||||
@pokemonsprites.delete_if { |sprite| sprite && sprite.disposed? }
|
||||
for j in 0...Settings::MAX_PARTY_SIZE
|
||||
sprite = @pokemonsprites[j]
|
||||
if sprite && !sprite.disposed?
|
||||
|
||||
@@ -588,12 +588,7 @@ class PokemonMartScreen
|
||||
pbDisplayPaused(_INTL("You have no more room in the Bag."))
|
||||
else
|
||||
@adapter.setMoney(@adapter.getMoney-price)
|
||||
for i in 0...@stock.length
|
||||
if GameData::Item.get(@stock[i]).is_important? && $PokemonBag.pbHasItem?(@stock[i])
|
||||
@stock[i]=nil
|
||||
end
|
||||
end
|
||||
@stock.compact!
|
||||
@stock.delete_if { |item| GameData::Item.get(item).is_important? && $PokemonBag.pbHasItem?(item) }
|
||||
pbDisplayPaused(_INTL("Here you are! Thank you!")) { pbSEPlay("Mart buy item") }
|
||||
if quantity >= 10 && $PokemonBag && GameData::Item.exists?(:PREMIERBALL)
|
||||
if Settings::MORE_BONUS_PREMIER_BALLS && GameData::Item.get(item).is_poke_ball?
|
||||
@@ -660,11 +655,7 @@ end
|
||||
#
|
||||
#===============================================================================
|
||||
def pbPokemonMart(stock,speech=nil,cantsell=false)
|
||||
for i in 0...stock.length
|
||||
stock[i] = GameData::Item.get(stock[i]).id
|
||||
stock[i] = nil if GameData::Item.get(stock[i]).is_important? && $PokemonBag.pbHasItem?(stock[i])
|
||||
end
|
||||
stock.compact!
|
||||
stock.delete_if { |item| GameData::Item.get(item).is_important? && $PokemonBag.pbHasItem?(item) }
|
||||
commands = []
|
||||
cmdBuy = -1
|
||||
cmdSell = -1
|
||||
|
||||
@@ -184,10 +184,7 @@ def pbManageMysteryGifts
|
||||
break
|
||||
elsif cmd==0 # Toggle on/offline
|
||||
if online.include?(gift[0])
|
||||
for i in 0...online.length
|
||||
online[i]=nil if online[i]==gift[0]
|
||||
end
|
||||
online.compact!
|
||||
online.delete(gift[0])
|
||||
else
|
||||
online.push(gift[0])
|
||||
end
|
||||
@@ -208,10 +205,7 @@ def pbManageMysteryGifts
|
||||
$Trainer.mystery_gifts.push(gift) if !replaced
|
||||
pbReceiveMysteryGift(gift[0])
|
||||
elsif cmd==3 # Delete
|
||||
if pbConfirmMessage(_INTL("Are you sure you want to delete this gift?"))
|
||||
master[command]=nil
|
||||
master.compact!
|
||||
end
|
||||
master.delete_at(command) if pbConfirmMessage(_INTL("Are you sure you want to delete this gift?"))
|
||||
break
|
||||
end
|
||||
end
|
||||
@@ -305,7 +299,7 @@ def pbDownloadMysteryGift(trainer)
|
||||
pbMessageDisplay(sprites["msgwindow"],_INTL("The gift has been received!")) { sprite.update }
|
||||
pbMessageDisplay(sprites["msgwindow"],_INTL("Please pick up your gift from the deliveryman in any Poké Mart.")) { sprite.update }
|
||||
trainer.mystery_gifts.push(gift)
|
||||
pending[command]=nil; pending.compact!
|
||||
pending.delete_at(command)
|
||||
opacityDiff = 16*20/Graphics.frame_rate
|
||||
loop do
|
||||
Graphics.update
|
||||
|
||||
Reference in New Issue
Block a user