Method: RGSS.setup_system

Defined in:
lib/RGSS.rb

.setup_system(version, options) ⇒ Object



203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# File 'lib/RGSS.rb', line 203

def self.setup_system(version, options)
  # convert variable and switch name arrays to a hash when serialized
  # if round_trip isn't set change version_id to fixed number
  if options[:round_trip]
    iso = ->(val) { return val }
    reset_method(RPG::System, :reduce_string, iso)
    reset_method(RPG::System, :map_version, iso)
    reset_method(Game_System, :map_version, iso)
  else
    reset_method(RPG::System, :reduce_string, ->(str) {
      return nil if str.nil?
      stripped = str.strip
      return stripped.empty? ? nil : stripped
    })
    # These magic numbers should be different. If they are the same, the saved version
    # of the map in save files will be used instead of any updated version of the map
    reset_method(RPG::System, :map_version, ->(ignored) { return 12345678 })
    reset_method(Game_System, :map_version, ->(ignored) { return 87654321 })
  end
end