diff --git a/src/entities/items/item.c b/src/entities/items/item.c index 555d8ac..96d444c 100644 --- a/src/entities/items/item.c +++ b/src/entities/items/item.c @@ -86,8 +86,8 @@ static void reset(void) i = (Item*)self; - i->startX = (int) self->x; - i->startY = (int) self->y; + self->x = i->startX; + self->y = i->startY; } static void tick(void) diff --git a/src/world/entities.c b/src/world/entities.c index f7fc4a0..014c0bb 100644 --- a/src/world/entities.c +++ b/src/world/entities.c @@ -472,6 +472,13 @@ static void checkStuckInWall(void) if (hasHitWorld(mx, my)) { SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN, "%s (%d): in wall at %d,%d", self->name, self->type, mx, my); + + if (self->type == ET_KEY || self->type == ET_ITEM) + { + SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN, "Attempting to reset stuck item"); + + self->reset(); + } } break; }