(babies): Err, the maxpop case wasn't an optimization... Without
that, we get negative babies, which leads to negative avail and baby
food (cannibalism?) in grow_people(). Restore it.
(get_assembly_point): Close loophole that allowed players to find all
unowned sectors. The assembly point must now be owned or allied, or
have an owned or allied ship.
Info pages didn't match the old rule. Fix them to match the new rule.
(ac_encounter): Non-recon missions no longer make contact to owner of
sectors overflown, because only recon missions identify the owner.
This matches info Hidden.
(add): Initialize nat_last_login and nat_last_logout to zero rather
than current time. Nation addition time is irrelevant.
(natstr): Document zero nat_last_login, nat_last_login mean never
logged in/out.
(player_main): Test nat_last_login zero instead of nat_hostaddr empty.
(player_main): Assign nat_userid, nat_hostname, nat_hostaddr straight
from player. The last connection's host is now shown as dotted quads
instead of nowhere when the name isn't known.
(natstr): Document that nat_userid, nat_hostname may be empty.
(player_main): Simplify printing last connection address: nat_hostaddr
can't be empty here; don't bother to substitute "nobody" for empty
user.
(lndstr, natstr, shpstr): Fix string types from s_char[] to char[].
They were declared NSC_STRINGY in their selector descriptors, and
NSC_STRINGY is specified to represent char[].
(player): Get rid of s_char.
(babies): Factored out of grow_people(). Identical, except it doesn't
bother to `optimize' the maxpop case, and it drops the weird food
limit computation for opt_NOFOOD, which didn't limited for any
reasonable game parameters.
(natstr): Member nat_connected is inappropriate, because it is
transient server state, not persistent game state. Remove.
(player_main, edit): Remove uses.
(coun): Use getplayer() instead of nat_connected. Delete the message
on command being out of order.
(player_find_other): Replace by getplayer. player_find_other()
searches for a player other than US for country CNUM, which is in
state PS_PLAYING. Since there can be at most one player in state
PS_PLAYING, and no caller pass that player as US, they can simply use
getplayer() instead.
(getplayer): There may be multiple players for the same country in the
list of players, but at most one in state PS_PLAYING. getplayer()
used to get the one first in the list. However, its callers need the
one in state PS_PLAYING. In particular, typed_wu() notifies the
player obtained from getplayer(). If the player in state PS_PLAYING
isn't first, say because another one is trying to log in, the
notification gets lost. Fix by making getplayer() return the player
in state PS_PLAYING.
(getpath): Fix buffer overflow. Remote hole in commands bomb, drop,
fly, para, reco, sail, sweep. Old code also screwed up when
getstring() failed, unless player->aborted. Fixed code is still ugly
and cries for a rewrite.
(diridx): New. Use instead of chkdir() where direction characters
must be valid. Oopses on bad direction characters.
(pathtoxy, ac_encounter): Bad direction characters used to lead to bad
array subscript and potential disaster.
(pathrange, path): Stop on DIR_STOP as well as on bad direction
characters. This is just for consistency with other code; DIR_STOP
should occur only last in a path here.
(sail_nav_fleet, nav_ship): No change except for the oops.
Ron Koenderink [Sun, 21 Aug 2005 17:17:38 +0000 (17:17 +0000)]
(io_output_all,update_main,update_wait): Do not block on writing when
aborting commands for an update. Move update_pending to the start of
the update sequence where the commands are aborted.
(sorde): Output messed up for ships with sail path. Fix and
simplify. Remove inappropriate ship sanity check, should be done
elsewhere, and differently.
(qorde): Output messed up for ships with sail path. Fix and
simplify. Remove inappropriate ship sanity check, should be done
elsewhere, and differently.
(checksect, give_back_cap, guerrilla): No longer change capital to
agribusiness. That was done when the occupier abandons the old-owners
capital or it revolts, to prevent players from sacking the same
capital many timers. The server has a much better way to prevent that
since 4.2.7, so this weird hack is no longer useful. Thanks to Pat
Loney for pointing this out.
(player_init) [LISTENMAXCONN]: Comment seems to claim Linux doesn't
have SOMAXCONN, but has LISTENMAXCONN. In fact, it has SOMAXCONN, and
LISTENMAXCONN doesn't exist anywhere in /usr/include or the Internet.
Remove the special case.