From: Christian Heller Date: Sun, 8 Feb 2015 15:49:49 +0000 (+0100) Subject: Server: Remove .stomach thing type attribute, derive from .lifepoints. X-Git-Tag: tce~538 X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/%7B%7B%20web_path%20%7D%7D/static/tasks?a=commitdiff_plain;h=93d0d862f86d99062a59ab8bdca21f2ffeaf838a;p=plomrogue Server: Remove .stomach thing type attribute, derive from .lifepoints. --- diff --git a/SERVER_COMMANDS b/SERVER_COMMANDS index ef52922..3036c04 100644 --- a/SERVER_COMMANDS +++ b/SERVER_COMMANDS @@ -200,7 +200,14 @@ MAKE_WORLD command to argument. TT_LIFEPOINTS [0-255] Set selected thing type's initial lifepoints value to argument. Things of 0 -lifepoints are considered inanimate, otherwise animate. +lifepoints are considered inanimate, otherwise animate. This value also sets the +degree to which the selected type's things suffer from under- or over-satiation: +If 0, not at all. Else, it defines a stomach size value of 32767 divided by it. +Each turn a thing of the given tpe may then suffer a lifepoint decrement to the +change of the rounded down quotient of its satiation score's absolute value by +its stomach size value, then again divided by the latter. (This means that the +change is always zero when the absolute value of the satiation score is lower +than the stomach size value.) TT_SYMBOL [char] Set to argument symbol by which things of the selected type are represented on @@ -219,11 +226,3 @@ If non-zero, there is a chance of 1 divided by the given value each turn for any thing of the selected type to emit an offspring to a random neighbor cell if one is available that is passable and not inhabited by a thing of the same same type or, if the proliferating thing is animate, any other animate thing. - -TT_STOMACH [0-32767] -Set degree to which things of the selected type suffer from hunger or -over-satiation: If 0, not at all. Else, each turn a thing of the given type may -suffer a lifepoint decrement to the chance of the rounded down quotient of the -satiation score's absolute value by the given value, then again divided by the -latter. This means that the chance is always zero when the absolute value of the -satiation score is lower than the given value. diff --git a/confserver/world b/confserver/world index e8cb6a4..a0ff5e1 100644 --- a/confserver/world +++ b/confserver/world @@ -23,35 +23,31 @@ TA_NAME use TT_ID 0 TT_START_NUMBER 1 -TT_LIFEPOINTS 5 +TT_LIFEPOINTS 30 TT_SYMBOL @ TT_NAME HUMAN TT_CONSUMABLE 0 -TT_STOMACH 2048 TT_ID 1 TT_START_NUMBER 27 -TT_LIFEPOINTS 1 +TT_LIFEPOINTS 6 TT_SYMBOL a TT_NAME ANT TT_CONSUMABLE 0 -TT_STOMACH 4096 TT_ID 2 TT_START_NUMBER 9 -TT_LIFEPOINTS 3 +TT_LIFEPOINTS 18 TT_SYMBOL z TT_NAME ZOMBIE TT_CONSUMABLE 0 -TT_STOMACH 1024 TT_ID 3 TT_START_NUMBER 3 -TT_LIFEPOINTS 9 +TT_LIFEPOINTS 54 TT_SYMBOL S TT_NAME SHOGGOTH TT_CONSUMABLE 0 -TT_STOMACH 512 TT_ID 4 TT_START_NUMBER 9 diff --git a/src/server/god_commands.c b/src/server/god_commands.c index f03dcf1..d91cea3 100644 --- a/src/server/god_commands.c +++ b/src/server/god_commands.c @@ -100,7 +100,6 @@ static uint8_t parse_thingtype_manipulation(char * tok0, char * tok1) || parse_val(tok0,tok1,s[S_CMD_TT_STARTN],'8',(char *) &tt->start_n) || parse_val(tok0,tok1,s[S_CMD_TT_SYMB],'c',(char *) &tt->char_on_map) || parse_val(tok0,tok1,s[S_CMD_TT_PROL],'8',(char *) &tt->proliferate) - || parse_val(tok0,tok1,s[S_CMD_TT_STOMACH], 'u', (char *) &tt->stomach) || parse_val(tok0,tok1,s[S_CMD_TT_NAME],'s',(char *) &tt->name)) { ; diff --git a/src/server/hardcoded_strings.c b/src/server/hardcoded_strings.c index fcb2011..dfb30e1 100644 --- a/src/server/hardcoded_strings.c +++ b/src/server/hardcoded_strings.c @@ -9,7 +9,7 @@ -char * s[45]; +char * s[44]; @@ -33,7 +33,6 @@ extern void init_strings() s[S_CMD_TT_NAME] = "TT_NAME"; s[S_CMD_TT_CORPS] = "TT_CORPSE_ID"; s[S_CMD_TT_PROL] = "TT_PROLIFERATE"; - s[S_CMD_TT_STOMACH] = "TT_STOMACH"; s[S_CMD_T_ID] = "T_ID"; s[S_CMD_T_TYPE] = "T_TYPE"; s[S_CMD_T_POSY] = "T_POSY"; diff --git a/src/server/hardcoded_strings.h b/src/server/hardcoded_strings.h index c9f720b..4725bc2 100644 --- a/src/server/hardcoded_strings.h +++ b/src/server/hardcoded_strings.h @@ -32,7 +32,6 @@ enum string_num S_CMD_TT_NAME, S_CMD_TT_CORPS, S_CMD_TT_PROL, - S_CMD_TT_STOMACH, S_CMD_T_ID, S_CMD_T_TYPE, S_CMD_T_POSY, @@ -63,7 +62,7 @@ enum string_num extern void init_strings(); -extern char * s[45]; +extern char * s[44]; diff --git a/src/server/io.c b/src/server/io.c index 9e55b01..b3b6f8a 100644 --- a/src/server/io.c +++ b/src/server/io.c @@ -417,7 +417,6 @@ extern void save_world() write_key_space_string(file, s[S_CMD_TT_NAME], tt->name); write_key_space_uvalue(file, s[S_CMD_TT_CONSUM], tt->consumable); write_key_space_uvalue(file, s[S_CMD_TT_PROL], tt->proliferate); - write_key_space_uvalue(file, s[S_CMD_TT_STOMACH], tt->stomach); try_fputc('\n', file, __func__); } for (tt = world.thing_types; tt; tt = tt->next) 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) diff --git a/src/server/thing_actions.h b/src/server/thing_actions.h index 0f9b962..ebdd871 100644 --- a/src/server/thing_actions.h +++ b/src/server/thing_actions.h @@ -39,7 +39,7 @@ extern void actor_pick(struct Thing * t); extern void actor_use(struct Thing * t); /* Decrement "t"'s satiation and trigger a chance (dependent on over-/under- - * satiation value) of lifepoint decrement, when its type's .stomach is >0. + * satiation value) of lifepoint decrement. */ extern void hunger(struct Thing * t); diff --git a/src/server/things.h b/src/server/things.h index 62ef908..33a07db 100644 --- a/src/server/things.h +++ b/src/server/things.h @@ -47,7 +47,6 @@ struct ThingType uint8_t id; /* thing type identifier / sets .type */ char char_on_map; /* thing symbol to appear on map */ char * name; /* string to describe thing in game log */ - uint16_t stomach; /* if >0, defines onset & chance of hunger suffering */ uint16_t consumable; /* can be eaten if !0, for so much .satiation win */ uint8_t corpse_id; /* type to change thing into upon destruction */ uint8_t lifepoints; /* default start value for thing's .lifepoints */