Compiler methods can now accept a file path as a parameter, made overworld poison flashes slower

This commit is contained in:
Maruno17
2021-05-20 19:34:26 +01:00
parent 2b5d63673d
commit 3eea17b877
2 changed files with 61 additions and 61 deletions

View File

@@ -94,7 +94,7 @@ Events.onStepTakenTransferPossible += proc { |_sender,e|
for i in $Trainer.able_party for i in $Trainer.able_party
if i.status == :POISON && !i.hasAbility?(:IMMUNITY) if i.status == :POISON && !i.hasAbility?(:IMMUNITY)
if !flashed if !flashed
$game_screen.start_flash(Color.new(255,0,0,128), 4) pbFlash(Color.new(255, 0, 0, 128), 8)
flashed = true flashed = true
end end
i.hp -= 1 if i.hp>1 || Settings::POISON_FAINT_IN_FIELD i.hp -= 1 if i.hp>1 || Settings::POISON_FAINT_IN_FIELD

View File

@@ -4,7 +4,7 @@ module Compiler
#============================================================================= #=============================================================================
# Compile Town Map data # Compile Town Map data
#============================================================================= #=============================================================================
def compile_town_map def compile_town_map(path = "PBS/townmap.txt")
nonglobaltypes = { nonglobaltypes = {
"Name" => [0, "s"], "Name" => [0, "s"],
"Filename" => [1, "s"], "Filename" => [1, "s"],
@@ -15,7 +15,7 @@ module Compiler
placenames = [] placenames = []
placedescs = [] placedescs = []
sections = [] sections = []
pbCompilerEachCommentedLine("PBS/townmap.txt") { |line,lineno| pbCompilerEachCommentedLine(path) { |line,lineno|
if line[/^\s*\[\s*(\d+)\s*\]\s*$/] if line[/^\s*\[\s*(\d+)\s*\]\s*$/]
currentmap = $~[1].to_i currentmap = $~[1].to_i
sections[currentmap] = [] sections[currentmap] = []
@@ -52,9 +52,9 @@ module Compiler
#============================================================================= #=============================================================================
# Compile map connections # Compile map connections
#============================================================================= #=============================================================================
def compile_connections def compile_connections(path = "PBS/connections.txt")
records = [] records = []
pbCompilerEachPreppedLine("PBS/connections.txt") { |line,lineno| pbCompilerEachPreppedLine(path) { |line,lineno|
hashenum = { hashenum = {
"N" => "N","North" => "N", "N" => "N","North" => "N",
"E" => "E","East" => "E", "E" => "E","East" => "E",
@@ -94,11 +94,11 @@ module Compiler
#============================================================================= #=============================================================================
# Compile phone messages # Compile phone messages
#============================================================================= #=============================================================================
def compile_phone def compile_phone(path = "PBS/phone.txt")
return if !safeExists?("PBS/phone.txt") return if !safeExists?(path)
database = PhoneDatabase.new database = PhoneDatabase.new
sections = [] sections = []
File.open("PBS/phone.txt","rb") { |f| File.open(path, "rb") { |f|
pbEachSection(f) { |section,name| pbEachSection(f) { |section,name|
case name case name
when "<Generics>" when "<Generics>"
@@ -132,12 +132,12 @@ module Compiler
#============================================================================= #=============================================================================
# Compile type data # Compile type data
#============================================================================= #=============================================================================
def compile_types def compile_types(path = "PBS/types.txt")
GameData::Type::DATA.clear GameData::Type::DATA.clear
type_names = [] type_names = []
# Read from PBS file # Read from PBS file
File.open("PBS/types.txt", "rb") { |f| File.open(path, "rb") { |f|
FileLineData.file = "PBS/types.txt" # For error reporting FileLineData.file = path # For error reporting
# Read a whole section's lines at once, then run through this code. # Read a whole section's lines at once, then run through this code.
# contents is a hash containing all the XXX=YYY lines in that section, where # contents is a hash containing all the XXX=YYY lines in that section, where
# the keys are the XXX and the values are the YYY (as unprocessed strings). # the keys are the XXX and the values are the YYY (as unprocessed strings).
@@ -150,7 +150,7 @@ module Compiler
# empty # empty
if contents[key].nil? if contents[key].nil?
if ["Name", "InternalName"].include?(key) if ["Name", "InternalName"].include?(key)
raise _INTL("The entry {1} is required in PBS/types.txt section {2}.", key, type_id) raise _INTL("The entry {1} is required in {2} section {3}.", key, path, type_id)
end end
next next
end end
@@ -186,15 +186,15 @@ module Compiler
GameData::Type.each do |type| GameData::Type.each do |type|
type.weaknesses.each do |other_type| type.weaknesses.each do |other_type|
next if GameData::Type.exists?(other_type) next if GameData::Type.exists?(other_type)
raise _INTL("'{1}' is not a defined type (PBS/types.txt, section {2}, Weaknesses).", other_type.to_s, type.id_number) raise _INTL("'{1}' is not a defined type ({2}, section {3}, Weaknesses).", other_type.to_s, path, type.id_number)
end end
type.resistances.each do |other_type| type.resistances.each do |other_type|
next if GameData::Type.exists?(other_type) next if GameData::Type.exists?(other_type)
raise _INTL("'{1}' is not a defined type (PBS/types.txt, section {2}, Resistances).", other_type.to_s, type.id_number) raise _INTL("'{1}' is not a defined type ({2}, section {3}, Resistances).", other_type.to_s, path, type.id_number)
end end
type.immunities.each do |other_type| type.immunities.each do |other_type|
next if GameData::Type.exists?(other_type) next if GameData::Type.exists?(other_type)
raise _INTL("'{1}' is not a defined type (PBS/types.txt, section {2}, Immunities).", other_type.to_s, type.id_number) raise _INTL("'{1}' is not a defined type ({2}, section {3}, Immunities).", other_type.to_s, path, type.id_number)
end end
end end
# Save all data # Save all data
@@ -206,11 +206,11 @@ module Compiler
#============================================================================= #=============================================================================
# Compile ability data # Compile ability data
#============================================================================= #=============================================================================
def compile_abilities def compile_abilities(path = "PBS/abilities.txt")
GameData::Ability::DATA.clear GameData::Ability::DATA.clear
ability_names = [] ability_names = []
ability_descriptions = [] ability_descriptions = []
pbCompilerEachPreppedLine("PBS/abilities.txt") { |line, line_no| pbCompilerEachPreppedLine(path) { |line, line_no|
line = pbGetCsvRecord(line, line_no, [0, "vnss"]) line = pbGetCsvRecord(line, line_no, [0, "vnss"])
ability_number = line[0] ability_number = line[0]
ability_symbol = line[1].to_sym ability_symbol = line[1].to_sym
@@ -241,12 +241,12 @@ module Compiler
#============================================================================= #=============================================================================
# Compile move data # Compile move data
#============================================================================= #=============================================================================
def compile_moves def compile_moves(path = "PBS/moves.txt")
GameData::Move::DATA.clear GameData::Move::DATA.clear
move_names = [] move_names = []
move_descriptions = [] move_descriptions = []
# Read each line of moves.txt at a time and compile it into an move # Read each line of moves.txt at a time and compile it into an move
pbCompilerEachPreppedLine("PBS/moves.txt") { |line, line_no| pbCompilerEachPreppedLine(path) { |line, line_no|
line = pbGetCsvRecord(line, line_no, [0, "vnssueeuuueiss", line = pbGetCsvRecord(line, line_no, [0, "vnssueeuuueiss",
nil, nil, nil, nil, nil, :Type, ["Physical", "Special", "Status"], nil, nil, nil, nil, nil, :Type, ["Physical", "Special", "Status"],
nil, nil, nil, :Target, nil, nil, nil nil, nil, nil, :Target, nil, nil, nil
@@ -297,13 +297,13 @@ module Compiler
#============================================================================= #=============================================================================
# Compile item data # Compile item data
#============================================================================= #=============================================================================
def compile_items def compile_items(path = "PBS/items.txt")
GameData::Item::DATA.clear GameData::Item::DATA.clear
item_names = [] item_names = []
item_names_plural = [] item_names_plural = []
item_descriptions = [] item_descriptions = []
# Read each line of items.txt at a time and compile it into an item # Read each line of items.txt at a time and compile it into an item
pbCompilerEachCommentedLine("PBS/items.txt") { |line, line_no| pbCompilerEachCommentedLine(path) { |line, line_no|
line = pbGetCsvRecord(line, line_no, [0, "vnssuusuuUN"]) line = pbGetCsvRecord(line, line_no, [0, "vnssuusuuUN"])
item_number = line[0] item_number = line[0]
item_symbol = line[1].to_sym item_symbol = line[1].to_sym
@@ -343,9 +343,9 @@ module Compiler
#============================================================================= #=============================================================================
# Compile berry plant data # Compile berry plant data
#============================================================================= #=============================================================================
def compile_berry_plants def compile_berry_plants(path = "PBS/berryplants.txt")
GameData::BerryPlant::DATA.clear GameData::BerryPlant::DATA.clear
pbCompilerEachCommentedLine("PBS/berryplants.txt") { |line, line_no| pbCompilerEachCommentedLine(path) { |line, line_no|
if line[/^\s*(\w+)\s*=\s*(.*)$/] # Of the format XXX = YYY if line[/^\s*(\w+)\s*=\s*(.*)$/] # Of the format XXX = YYY
key = $1 key = $1
value = $2 value = $2
@@ -373,15 +373,15 @@ module Compiler
#============================================================================= #=============================================================================
# Compile Pokémon data # Compile Pokémon data
#============================================================================= #=============================================================================
def compile_pokemon def compile_pokemon(path = "PBS/pokemon.txt")
GameData::Species::DATA.clear GameData::Species::DATA.clear
species_names = [] species_names = []
species_form_names = [] species_form_names = []
species_categories = [] species_categories = []
species_pokedex_entries = [] species_pokedex_entries = []
# Read from PBS file # Read from PBS file
File.open("PBS/pokemon.txt", "rb") { |f| File.open(path, "rb") { |f|
FileLineData.file = "PBS/pokemon.txt" # For error reporting FileLineData.file = path # For error reporting
# Read a whole section's lines at once, then run through this code. # Read a whole section's lines at once, then run through this code.
# contents is a hash containing all the XXX=YYY lines in that section, where # contents is a hash containing all the XXX=YYY lines in that section, where
# the keys are the XXX and the values are the YYY (as unprocessed strings). # the keys are the XXX and the values are the YYY (as unprocessed strings).
@@ -390,7 +390,7 @@ module Compiler
FileLineData.setSection(species_number, "header", nil) # For error reporting FileLineData.setSection(species_number, "header", nil) # For error reporting
# Raise an error if a species number is invalid or used twice # Raise an error if a species number is invalid or used twice
if species_number == 0 if species_number == 0
raise _INTL("A Pokémon species can't be numbered 0 (PBS/pokemon.txt).") raise _INTL("A Pokémon species can't be numbered 0 ({1}).", path)
elsif GameData::Species::DATA[species_number] elsif GameData::Species::DATA[species_number]
raise _INTL("Species ID number '{1}' is used twice.\r\n{2}", species_number, FileLineData.linereport) raise _INTL("Species ID number '{1}' is used twice.\r\n{2}", species_number, FileLineData.linereport)
end end
@@ -400,7 +400,7 @@ module Compiler
# empty # empty
if nil_or_empty?(contents[key]) if nil_or_empty?(contents[key])
if ["Name", "InternalName"].include?(key) if ["Name", "InternalName"].include?(key)
raise _INTL("The entry {1} is required in PBS/pokemon.txt section {2}.", key, species_number) raise _INTL("The entry {1} is required in {2} section {3}.", key, path, species_number)
end end
contents[key] = nil contents[key] = nil
next next
@@ -426,7 +426,7 @@ module Compiler
# Convert height/weight to 1 decimal place and multiply by 10 # Convert height/weight to 1 decimal place and multiply by 10
value = (value * 10).round value = (value * 10).round
if value <= 0 if value <= 0
raise _INTL("Value for '{1}' can't be less than or close to 0 (section {2}, PBS/pokemon.txt)", key, species_number) raise _INTL("Value for '{1}' can't be less than or close to 0 (section {2}, {3})", key, species_number, path)
end end
contents[key] = value contents[key] = value
when "Moves" when "Moves"
@@ -539,7 +539,7 @@ module Compiler
#============================================================================= #=============================================================================
# Compile Pokémon forms data # Compile Pokémon forms data
#============================================================================= #=============================================================================
def compile_pokemon_forms def compile_pokemon_forms(path = "PBS/pokemonforms.txt")
species_names = [] species_names = []
species_form_names = [] species_form_names = []
species_categories = [] species_categories = []
@@ -551,8 +551,8 @@ module Compiler
form_number = species.id_number if form_number < species.id_number form_number = species.id_number if form_number < species.id_number
end end
# Read from PBS file # Read from PBS file
File.open("PBS/pokemonforms.txt", "rb") { |f| File.open(path, "rb") { |f|
FileLineData.file = "PBS/pokemonforms.txt" # For error reporting FileLineData.file = path # For error reporting
# Read a whole section's lines at once, then run through this code. # Read a whole section's lines at once, then run through this code.
# contents is a hash containing all the XXX=YYY lines in that section, where # contents is a hash containing all the XXX=YYY lines in that section, where
# the keys are the XXX and the values are the YYY (as unprocessed strings). # the keys are the XXX and the values are the YYY (as unprocessed strings).
@@ -562,14 +562,14 @@ module Compiler
# Split section_name into a species number and form number # Split section_name into a species number and form number
split_section_name = section_name.split(/[-,\s]/) split_section_name = section_name.split(/[-,\s]/)
if split_section_name.length != 2 if split_section_name.length != 2
raise _INTL("Section name {1} is invalid (PBS/pokemonforms.txt). Expected syntax like [XXX,Y] (XXX=internal name, Y=form number).", sectionName) raise _INTL("Section name {1} is invalid ({2}). Expected syntax like [XXX,Y] (XXX=internal name, Y=form number).", sectionName, path)
end end
species_symbol = csvEnumField!(split_section_name[0], :Species, nil, nil) species_symbol = csvEnumField!(split_section_name[0], :Species, nil, nil)
form = csvPosInt!(split_section_name[1]) form = csvPosInt!(split_section_name[1])
# Raise an error if a species is undefined, the form number is invalid or # Raise an error if a species is undefined, the form number is invalid or
# a species/form combo is used twice # a species/form combo is used twice
if !GameData::Species.exists?(species_symbol) if !GameData::Species.exists?(species_symbol)
raise _INTL("Species ID '{1}' is not defined in pokemon.txt.\r\n{2}", species_symbol, FileLineData.linereport) raise _INTL("Species ID '{1}' is not defined in {2}.\r\n{3}", species_symbol, path, FileLineData.linereport)
elsif form == 0 elsif form == 0
raise _INTL("A form cannot be defined with a form number of 0.\r\n{1}", FileLineData.linereport) raise _INTL("A form cannot be defined with a form number of 0.\r\n{1}", FileLineData.linereport)
elsif used_forms[species_symbol] && used_forms[species_symbol].include?(form) elsif used_forms[species_symbol] && used_forms[species_symbol].include?(form)
@@ -603,7 +603,7 @@ module Compiler
# Convert height/weight to 1 decimal place and multiply by 10 # Convert height/weight to 1 decimal place and multiply by 10
value = (value * 10).round value = (value * 10).round
if value <= 0 if value <= 0
raise _INTL("Value for '{1}' can't be less than or close to 0 (section {2}, PBS/pokemonforms.txt)", key, section_name) raise _INTL("Value for '{1}' can't be less than or close to 0 (section {2}, {3})", key, section_name, path)
end end
contents[key] = value contents[key] = value
when "Moves" when "Moves"
@@ -736,11 +736,11 @@ module Compiler
#============================================================================= #=============================================================================
# Compile TM/TM/Move Tutor compatibilities # Compile TM/TM/Move Tutor compatibilities
#============================================================================= #=============================================================================
def compile_move_compatibilities def compile_move_compatibilities(path = "PBS/tm.txt")
return if !safeExists?("PBS/tm.txt") return if !safeExists?(path)
species_hash = {} species_hash = {}
move = nil move = nil
pbCompilerEachCommentedLine("PBS/tm.txt") { |line, line_no| pbCompilerEachCommentedLine(path) { |line, line_no|
Graphics.update if line_no % 50 == 0 Graphics.update if line_no % 50 == 0
if line[/^\s*\[\s*(\S+)\s*\]\s*$/] if line[/^\s*\[\s*(\S+)\s*\]\s*$/]
move = parseMove($~[1]) move = parseMove($~[1])
@@ -765,7 +765,7 @@ module Compiler
Compiler.write_pokemon Compiler.write_pokemon
Compiler.write_pokemon_forms Compiler.write_pokemon_forms
begin begin
File.delete("PBS/tm.txt") File.delete(path) if path == "PBS/tm.txt"
rescue SystemCallError rescue SystemCallError
end end
end end
@@ -773,10 +773,10 @@ module Compiler
#============================================================================= #=============================================================================
# Compile Shadow movesets # Compile Shadow movesets
#============================================================================= #=============================================================================
def compile_shadow_movesets def compile_shadow_movesets(path = "PBS/shadowmoves.txt")
sections = {} sections = {}
if safeExists?("PBS/shadowmoves.txt") if safeExists?(path)
pbCompilerEachCommentedLine("PBS/shadowmoves.txt") { |line, _line_no| pbCompilerEachCommentedLine(path) { |line, _line_no|
if line[/^\s*(\w+)\s*=\s*(.*)$/] if line[/^\s*(\w+)\s*=\s*(.*)$/]
key = $1 key = $1
value = $2 value = $2
@@ -798,10 +798,10 @@ module Compiler
#============================================================================= #=============================================================================
# Compile Regional Dexes # Compile Regional Dexes
#============================================================================= #=============================================================================
def compile_regional_dexes def compile_regional_dexes(path = "PBS/regionaldexes.txt")
dex_lists = [] dex_lists = []
section = nil section = nil
pbCompilerEachPreppedLine("PBS/regionaldexes.txt") { |line, line_no| pbCompilerEachPreppedLine(path) { |line, line_no|
Graphics.update if line_no % 200 == 0 Graphics.update if line_no % 200 == 0
if line[/^\s*\[\s*(\d+)\s*\]\s*$/] if line[/^\s*\[\s*(\d+)\s*\]\s*$/]
section = $~[1].to_i section = $~[1].to_i
@@ -837,11 +837,11 @@ module Compiler
#============================================================================= #=============================================================================
# Compile ribbon data # Compile ribbon data
#============================================================================= #=============================================================================
def compile_ribbons def compile_ribbons(path = "PBS/ribbons.txt")
GameData::Ribbon::DATA.clear GameData::Ribbon::DATA.clear
ribbon_names = [] ribbon_names = []
ribbon_descriptions = [] ribbon_descriptions = []
pbCompilerEachPreppedLine("PBS/ribbons.txt") { |line, line_no| pbCompilerEachPreppedLine(path) { |line, line_no|
line = pbGetCsvRecord(line, line_no, [0, "vnss"]) line = pbGetCsvRecord(line, line_no, [0, "vnss"])
ribbon_number = line[0] ribbon_number = line[0]
ribbon_symbol = line[1].to_sym ribbon_symbol = line[1].to_sym
@@ -872,7 +872,7 @@ module Compiler
#============================================================================= #=============================================================================
# Compile wild encounter data # Compile wild encounter data
#============================================================================= #=============================================================================
def compile_encounters def compile_encounters(path = "PBS/encounters.txt")
new_format = nil new_format = nil
encounter_hash = nil encounter_hash = nil
step_chances = nil step_chances = nil
@@ -881,7 +881,7 @@ module Compiler
current_type = nil current_type = nil
expected_lines = 0 expected_lines = 0
max_level = GameData::GrowthRate.max_level max_level = GameData::GrowthRate.max_level
pbCompilerEachPreppedLine("PBS/encounters.txt") { |line, line_no| pbCompilerEachPreppedLine(path) { |line, line_no|
next if line.length == 0 next if line.length == 0
if expected_lines > 0 && line[/^\d+,/] && new_format # Species line (new format) if expected_lines > 0 && line[/^\d+,/] && new_format # Species line (new format)
values = line.split(',').collect! { |v| v.strip } values = line.split(',').collect! { |v| v.strip }
@@ -1064,11 +1064,11 @@ module Compiler
#============================================================================= #=============================================================================
# Compile trainer type data # Compile trainer type data
#============================================================================= #=============================================================================
def compile_trainer_types def compile_trainer_types(path = "PBS/trainertypes.txt")
GameData::TrainerType::DATA.clear GameData::TrainerType::DATA.clear
tr_type_names = [] tr_type_names = []
# Read each line of trainertypes.txt at a time and compile it into a trainer type # Read each line of trainertypes.txt at a time and compile it into a trainer type
pbCompilerEachCommentedLine("PBS/trainertypes.txt") { |line, line_no| pbCompilerEachCommentedLine(path) { |line, line_no|
line = pbGetCsvRecord(line, line_no, [0, "unsUSSSeUS", line = pbGetCsvRecord(line, line_no, [0, "unsUSSSeUS",
nil, nil, nil, nil, nil, nil, nil, { nil, nil, nil, nil, nil, nil, nil, {
"Male" => 0, "M" => 0, "0" => 0, "Male" => 0, "M" => 0, "0" => 0,
@@ -1109,7 +1109,7 @@ module Compiler
#============================================================================= #=============================================================================
# Compile individual trainer data # Compile individual trainer data
#============================================================================= #=============================================================================
def compile_trainers def compile_trainers(path = "PBS/trainers.txt")
schema = GameData::Trainer::SCHEMA schema = GameData::Trainer::SCHEMA
max_level = GameData::GrowthRate.max_level max_level = GameData::GrowthRate.max_level
trainer_names = [] trainer_names = []
@@ -1120,7 +1120,7 @@ module Compiler
old_format_current_line = 0 old_format_current_line = 0
old_format_expected_lines = 0 old_format_expected_lines = 0
# Read each line of trainers.txt at a time and compile it as a trainer property # Read each line of trainers.txt at a time and compile it as a trainer property
pbCompilerEachPreppedLine("PBS/trainers.txt") { |line, line_no| pbCompilerEachPreppedLine(path) { |line, line_no|
if line[/^\s*\[\s*(.+)\s*\]\s*$/] if line[/^\s*\[\s*(.+)\s*\]\s*$/]
# New section [trainer_type, name] or [trainer_type, name, version] # New section [trainer_type, name] or [trainer_type, name, version]
if trainer_hash if trainer_hash
@@ -1363,14 +1363,14 @@ module Compiler
#============================================================================= #=============================================================================
# Compile Battle Tower and other Cups trainers/Pokémon # Compile Battle Tower and other Cups trainers/Pokémon
#============================================================================= #=============================================================================
def compile_trainer_lists def compile_trainer_lists(path = "PBS/trainerlists.txt")
btTrainersRequiredTypes = { btTrainersRequiredTypes = {
"Trainers" => [0, "s"], "Trainers" => [0, "s"],
"Pokemon" => [1, "s"], "Pokemon" => [1, "s"],
"Challenges" => [2, "*s"] "Challenges" => [2, "*s"]
} }
if !safeExists?("PBS/trainerlists.txt") if !safeExists?(path)
File.open("PBS/trainerlists.txt","wb") { |f| File.open(path, "wb") { |f|
f.write(0xEF.chr) f.write(0xEF.chr)
f.write(0xBB.chr) f.write(0xBB.chr)
f.write(0xBF.chr) f.write(0xBF.chr)
@@ -1383,8 +1383,8 @@ module Compiler
MessageTypes.setMessagesAsHash(MessageTypes::BeginSpeech,[]) MessageTypes.setMessagesAsHash(MessageTypes::BeginSpeech,[])
MessageTypes.setMessagesAsHash(MessageTypes::EndSpeechWin,[]) MessageTypes.setMessagesAsHash(MessageTypes::EndSpeechWin,[])
MessageTypes.setMessagesAsHash(MessageTypes::EndSpeechLose,[]) MessageTypes.setMessagesAsHash(MessageTypes::EndSpeechLose,[])
File.open("PBS/trainerlists.txt","rb") { |f| File.open(path, "rb") { |f|
FileLineData.file = "PBS/trainerlists.txt" FileLineData.file = path
pbEachFileSectionEx(f) { |section,name| pbEachFileSectionEx(f) { |section,name|
next if name!="DefaultTrainerList" && name!="TrainerList" next if name!="DefaultTrainerList" && name!="TrainerList"
rsection = [] rsection = []
@@ -1474,12 +1474,12 @@ module Compiler
#============================================================================= #=============================================================================
# Compile metadata # Compile metadata
#============================================================================= #=============================================================================
def compile_metadata def compile_metadata(path = "PBS/metadata.txt")
GameData::Metadata::DATA.clear GameData::Metadata::DATA.clear
GameData::MapMetadata::DATA.clear GameData::MapMetadata::DATA.clear
# Read from PBS file # Read from PBS file
File.open("PBS/metadata.txt", "rb") { |f| File.open(path, "rb") { |f|
FileLineData.file = "PBS/metadata.txt" # For error reporting FileLineData.file = path # For error reporting
# Read a whole section's lines at once, then run through this code. # Read a whole section's lines at once, then run through this code.
# contents is a hash containing all the XXX=YYY lines in that section, where # contents is a hash containing all the XXX=YYY lines in that section, where
# the keys are the XXX and the values are the YYY (as unprocessed strings). # the keys are the XXX and the values are the YYY (as unprocessed strings).
@@ -1492,7 +1492,7 @@ module Compiler
# empty # empty
if contents[key].nil? if contents[key].nil?
if map_id == 0 && ["Home", "PlayerA"].include?(key) if map_id == 0 && ["Home", "PlayerA"].include?(key)
raise _INTL("The entry {1} is required in PBS/metadata.txt section 0.", key) raise _INTL("The entry {1} is required in {2} section 0.", key, path)
end end
next next
end end