|
@@ -72,11 +72,14 @@ class WeaponImageApplier(ImageApplier):
|
72
|
72
|
animation_position: int,
|
73
|
73
|
) -> Image.Image:
|
74
|
74
|
try:
|
75
|
|
- # FIXME Cache
|
76
|
75
|
image_file_path = self.path_manager.path(
|
77
|
76
|
self._images_scheme[mode][weapon_type][animation_position],
|
78
|
77
|
)
|
79
|
|
- return Image.open(image_file_path)
|
|
78
|
+ try:
|
|
79
|
+ return self._cache[image_file_path]
|
|
80
|
+ except KeyError:
|
|
81
|
+ self._cache[image_file_path] = Image.open(image_file_path)
|
|
82
|
+ return self._cache[image_file_path]
|
80
|
83
|
except KeyError:
|
81
|
84
|
raise UnknownWeapon(
|
82
|
85
|
'Unknown weapon "{}" for mode "{}"'.format(weapon_type, mode),
|