Move update_timeused() from may_play_now() back to callers
This backs out a small part of commit d1ff2a60
, for clarity.
While there, oops when may_play_now() is called with incorrect natp
argument.
This commit is contained in:
parent
6a1078f8a0
commit
f1d89514a5
2 changed files with 7 additions and 2 deletions
|
@ -273,7 +273,8 @@ int
|
||||||
may_play_now(struct natstr *natp, time_t now,
|
may_play_now(struct natstr *natp, time_t now,
|
||||||
int suppress_deity_message)
|
int suppress_deity_message)
|
||||||
{
|
{
|
||||||
update_timeused(now);
|
if (CANT_HAPPEN(natp->nat_cnum != player->cnum))
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (!gamehours(now)) {
|
if (!gamehours(now)) {
|
||||||
if (natp->nat_stat != STAT_GOD || !suppress_deity_message)
|
if (natp->nat_stat != STAT_GOD || !suppress_deity_message)
|
||||||
|
|
|
@ -120,11 +120,14 @@ command(void)
|
||||||
{
|
{
|
||||||
char *redir; /* UTF-8 */
|
char *redir; /* UTF-8 */
|
||||||
char scanspace[1024];
|
char scanspace[1024];
|
||||||
|
time_t now;
|
||||||
|
|
||||||
if (getcommand(player->combuf) < 0)
|
if (getcommand(player->combuf) < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!may_play_now(getnatp(player->cnum), time(NULL), 1))
|
now = time(NULL);
|
||||||
|
update_timeused(now);
|
||||||
|
if (!may_play_now(getnatp(player->cnum), now, 1))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (parse(player->combuf, scanspace, player->argp, player->comtail,
|
if (parse(player->combuf, scanspace, player->argp, player->comtail,
|
||||||
|
@ -171,6 +174,7 @@ status(void)
|
||||||
pr("You are no longer broke!\n");
|
pr("You are no longer broke!\n");
|
||||||
|
|
||||||
time(&player->curup);
|
time(&player->curup);
|
||||||
|
update_timeused(player->curup);
|
||||||
if (!may_play_now(natp, player->curup, 0))
|
if (!may_play_now(natp, player->curup, 0))
|
||||||
return 0;
|
return 0;
|
||||||
if (player->btused) {
|
if (player->btused) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue