From 325a281a15956ac551b282a86ef0adbbf59412f0 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 17 Dec 2023 11:26:00 +0200 Subject: [PATCH 28/28] Add PlayerState value "HasCapital" Requested by ihnatus See osdn #48886 Signed-off-by: Marko Lindqvist --- common/fc_types.h | 2 ++ common/player.c | 2 ++ doc/README.effects | 2 ++ 3 files changed, 6 insertions(+) diff --git a/common/fc_types.h b/common/fc_types.h index 5116c004e5..c765cfa9fd 100644 --- a/common/fc_types.h +++ b/common/fc_types.h @@ -581,6 +581,8 @@ const char *ai_level_name_update_cb(const char *old); #define SPECENUM_NAME plrstate_type #define SPECENUM_VALUE0 PLRS_BARBARIAN #define SPECENUM_VALUE0NAME "Barbarian" +#define SPECENUM_VALUE1 PLRS_HAS_CAPITAL +#define SPECENUM_VALUE1NAME "HasCapital" #define SPECENUM_COUNT PLRS_LAST #include "specenum_gen.h" diff --git a/common/player.c b/common/player.c index e49d59a9b1..54cfdcb2a3 100644 --- a/common/player.c +++ b/common/player.c @@ -1990,6 +1990,8 @@ bool player_has_state(const struct player *pplayer, switch (state) { case PLRS_BARBARIAN: return is_barbarian(pplayer); + case PLRS_HAS_CAPITAL: + return player_primary_capital(pplayer) != NULL; case PLRS_LAST: fc_assert(state != PLRS_LAST); break; diff --git a/doc/README.effects b/doc/README.effects index 4d186ad88f..08e133b463 100644 --- a/doc/README.effects +++ b/doc/README.effects @@ -147,6 +147,8 @@ OriginalOwner is the city founding nation ServerSetting is if a Boolean server setting is enabled. The setting must be visible to all players and affect the game rules. FormAge is time since latest unit upgrade of conversion. +PlayerState is one of "Barbarian", + or "HasCapital" (true if player had capital at the beginning of the turn) Effect types -- 2.43.0