Fixed symbol/string error in compiling TM compatibility data

This commit is contained in:
Maruno17
2020-12-12 21:34:57 +00:00
parent bc13517cb7
commit 9ceda78d37
2 changed files with 13 additions and 13 deletions

View File

@@ -564,13 +564,13 @@ module Compiler
def parseItem(item)
clonitem = item.upcase
clonitem.sub!(/^\s*/,"")
clonitem.sub!(/\s*$/,"")
clonitem.sub!(/^\s*/, "")
clonitem.sub!(/\s*$/, "")
itm = GameData::Item.try_get(clonitem)
if !itm
raise _INTL("Undefined item constant name: {1}\r\nName must consist only of letters, numbers and\r\nunderscores, and can't begin with a number.\r\nMake sure the item is defined in\r\nPBS/items.txt.\r\n{2}", item, FileLineData.linereport)
end
return itm.id.to_s
return itm.id
end
def parseSpecies(item)
@@ -591,7 +591,7 @@ module Compiler
return nil if skip_unknown
raise _INTL("Undefined move constant name: {1}\r\nName must consist only of letters, numbers and\r\nunderscores, and can't begin with a number.\r\nMake sure the move is defined in\r\nPBS/moves.txt.\r\n{2}", move, FileLineData.linereport)
end
return mov.id.to_s
return mov.id
end
# Unused
@@ -611,7 +611,7 @@ module Compiler
if !typ
raise _INTL("Undefined Trainer type constant name: {1}\r\nName must consist only of letters, numbers and\r\nunderscores, and can't begin with a number.\r\nMake sure the trainer type is defined in\r\ntrainertypes.txt.\r\n{2}", type, FileLineData.linereport)
end
return typ.id.to_s
return typ.id
end
#=============================================================================

View File

@@ -191,7 +191,7 @@ module Compiler
if line[/^\s*(\w+)\s*=\s*(.*)$/] # Of the format XXX = YYY
key = $1
value = $2
item_symbol = parseItem(key).to_sym
item_symbol = parseItem(key)
item_number = GameData::Item.get(item_symbol).id_number
line = pbGetCsvRecord(value, line_no, [0, "vuuv"])
# Construct berry plant hash
@@ -992,7 +992,7 @@ module Compiler
def compile_move_compatibilities
lineno = 1
havesection = false
sectionname = nil
move_id = nil
sections = {}
if safeExists?("PBS/tm.txt")
f = File.open("PBS/tm.txt","rb")
@@ -1004,21 +1004,21 @@ module Compiler
FileLineData.setLine(line,lineno)
if !line[/^\#/] && !line[/^\s*$/]
if line[/^\s*\[\s*(.*)\s*\]\s*$/]
sectionname = parseMove($~[1])
if sections[sectionname]
raise _INTL("TM section [{1}] is defined twice.\r\n{2}",sectionname,FileLineData.linereport)
move_id = parseMove($~[1])
if sections[move_id]
raise _INTL("TM section [{1}] is defined twice.\r\n{2}",move_id.to_s,FileLineData.linereport)
end
sections[sectionname] = []
sections[move_id] = []
havesection = true
else
if sectionname==nil
if !move_id
raise _INTL("Expected a section at the beginning of the file. This error may also occur if the file was not saved in UTF-8.\r\n{1}",
FileLineData.linereport)
end
specieslist = line.sub(/\s+$/,"").split(",")
for species in specieslist
next if !species || species==""
sec = sections[sectionname]
sec = sections[move_id]
sec[sec.length] = parseSpecies(species)
end
end