53 if (
nullptr == punit) {
55 qDebug(
"handle_city_name_suggestion_req() invalid unit %d", unit_id);
61 qDebug(
"handle_city_name_suggest_req(unit_pos (%d, %d))",
63 dlsend_packet_city_name_suggestion_info(
71 qDebug(
"handle_city_name_suggest_req(unit_pos (%d, %d)): "
72 "cannot build there.",
97 qDebug(
"Error in specialist change request from client.");
118 if (
nullptr == pcity) {
120 qDebug(
"handle_city_make_specialist() bad city number %d.", city_id);
124 if (
nullptr == ptile) {
125 qCritical(
"handle_city_make_specialist() bad tile number %d.", tile_id);
130 qCritical(
"handle_city_make_specialist() tile (%d, %d) not in the "
131 "city map of \"%s\".",
142 qDebug(
"handle_city_make_specialist() not working (%d, %d) "
163 if (
nullptr == pcity) {
165 qDebug(
"handle_city_make_worker() bad city number %d.", city_id);
169 if (
nullptr == ptile) {
170 qCritical(
"handle_city_make_worker() bad tile number %d.", tile_id);
175 qCritical(
"handle_city_make_worker() tile (%d, %d) not in the "
176 "city map of \"%s\".",
188 qDebug(
"handle_city_make_worker() already working (%d, %d) \"%s\".",
194 qDebug(
"handle_city_make_worker() no specialists (%d, %d) \"%s\".",
200 qDebug(
"handle_city_make_worker() cannot work here (%d, %d) \"%s\".",
235 _(
"You have already sold something here this turn."));
246 PL_(
"You sell %s in %s for %d gold.",
247 "You sell %s in %s for %d gold.", price),
268 if (!pcity || !pimprove) {
288 _(
"Cannot buy in city created this turn."));
294 _(
"You have already bought this turn."));
301 _(
"You don't buy %s!"),
308 _(
"Can't buy units when city is in disorder."));
325 PL_(
"%d gold required.",
"%d gold required.", cost), cost);
329 PL_(
"%s You only have %d gold.",
351 Q_(
"?unit:You bought %s in %s."),
358 Q_(
"?improvement:You bought %s in %s."),
424 int production_kind,
int production_value)
429 if (!universals_n_is_valid(universals_n(production_kind))) {
430 qCritical(
"[%s] bad production_kind %d.", __FUNCTION__, production_kind);
431 prod.kind = VUT_NONE;
436 if (!universals_n_is_valid(
prod.kind)) {
437 qCritical(
"[%s] production_kind %d with bad production_value %d.",
438 __FUNCTION__, production_kind, production_value);
439 prod.kind = VUT_NONE;
458 _(
"You have bought this turn, can't change."));
498 bv_city_options options)
521 if (
nullptr == pcity) {
523 qDebug(
"handle_city_rally_point() bad city number %d.", city_id);
529 qCritical(
"handle_city_rally_point() invalid packet length %d (max %d)",
545 if (!checked_orders) {
547 qCritical(
"invalid rally point orders for city number %d.", city_id);
567 if (
nullptr == pcity) {
569 qDebug(
"handle_city_manager() bad city number %d.", city_id);
bool action_prob_possible(const struct act_prob probability)
Returns TRUE iff the given action probability belongs to an action that may be possible.
struct act_prob action_prob_vs_tile(const struct unit *actor_unit, const action_id act_id, const struct tile *target_tile, const struct extra_type *target_extra)
Get the actor unit's probability of successfully performing the chosen action on the target tile.
int city_production_build_shield_cost(const struct city *pcity)
Return the number of shields it takes to build current city production.
bool can_city_build_now(const struct city *pcity, const struct universal *target)
Returns whether city can immediately build given target, unit or improvement.
bool city_can_use_specialist(const struct city *pcity, Specialist_type_id type)
Returns TRUE iff the given city can use this kind of specialist.
bool city_production_has_flag(const struct city *pcity, enum impr_flag_id flag)
Return TRUE when the current production has this flag.
bool city_map_includes_tile(const struct city *const pcity, const struct tile *map_tile)
Returns TRUE iff pcity's city map includes the specified tile.
const char * city_name_get(const struct city *pcity)
Return the name of the city.
citizens city_specialists(const struct city *pcity)
Give the number of specialists in a city.
bool is_city_center(const struct city *pcity, const struct tile *ptile)
Return TRUE if the city is centered at the given tile.
bool city_can_work_tile(const struct city *pcity, const struct tile *ptile)
Returns TRUE when a tile is available to be worked, or the city itself is currently working the tile ...
bool city_can_change_build(const struct city *pcity)
Returns TRUE iff the given city can change what it is building.
void handle_city_change(struct player *pplayer, int city_id, int production_kind, int production_value)
Handle request to change current production.
void handle_city_options_req(struct player *pplayer, int city_id, bv_city_options options)
Handles a packet from the client that requests the city options for the given city be changed.
void handle_city_name_suggestion_req(struct player *pplayer, int unit_id)
Send city_name_suggestion packet back to requesting conn, with suggested name and with same id which ...
void handle_city_manager(struct player *pplayer, int city_id, bool enabled, struct cm_parameter parameter)
Handles a request to set city manager parameter.
void handle_city_worklist(struct player *pplayer, int city_id, const struct worklist *worklist)
Handle city worklist update request.
void handle_city_buy(struct player *pplayer, int city_id)
Handle buying request.
void handle_city_change_specialist(struct player *pplayer, int city_id, Specialist_type_id from, Specialist_type_id to)
Handle request to change specialist type.
void really_handle_city_buy(struct player *pplayer, struct city *pcity)
Handle buying request.
void handle_city_sell(struct player *pplayer, int city_id, int build_id)
Handle improvement selling request.
void handle_city_rally_point(struct player *pplayer, int city_id, int length, bool persistent, bool vigilant, const struct unit_order *orders)
Handles a request to set city rally point for new units.
void handle_city_make_worker(struct player *pplayer, int city_id, int tile_id)
Handle request to turn specialist in to city worker.
void handle_city_refresh(struct player *pplayer, int city_id)
Handle city refresh request.
void handle_city_make_specialist(struct player *pplayer, int city_id, int tile_id)
Handle request to change city worker in to specialist.
void handle_city_rename(struct player *pplayer, int city_id, const char *name)
'struct packet_city_rename' handler.
void really_handle_city_sell(struct player *pplayer, struct city *pcity, struct impr_type *pimprove)
Handle improvement selling request.
void auto_arrange_workers(struct city *pcity)
Call sync_cities() to send the affected cities to the clients.
bool city_refresh(struct city *pcity)
Updates unit upkeeps and city internal cached data.
void city_refresh_for_player(struct player *pplayer)
Called on government change or wonder completion or stuff like that – Syela.
void cm_copy_parameter(struct cm_parameter *dest, const struct cm_parameter *const src)
Copy the parameter from the source to the destination field.
void conn_list_do_unbuffer(struct conn_list *dest)
Convenience functions to unbuffer a list of connections.
void conn_list_do_buffer(struct conn_list *dest)
Convenience functions to buffer a list of connections.
#define PL_(String1, String2, n)
const struct ft_color ftc_server
const char * city_link(const struct city *pcity)
Get a text link to a city.
int impr_sell_gold(const struct impr_type *pimprove)
Returns the amount of gold received when this improvement is sold.
struct impr_type * improvement_by_number(const Impr_type_id id)
Returns the improvement type for the given index/ID.
const char * improvement_name_translation(const struct impr_type *pimprove)
Return the (translated) name of the given improvement.
enum test_result test_player_sell_building_now(struct player *pplayer, const city *pcity, const struct impr_type *pimprove)
Return TRUE iff the player can sell the given improvement from city.
#define fc_assert_ret(condition)
struct tile * index_to_tile(const struct civ_map *imap, int mindex)
Return the tile for the given index position.
void notify_player(const struct player *pplayer, const struct tile *ptile, enum event_type event, const struct ft_color color, const char *format,...)
Similar to notify_conn_packet (see also), but takes player as "destination".
struct unit * player_unit_by_number(const struct player *pplayer, int unit_id)
If the specified player owns the unit with the specified id, return pointer to the unit struct.
struct city * player_city_by_number(const struct player *pplayer, int city_id)
If the specified player owns the city with the specified id, return pointer to the city struct.
bool player_owns_city(const struct player *pplayer, const struct city *pcity)
Return TRUE iff the given player owns the city.
void send_player_info_c(struct player *src, struct conn_list *dest)
Send information about player slot 'src', or all valid (i.e.
struct universal universal_by_number(const enum universals_n kind, const int value)
Combine values into a universal structure.
bool are_universals_equal(const struct universal *psource1, const struct universal *psource2)
Return TRUE iff the two sources are equivalent.
#define sanity_check_city(x)
Specialist_type_id specialist_count()
Return the number of specialist_types.
#define specialist_type_iterate_end
#define specialist_type_iterate(sp)
#define DEFAULT_SPECIALIST
struct city::@14 rally_point
bv_city_options city_options
struct universal production
struct unit_order * orders
char name[MAX_LEN_CITYNAME]
citizens specialists[SP_MAX]
struct cm_parameter * cm_parameter
struct packet_game_info info
struct conn_list * connections
struct player_economic economic
int fc_snprintf(char *str, size_t n, const char *format,...)
See also fc_utf8_snprintf_trunc(), fc_utf8_snprintf_rep().
#define sz_strlcpy(dest, src)
#define tile_worked(_tile)
const struct unit_type * utype
const struct impr_type * building
void illegal_action_msg(struct player *pplayer, const enum event_type event, struct unit *actor, const action_id stopped_action, const struct tile *target_tile, const struct city *target_city, const struct unit *target_unit)
Try to explain to the player why an action is illegal.
const char * utype_name_translation(const struct unit_type *punittype)
Return the (translated) name of the unit type.
void worklist_copy(struct worklist *dst, const struct worklist *src)
Copy contents from worklist src to worklist dst.