(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.
(main): Rev. 1.43 broke option -D. Its meaning in presence of -e is
unclear. Other programs only support -e. Remove -D.
(install_service): Remove argument datadir_set.
(main): New option -v.
(main): Exit successfully after -h.
(main): Don't print usage on unknown options, just point to -h.
(print_usage): Rewrite. Deprecate use of non-option arguments.
(lwpInitSystem): Stack checking doesn't work and is not necessary for
main thread; clear LWP_STACKCHECK.
(lwpStackCheck): Log stack overflow/underflow and abort.
Ron Koenderink [Wed, 16 Mar 2005 02:39:51 +0000 (02:39 +0000)]
(loc_Ctrl_C_Handler,loc_Exit_Handler) [_WIN32]: Process other
exit methods in the same way as ctrl-c. Change loc_Ctrl_C_Handler()
to loc_Exit_Handler() to reflect changed functionality.
(shutdwn): Rev. 1.51 broke the Linux pthread hack. It is unclear what
this hack is trying to achieve. It never worked without -d, because
mainpid got assigned the wrong pid. It doesn't make sense with recent
versions of Linux pthreads, which use the same PID for all threads, as
required by POSIX. Remove. Closes #1161397.
Ron Koenderink [Tue, 15 Mar 2005 18:19:07 +0000 (18:19 +0000)]
(service_stoppped,stop_service,loc_Ctrl_C_Handler,
empth_request_shutdown,loc_BlockMainThread,empth_init,
service_ctrl_handler) [_WIN32]: Remove the Windows Build UI and
replace with Ctrl-c signal trap. The shutdown event that was used for
STOPPING the service is now used for both foreground and background
(service) modes of operation. Also move the shutdown event from service
code to empth_t library.
Marc Olzheim [Tue, 15 Mar 2005 18:05:16 +0000 (18:05 +0000)]
Don't try running 'cvs co' more than 5 times, since it might be a local
problem as well. Document NIGHTLY_SKIP_STEP=PATCH. Update to the currently
running script.
Ron Koenderink [Sun, 13 Mar 2005 21:53:23 +0000 (21:53 +0000)]
(main,print_usage) [_WIN32]: Add the ability to enable
empire thread debugging for Windows build.
(empth_select) [_WIN32]: Fix empth_select() so can be aborted.
The bug was that a command would not be aborted during an update.
The problem was select() was not interrupt by the setting of the
signalling wakeup event. Fix by replacing the select() with
WSAEventSelect().
(empth_exit) [_WIN32]:
Fix the shutdown sequence for Windows build to be running in
empth_t context. Add a loc_RunThisThread() in empth_exit()
before starting the shutdown() sequence.
Write pid file, like a good daemon. Thanks to Daniel O'Connor for the
initial patch.
(create_pidfile, pidfname): New.
(start_server): Create pid file.
(finish_server): Remove pid file.
(main) [__linux__ && _EMPTH_POSIX]: Don't hack pid into argv[0].
Recent versions of Linux pthreads no longer show multiple PIDs, and
deities can get the PID fro the pid file anyway.
(finish_server): New, factored out of termination code. Fixes two
places in service_main() that lacked close_files().
(close_files, loc_NTTerm): Static linkage.