Project

General

Profile

Feature #1260 ยป 0015-common-Remove-trailing-spaces.patch

Marko Lindqvist, 03/22/2025 12:06 AM

View differences:

common/city.c
if (state) {
fc_snprintf(buffer, sizeof(buffer), "%s(%s)",
improvement_name_translation(pimprove), state);
improvement_name_translation(pimprove), state);
return buffer;
} else {
return improvement_name_translation(pimprove);
......
**************************************************************************/
bool can_city_build_improvement_now(const struct city *pcity,
const struct impr_type *pimprove)
{
{
if (!can_city_build_improvement_direct(pcity, pimprove)) {
return FALSE;
}
......
}
/**********************************************************************//**
Return whether given city can build given unit, ignoring whether unit
Return whether given city can build given unit, ignoring whether unit
is obsolete.
**************************************************************************/
bool can_city_build_unit_direct(const struct civ_map *nmap,
......
}
/**********************************************************************//**
Return whether given city can build given unit; returns FALSE if unit is
Return whether given city can build given unit; returns FALSE if unit is
obsolete.
**************************************************************************/
bool can_city_build_unit_now(const struct civ_map *nmap,
......
}
/**********************************************************************//**
Returns whether city can ever build given target, unit or improvement.
Returns whether city can ever build given target, unit or improvement.
**************************************************************************/
bool can_city_build_later(const struct civ_map *nmap,
const struct city *pcity,
......
void city_choose_build_default(const struct civ_map *nmap, struct city *pcity)
{
if (NULL == city_tile(pcity)) {
/* When a "dummy" city is created with no tile, then choosing a build
/* When a "dummy" city is created with no tile, then choosing a build
* target could fail. This currently might happen during map editing.
* FIXME: assumes the first unit is always "valid", so check for
* obsolete units elsewhere. */
......
const struct impr_type *pimprove)
{
if (NULL == pimprove) {
/* Callers should ensure that any external data is tested with
/* Callers should ensure that any external data is tested with
* valid_improvement_by_number() */
return FALSE;
}
......
}
}
prod += (prod
prod += (prod
* get_tile_output_bonus(pcity, ptile, output,
EFT_OUTPUT_PER_TILE))
EFT_OUTPUT_PER_TILE))
/ 100;
if (penalty_limit > 0 && prod > penalty_limit) {
if (prod <= game.info.granularity) {
......
}
/**********************************************************************//**
Return the (translated) name of the given city style.
Return the (translated) name of the given city style.
You don't have to free the return pointer.
**************************************************************************/
const char *city_style_name_translation(const int style)
......
}
/**********************************************************************//**
Return TRUE iff a city exists within a city radius of the given
Return TRUE iff a city exists within a city radius of the given
location. may_be_on_center determines if a city at x,y counts.
**************************************************************************/
bool city_exists_within_max_city_map(const struct civ_map *nmap,
......
*angry = MIN(base_angry, size - spes);
/* Create unhappy citizens. In the beginning, all who are not content,
* specialists or angry are unhappy. This is changed by luxuries and
* specialists or angry are unhappy. This is changed by luxuries and
* buildings later. */
*unhappy = (size - spes - *content - *angry);
......
}
/**********************************************************************//**
Make people happy:
Make people happy:
* angry citizen are eliminated first
* then content are made happy, then unhappy content, etc.
* each conversions costs 2 or 4 luxuries.
......
}
/**********************************************************************//**
Gets whether cities that pcity trades with had the plague. If so, it
Gets whether cities that pcity trades with had the plague. If so, it
returns the health penalty in tenth of percent which depends on the size
of both cities. The health penalty is given as the product of the ruleset
option 'game.info.illness_trade_infection' (in percent) and the square
......
/* Calculate city production!
*
* This is a rather complicated process if we allow rules to become
* more generalized. We can assume that there are no recursive dependency
* more generalized. We can assume that there are no recursive dependency
* loops, but there are some dependencies that do not follow strict
* ordering. For instance corruption must be calculated before
* ordering. For instance corruption must be calculated before
* trade taxes can be counted up, which must occur before the science bonus
* is added on. But the calculation of corruption must include the
* trade bonus. To do this without excessive special casing means that in
* is added on. But the calculation of corruption must include the
* trade bonus. To do this without excessive special casing means that in
* this case the bonuses are multiplied on twice (but only saved the second
* time).
*/
......
if (settings->cancelling == TRI_ACTIVE) {
can_trade = TRUE;
}
}
}
if (can_trade) {
int value;
......
{
log_debug("Improvement %s removed from city %s",
improvement_rule_name(pimprove), pcity->name);
pcity->built[improvement_index(pimprove)].turn = I_DESTROYED;
if (is_server() && is_wonder(pimprove)) {
common/city.h
bool was_happy;
bool had_famine;
int anarchy; /* anarchy rounds count */
int rapture; /* rapture rounds count */
int anarchy; /* anarchy rounds count */
int rapture; /* rapture rounds count */
int turn_founded;
int turn_last_built;
common/combat.c
double def_P_lose1 = 1 - att_P_lose1;
/*
This calculates
This calculates
binomial_coeff(def_N_lose-1 + lr, lr)
* def_P_lose1^(def_N_lose-1)
......
*def_fp = MIN(*def_fp, game.info.low_firepower_pearl_harbor);
}
/*
/*
* When attacked by fighters, helicopters have their firepower
* reduced to low firepower bonus.
*/
......
}
/*******************************************************************//**
Try defending against nuclear attack; if successful, return a city which
Try defending against nuclear attack; if successful, return a city which
had enough luck and EFT_NUKE_PROOF.
If the attack was successful return NULL.
***********************************************************************/
......
/*******************************************************************//**
return the modified defense power of a unit.
An veteran aegis cruiser in a mountain city with SAM and SDI defense
An veteran aegis cruiser in a mountain city with SAM and SDI defense
being attacked by a missile gets defense 288.
***********************************************************************/
int get_total_defense_power(const struct unit *attacker,
common/culture.h
/**********************************************************************
/***********************************************************************
Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......
}
#endif /* __cplusplus */
#endif /* FC__CULTURE_H */
#endif /* FC__CULTURE_H */
common/diptreaty.c
&& diplomacy_possible(pplayer,aplayer)
&& get_player_bonus(pplayer, EFT_NO_DIPLOMACY) <= 0
&& get_player_bonus(aplayer, EFT_NO_DIPLOMACY) <= 0
&& (player_has_embassy(aplayer, pplayer)
&& (player_has_embassy(aplayer, pplayer)
|| player_has_embassy(pplayer, aplayer)
|| player_diplstate_get(pplayer, aplayer)->contact_turns_left
> 0
......
log_error("Illegal tech value %i in clause.", val);
return FALSE;
}
if (is_pact_clause(type)
&& ((ds == DS_PEACE && type == CLAUSE_PEACE)
|| (ds == DS_ARMISTICE && type == CLAUSE_PEACE)
......
/* we already have this diplomatic state */
log_error("Illegal treaty suggested between %s and %s - they "
"already have this treaty level.",
nation_rule_name(nation_of_player(ptreaty->plr0)),
nation_rule_name(nation_of_player(ptreaty->plr0)),
nation_rule_name(nation_of_player(ptreaty->plr1)));
return FALSE;
}
......
pclause->type = type;
pclause->from = pfrom;
pclause->value = val;
clause_list_append(ptreaty->clauses, pclause);
ptreaty->accept0 = FALSE;
common/events.c
}
/**********************************************************************//**
Initialize events.
Initialize events.
Now also initialise sorted_events[].
**************************************************************************/
void events_init(void)
......
}
/**********************************************************************//**
Free events.
Free events.
**************************************************************************/
void events_free(void)
{
common/extras.c
if (extra_has_flag(pextra, EF_AUTO_ON_CITY_CENTER)) {
struct tile *vtile = tile_virtual_new(ptile);
/* Would extra get rebuilt if removed */
/* Would extra get rebuilt if removed */
tile_remove_extra(vtile, pextra);
if (player_can_build_extra(pextra, city_owner(pcity), vtile)) {
/* No need to worry about conflicting extras - extra would had
common/featured_text.c
}
return stop - featured_text + 1;
}
/**********************************************************************//**
Separate the text from the text features. 'tags' can be nullptr.
common/featured_text.h
* Full name sequence: [strike] ... [/strike]
* Abbreviation sequence: [s] ... [/s]
* Text tag type: TTT_STRIKE
*
*
* - Underline.
* Full name sequence: [underline] ... [/underline]
* Abbreviation sequence: [u] ... [/u]
......
#define FT_OFFSET_UNSET ((ft_offset_t) -1)
/* Opaque type. */
struct text_tag;
struct text_tag;
/* Define struct text_tag_list. */
#define SPECLIST_TAG text_tag
#define SPECLIST_TYPE struct text_tag
#include "speclist.h"
#include "speclist.h"
#define text_tag_list_iterate(tags, ptag) \
TYPED_LIST_ITERATE(struct text_tag, tags, ptag)
common/game.h
char *helptxt;
};
/* The number of turns that the first user needs to be attached to a
* player for that user to be ranked as that player */
/* The number of turns that the first user needs to be attached to
* a player for that user to be ranked as that player */
#define TURNS_NEEDED_TO_RANK 10
struct civ_game {
common/government.c
}
/**********************************************************************//**
Return the (translated) name of the given government.
Return the (translated) name of the given government.
You don't have to free the return pointer.
**************************************************************************/
const char *government_name_translation(const struct government *pgovern)
......
}
/**********************************************************************//**
Return the (translated) name of the given government of a player.
Return the (translated) name of the given government of a player.
You don't have to free the return pointer.
**************************************************************************/
const char *government_name_for_player(const struct player *pplayer)
common/improvement.c
}
/**********************************************************************//**
Return the (translated) name of the given improvement.
Return the (translated) name of the given improvement.
You don't have to free the return pointer.
**************************************************************************/
const char *improvement_name_translation(const struct impr_type *pimprove)
......
}
/* Check if particular building can be solt */
if (pimprove != NULL
if (pimprove != NULL
&& !can_city_sell_building(pcity, pimprove)) {
return TR_OTHER_FAILURE;
}
common/mapimg.c
astr_str(&defaults[MAPDEF_TURNS]), astr_str(&defaults[MAPDEF_ZOOM]),
astr_str(&defaults[MAPDEF_MAP]),
astr_str(&str_format), astr_str(&str_showplr));
mapdef_destroy(pmapdef);
astr_free(&str_format);
astr_free(&str_showplr);
......
int x, int y)
{
int nat_x, nat_y;
MAP_TO_NATIVE_POS(&nat_x, &nat_y, x, y);
*base_x = nat_x * TILE_SIZE + ((nat_y % 2) ? TILE_SIZE / 2 : 0);
common/nation.c
}
/************************************************************************//**
Return the (translated) adjective for the given nation.
Return the (translated) adjective for the given nation.
You don't have to free the return pointer.
****************************************************************************/
const char *nation_adjective_translation(const struct nation_type *pnation)
......
}
/************************************************************************//**
Return the (translated) plural noun of the given nation.
Return the (translated) plural noun of the given nation.
You don't have to free the return pointer.
****************************************************************************/
const char *nation_plural_translation(const struct nation_type *pnation)
......
}
/************************************************************************//**
Return the (translated) adjective for the given nation of a player.
Return the (translated) adjective for the given nation of a player.
You don't have to free the return pointer.
****************************************************************************/
const char *nation_adjective_for_player(const struct player *pplayer)
......
}
/************************************************************************//**
Return the (translated) plural noun of the given nation of a player.
Return the (translated) plural noun of the given nation of a player.
You don't have to free the return pointer.
****************************************************************************/
const char *nation_plural_for_player(const struct player *pplayer)
common/oblig_reqs.c
ae_contra_close(oreq->contras);
} obligatory_req_vector_iterate_end;
obligatory_req_vector_free(&oblig_hard_reqs_sr[i]);
}
}
}
/**********************************************************************//**
common/reqtext.c
fc_strlcat(buf, prefix, bufsz);
if (preq->present) {
cat_snprintf(buf, bufsz,
/* TRANS: "Requires that you are playing Asian style
/* TRANS: "Requires that you are playing Asian style
* nation." */
_("Requires that you are playing %s style nation."),
style_name_translation(preq->source.value.style));
......
/* TRANS: %s is a list of unit classes separated by "or". */
cat_snprintf(buf, bufsz, Q_("?uclasslist:Requires %s units."),
astr_str(&list));
} else {
} else {
/* TRANS: %s is a list of unit classes separated by "or". */
cat_snprintf(buf, bufsz, Q_("?uclasslist:Does not apply to "
"%s units."),
common/spaceship.c
struct spaceship_component *fill)
{
fc_assert_ret_val(fill != NULL, FALSE);
if (ship->modules > (ship->habitation + ship->life_support
+ ship->solar_panels)) {
/* "nice" governments prefer to keep success 100%;
......
int i;
if (!BV_ISSET(ship->structure, 0)) {
/* if we don't have the first structural, place that! */
/* If we don't have the first structural, place that! */
fill->type = SSHIP_PLACE_STRUCTURAL;
fill->num = 0;
return TRUE;
}
if (ship->habitation >= 1
&& !BV_ISSET(ship->structure, modules_info[0].required)) {
req = modules_info[0].required;
common/spaceship.h
/**********************************************************************
/***********************************************************************
Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
common/tech.h
use Tech_type_id very widely, and don't use (-1) flag values. (?)
*/
/* [more accurately]
* Unlike most other indices, the Tech_type_id is widely used, because it
* so frequently passed to packet and scripting. The client menu routines
* Unlike most other indices, the Tech_type_id is widely used, because it
* so frequently passed to packet and scripting. The client menu routines
* sometimes add and subtract these numbers.
*/
#define A_NONE 0
......
bv_tech_flags flags;
struct strvec *helptext;
/*
* Message displayed to the first player to get a bonus tech
/*
* Message displayed to the first player to get a bonus tech
*/
char *bonus_message;
......
* be right if game.info.tech_cost_style is TECH_COST_CIV1CIV2. */
double cost;
/*
/*
* Number of requirements this technology has _including_
* itself. Precalculated at server then send to client.
*/
common/tile.c
empty_cleared = TRUE;
}
return &(empty_extras);
return &(empty_extras);
}
/************************************************************************//**
......
tile_mine(ptile, tgt);
return TRUE;
case ACTIVITY_IRRIGATE:
case ACTIVITY_IRRIGATE:
tile_irrigate(ptile, tgt);
return TRUE;
common/unit.c
{
enum unit_activity current = punit->activity;
struct extra_type *target = punit->activity_target;
enum unit_activity current2 =
(current == ACTIVITY_FORTIFIED) ? ACTIVITY_FORTIFYING : current;
enum unit_activity current2
= (current == ACTIVITY_FORTIFIED) ? ACTIVITY_FORTIFYING : current;
enum gen_action action = punit->action;
bool result;
......
enemy unit (that has a ZOC) on a terrain that has zoc rules.
Since this function is used in the client, it has to deal with some
client-specific features, like FoW and the fact that the client cannot
client-specific features, like FoW and the fact that the client cannot
see units inside enemy cities.
**************************************************************************/
bool is_plr_zoc_client(const struct player *pplayer, const struct tile *ptile0,
......
}
/**********************************************************************//**
Helper for transporter_for_unit() and transporter_for_unit_at()
Helper for transporter_for_unit() and transporter_for_unit_at()
**************************************************************************/
static struct unit *base_transporter_for_unit(const struct unit *pcargo,
const struct tile *ptile,
common/unit.h
};
enum unit_focus_status {
FOCUS_AVAIL, FOCUS_WAIT, FOCUS_DONE
FOCUS_AVAIL, FOCUS_WAIT, FOCUS_DONE
};
enum goto_route_type {
common/unittype.c
Return the "happy cost" (the number of citizens who are discontented)
for this unit.
**************************************************************************/
int utype_happy_cost(const struct unit_type *ut,
int utype_happy_cost(const struct unit_type *ut,
const struct player *pplayer)
{
return ut->happy_cost * get_player_bonus(pplayer, EFT_UNHAPPY_FACTOR);
common/victory.h
/**********************************************************************
/***********************************************************************
Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......
}
#endif /* __cplusplus */
#endif /* FC__VICTORY_H */
#endif /* FC__VICTORY_H */
common/workertask.h
/**********************************************************************
/***********************************************************************
Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......
}
#endif /* __cplusplus */
#endif /* FC__WORKERTASK_H */
#endif /* FC__WORKERTASK_H */
common/worklist.c
for (i = 0; i < MAX_LEN_WORKLIST; i++) {
/* just setting the entry to zero: */
pwl->entries[i].kind = VUT_NONE;
/* all the union pointers should be in the same place: */
/* all the union pointers should be in the same place: */
pwl->entries[i].value.building = NULL;
}
}
/************************************************************************//**
Returns the number of entries in the worklist. The returned value can
Returns the number of entries in the worklist. The returned value can
also be used as the next available worklist index (assuming that
len < MAX_LEN_WORKLIST).
****************************************************************************/
......
void worklist_advance(struct worklist *pwl)
{
worklist_remove(pwl, 0);
}
}
/************************************************************************//**
Copy contents from worklist src to worklist dst.
......
}
/* just setting the entry to zero: */
pwl->entries[pwl->length - 1].kind = VUT_NONE;
/* all the union pointers should be in the same place: */
/* all the union pointers should be in the same place: */
pwl->entries[pwl->length - 1].value.building = NULL;
pwl->length--;
}
/************************************************************************//**
Adds the id to the next available slot in the worklist. 'id' is the ID of
Adds the id to the next available slot in the worklist. 'id' is the ID of
the unit/building to be produced; is_unit specifies whether it's a unit or
a building. Returns TRUE if successful.
a building. Returns TRUE if successful.
****************************************************************************/
bool worklist_append(struct worklist *pwl, const struct universal *prod)
{
......
/************************************************************************//**
Inserts the production at the location idx in the worklist, thus moving
all subsequent entries down. 'id' specifies the unit/building to
be produced; is_unit tells whether it's a unit or building. Returns TRUE
all subsequent entries down. 'id' specifies the unit/building to
be produced; is_unit tells whether it's a unit or building. Returns TRUE
if successful.
****************************************************************************/
bool worklist_insert(struct worklist *pwl, const struct universal *prod,
    (1-1/1)