(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().
Client UTF-8 support.
(login): New parameter utf8. If set, request option utf-8 from
server.
(expect, recvline): Split recvline() out of expect(). Replace or
remove some unhelpful diagnostics.
(eight_bit_clean): New.
(screen): If eight_bit_clean is set, highlighting is switched with
SO/SI. Else characters with MSB set are highlighted.
(main): New option -u to request UTF-8 and set eight_bit_clean.
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.
Ron Koenderink [Thu, 26 May 2005 01:58:48 +0000 (01:58 +0000)]
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.
(nstr_comp): Interpret identifiers as strings only when the
other operand is a string-value selector.
(nstr_comp_val): Don't interpret identifiers as strings.
(nstr_resolve_id): New parameter string_ok.
Ron Koenderink [Sun, 8 May 2005 18:39:09 +0000 (18:39 +0000)]
(build_bridge,build_tower,retreat_ship1): Mark "X" on sector
where mines were found when retreating. Remove "X" when the
bridge span or tower is built. Closes #1149809.
The bmap is now updated when the bridge span or tower is built.
A bulletin was added for when mines were swept when
retreating.
Ron Koenderink [Tue, 3 May 2005 00:06:10 +0000 (00:06 +0000)]
(main,install_service) [_WIN32]: Move the construction of full path names
for program file and econfig file for installing a service to main()
instead of install_service(). This is because current directory
information is lost because of the use of chdir() to move the current
directory to the datadir. This change also fixed the setting of a
relative directory for the econfig file. The service starts in an
arbitrary directory so a relative path can not used by the service.
Ron Koenderink [Tue, 5 Apr 2005 03:00:35 +0000 (03:00 +0000)]
(ship_grow_scale, plane_grow_scale, land_grow_scale): Change from int
to float. This allows more control of the max. efficiency gain, and
makes it similiar to ship_mob_scale etc. Closes #1025600.
Ron Koenderink [Sat, 26 Mar 2005 17:21:23 +0000 (17:21 +0000)]
(xdprval): Only use of prnf() that is not for telegram text.
Replace by pr() in preparation of output conversion of telegram text
for the UTF-8 option.
Ron Koenderink [Fri, 25 Mar 2005 21:28:25 +0000 (21:28 +0000)]
(): Remove -e from the list of no parameter options in the fairland
manual page. There is not -e without parameter option.
There is -e with parameter option and it is properly
documented.
(lnd_mar_one_sector): When units in different sectors march, only
units in the sector with the highest-numbered unit were interdicted.
A marching non-spy made all marching spies visible to interdiction
regardless of location. Interdict sector by sector, similar to
shp_nav_one_sector(). Interdict spies only if they are together with
non-spies in the same sector.
(shp_nav_one_sector): When shp_interdict() removed the second ship in
a sector, interdiction loop followed dangling pointer and crashed.
Simplify & fix.
(mlist): Member done no longer used, remove.
Ron Koenderink [Sun, 20 Mar 2005 11:07:45 +0000 (11:07 +0000)]
[_WIN32]: Add #define WIN32 whereever winsock2.h is used. There is bug
in the VC7 version of winsock2.h. In version VC7, the #pragma
pack(push) and pack(pop) have an #ifdef !WIN32 add to them. However,
if WIN32 is not defined at the beginning, the push is done but by the
time the pop is reach something else has set WIN32 define so the pop
is not done, and it changes the default pack from /Zp2 to /Zp4, which
makes the data structures incompatible between objects with winsock2.h
and without winsock2.h. By adding the WIN32 both the push and pop are
not done.
(nstr_parse_val): strtod() recognizes a few strings as numbers that we
want to recognize as identifiers, notably "inf". Recognize
identifiers starting with letters before numbers.
(produce): When player->simulation, level production executed item
production code for item I_NONE. This tries to put products into
vec[I_NONE]. Until item.h rev. 1.12, vec[I_NONE] was unused and zero,
so it worked. Since then, it's a subscript out of bounds, clobbering
two bytes of stack. The (unpredictable) stack contents could make the
code believe that there's not enough space for the `products', which
then reduced predicted production, typically to zero.
(_c_copyright_header, _ipglob_copyright_header, copyright_header):
_c_copyright_header and _ipglob_copyright_header are almost identical.
Replace by copyright_header, interpolate variable parts with printf.
(wrmakesrc, wrauth, wrgamesdef): Make generated file comments match
our usual style a bit more closely.