Commit graph

38 commits

Author SHA1 Message Date
de7657dd99 Permit flash to yourself
Flashing yourself failed with a bogus "not logged on" message for
deities, and a mildly bogus "not a deity or friendly with us" message
for mortals.

Fix by simply permitting it.  Not terribly useful, except perhaps for
empire-hub users, but why not.
2011-02-13 16:39:20 +01:00
0d4566847f Drop redundant chat(), sendmessage() parameter us
It can't be anything but the current player.
2011-02-13 16:39:20 +01:00
5eeac45b8d Clean up confusing control flow in sendmessage()
The second patch hunk fixes a latent bug.  Before, rejected deity
flashes led to a bogus "not logged on" message, now they lead to a
"not accepting" message.  But deity flashes can't be rejected, so this
doesn't matter.
2011-02-13 16:32:37 +01:00
e21f5035cb Optimize sendmessage() use of getnatp()
Don't call it when its value must be TO anyway.

While there, oops when it fails instead of recovering silently.
2011-02-13 16:06:23 +01:00
fc633a4f1f Fix racy detection of ally rejecting flashes
sendmessage() checked NF_FLASH on two places: when deciding whether to
send the message, and later when telling the player why it didn't send
a flash.  This can race with the toggle command as follows: if a flash
could not be sent because the recipient's NF_FLASH was off, and the
recipient toggled it on before the flag was checked again, the flash
command claimed the sender wasn't logged on.
2011-02-13 16:06:23 +01:00
53a4fc6e26 Change flash not to print "Flash sent" for deities
It's annoying.  It never did that for mortals.
2011-02-13 16:06:23 +01:00
73e25ff21e Update copyright notice 2010-01-19 08:40:17 +01:00
c528fcbe3e Update known contributors comments 2009-12-13 17:34:28 +01:00
615681ce16 Don't use 0 as null pointer constant, part 1
Use NULL instead of 0, for clarity.  Except in pointer comparisons;
leave that to the next two commits.
2009-03-24 21:45:44 +01:00
35ef345ecb Update copyright notice 2009-02-08 09:33:18 +01:00
d702068457 Fix trailing whitespace 2008-09-17 21:31:40 -04:00
db02dda32f Update copyright notice 2008-01-19 10:15:37 +01:00
a34a5fd23c (chat): New, factored out of flash() and wall().
(flash, wall): Use it.
2007-11-25 14:34:50 +00:00
566223c36b (flash, wall): Use player->comtail[] to find the raw message. The old
hack to find worked only when there were no spaces in flash's first
argument.  Closes #941740.
2007-11-25 14:31:09 +00:00
8b0c965a38 (flash, wall): Remove rev 1.11's bogus input filtering. 2007-11-25 14:28:42 +00:00
a98bac5146 (sendmessage): Internal linkage. 2007-11-18 11:58:30 +00:00
f915f91b47 Update known contributors comment. 2007-07-27 20:16:19 +00:00
3788676530 Clean up after removal of wait command:
(player_wakeup_all, player_wakeup): Remove.  Callers changed.
(player): Remove member waiting.
2007-01-31 06:08:39 +00:00
7c605a05ed (sendmessage): Don't split messages into lines of no more than 60
characters.  Update info flash and wall.  They were wrong, anyway:
they claimed long messages were truncated.
2007-01-20 16:32:35 +00:00
63bdc89835 Update copyright notice. 2007-01-09 19:09:31 +00:00
e42053d928 Break inclusion cycle: prototypes.h and commands.h included each
other.  Ensure headers in include/ can be included in any order
(except for econfig-spec.h, which is special).  New header types.h to
help avoid inclusion cycles.  Sort include directives.  Remove some
superflous includes.
2006-07-10 06:37:23 +00:00
4515b84c59 COPYING duplicates information from README. Remove. Move GPL from
LICENSE to COPYING, because that's where it usually is.  Update all
the references to these files.
2006-01-21 19:48:41 +00:00
011f88fec8 (acce, flash, nati, new, rela): Don't bother to complain about bad
country argument, natarg() does that.

(acce, flash, nati, rela): natarg() ensures getnatp() succeeds, no
need to check.
2006-01-06 17:44:31 +00:00
3e400c018c Update copyright notice. 2006-01-05 13:36:57 +00:00
8b16c31223 Change nation status from bits to a simple enum:
(nat_status, STAT_UNUSED, STAT_VIS, STAT_ACTIVE): New.
(STAT_NEW, STAT_SANCT, STAT_GOD): Change into nat_status members.
(STAT_INUSE, STAT_NORM): Remove.
(natstr): Use new nat_status for nat_stat.
    New value       Old value
    STAT_UNUSED     0
    STAT_NEW        STAT_INUSE | STAT_NEW
    STAT_VIS        STAT_INUSE
    STAT_SANCT      STAT_INUSE | STAT_SANCT
    STAT_ACTIVE     STAT_INUSE | STAT_NORM
    STAT_GOD        STAT_INUSE | STAT_NORM | STAT_GOD
Users changed.
2006-01-04 22:49:42 +00:00
3aebb68ee7 Include config.h. 2005-12-27 18:04:19 +00:00
71e164ed30 Document, in particular use of UTF-8. Simplify code in a couple of
places, but no functional changes.
2005-06-13 19:02:49 +00:00
b5ff7e3beb (copy_ascii_no_funny, copy_utf8_no_funny)
(copy_utf8_to_ascii_no_funny): New.
(flash, wall, prmptrd, uprmptrd, getcommand): Use them to filter
input.
(uprnf, pr_flash): Use them to filter output.
(prtoascii): No longer used, remove.

(player_commands, player_commands_index): Internal linkage.
2005-06-13 18:16:44 +00:00
ddfd5c1699 (play_list): player->combuf[] is user text and must be printed as
such.
(ufindbreak, ufindpfx): Rename, move to pr.c, external linkage.
2005-06-13 08:42:27 +00:00
e6ef2545bd (sendmessage): Skip players not in state PS_PLAYING. Flashes to them
get ignored, hence telling the player that the flash was sent is
wrong.  Skipping fixes that.
2005-06-09 22:28:54 +00:00
baf416652a Login options.
(player): New member flags.
(PF_UTF8, NF_UTF8): New PF_UTF8 replaces NF_UTF8.  Users changed.
(options_cmd): New.
(login_coms): New command `options'.
(toggle): Revert to the previous rev.
2005-05-27 16:31:19 +00:00
Ron Koenderink
2cc44bb182 Support UTF-8 encoded Unicode for user communications.
(NF_UTF8, togg): New client flag.
(flash, wall): User text input filtering.
(parse, prmptrd): Normal text input filtering.
(uprmptrd, ugetstring): New, to get user text.
(getele, flash, wall): Use them.
(getele): No need to filter out funny characters; input filtering
takes care of them.
(sendmessage, ufindbreak): Work on user text.
(uprnf): New, to print user text.
(rea, gamedown, show_motd): Use it.
(prnf): Unused, remove.
(pr, upr_player): Normal text output filtering (with highlighting).
(pr_flash): User text output filtering.
2005-05-26 01:58:48 +00:00
345ad3dfe0 Update copyright notice. 2005-03-16 22:03:16 +00:00
fac342ed49 Update copyright notice. 2004-09-07 15:07:16 +00:00
60541ccfaf (flash, wall): Long arguments could smash the stack; fix insufficient
buffers.  Closes #940792.

(wall): Don't strip first word from message.  Closes #940790.
2004-04-25 13:09:41 +00:00
696b5b4b64 POSIX has all we need in <time.h>. No need to fool around with
<sys/time.h>.
2004-02-19 09:57:25 +00:00
9b7adfbecc Indented with src/scripts/indent-emp. 2003-09-02 20:48:48 +00:00
d8b7fdfae1 Import of Empire 4.2.12 2003-08-23 12:23:04 +00:00