![]() |
Freeciv21
Develop your civilization from humble roots to a global empire
|
#include "bitvector.h"#include "log.h"#include "rand.h"#include "base.h"#include "combat.h"#include "events.h"#include "game.h"#include "map.h"#include "movement.h"#include "player.h"#include "research.h"#include "unitlist.h"#include "actiontools.h"#include "aiiface.h"#include "citytools.h"#include "cityturn.h"#include "diplhand.h"#include "diplomats.h"#include "maphand.h"#include "notify.h"#include "plrhand.h"#include "techtools.h"#include "unithand.h"#include "unittools.h"#include "script_server.h"
Include dependency graph for diplomats.cpp:Go to the source code of this file.
Functions | |
| static void | diplomat_charge_movement (struct unit *pdiplomat, struct tile *ptile) |
| This subtracts the destination movement cost from a diplomat/spy. More... | |
| static bool | diplomat_success_vs_defender (struct unit *pattacker, struct unit *pdefender, struct tile *pdefender_tile) |
| This determines if a diplomat/spy succeeds against some defender, who is also a diplomat or spy. More... | |
| static bool | diplomat_may_lose_gold (struct player *dec_player, struct player *inc_player, int revolt_gold) |
| Gold for inciting might get lost. More... | |
| static bool | diplomat_infiltrate_tile (struct player *pplayer, struct player *cplayer, const struct action *paction, struct unit *pdiplomat, struct unit *pvictim, struct tile *ptile, struct player **defender_owner) |
| This determines if a diplomat/spy succeeds in infiltrating a tile. More... | |
| static void | diplomat_escape (struct player *pplayer, struct unit *pdiplomat, const struct city *pcity, const struct action *paction) |
| This determines if a diplomat/spy survives and escapes. More... | |
| static void | diplomat_escape_full (struct player *pplayer, struct unit *pdiplomat, bool city_related, struct tile *ptile, const char *vlink, const struct action *paction) |
| This determines if a diplomat/spy survives and escapes. More... | |
| bool | spy_poison (struct player *pplayer, struct unit *pdiplomat, struct city *pcity, const struct action *paction) |
| Poison a city's water supply. More... | |
| bool | spy_spread_plague (struct player *act_player, struct unit *act_unit, struct city *tgt_city, const struct action *paction) |
| Spread a plague to the target city. More... | |
| bool | diplomat_investigate (struct player *pplayer, struct unit *pdiplomat, struct city *pcity, const struct action *paction) |
| Investigate a city. More... | |
| void | spy_send_sabotage_list (struct connection *pc, struct unit *pdiplomat, struct city *pcity, const struct action *paction, bool disturb_player) |
| Get list of improvements from city (for purposes of sabotage). More... | |
| bool | diplomat_embassy (struct player *pplayer, struct unit *pdiplomat, struct city *pcity, const struct action *paction) |
| Establish an embassy. More... | |
| bool | spy_sabotage_unit (struct player *pplayer, struct unit *pdiplomat, struct unit *pvictim, const struct action *paction) |
| Sabotage an enemy unit. More... | |
| bool | diplomat_bribe (struct player *pplayer, struct unit *pdiplomat, struct unit *pvictim, const struct action *paction) |
| Bribe an enemy unit. More... | |
| bool | spy_attack (struct player *act_player, struct unit *act_unit, struct tile *tgt_tile, const struct action *paction) |
| Diplomatic battle. More... | |
| int | diplomats_unignored_tech_stealings (struct unit *pdiplomat, struct city *pcity) |
| Returns the amount of tech thefts from a city not ignored by the EFT_STEALINGS_IGNORE effect. More... | |
| bool | diplomat_get_tech (struct player *pplayer, struct unit *pdiplomat, struct city *pcity, Tech_type_id technology, const struct action *paction) |
| Try to steal a technology from an enemy city. More... | |
| bool | diplomat_incite (struct player *pplayer, struct unit *pdiplomat, struct city *pcity, const struct action *paction) |
| Incite a city to disaffect. More... | |
| bool | diplomat_sabotage (struct player *pplayer, struct unit *pdiplomat, struct city *pcity, Impr_type_id improvement, const struct action *paction) |
| Sabotage enemy city's improvement or production. More... | |
| bool | spy_steal_gold (struct player *act_player, struct unit *act_unit, struct city *tgt_city, const struct action *paction) |
| Steal gold from another player. More... | |
| bool | spy_steal_some_maps (struct player *act_player, struct unit *act_unit, struct city *tgt_city, const struct action *paction) |
| Steal part of another player's map. More... | |
| bool | spy_nuke_city (struct player *act_player, struct unit *act_unit, struct city *tgt_city, const struct action *paction) |
| Hide a suitcase nuke in a city and detonate it. More... | |
| int | count_diplomats_on_tile (struct tile *ptile) |
| Return number of diplomats on this square. More... | |
| int count_diplomats_on_tile | ( | struct tile * | ptile | ) |
Return number of diplomats on this square.
AJS 20000130
Definition at line 2149 of file diplomats.cpp.
Referenced by dai_diplomat_defend(), dai_manage_diplomat(), and find_city_to_diplomat().
| bool diplomat_bribe | ( | struct player * | pplayer, |
| struct unit * | pdiplomat, | ||
| struct unit * | pvictim, | ||
| const struct action * | paction | ||
| ) |
Bribe an enemy unit.
Returns TRUE iff action could be done, FALSE if it couldn't. Even if this returns TRUE, unit may have died during the action.
Definition at line 561 of file diplomats.cpp.
Referenced by unit_perform_action().
This subtracts the destination movement cost from a diplomat/spy.
Definition at line 1774 of file diplomats.cpp.
Referenced by diplomat_get_tech(), and diplomat_sabotage().
| bool diplomat_embassy | ( | struct player * | pplayer, |
| struct unit * | pdiplomat, | ||
| struct city * | pcity, | ||
| const struct action * | paction | ||
| ) |
Establish an embassy.
Returns TRUE iff action could be done, FALSE if it couldn't. Even if this returns TRUE, unit may have died during the action.
Definition at line 418 of file diplomats.cpp.
Referenced by unit_perform_action().
|
static |
This determines if a diplomat/spy survives and escapes.
If "pcity" is nullptr, assume action was in the field.
Spies have a game.server.diplchance specified chance of survival (better if veteran):
Definition at line 2050 of file diplomats.cpp.
Referenced by diplomat_get_tech(), diplomat_sabotage(), and spy_sabotage_unit().
|
static |
This determines if a diplomat/spy survives and escapes.
Spies have a game.server.diplchance specified chance of survival (better if veteran):
Definition at line 2078 of file diplomats.cpp.
Referenced by diplomat_escape(), diplomat_incite(), spy_nuke_city(), spy_poison(), spy_spread_plague(), spy_steal_gold(), and spy_steal_some_maps().
| bool diplomat_get_tech | ( | struct player * | pplayer, |
| struct unit * | pdiplomat, | ||
| struct city * | pcity, | ||
| Tech_type_id | technology, | ||
| const struct action * | paction | ||
| ) |
Try to steal a technology from an enemy city.
If paction results in ACTION_SPY_STEAL_TECH or ACTION_SPY_STEAL_TECH_ESC, steal a random technology. Otherwise, steal the technology whose ID is "technology". (Note: Only Spies can select what to steal.)
FIXME: It should give a loss of reputation to steal from a player you are not at war with
Returns TRUE iff action could be done, FALSE if it couldn't. Even if this returns TRUE, unit may have died during the action.
Definition at line 805 of file diplomats.cpp.
Referenced by unit_perform_action().
| bool diplomat_incite | ( | struct player * | pplayer, |
| struct unit * | pdiplomat, | ||
| struct city * | pcity, | ||
| const struct action * | paction | ||
| ) |
Incite a city to disaffect.
Returns TRUE iff action could be done, FALSE if it couldn't. Even if this returns TRUE, unit may have died during the action.
Definition at line 1036 of file diplomats.cpp.
Referenced by unit_perform_action().
|
static |
This determines if a diplomat/spy succeeds in infiltrating a tile.
'pplayer' is the player who tries to do a spy/diplomat action on 'ptile' with the unit 'pdiplomat' against 'cplayer'. If 'cplayer' is nullptr the owner of the chosen defender, if a defender can be chosen, gets its role. 'defender_owner' is, if non nullptr, set to the owner of the unit that defended.
Definition at line 1855 of file diplomats.cpp.
Referenced by diplomat_bribe(), diplomat_get_tech(), diplomat_incite(), diplomat_sabotage(), spy_attack(), spy_nuke_city(), spy_poison(), spy_sabotage_unit(), spy_spread_plague(), spy_steal_gold(), and spy_steal_some_maps().
| bool diplomat_investigate | ( | struct player * | pplayer, |
| struct unit * | pdiplomat, | ||
| struct city * | pcity, | ||
| const struct action * | paction | ||
| ) |
Investigate a city.
Returns TRUE iff action could be done, FALSE if it couldn't. Even if this returns TRUE, unit may have died during the action.
Definition at line 271 of file diplomats.cpp.
Referenced by unit_perform_action().
|
static |
Gold for inciting might get lost.
Returns TRUE if money is lost, FALSE if not.
Definition at line 985 of file diplomats.cpp.
Referenced by diplomat_incite().
| bool diplomat_sabotage | ( | struct player * | pplayer, |
| struct unit * | pdiplomat, | ||
| struct city * | pcity, | ||
| Impr_type_id | improvement, | ||
| const struct action * | paction | ||
| ) |
Sabotage enemy city's improvement or production.
If this is untargeted sabotage city a random improvement or production is targeted. Targeted sabotage city lets the value of "improvement" decide the target. If "improvement" is -1, sabotage current production. Otherwise, sabotage the city improvement whose ID is "improvement".
Returns TRUE iff action could be done, FALSE if it couldn't. Even if this returns TRUE, unit may have died during the action.
Definition at line 1170 of file diplomats.cpp.
Referenced by unit_perform_action().
|
static |
This determines if a diplomat/spy succeeds against some defender, who is also a diplomat or spy.
Note: a superspy defender always succeeds, otherwise a superspy attacker always wins.
Return TRUE if the "attacker" succeeds.
Definition at line 1790 of file diplomats.cpp.
Referenced by diplomat_infiltrate_tile().
Returns the amount of tech thefts from a city not ignored by the EFT_STEALINGS_IGNORE effect.
Definition at line 764 of file diplomats.cpp.
Referenced by dai_action_value_unit_vs_city(), diplomat_get_tech(), and find_city_to_diplomat().
| bool spy_attack | ( | struct player * | act_player, |
| struct unit * | act_unit, | ||
| struct tile * | tgt_tile, | ||
| const struct action * | paction | ||
| ) |
Diplomatic battle.
Returns TRUE iff action could be done, FALSE if it couldn't. Even if this returns TRUE, unit may have died during the action.
Definition at line 725 of file diplomats.cpp.
Referenced by unit_perform_action().
| bool spy_nuke_city | ( | struct player * | act_player, |
| struct unit * | act_unit, | ||
| struct city * | tgt_city, | ||
| const struct action * | paction | ||
| ) |
Hide a suitcase nuke in a city and detonate it.
Returns TRUE iff action could be done, FALSE if it couldn't. Even if this returns TRUE, unit may have died during the action.
Definition at line 1680 of file diplomats.cpp.
Referenced by unit_perform_action().
| bool spy_poison | ( | struct player * | pplayer, |
| struct unit * | pdiplomat, | ||
| struct city * | pcity, | ||
| const struct action * | paction | ||
| ) |
Poison a city's water supply.
'pplayer' is the player who tries to poison 'pcity' with its unit 'pdiplomat'.
Returns TRUE iff action could be done, FALSE if it couldn't. Even if this returns TRUE, unit may have died during the action.
Definition at line 84 of file diplomats.cpp.
Referenced by unit_perform_action().
| bool spy_sabotage_unit | ( | struct player * | pplayer, |
| struct unit * | pdiplomat, | ||
| struct unit * | pvictim, | ||
| const struct action * | paction | ||
| ) |
Sabotage an enemy unit.
Returns TRUE iff action could be done, FALSE if it couldn't. Even if this returns TRUE, unit may have died during the action.
Definition at line 477 of file diplomats.cpp.
Referenced by unit_perform_action().
| void spy_send_sabotage_list | ( | struct connection * | pc, |
| struct unit * | pdiplomat, | ||
| struct city * | pcity, | ||
| const struct action * | paction, | ||
| bool | disturb_player | ||
| ) |
Get list of improvements from city (for purposes of sabotage).
Only send back to the originating connection, if there is one. (?)
Definition at line 361 of file diplomats.cpp.
Referenced by handle_unit_action_query().
| bool spy_spread_plague | ( | struct player * | act_player, |
| struct unit * | act_unit, | ||
| struct city * | tgt_city, | ||
| const struct action * | paction | ||
| ) |
Spread a plague to the target city.
'act_player' is the player who tries to infect 'tgt_city' with its unit 'act_unit'.
Returns TRUE iff action could be done, FALSE if it couldn't. Even if this returns TRUE, unit may have died during the action.
Definition at line 167 of file diplomats.cpp.
Referenced by unit_perform_action().
| bool spy_steal_gold | ( | struct player * | act_player, |
| struct unit * | act_unit, | ||
| struct city * | tgt_city, | ||
| const struct action * | paction | ||
| ) |
Steal gold from another player.
The amount stolen is decided randomly. Not everything stolen reaches the player that ordered it stolen.
Returns TRUE iff action could be done, FALSE if it couldn't. Even if this returns TRUE, unit may have died during the action.
Definition at line 1424 of file diplomats.cpp.
Referenced by unit_perform_action().
| bool spy_steal_some_maps | ( | struct player * | act_player, |
| struct unit * | act_unit, | ||
| struct city * | tgt_city, | ||
| const struct action * | paction | ||
| ) |
Steal part of another player's map.
Returns TRUE iff action could be done, FALSE if it couldn't. Even if this returns TRUE, unit may have died during the action.
Definition at line 1559 of file diplomats.cpp.
Referenced by unit_perform_action().