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]

check_extract_action


I think the check_extract_action should be changed from (with varible
names changed :-) ):



    if (any_cell_materials_defined()

	  && cell_material_defined(m)

	  && material_at(x, y, m) >= amount) {

	return A_ANY_OK;

    }

    /* Then look for extraction from independent unit. */

    for_all_stack(x, y, stack_unit) {

	if (in_play(stack_unit)

	    && indep(stack_unit)

	    && stack_unit->supply[m] >= amount) {

	    return A_ANY_OK;

	}

    }

    return A_EXTRACT_NO_SOURCE;

}



to:



    if (any_cell_materials_defined()

	  && cell_material_defined(m)

	  && material_at(x, y, m) > 0 ) {

	return A_ANY_OK;

    }

    /* Then look for extraction from independent unit. */

    for_all_stack(x, y, stack_unit) {

	if (in_play(stack_unit)

	    && indep(stack_unit)

	    && stack_unit->supply[m] > 0 ) {

	    return A_ANY_OK;

	}

    }

    return A_EXTRACT_NO_SOURCE;

}



This matches the checks in unit.c, that at least one unit of material
may be extracted from either the terrain or the units in stacked on the
cell.  This check proably needs the check for the unit being independant
(taking material from enemies is probably a not normal.  The check in
unit.c is that the unit is trusted, rather than independant.  I don't
know if that makes a differnce.




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