Bug #1549 » 3_4-aak_player_city.patch
common/actions.c | ||
---|---|---|
Create a new action.
|
||
**************************************************************************/
|
||
static struct action *action_new(action_id id,
|
||
enum action_actor_kind aak,
|
||
enum action_result result,
|
||
const int min_distance,
|
||
const int max_distance,
|
||
... | ... | |
/* Not set here */
|
||
BV_CLR_ALL(action->sub_results);
|
||
action->actor_kind = AAK_UNIT;
|
||
action->actor_kind = aak;
|
||
action->target_kind = actres_target_kind_default(result);
|
||
action->sub_target_kind = actres_sub_target_kind_default(result);
|
||
action->target_complexity = actres_target_compl_calc(result);
|
||
... | ... | |
const int max_distance,
|
||
bool actor_consuming_always)
|
||
{
|
||
struct action *act = action_new(id, result,
|
||
struct action *act = action_new(id, AAK_UNIT, result,
|
||
min_distance, max_distance,
|
||
actor_consuming_always);
|
||
... | ... | |
player_action_new(action_id id,
|
||
enum action_result result)
|
||
{
|
||
struct action *act = action_new(id, result,
|
||
struct action *act = action_new(id, AAK_PLAYER, result,
|
||
0, 0, FALSE);
|
||
return act;
|
||
... | ... | |
action_iterate(blocker_id) {
|
||
struct action *blocker = action_by_number(blocker_id);
|
||
fc_assert_action(action_get_actor_kind(blocker) == AAK_UNIT,
|
||
continue);
|
||
if (action_get_actor_kind(blocker) != AAK_UNIT) {
|
||
/* Currently, only unit's actions may block each other */
|
||
continue;
|
||
}
|
||
if (!action_would_be_blocked_by(act, blocker)) {
|
||
/* It doesn't matter if it is legal. It won't block the action. */
|
||
... | ... | |
/* No actor detected. */
|
||
return FALSE;
|
||
case AAK_CITY:
|
||
case AAK_PLAYER:
|
||
/* Currently can't detect */
|
||
return TRUE;
|
||
case AAK_COUNT:
|
||
fc_assert(action_get_actor_kind(paction) != AAK_COUNT);
|
||
break;
|
||
... | ... | |
}
|
||
} unit_type_iterate_end;
|
||
break;
|
||
case AAK_CITY:
|
||
case AAK_PLAYER:
|
||
/* No ruleset hard reqs atm */
|
||
return TRUE;
|
||
case AAK_COUNT:
|
||
fc_assert(action_get_actor_kind(paction) != AAK_COUNT);
|
||
break;
|
common/actions.h | ||
---|---|---|
#define SPECENUM_NAME action_actor_kind
|
||
#define SPECENUM_VALUE0 AAK_UNIT
|
||
#define SPECENUM_VALUE0NAME N_("a unit")
|
||
#define SPECENUM_VALUE1 AAK_CITY
|
||
#define SPECENUM_VALUE1NAME N_("a city")
|
||
#define SPECENUM_VALUE2 AAK_PLAYER
|
||
#define SPECENUM_VALUE2NAME N_("a player")
|
||
#define SPECENUM_COUNT AAK_COUNT
|
||
#include "specenum_gen.h"
|
||
common/improvement.c | ||
---|---|---|
}
|
||
} unit_type_iterate_end;
|
||
break;
|
||
case AAK_CITY:
|
||
/* No known limitations */
|
||
return TRUE;
|
||
case AAK_PLAYER:
|
||
/* If civil war is impossible for other reasons, no effect */
|
||
/* Ignore the capital presence considering a scripted civil war.
|
||
* Counting playable nations and normal players is not that easy
|
||
* in clients thus skipped here, these limits bump rather rarely */
|
||
if (ACTION_CIVIL_WAR == enabler->action
|
||
&& (city_list_size(city_owner(pcity)->cities)
|
||
< GAME_MIN_CIVILWARSIZE)) {
|
||
continue;
|
||
}
|
||
return TRUE;
|
||
case AAK_COUNT:
|
||
fc_assert(action_id_get_actor_kind(act) != AAK_COUNT);
|
||
break;
|