Skip to content

Commit

Permalink
Effects: Use the filename for the cache, not the bitmap pointer
Browse files Browse the repository at this point in the history
The pointer can be reused by a new bitmap and cause wrong animations.

Fix EasyRPG#3256
  • Loading branch information
Ghabry committed Aug 28, 2024
1 parent 3a367bb commit e2f18ec
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/liblcf-version
Submodule liblcf-version added at 032ccd
4 changes: 2 additions & 2 deletions src/cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ namespace {
std::unordered_map<tile_key_type, std::weak_ptr<Bitmap>> cache_tiles;

// rect, flip_x, flip_y, tone, blend
using effect_key_type = std::tuple<Bitmap*, Rect, bool, bool, Tone, Color>;
using effect_key_type = std::tuple<std::string, Rect, bool, bool, Tone, Color>;
std::map<effect_key_type, std::weak_ptr<Bitmap>> cache_effects;

std::string system_name;
Expand Down Expand Up @@ -454,7 +454,7 @@ BitmapRef Cache::Tile(StringView filename, int tile_id) {

BitmapRef Cache::SpriteEffect(const BitmapRef& src_bitmap, const Rect& rect, bool flip_x, bool flip_y, const Tone& tone, const Color& blend) {
const effect_key_type key {
src_bitmap.get(),
src_bitmap->GetFilename(),
rect,
flip_x,
flip_y,
Expand Down

0 comments on commit e2f18ec

Please sign in to comment.