Project

Profile

Help

HostedRedmine.com has moved to the Planio platform. All logins and passwords remained the same. All users will be able to login and use Redmine just as before. Read more...

Feature #825236 ยป 0055-Disallow-placing-extras-where-also-workers-are-makin.patch

Marko Lindqvist, 2019-07-07 10:10 PM

View differences:

common/extras.c
}
}
/* Placing extras is not allowed to tiles where also workers do changes. */
unit_list_iterate(ptile->units, punit) {
tile_changing_activities_iterate(act) {
if (punit->activity == act) {
return FALSE;
}
} tile_changing_activities_iterate_end;
} unit_list_iterate_end;
return player_can_build_extra(pextra, pplayer, ptile);
}
common/unit.c
Activity_type_id real_activities[ACTIVITY_LAST];
const Activity_type_id tile_changing_activities[] =
{ ACTIVITY_PILLAGE, ACTIVITY_GEN_ROAD, ACTIVITY_IRRIGATE, ACTIVITY_MINE,
ACTIVITY_BASE, ACTIVITY_CULTIVATE, ACTIVITY_PLANT, ACTIVITY_TRANSFORM,
ACTIVITY_POLLUTION, ACTIVITY_FALLOUT, ACTIVITY_LAST };
struct cargo_iter {
struct iterator vtable;
const struct unit_list_link *links[GAME_TRANSPORT_MAX_RECURSIVE];
common/unit.h
activity_type_list_iterate_end \
}
extern const Activity_type_id tile_changing_activities[ACTIVITY_LAST];
#define tile_changing_activities_iterate(_act_) \
{ \
activity_type_list_iterate(tile_changing_activities, _act_)
#define tile_changing_activities_iterate_end \
activity_type_list_iterate_end \
}
bool unit_can_help_build_wonder_here(const struct unit *punit);
bool unit_can_est_trade_route_here(const struct unit *punit);
enum unit_airlift_result
server/unittools.c
int total = 0;
bool tgt_matters = activity_requires_target(act);
unit_list_iterate (ptile->units, punit) {
unit_list_iterate(ptile->units, punit) {
if (punit->activity == act
&& (!tgt_matters || punit->activity_target == tgt)) {
total += punit->activity_count;
......
**************************************************************************/
static void update_unit_activity(struct unit *punit)
{
const enum unit_activity tile_changing_actions[] =
{ ACTIVITY_PILLAGE, ACTIVITY_GEN_ROAD, ACTIVITY_IRRIGATE, ACTIVITY_MINE,
ACTIVITY_BASE, ACTIVITY_CULTIVATE, ACTIVITY_PLANT, ACTIVITY_TRANSFORM,
ACTIVITY_POLLUTION, ACTIVITY_FALLOUT, ACTIVITY_LAST };
struct player *pplayer = unit_owner(punit);
bool unit_activity_done = FALSE;
enum unit_activity activity = punit->activity;
struct tile *ptile = unit_tile(punit);
int i;
switch (activity) {
case ACTIVITY_IDLE:
......
} unit_list_iterate_end;
}
for (i = 0; tile_changing_actions[i] != ACTIVITY_LAST; i++) {
if (tile_changing_actions[i] == activity) {
tile_changing_activities_iterate(act) {
if (act == activity) {
/* Some units nearby may not be able to continue their action,
* such as building irrigation if we removed the only source
* of water from them. */
......
} adjc_iterate_end;
break;
}
}
} tile_changing_activities_iterate_end;
}
if (activity == ACTIVITY_FORTIFYING) {
    (1-1/1)