Author: sveinung Date: Sun Aug 24 16:10:20 2014 New Revision: 26014 URL: http://svn.gna.org/viewcvs/freeciv?rev=26014&view=rev Log: New diplomatic relationship requirement type property foreign
Only support the local range since that is the only place it makes sense. See patch #5068 Modified: trunk/common/fc_types.h trunk/common/player.c trunk/common/player.h trunk/common/requirements.c trunk/doc/README.effects Modified: trunk/common/fc_types.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/fc_types.h?rev=26014&r1=26013&r2=26014&view=diff ============================================================================== --- trunk/common/fc_types.h (original) +++ trunk/common/fc_types.h Sun Aug 24 16:10:20 2014 @@ -323,7 +323,7 @@ int baseflag; /* enum base_flag_id */ int roadflag; /* enum road_flag_id */ int diplrel; /* enum diplstate_type or - enum diplrel_asym */ + enum diplrel_other */ enum ustate_prop unit_state; int minmoves; int max_tile_units; Modified: trunk/common/player.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/player.c?rev=26014&r1=26013&r2=26014&view=diff ============================================================================== --- trunk/common/player.c (original) +++ trunk/common/player.c Sun Aug 24 16:10:20 2014 @@ -1333,7 +1333,7 @@ fc_assert(player2 != NULL); /* No relationship to it self. */ - if (player1 == player2) { + if (player1 == player2 && diplrel != DRO_FOREIGN) { return FALSE; } @@ -1342,22 +1342,24 @@ } switch (diplrel) { - case DRA_GIVES_SHARED_VISION: + case DRO_GIVES_SHARED_VISION: return gives_shared_vision(player1, player2); - case DRA_RECEIVES_SHARED_VISION: + case DRO_RECEIVES_SHARED_VISION: return gives_shared_vision(player2, player1); - case DRA_HOSTS_EMBASSY: + case DRO_HOSTS_EMBASSY: return player_has_embassy(player2, player1); - case DRA_HAS_EMBASSY: + case DRO_HAS_EMBASSY: return player_has_embassy(player1, player2); - case DRA_HOSTS_REAL_EMBASSY: + case DRO_HOSTS_REAL_EMBASSY: return player_has_real_embassy(player2, player1); - case DRA_HAS_REAL_EMBASSY: + case DRO_HAS_REAL_EMBASSY: return player_has_real_embassy(player1, player2); - case DRA_HAS_CASUS_BELLI: + case DRO_HAS_CASUS_BELLI: return 0 < player_diplstate_get(player1, player2)->has_reason_to_cancel; - case DRA_PROVIDED_CASUS_BELLI: + case DRO_PROVIDED_CASUS_BELLI: return 0 < player_diplstate_get(player2, player1)->has_reason_to_cancel; + case DRO_FOREIGN: + return player1 != player2; } fc_assert_msg(FALSE, "diplrel_between(): invalid diplrel number %d.", @@ -1391,9 +1393,9 @@ int diplrel_by_rule_name(const char *value) { /* Look for asymmetric diplomatic relations */ - int diplrel = diplrel_asym_by_name(value, fc_strcasecmp); - - if (diplrel != diplrel_asym_invalid()) { + int diplrel = diplrel_other_by_name(value, fc_strcasecmp); + + if (diplrel != diplrel_other_invalid()) { return diplrel; } @@ -1401,13 +1403,13 @@ diplrel = diplstate_type_by_name(value, fc_strcasecmp); /* - * Make sure DS_LAST isn't returned as DS_LAST is the first diplrel_asym. + * Make sure DS_LAST isn't returned as DS_LAST is the first diplrel_other. * * Can't happend now. This is in case that changes in the future. */ - fc_assert_ret_val(diplrel != DS_LAST, diplrel_asym_invalid()); + fc_assert_ret_val(diplrel != DS_LAST, diplrel_other_invalid()); /* - * Make sure that diplrel_asym_invalid() is returned. + * Make sure that diplrel_other_invalid() is returned. * * Can't happend now. At the moment dpilrel_asym_invalid() is the same as * diplstate_type_invalid(). This is in case that changes in the future. @@ -1416,7 +1418,7 @@ return diplrel; } - return diplrel_asym_invalid(); + return diplrel_other_invalid(); } /************************************************************************** @@ -1427,7 +1429,7 @@ if (value < DS_LAST) { return diplstate_type_name(value); } else { - return diplrel_asym_name(value); + return diplrel_other_name(value); } } @@ -1439,7 +1441,7 @@ if (value < DS_LAST) { return diplstate_type_translated_name(value); } else { - return _(diplrel_asym_name(value)); + return _(diplrel_other_name(value)); } } Modified: trunk/common/player.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/player.h?rev=26014&r1=26013&r2=26014&view=diff ============================================================================== --- trunk/common/player.h (original) +++ trunk/common/player.h Sun Aug 24 16:10:20 2014 @@ -138,31 +138,33 @@ #define SPECENUM_VALUE6 DS_TEAM #define SPECENUM_VALUE6NAME N_("?diplomatic_state:Team") /* When adding or removing entries, note that first value - * of diplrel_asym should be next to last diplstate_type */ + * of diplrel_other should be next to last diplstate_type */ #define SPECENUM_COUNT DS_LAST /* leave this last */ #include "specenum_gen.h" -/* Asymmetric diplomatic relations. +/* Other diplomatic relation properties. * * The first element here is numbered DS_LAST */ -#define SPECENUM_NAME diplrel_asym -#define SPECENUM_VALUE7 DRA_GIVES_SHARED_VISION +#define SPECENUM_NAME diplrel_other +#define SPECENUM_VALUE7 DRO_GIVES_SHARED_VISION #define SPECENUM_VALUE7NAME N_("Gives shared vision") -#define SPECENUM_VALUE8 DRA_RECEIVES_SHARED_VISION +#define SPECENUM_VALUE8 DRO_RECEIVES_SHARED_VISION #define SPECENUM_VALUE8NAME N_("Receives shared vision") -#define SPECENUM_VALUE9 DRA_HOSTS_EMBASSY +#define SPECENUM_VALUE9 DRO_HOSTS_EMBASSY #define SPECENUM_VALUE9NAME N_("Hosts embassy") -#define SPECENUM_VALUE10 DRA_HAS_EMBASSY +#define SPECENUM_VALUE10 DRO_HAS_EMBASSY #define SPECENUM_VALUE10NAME N_("Has embassy") -#define SPECENUM_VALUE11 DRA_HOSTS_REAL_EMBASSY +#define SPECENUM_VALUE11 DRO_HOSTS_REAL_EMBASSY #define SPECENUM_VALUE11NAME N_("Hosts real embassy") -#define SPECENUM_VALUE12 DRA_HAS_REAL_EMBASSY +#define SPECENUM_VALUE12 DRO_HAS_REAL_EMBASSY #define SPECENUM_VALUE12NAME N_("Has real embassy") -#define SPECENUM_VALUE13 DRA_HAS_CASUS_BELLI +#define SPECENUM_VALUE13 DRO_HAS_CASUS_BELLI #define SPECENUM_VALUE13NAME N_("Has Casus Belli") -#define SPECENUM_VALUE14 DRA_PROVIDED_CASUS_BELLI +#define SPECENUM_VALUE14 DRO_PROVIDED_CASUS_BELLI #define SPECENUM_VALUE14NAME N_("Provided Casus Belli") +#define SPECENUM_VALUE15 DRO_FOREIGN +#define SPECENUM_VALUE15NAME N_("Is foreign") #include "specenum_gen.h" enum dipl_reason { Modified: trunk/common/requirements.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/requirements.c?rev=26014&r1=26013&r2=26014&view=diff ============================================================================== --- trunk/common/requirements.c (original) +++ trunk/common/requirements.c Sun Aug 24 16:10:20 2014 @@ -144,7 +144,7 @@ break; case VUT_DIPLREL: source.value.diplrel = diplrel_by_rule_name(value); - if (source.value.diplrel != diplrel_asym_invalid()) { + if (source.value.diplrel != diplrel_other_invalid()) { return source; } break; @@ -341,7 +341,7 @@ break; case VUT_DIPLREL: source.value.diplrel = value; - if (source.value.diplrel != diplrel_asym_invalid()) { + if (source.value.diplrel != diplrel_other_invalid()) { return source; } break; @@ -630,7 +630,10 @@ && req.range != REQ_RANGE_PLAYER && req.range != REQ_RANGE_TEAM && req.range != REQ_RANGE_ALLIANCE - && req.range != REQ_RANGE_WORLD); + && req.range != REQ_RANGE_WORLD) + /* Non local foreign makes no sense. */ + || (req.source.value.diplrel == DRO_FOREIGN + && req.range != REQ_RANGE_LOCAL); break; case VUT_NATION: invalid = (req.range != REQ_RANGE_PLAYER Modified: trunk/doc/README.effects URL: http://svn.gna.org/viewcvs/freeciv/trunk/doc/README.effects?rev=26014&r1=26013&r2=26014&view=diff ============================================================================== --- trunk/doc/README.effects (original) +++ trunk/doc/README.effects Sun Aug 24 16:10:20 2014 @@ -469,7 +469,7 @@ "Armistice", "Peace", "Alliance", "Team", "Gives shared vision", "Receives shared vision", "Hosts embassy", "Has embassy", "Hosts real embassy" (not from an effect), "Has real embassy", -"Has Casus Belli" (reason for war) or "Provided Casus Belli". +"Has Casus Belli" (reason for war), "Provided Casus Belli" or "Is foreign". A DiplRel is considered fulfilled for the range * world if some player in the world has the specified diplomatic _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits