Ron Koenderink [Thu, 7 Jul 2005 21:57:15 +0000 (21:57 +0000)]
(show_sect_capab, mission_pln_equip, pln_equip): Change i_type
references to use I_NONE instead of zero. Zero has been invalid since
item.h rev. 1.12, and was questionable style before.
Ron Koenderink [Mon, 4 Jul 2005 14:07:31 +0000 (14:07 +0000)]
(pr_player, upr_player): Blocking I/O on another player's struct iop *
is unsafe! By the time the blocked thread wakes up, that player may
be gone, along with its struct iop *, and io_write() follows a
dangling pointer. Moreover, at most one thread may use empth_select()
on the same file descriptor. Violations of that restriction cause
threads to hang under Windows since ntthread.c rev. 1.15. Make all
output to another player non-blocking for now. Historically, player
threads sent output only to their socket, though their own iop. This
was broken by flash and asynchronous telegram notification a long time
ago.
Ron Koenderink [Thu, 30 Jun 2005 16:10:42 +0000 (16:10 +0000)]
(main) [_WIN32]: Windows putchar() screws up when printing multibyte
strings bytewise unless the stream is buffered. Switch stdout to
line-buffered mode.
(login): Explicitly flush stdout, because Windows doesn't implement
line-buffering faithfully.
Ron Koenderink [Sun, 26 Jun 2005 18:31:14 +0000 (18:31 +0000)]
(loc_Sem_t, empth_sem_t) [_WIN32]: empthread.h defines empth_sem_t as
incomplete type struct loc_Sem_t. Instead of completing it here, the
code defined an unrelated type loc_Sem_t as (complete) type struct
empth_sem_t. The resulting type errors were swept under the carpet
with casts. Obvious fix.
Based on a page Doug Wescott created for his Petting Zoo. I restored
the ASCII art to the original, gave credit to its creator, quoted from
WordNet (free) instead of American Heritage Dictionary, omitted parts
that might be illegal to distribute in certain countries, and improved
see also.
(att_move_in_off): When boarding from a sector, mil entering the ship
less one were not removed from the sector. The problem is putsect()
overwriting data from prior put_combat() with old data. Broken in
rev. 1.17. Change lunchbox code to match that of 1.16. Closes
#1219918, reported by Doug Wescott.
(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_login, player_main): Move the C_INIT that terminates the login
phase to player_login(). No functional change.
(showvers): Trivial, used just once. Inline, remove.
(parse): Support 127 arguments instead of 100, to match
player->argp[]. Assign complete argument vector. This should make
buffer overruns blatantly obvious.
(parse): Don't bother checking SPACE argument, just crash. It is
extremely unlikely that such a programming error wouldn't be
discovered by even them most superficial testing.
[_WIN32] (loc_StripDels): Remove. Different behavior depending on the
platform is evil, and line editing is none of the server's business
anyway. If your client can't deal with the delete key, well, here's a
nickel, kid, get yourself a better computer.
(ioq_gets): Support telnet line termination "\r\n". Previously,
string input other than through parse() or getele() failed to strip
'\r', which could end up in ship names and such.
(getele): Code dealing with '\r' is now redundant, remove. It ceased
to work in rev. 1.6 because input filtering replaces '\r' by '?'.
(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.
(getsose): Port from obsolete termcap to terminfo. The old code
manually stripped off padding, which is evil. The new code does
nothing when the stdout is not connected to a terminal.
(SO, smso, SE, rmso): Rename, static linkage.
(putso, putse): New.
(screen): Use it.
(program_name, help): New.
(main): New option -h. Terminate unsuccessfully on invalid option.
(usage, parse_args): Factored usage() out of parse_args().
(parse_args): More useful diagnostics.
(flee, army, wing): Print how many new members were added.
Previously, it printed how many were selected, which can include old
members of the group.
(flee, army): The rather obscure feature to assign the fleet's /
army's retreat orders to members was broken. It ignored ownership,
and thus could copy some other player's retreat orders. Abusable.
Copying the first member's retreat orders is less than useful, in
particular for group ~. The code now chooses the first one in the
same sector with RET_GROUP set. RET_GROUP is never set for group ~.
Ron Koenderink [Sun, 29 May 2005 16:22:14 +0000 (16:22 +0000)]
(output,screen): In ASCII mode, remove standout bit if the client
does not support standout mode.
In UTF8 mode, remove SO/SI characters if the client does not support
standout mode.
Ron Koenderink [Sun, 29 May 2005 14:17:07 +0000 (14:17 +0000)]
Changed the name of Attack and Move concept files and
a number of Subjects files to prevent name
conflicts where the only the case is difference.
Attack -> Attacking
Moving -> Transportation
Move -> Moving
Market -> Commerce
Nation -> Nations
Production -> Producing
Update -> Updating
(EFF_OWNER): The assertion that EFF_OWNER implies ef_read() sets
player->owner is no longer used. Use it to indicate that owner can be
accessed through struct genitem, similar to EFF_XY and EFF_GROUP.
(xdump): Fix ownership checking. Old version worked only when
nxtitem() set player->owner.
(empfile): Set EFF_OWNER for EF_LOST. This fixes `xdump lost'
disclosing other countries' losses.
(loststr): Document implications of EFF_OWNER.
(empfile): Set EFF_OWNER for EF_NATION.
(natstr): Rearrange members for EFF_OWNER, document.
(nat_ca): Unused so far. Clean it up, add most missing selectors.
(fileinit): Use it. This implements `xdump nation'.
(nxtitem): Skipped unowned sectors (could not occur), ships, planes,
land units and nukes for selection type NS_LIST. Thus, unowned items
explicitly selected by item number are skipped, while the same items
selected implicitely by group, area or whatever are not. This makes
no sense. Some callers break the nstr_item abstraction to prevent the
skipping, so they get all items regardless of how they were selected.
All other callers filter out unowned items. This skipping misfeature
dates back to the very oldest known versions of Empire. Remove it.
Also remove skipping prevention hacks from callers.
(tend_nxtitem): Now identical to nxtitem(), except it lacks some extra
normalization of item coordinates, which should have no effect.
Replace by nxtitem().