Change how option_identifier is calculated

This will provide more headroom before running out of space in the 32
bits of the title where this data goes.
This commit is contained in:
Kevin Cathcart 2018-01-27 21:07:09 -05:00
parent f6f444a1d8
commit 124e3b69de
1 changed files with 25 additions and 13 deletions

View File

@ -252,19 +252,31 @@ class World(object):
@property @property
def option_identifier(self): def option_identifier(self):
logic = 0 if self.logic == 'noglitches' else 1 id_value = 0
mode = ['standard', 'open', 'swordless'].index(self.mode) id_value_max = 1
dungeonitems = 0 if self.place_dungeon_items else 1
goal = ['ganon', 'pedestal', 'dungeons', 'triforcehunt', 'crystals'].index(self.goal) def markbool(value):
shuffle = ['vanilla', 'simple', 'restricted', 'full', 'madness', 'insanity', 'dungeonsfull', 'dungeonssimple'].index(self.shuffle) nonlocal id_value, id_value_max
difficulty = ['easy', 'normal', 'hard', 'expert', 'insane'].index(self.difficulty) id_value += id_value_max * bool(value)
timer = ['none', 'display', 'timed', 'timed-ohko', 'timed-countdown', 'ohko'].index(self.timer) id_value_max *= 2
progressive = ['on', 'off', 'random'].index(self.progressive) def marksequence(options, value):
algorithm = ['freshness', 'flood', 'vt21', 'vt22', 'vt25', 'vt26', 'balanced'].index(self.algorithm) nonlocal id_value, id_value_max
beatableonly = 1 if self.check_beatable_only else 0 id_value += id_value_max * options.index(value)
shuffleganon = 1 if self.shuffle_ganon else 0 id_value_max *= len(options)
keysanity = 1 if self.keysanity else 0 markbool(self.logic == 'noglitches')
return logic | (beatableonly << 1) | (dungeonitems << 2) | (shuffleganon << 3) | (goal << 4) | (shuffle << 7) | (difficulty << 11) | (algorithm << 13) | (mode << 16) | (keysanity << 18) | (timer << 19) | (progressive << 21) marksequence(['standard', 'open', 'swordless'], self.mode)
markbool(self.place_dungeon_items)
marksequence(['ganon', 'pedestal', 'dungeons', 'triforcehunt', 'crystals'], self.goal)
marksequence(['vanilla', 'simple', 'restricted', 'full', 'madness', 'insanity', 'dungeonsfull', 'dungeonssimple'], self.shuffle)
marksequence(['easy', 'normal', 'hard', 'expert', 'insane'], self.difficulty)
marksequence(['none', 'display', 'timed', 'timed-ohko', 'timed-countdown', 'ohko'], self.timer)
marksequence(['on', 'off', 'random'], self.progressive)
marksequence(['freshness', 'flood', 'vt21', 'vt22', 'vt25', 'vt26', 'balanced'], self.algorithm)
markbool(self.check_beatable_only)
markbool(self.shuffle_ganon)
markbool(self.keysanity)
assert id_value_max <= 0xFFFFFFFF
return id_value
class CollectionState(object): class CollectionState(object):