mirror of https://github.com/pret/pokecrystal.git
Generalize get_base_stats.
This commit is contained in:
parent
62596e14c6
commit
b74abd7c21
15
gfx.py
15
gfx.py
|
@ -12,12 +12,17 @@ pics = [
|
||||||
'gfx/shrink2',
|
'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():
|
def get_base_stats():
|
||||||
global base_stats
|
return get_cache('data/base_stats.asm')
|
||||||
if not base_stats:
|
|
||||||
base_stats = open('data/base_stats.asm').read()
|
|
||||||
return base_stats
|
|
||||||
|
|
||||||
def get_pokemon_dimensions(name):
|
def get_pokemon_dimensions(name):
|
||||||
if name == 'egg':
|
if name == 'egg':
|
||||||
|
|
Loading…
Reference in New Issue