Sped up compiling of pokemon.txt/pokemonforms.txt

This commit is contained in:
Maruno17
2020-12-25 18:15:14 +00:00
parent ad21fc92cb
commit c8930d408a

View File

@@ -675,7 +675,6 @@ module Compiler
species_pokedex_entries[species_number] = species_hash[:pokedex_entry] species_pokedex_entries[species_number] = species_hash[:pokedex_entry]
} }
} }
#p GameData::Species::DATA.keys
# Enumerate all evolution species and parameters (this couldn't be done earlier) # Enumerate all evolution species and parameters (this couldn't be done earlier)
GameData::Species.each do |species| GameData::Species.each do |species|
FileLineData.setSection(species.id_number, "Evolutions", nil) # For error reporting FileLineData.setSection(species.id_number, "Evolutions", nil) # For error reporting
@@ -694,20 +693,16 @@ module Compiler
end end
end end
# Add prevolution "evolution" entry for all evolved species # Add prevolution "evolution" entry for all evolved species
GameData::Species.each do |species| all_evos = {}
found_prevolution = false GameData::Species.each do |species| # Build a hash of prevolutions for each species
Graphics.update if species.id_number % 200 == 0 next if all_evos[species.species]
pbSetWindowText(_INTL("Processing {1} prevolution line {2}", FileLineData.file, species.id_number)) if species.id_number % 50 == 0 species.evolutions.each do |evo|
GameData::Species.each do |other_species| all_evos[evo[0]] = [species.species, evo[1], evo[2], true] if !all_evos[evo[0]]
other_species.evolutions.each do |evo|
next if evo[0] != species.species || evo[3]
species.evolutions.push([other_species.species, evo[1], evo[2], true])
found_prevolution = true
break
end
break if found_prevolution
end end
end end
GameData::Species.each do |species| # Distribute prevolutions
species.evolutions.push(all_evos[species.species].clone) if all_evos[species.species]
end
# Save all data # Save all data
GameData::Species.save GameData::Species.save
MessageTypes.setMessages(MessageTypes::Species, species_names) MessageTypes.setMessages(MessageTypes::Species, species_names)
@@ -885,21 +880,17 @@ module Compiler
} }
# Add prevolution "evolution" entry for all evolved forms that define their # Add prevolution "evolution" entry for all evolved forms that define their
# own evolution methods (and thus won't have a prevolution listed already) # own evolution methods (and thus won't have a prevolution listed already)
GameData::Species.each do |species| all_evos = {}
GameData::Species.each do |species| # Build a hash of prevolutions for each species
next if all_evos[species.species]
species.evolutions.each do |evo|
all_evos[evo[0]] = [species.species, evo[1], evo[2], true] if !evo[3] && !all_evos[evo[0]]
end
end
GameData::Species.each do |species| # Distribute prevolutions
next if species.form == 0 # Looking at alternate forms only next if species.form == 0 # Looking at alternate forms only
next if species.evolutions.any? { |evo| evo[3] } # Already has prevo listed next if species.evolutions.any? { |evo| evo[3] } # Already has prevo listed
found_prevolution = false species.evolutions.push(all_evos[species.species].clone) if all_evos[species.species]
Graphics.update if species.id_number % 200 == 0
pbSetWindowText(_INTL("Processing {1} prevolution line {2}", FileLineData.file, species.id_number)) if species.id_number % 50 == 0
GameData::Species.each do |other_species|
other_species.evolutions.each do |evo|
next if evo[0] != species.species || evo[3]
species.evolutions.push([other_species.species, evo[1], evo[2], true])
found_prevolution = true
break
end
break if found_prevolution
end
end end
# Save all data # Save all data
GameData::Species.save GameData::Species.save