Prevent command from execute after game restrictions
If a player is at a prompt when either game hours restrictions starts or logged in time limit is exceeded the player is allow to enter one command.
This commit is contained in:
parent
fe69514067
commit
3da4030ac0
2 changed files with 25 additions and 5 deletions
|
@ -109,8 +109,7 @@ player_main(struct player *p)
|
||||||
natp->nat_tgms = 0;
|
natp->nat_tgms = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (status()) {
|
while (status() && command()) {
|
||||||
command();
|
|
||||||
player->aborted = player->eof;
|
player->aborted = player->eof;
|
||||||
empth_yield();
|
empth_yield();
|
||||||
}
|
}
|
||||||
|
@ -129,9 +128,21 @@ command(void)
|
||||||
{
|
{
|
||||||
char *redir; /* UTF-8 */
|
char *redir; /* UTF-8 */
|
||||||
char scanspace[1024];
|
char scanspace[1024];
|
||||||
|
time_t now;
|
||||||
|
struct natstr *natp;
|
||||||
|
|
||||||
if (getcommand(player->combuf) < 0)
|
if (getcommand(player->combuf) < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
now = time(NULL);
|
||||||
|
update_timeused(now);
|
||||||
|
natp = getnatp(player->cnum);
|
||||||
|
if (natp->nat_stat == STAT_ACTIVE &&
|
||||||
|
natp->nat_timeused > m_m_p_d * 60) {
|
||||||
|
pr("Max minutes per day limit exceeded.\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (parse(player->combuf, scanspace, player->argp, player->comtail,
|
if (parse(player->combuf, scanspace, player->argp, player->comtail,
|
||||||
&player->condarg, &redir) < 0) {
|
&player->condarg, &redir) < 0) {
|
||||||
pr("See \"info Syntax\"?\n");
|
pr("See \"info Syntax\"?\n");
|
||||||
|
|
|
@ -780,7 +780,7 @@ index 3106849..726b5fc 100644
|
||||||
return lp;
|
return lp;
|
||||||
}
|
}
|
||||||
diff --git a/src/lib/player/player.c b/src/lib/player/player.c
|
diff --git a/src/lib/player/player.c b/src/lib/player/player.c
|
||||||
index 0e1c5e3..9773db4 100644
|
index 9912ba1..9dd8c5b 100644
|
||||||
--- a/src/lib/player/player.c
|
--- a/src/lib/player/player.c
|
||||||
+++ b/src/lib/player/player.c
|
+++ b/src/lib/player/player.c
|
||||||
@@ -40,6 +40,7 @@
|
@@ -40,6 +40,7 @@
|
||||||
|
@ -800,7 +800,7 @@ index 0e1c5e3..9773db4 100644
|
||||||
update_timeused_login(player->curup);
|
update_timeused_login(player->curup);
|
||||||
show_motd();
|
show_motd();
|
||||||
if (init_nats() < 0) {
|
if (init_nats() < 0) {
|
||||||
@@ -116,7 +117,7 @@ player_main(struct player *p)
|
@@ -115,7 +116,7 @@ player_main(struct player *p)
|
||||||
}
|
}
|
||||||
/* #*# I put the following line in to prevent server crash -KHS */
|
/* #*# I put the following line in to prevent server crash -KHS */
|
||||||
natp = getnatp(player->cnum);
|
natp = getnatp(player->cnum);
|
||||||
|
@ -809,7 +809,16 @@ index 0e1c5e3..9773db4 100644
|
||||||
putnat(natp);
|
putnat(natp);
|
||||||
update_timeused(natp->nat_last_logout);
|
update_timeused(natp->nat_last_logout);
|
||||||
enforce_minimum_session_time();
|
enforce_minimum_session_time();
|
||||||
@@ -175,7 +176,7 @@ status(void)
|
@@ -134,7 +135,7 @@ command(void)
|
||||||
|
if (getcommand(player->combuf) < 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
- now = time(NULL);
|
||||||
|
+ now = empire_time(NULL);
|
||||||
|
update_timeused(now);
|
||||||
|
natp = getnatp(player->cnum);
|
||||||
|
if (natp->nat_stat == STAT_ACTIVE &&
|
||||||
|
@@ -186,7 +187,7 @@ status(void)
|
||||||
if (!(old_nstat & MONEY) && (player->nstat & MONEY))
|
if (!(old_nstat & MONEY) && (player->nstat & MONEY))
|
||||||
pr("You are no longer broke!\n");
|
pr("You are no longer broke!\n");
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue