Generalize get_base_stats.

This commit is contained in:
yenatch 2015-08-31 22:31:39 -04:00
parent 62596e14c6
commit b74abd7c21
1 changed files with 10 additions and 5 deletions

15
gfx.py
View File

@ -12,12 +12,17 @@ pics = [
'gfx/shrink2',
]
base_stats = None
cache = {}
def get_cache(filename):
global cache
cached = cache.get(filename)
if cached == None:
cached = open(filename).read()
cache[filename] = cached
return cached
def get_base_stats():
global base_stats
if not base_stats:
base_stats = open('data/base_stats.asm').read()
return base_stats
return get_cache('data/base_stats.asm')
def get_pokemon_dimensions(name):
if name == 'egg':