remove duplicate shop setting in gui and make entrance/location cache renew slightly faster

This commit is contained in:
Fabian Dill 2020-08-27 04:05:11 +02:00
parent 9c69aff4c1
commit 112868b751
4 changed files with 5 additions and 19 deletions

View File

@ -5,7 +5,7 @@ from enum import Enum, unique
import logging
import json
from collections import OrderedDict, Counter, deque
from typing import Union, Optional, List
from typing import Union, Optional, List, Set
import secrets
import random
@ -333,9 +333,7 @@ class World(object):
def get_entrances(self) -> list:
if self._cached_entrances is None:
self._cached_entrances = []
for region in self.regions:
self._cached_entrances.extend(region.entrances)
self._cached_entrances = [entrance for region in self.regions for entrance in region.entrances]
return self._cached_entrances
def clear_entrance_cache(self):
@ -343,9 +341,7 @@ class World(object):
def get_locations(self) -> list:
if self._cached_locations is None:
self._cached_locations = []
for region in self.regions:
self._cached_locations.extend(region.locations)
self._cached_locations = [location for region in self.regions for location in region.locations]
return self._cached_locations
def clear_location_cache(self):

10
Gui.py
View File

@ -351,14 +351,6 @@ def guiMain(args=None):
shuffleLabel = Label(shuffleFrame, text='Entrance shuffle algorithm')
shuffleLabel.pack(side=LEFT)
shop_shuffleFrame = Frame(drowDownFrame)
shop_shuffleVar = StringVar()
shop_shuffleVar.set('off')
shop_shuffleOptionMenu = OptionMenu(shop_shuffleFrame, shop_shuffleVar, 'off', 'inventory', 'price',
'price and inventory')
shop_shuffleOptionMenu.pack(side=RIGHT)
shop_shuffleLabel = Label(shop_shuffleFrame, text='Shop Shuffle')
shop_shuffleLabel.pack(side=LEFT)
modeFrame.pack(expand=True, anchor=E)
logicFrame.pack(expand=True, anchor=E)
@ -374,7 +366,6 @@ def guiMain(args=None):
accessibilityFrame.pack(expand=True, anchor=E)
algorithmFrame.pack(expand=True, anchor=E)
shuffleFrame.pack(expand=True, anchor=E)
shop_shuffleFrame.pack(expand=True, anchor=E)
enemizerFrame = LabelFrame(randomizerWindow, text="Enemizer", padx=5, pady=2)
@ -505,7 +496,6 @@ def guiMain(args=None):
guiargs.accessibility = accessibilityVar.get()
guiargs.algorithm = algorithmVar.get()
guiargs.shuffle = shuffleVar.get()
guiargs.shop_shuffle = shop_shuffleVar.get()
guiargs.heartbeep = heartbeepVar.get()
guiargs.heartcolor = heartcolorVar.get()
guiargs.fastmenu = fastMenuVar.get()

View File

@ -431,7 +431,7 @@ def copy_dynamic_regions_and_locations(world, ret):
new_loc.item_rule = location.item_rule
new_reg.locations.append(new_loc)
ret.clear_location_cache()
ret.clear_location_cache()
def create_playthrough(world):

View File

@ -6,7 +6,7 @@ def tuplize_version(version: str) -> typing.Tuple[int, ...]:
return tuple(int(piece, 10) for piece in version.split("."))
__version__ = "2.5.1"
__version__ = "2.5.2"
_version_tuple = tuplize_version(__version__)
import os