From 237775f50d33fda901c3396c56ee971c91c8d89f Mon Sep 17 00:00:00 2001 From: Ari Johnson Date: Thu, 7 Jun 2007 22:58:41 +0000 Subject: [PATCH] Added @poll/clear and changed @poll with no argument to display the current poll --- game/txt/hlp/cobra_cmd.hlp | 13 ++++++++----- hdrs/game.h | 2 +- src/bsd.c | 20 +++++++++++++++++--- src/cmds.c | 4 ++-- src/command.c | 2 +- 5 files changed, 29 insertions(+), 12 deletions(-) diff --git a/game/txt/hlp/cobra_cmd.hlp b/game/txt/hlp/cobra_cmd.hlp index 16f59d3..cc6cd55 100644 --- a/game/txt/hlp/cobra_cmd.hlp +++ b/game/txt/hlp/cobra_cmd.hlp @@ -2652,11 +2652,14 @@ See also: give See also @emit, @oemit, @remit, NOSPOOF, and SPOOFING. & @poll - @poll [] - - This command requiring the poll power sets the "poll", the Doing - question on the WHO, the poll questoin can also be reset to the - string "Doing" by simply typing the command with no argument attached. + @poll + @poll + @poll/clear + + This command manipulates the message at the top of WHO/DOING. By itself, + it displays the current poll. Those with sufficient power can set + or clear the message by using the second or third forms, respectively. + Clearing the message sets it to the default, 'Doing'. See also: @doing, WHO, DOING & @poor diff --git a/hdrs/game.h b/hdrs/game.h index f84a64e..abf45a3 100644 --- a/hdrs/game.h +++ b/hdrs/game.h @@ -27,7 +27,7 @@ extern void fcache_load(dbref player); extern void hide_player(dbref player, int hide); enum motd_type { MOTD_MOTD, MOTD_DOWN, MOTD_FULL, MOTD_LIST }; extern void do_motd(dbref player, enum motd_type key, const char *message); -extern void do_poll(dbref player, const char *message); +extern void do_poll(dbref player, const char *message, int clear); /* From cque.c */ extern int do_wait (dbref player, dbref cause, char *arg1, char *cmd, int until, char finvoc); diff --git a/src/bsd.c b/src/bsd.c index b3ea2d1..5012517 100644 --- a/src/bsd.c +++ b/src/bsd.c @@ -3999,16 +3999,30 @@ do_doing(dbref player, const char *message) * \endverbatim * \param player the enactor. * \param message the message to set. + * \param clear true if the poll should be reset to the default 'Doing' */ void -do_poll(dbref player, const char *message) +do_poll(dbref player, const char *message, int clear) { int i; + if ((!message || !*message) && !clear) { + /* Just display the poll. */ + notify_format(player, T("The current poll is: %s"), poll_msg); + return; + } + if (!Change_Poll(player)) { notify(player, T("Who do you think you are, Gallup?")); return; } + + if (clear) { + strcpy(poll_msg, "Doing"); + notify(player, T("Poll reset.")); + return; + } + strncpy(poll_msg, remove_markup(message, NULL), DOING_LEN - 1); for (i = 0; i < DOING_LEN; i++) { if ((poll_msg[i] == '\r') || (poll_msg[i] == '\n') || @@ -4020,10 +4034,10 @@ do_poll(dbref player, const char *message) if (strlen(message) >= DOING_LEN) { poll_msg[DOING_LEN - 1] = 0; notify_format(player, - T("Poll set. %zu characters lost."), + T("Poll set to '%s'. %zu characters lost."), poll_msg, strlen(message) - (DOING_LEN - 1)); } else - notify(player, T("Poll set.")); + notify_format(player, T("Poll set to: %s"), poll_msg); do_log(LT_WIZ, player, NOTHING, T("Poll Set to '%s'."), poll_msg); } diff --git a/src/cmds.c b/src/cmds.c index 669a648..71912ae 100644 --- a/src/cmds.c +++ b/src/cmds.c @@ -301,7 +301,7 @@ COMMAND (cmd_disable) { COMMAND (cmd_doing) { if (SW_ISSET(sw, SWITCH_HEADER)) - do_poll(player, arg_left); + do_poll(player, arg_left, 0); else do_doing(player, arg_left); } @@ -745,7 +745,7 @@ COMMAND (cmd_pemit) { } COMMAND (cmd_poll) { - do_poll(player, arg_left); + do_poll(player, arg_left, SW_ISSET(sw, SWITCH_CLEAR)); } COMMAND (cmd_poor) { diff --git a/src/command.c b/src/command.c index e3840de..1f70c1e 100644 --- a/src/command.c +++ b/src/command.c @@ -229,7 +229,7 @@ COMLIST commands[] = { {"@PEMIT", "LIST CONTENTS SILENT NOISY NOEVAL SPOOF", cmd_pemit, CMD_T_ANY | CMD_T_EQSPLIT | CMD_T_NOGAGGED, NULL}, - {"@POLL", NULL, cmd_poll, CMD_T_ANY, NULL}, + {"@POLL", "CLEAR", cmd_poll, CMD_T_ANY, NULL}, {"@POOR", NULL, cmd_poor, CMD_T_ANY, NULL}, {"@POWER", "ALIAS LIST ADD DELETE", cmd_power, CMD_T_ANY | CMD_T_EQSPLIT , NULL}, {"@POWERGROUP", "AUTO MAX ADD DELETE LIST RAW", cmd_powergroup, CMD_T_ANY | CMD_T_EQSPLIT, NULL}, -- 2.30.2