garrison_unit?

Stanley Sutton sutton@t-surf.com
Thu Aug 1 11:59:00 GMT 2002


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.  



More information about the Xconq7 mailing list