Fixes crash when missing fusion icons folder (thanks kurayamiblackheart)

This commit is contained in:
infinitefusion
2023-07-01 17:49:35 -04:00
parent 45c323bdb0
commit 6c1edae863
5 changed files with 8 additions and 1 deletions

View File

@@ -111,7 +111,7 @@ class PokeRadar_UI
bitmap1 = AnimatedBitmap.new(GameData::Species.icon_filename(headPoke)) bitmap1 = AnimatedBitmap.new(GameData::Species.icon_filename(headPoke))
bitmap2 = AnimatedBitmap.new(GameData::Species.icon_filename(bodyPoke)) bitmap2 = AnimatedBitmap.new(GameData::Species.icon_filename(bodyPoke))
ensureFusionIconExists()
bitmapFileName = sprintf("Graphics/Pokemon/FusionIcons/icon%03d", pokemonId) bitmapFileName = sprintf("Graphics/Pokemon/FusionIcons/icon%03d", pokemonId)
headPokeFileName = GameData::Species.icon_filename(headPoke) headPokeFileName = GameData::Species.icon_filename(headPoke)
bitmapPath = sprintf("%s.png", bitmapFileName) bitmapPath = sprintf("%s.png", bitmapFileName)

View File

@@ -188,6 +188,7 @@ class PokemonIconSprite < SpriteWrapper
icon2 = AnimatedBitmap.new(GameData::Species.icon_filename(bodyPoke)) icon2 = AnimatedBitmap.new(GameData::Species.icon_filename(bodyPoke))
dexNum = getDexNumberForSpecies(@pokemon.species) dexNum = getDexNumberForSpecies(@pokemon.species)
ensureFusionIconExists
bitmapFileName = sprintf("Graphics/Pokemon/FusionIcons/icon%03d", dexNum) bitmapFileName = sprintf("Graphics/Pokemon/FusionIcons/icon%03d", dexNum)
headPokeFileName = GameData::Species.icon_filename(headPoke) headPokeFileName = GameData::Species.icon_filename(headPoke)
bitmapPath = sprintf("%s.png", bitmapFileName) bitmapPath = sprintf("%s.png", bitmapFileName)

View File

@@ -35,6 +35,7 @@ class PokemonBoxIcon < IconSprite
icon2 = AnimatedBitmap.new(GameData::Species.icon_filename(bodyPoke)) icon2 = AnimatedBitmap.new(GameData::Species.icon_filename(bodyPoke))
dexNum = getDexNumberForSpecies(species) dexNum = getDexNumberForSpecies(species)
ensureFusionIconExists
bitmapFileName = sprintf("Graphics/Pokemon/FusionIcons/icon%03d", dexNum) bitmapFileName = sprintf("Graphics/Pokemon/FusionIcons/icon%03d", dexNum)
headPokeFileName = GameData::Species.icon_filename(headPoke) headPokeFileName = GameData::Species.icon_filename(headPoke)
bitmapPath = sprintf("%s.png", bitmapFileName) bitmapPath = sprintf("%s.png", bitmapFileName)

View File

@@ -48,6 +48,11 @@ def pbAddPokemonID(pokemon_id, level = 1, see_form = true, skip_randomize = fals
end end
def ensureFusionIconExists
directory_name = "Graphics/Pokemon/FusionIcons"
Dir.mkdir(directory_name) unless File.exists?(directory_name)
end
def addNewTripleFusion(pokemon1,pokemon2,pokemon3,level = 1) def addNewTripleFusion(pokemon1,pokemon2,pokemon3,level = 1)
return if !pokemon1 return if !pokemon1
return if !pokemon2 return if !pokemon2

Binary file not shown.