check_extract_action
Stanley Sutton
sutton@t-surf.com
Mon Aug 5 21:13:00 GMT 2002
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.
More information about the Xconq7
mailing list