X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=src%2Fserver%2Fthing_actions.c;h=dea23323bcf6b7a9f2b43974b5af180720d55faa;hb=93d0d862f86d99062a59ab8bdca21f2ffeaf838a;hp=a5c78ba55027a10cb094bfaffebe43ffc8356a47;hpb=52baa310d361f5736c675d8222b0479470d9c3c8;p=plomrogue diff --git a/src/server/thing_actions.c b/src/server/thing_actions.c index a5c78ba..dea2332 100644 --- a/src/server/thing_actions.c +++ b/src/server/thing_actions.c @@ -7,11 +7,11 @@ #include "thing_actions.h" #include /* NULL */ -#include /* uint8_t, INT16_MIN */ +#include /* uint8_t, INT16_MIN, INT16_MAX */ #include /* sprintf() */ #include /* free() */ #include /* strlen() */ -#include "../common/rexit.h" /* exit_trouble() */ +#include "../common/rexit.h" /* exit_err(), exit_trouble() */ #include "../common/try_malloc.h" /* try_malloc() */ #include "../common/yx_uint8.h" /* yx_uint8 */ #include "field_of_view.h" /* build_fov_map() */ @@ -332,17 +332,14 @@ extern void actor_use(struct Thing * t) extern void hunger(struct Thing * t) { - struct ThingType * tt = get_thing_type(t->type); - if (!(tt->stomach)) - { - return; - } if (t->satiation > INT16_MIN) { t->satiation--; } + struct ThingType * tt = get_thing_type(t->type); uint16_t testbase = t->satiation < 0 ? -(t->satiation) : t->satiation; - uint16_t endurance = tt->stomach; + exit_err(!(tt->lifepoints), "A thing that should not hunger is hungering."); + uint16_t endurance = INT16_MAX / tt->lifepoints; if ((testbase / endurance) / ((rrand() % endurance) + 1)) { if (get_player() == t)