aboutsummaryrefslogtreecommitdiffstats
path: root/src/player.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/player.cpp')
-rw-r--r--src/player.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/player.cpp b/src/player.cpp
index db34347..07cb1a0 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -253,8 +253,11 @@ bool PlayerSystem::receive(const UseItemEvent& uie)
e.component<Hit>()->effect = uie.attack->effect;
}
} else if (uie.item->type == "Food") {
- player.component<Health>()->health = player.component<Health>()->maxHealth;
- InventorySystem::take(uie.item->name, 1);
+ auto health = player.component<Health>();
+ if (health->health < health->maxHealth) {
+ health->health = health->maxHealth;
+ InventorySystem::take(uie.item->name, 1);
+ }
}
cool.store(false);