This is the mail archive of the xconq7@sources.redhat.com mailing list for the Xconq project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: garrison_unit?


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.  
> 



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]