This is the mail archive of the
xconq7@sources.redhat.com
mailing list for the Xconq project.
Re: garrison_unit?
- From: Lincoln Peters <peters2000 at mindspring dot com>
- To: Stanley Sutton <sutton at t-surf dot com>
- Cc: Xconq mailing list <xconq7 at sources dot redhat dot com>
- Date: 01 Aug 2002 10:39:43 -0700
- Subject: Re: garrison_unit?
- References: <8CB7243165D750498B12F7F868535B4009487E@pline2>
I suspect that this branch is used by time.g so that when a city is
upgraded, all of its occupants are transferred into the new city instead
of vanishing along with the old city. Although I'm not sure.
On Thu, 2002-08-01 at 07:01, Stanley Sutton wrote:
> As near as I can tell, there is a dead branch in the code:
> Unit *transport = NULL, *occ, *nextocc;
>
> /* Maybe get rid of the building unit if it is to be the garrison.
> */
> if (uu_hp_to_garrison(u, u2) >= unit->hp) {
> /* But first get the about-to-be-killed garrisoning unit
> disconnected from everything. */
> leave_cell(unit);
> /* Put new unit in place of the garrisoning one, if it was an
> occupant. */
> if (unit2->transport == unit) {
> leave_transport(unit2);
> if (transport != NULL) { /* some other unit that could be
> transport? */
> enter_transport(unit2, transport);
> } else {
> enter_cell(unit2, x, y);
> }
>
> The line 'if (transport != NULL) {' will always take the 2nd branch
> unless there is a side effect that I can't find. If there is a reason
> for the code, I'd like to document it.
>