Remove g.monstermoves

It's redundant with g.moves, so there is no more need for it.

Way, way back, it looks like g.moves and g.monstermoves can and did
desync, where g.moves would track the amount of moves the player had
gotten (and would therefore increase faster if the player were hasted)
and g.monstermoves would track the amount of monster move cycles, aka
turns. But this has not been the case for a long time, and they both
increment together in the same location in allmain.c. There are no
longer any cases where they will not be the same value.

This is a save-breaking change because it changes struct
instance_globals, but I have not updated the editlevel in this commit.
This commit is contained in:
copperwater
2021-08-22 09:53:24 -04:00
committed by PatR
parent b76a213caf
commit f855fb5e45
23 changed files with 81 additions and 86 deletions

View File

@@ -790,7 +790,7 @@ fall_asleep(int how_long, boolean wakeup_msg)
g.afternmv = Hear_again; /* this won't give any messages */
}
/* early wakeup from combat won't be possible until next monster turn */
u.usleep = g.monstermoves;
u.usleep = g.moves;
g.nomovemsg = wakeup_msg ? "You wake up." : You_can_move_again;
}
@@ -854,7 +854,7 @@ hatch_egg(anything *arg, long timeout)
mnum = big_to_little(egg->corpsenm);
/* The identity of one's father is learned, not innate */
yours = (egg->spe || (!flags.female && carried(egg) && !rn2(2)));
silent = (timeout != g.monstermoves); /* hatched while away */
silent = (timeout != g.moves); /* hatched while away */
/* only can hatch when in INVENT, FLOOR, MINVENT */
if (get_obj_location(egg, &x, &y, 0)) {
@@ -1169,8 +1169,8 @@ burn_object(anything* arg, long timeout)
many = menorah ? obj->spe > 1 : obj->quan > 1L;
/* timeout while away */
if (timeout != g.monstermoves) {
long how_long = g.monstermoves - timeout;
if (timeout != g.moves) {
long how_long = g.moves - timeout;
if (how_long >= obj->age) {
obj->age = 0;
@@ -1593,7 +1593,7 @@ cleanup_burn(anything* arg, long expire_time)
del_light_source(LS_OBJECT, obj_to_any(obj));
/* restore unused time */
obj->age += expire_time - g.monstermoves;
obj->age += expire_time - g.moves;
obj->lamplit = 0;
@@ -1657,7 +1657,7 @@ do_storms(void)
* boolean start_timer(long timeout,short kind,short func_index,
* anything *arg)
* Start a timer of kind 'kind' that will expire at time
* g.monstermoves+'timeout'. Call the function at 'func_index'
* g.moves+'timeout'. Call the function at 'func_index'
* in the timeout table using argument 'arg'. Return TRUE if
* a timer was started. This places the timer on a list ordered
* "sooner" to "later". If an object, increment the object's
@@ -1801,7 +1801,7 @@ wiz_timeout_queue(void)
if (win == WIN_ERR)
return 0;
Sprintf(buf, "Current time = %ld.", g.monstermoves);
Sprintf(buf, "Current time = %ld.", g.moves);
putstr(win, 0, buf);
putstr(win, 0, "");
putstr(win, 0, "Active timeout queue:");
@@ -1885,7 +1885,7 @@ run_timers(void)
* any time. The list is ordered, we are done when the first element
* is in the future.
*/
while (g.timer_base && g.timer_base->timeout <= g.monstermoves) {
while (g.timer_base && g.timer_base->timeout <= g.moves) {
curr = g.timer_base;
g.timer_base = curr->next;
@@ -1934,7 +1934,7 @@ start_timer(
(void) memset((genericptr_t) gnu, 0, sizeof *gnu);
gnu->next = 0;
gnu->tid = g.timer_id++;
gnu->timeout = g.monstermoves + when;
gnu->timeout = g.moves + when;
gnu->kind = kind;
gnu->needs_fixup = 0;
gnu->func_index = func_index;
@@ -1966,7 +1966,7 @@ stop_timer(short func_index, anything *arg)
if (timeout_funcs[doomed->func_index].cleanup)
(*timeout_funcs[doomed->func_index].cleanup)(arg, timeout);
free((genericptr_t) doomed);
return (timeout - g.monstermoves);
return (timeout - g.moves);
}
return 0L;
}
@@ -2017,7 +2017,7 @@ obj_split_timers(struct obj* src, struct obj* dest)
for (curr = g.timer_base; curr; curr = next_timer) {
next_timer = curr->next; /* things may be inserted */
if (curr->kind == TIMER_OBJECT && curr->arg.a_obj == src) {
(void) start_timer(curr->timeout - g.monstermoves, TIMER_OBJECT,
(void) start_timer(curr->timeout - g.moves, TIMER_OBJECT,
curr->func_index, obj_to_any(dest));
}
}
@@ -2111,7 +2111,7 @@ long
spot_time_left(xchar x, xchar y, short func_index)
{
long expires = spot_time_expires(x, y, func_index);
return (expires > 0L) ? expires - g.monstermoves : 0L;
return (expires > 0L) ? expires - g.moves : 0L;
}
/* Insert timer into the global queue */