Feature #1556 ยป 0040-server-Rermove-trailing-spaces.patch
server/animals.c | ||
---|---|---|
/***********************************************************************
|
||
Freeciv - Copyright (C) 1996 - 2004 The Freeciv Project Team
|
||
Freeciv - Copyright (C) 1996 - 2004 The Freeciv Project Team
|
||
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
|
||
the Free Software Foundation; either version 2, or (at your option)
|
server/auth.c | ||
---|---|---|
fc_snprintf(msg, MAX_LEN_MSG,
|
||
_("The password must have at least %d capital letters, %d "
|
||
"numbers, and be at minimum %d [printable] characters long. "
|
||
"Try again."),
|
||
"Try again."),
|
||
MIN_PASSWORD_CAPS, MIN_PASSWORD_NUMS, MIN_PASSWORD_LEN);
|
||
for (i = 0; i < strlen(password); i++) {
|
server/barbarian.c | ||
---|---|---|
TRUE, FALSE, FALSE)) {
|
||
/* Move */
|
||
(void) unit_move_pay(punit2, dir_tiles[rdir]);
|
||
log_debug("Moved barbarian unit from (%d, %d) to (%d, %d)",
|
||
log_debug("Moved barbarian unit from (%d, %d) to (%d, %d)",
|
||
TILE_XY(ptile), TILE_XY(dir_tiles[rdir]));
|
||
dest_found = TRUE;
|
||
}
|
server/cityhand.c | ||
---|---|---|
/* This function corresponds to city_can_buy() in the client. */
|
||
fc_assert_ret(pcity && player_owns_city(pplayer, pcity));
|
||
|
||
if (pcity->turn_founded == game.info.turn) {
|
||
notify_player(pplayer, pcity->tile, E_BAD_COMMAND, ftc_server,
|
||
_("Cannot buy in city created this turn."));
|
||
... | ... | |
return; /* sanity */
|
||
}
|
||
if (cost > pplayer->economic.gold) {
|
||
/* In case something changed while player tried to buy, or player
|
||
/* In case something changed while player tried to buy, or player
|
||
* tried to cheat! */
|
||
/* Split into two to allow localization of two pluralisations. */
|
||
char buf[MAX_LEN_MSG];
|
server/commands.c | ||
---|---|---|
NULL, NULL,
|
||
CMD_ECHO_ADMINS, VCF_NONE, 50
|
||
},
|
||
{"timeoutincrease", ALLOW_CTRL,
|
||
{"timeoutincrease", ALLOW_CTRL,
|
||
/* TRANS: translate text between <> only */
|
||
N_("timeoutincrease <turn> <turninc> <value> <valuemult>"),
|
||
N_("timeoutincrease <turn> <turninc> <value> <valuemult>"),
|
||
N_("See \"/help timeoutincrease\"."),
|
||
N_("Every <turn> turns, add <value> to timeout timer, then add <turninc> "
|
||
"to <turn> and multiply <value> by <valuemult>. Use this command in "
|
server/console.c | ||
---|---|---|
{
|
||
static char buf[MAX_LEN_CONSOLE_LINE];
|
||
va_list args;
|
||
|
||
va_start(args, message);
|
||
fc_vsnprintf(buf, sizeof(buf), message, args);
|
||
va_end(args);
|
server/diplhand.c | ||
---|---|---|
#define TURNS_LEFT 16
|
||
/**********************************************************************//**
|
||
Calls treaty_evaluate function if such is set for AI player.
|
||
Calls treaty_evaluate function if such is set for AI player.
|
||
**************************************************************************/
|
||
static void call_treaty_evaluate(struct player *pplayer, struct player *aplayer,
|
||
struct treaty *ptreaty)
|
||
... | ... | |
if (pgiver != pplayer && pgiver != pother) {
|
||
return;
|
||
}
|
||
|
||
ptreaty = find_treaty(pplayer, pother);
|
||
if (ptreaty && remove_clause(ptreaty, pgiver, type, value)) {
|
||
... | ... | |
player_number(pplayer),
|
||
player_number(pplayer));
|
||
notify_player(pother, NULL, E_DIPLOMACY, ftc_server,
|
||
_("%s canceled the meeting!"),
|
||
_("%s canceled the meeting!"),
|
||
player_name(pplayer));
|
||
/* Need to send to pplayer too, for multi-connects: */
|
||
dlsend_packet_diplomacy_cancel_meeting(pplayer->connections,
|
||
player_number(pother),
|
||
player_number(pplayer));
|
||
notify_player(pplayer, NULL, E_DIPLOMACY, ftc_server,
|
||
_("Meeting with %s canceled."),
|
||
_("Meeting with %s canceled."),
|
||
player_name(pother));
|
||
treaty_remove(ptreaty);
|
||
}
|
||
... | ... | |
dsend_packet_diplomacy_init_meeting(dest, player_number(other),
|
||
player_number(pplayer));
|
||
clause_list_iterate(ptreaty->clauses, pclause) {
|
||
dsend_packet_diplomacy_create_clause(dest,
|
||
dsend_packet_diplomacy_create_clause(dest,
|
||
player_number(other),
|
||
player_number(pclause->from),
|
||
pclause->type,
|
server/diplomats.c | ||
---|---|---|
/************************************************************************//**
|
||
Bribe an enemy unit.
|
||
|
||
- Can't bribe a unit if:
|
||
- Player doesn't have enough gold.
|
||
- Otherwise, the unit will be bribed.
|
||
... | ... | |
/************************************************************************//**
|
||
This determines if a diplomat/spy survives and escapes.
|
||
Spies have a game.server.diplchance specified chance of survival (better
|
||
Spies have a game.server.diplchance specified chance of survival (better
|
||
if veteran):
|
||
- Diplomats always die.
|
||
- Escapes to home city.
|
server/edithand.c | ||
---|---|---|
notify_conn(pc->self, ptile, E_BAD_COMMAND, ftc_editor,
|
||
/* TRANS: ..." at <tile-coordinates> because"... */
|
||
_("Cannot create a city at %s because the "
|
||
"given owner's player id %d is invalid"),
|
||
"given owner's player id %d is invalid"),
|
||
tile_link(ptile), owner);
|
||
return;
|
||
... | ... | |
changed = TRUE;
|
||
}
|
||
} improvement_iterate_end;
|
||
|
||
/* Handle food stock change. */
|
||
if (packet->food_stock != pcity->food_stock) {
|
||
int max = city_granary_size(city_size_get(pcity));
|
||
... | ... | |
city_refresh_queue_processing();
|
||
/* FIXME: city_refresh_queue_processing only sends to city owner? */
|
||
send_city_info(NULL, pcity);
|
||
send_city_info(NULL, pcity);
|
||
conn_list_do_unbuffer(game.est_connections);
|
||
}
|
||
... | ... | |
/************************************************************************//**
|
||
Handle editing of any or all player properties.
|
||
****************************************************************************/
|
||
void handle_edit_player(struct connection *pc,
|
||
void handle_edit_player(struct connection *pc,
|
||
const struct packet_edit_player *packet)
|
||
{
|
||
struct player *pplayer;
|
server/gamehand.c | ||
---|---|---|
#include <fc_config.h>
|
||
#endif
|
||
#include <stdio.h> /* for remove() */
|
||
#include <stdio.h> /* for remove() */
|
||
/* utility */
|
||
#include "capability.h"
|
||
... | ... | |
return L_START_ATTACK_FAST;
|
||
case 'A':
|
||
return L_START_ATTACK_STRONG;
|
||
default:
|
||
default:
|
||
return 0;
|
||
}
|
||
}
|
||
... | ... | |
utype_has_flag(utype, UTYF_FLAGLESS)),
|
||
NULL);
|
||
/* For scenarios or dispersion, huts may coincide with player starts (in
|
||
/* For scenarios or dispersion, huts may coincide with player starts (in
|
||
* other cases, huts are avoided as start positions). Remove any such hut,
|
||
* and make sure to tell the client, since we may have already sent this
|
||
* tile (with the hut) earlier: */
|
||
... | ... | |
Send game_info packet; some server options and various stuff...
|
||
dest == NULL means game.est_connections
|
||
It may be sent at any time. It MUST be sent before any player info,
|
||
It may be sent at any time. It MUST be sent before any player info,
|
||
as it contains the number of players. To avoid inconsistency, it
|
||
SHOULD be sent after rulesets and any other server settings.
|
||
****************************************************************************/
|
server/infrapts.c | ||
---|---|---|
/***********************************************************************
|
||
Freeciv - Copyright (C) 1996 - 2004 The Freeciv Project Team
|
||
Freeciv - Copyright (C) 1996 - 2004 The Freeciv Project Team
|
||
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
|
||
the Free Software Foundation; either version 2, or (at your option)
|
server/maphand.c | ||
---|---|---|
/**********************************************************************//**
|
||
Send all tiles known to specified clients.
|
||
If dest is NULL means game.est_connections.
|
||
|
||
Note for multiple connections this may change "sent" multiple times
|
||
for single player. This is ok, because "sent" data is just optimised
|
||
calculations, so it will be correct before this, for each connection
|
||
... | ... | |
struct vision_site *psite = map_get_player_site(ptile, pplayer);
|
||
fc_assert_ret_val(psite == NULL || psite->location == ptile, NULL);
|
||
|
||
return psite;
|
||
}
|
||
... | ... | |
buffer_shared_vision(pplayer);
|
||
players_iterate(pplayer2) {
|
||
if (!really_gives_vision(pplayer, pplayer2)
|
||
&& BV_ISSET(save_vision[player_index(pplayer)],
|
||
&& BV_ISSET(save_vision[player_index(pplayer)],
|
||
player_index(pplayer2))) {
|
||
log_debug("really removing shared vision from %s to %s",
|
||
player_name(pplayer), player_name(pplayer2));
|
||
... | ... | |
const struct terrain *newter)
|
||
{
|
||
bool old_is_ocean, new_is_ocean;
|
||
|
||
if (!oldter || !newter) {
|
||
return FALSE;
|
||
}
|
server/notify.c | ||
---|---|---|
const struct tile *ptile,
|
||
enum event_type event,
|
||
const struct ft_color color,
|
||
const char *format, ...)
|
||
const char *format, ...)
|
||
{
|
||
struct conn_list *dest = pplayer ? pplayer->connections : NULL;
|
||
struct packet_chat_msg genmsg;
|
||
... | ... | |
const struct tile *ptile,
|
||
enum event_type event,
|
||
const struct ft_color color,
|
||
const char *format, ...)
|
||
const char *format, ...)
|
||
{
|
||
struct packet_chat_msg genmsg;
|
||
struct event_cache_players *players = NULL;
|
server/sanitycheck.c | ||
---|---|---|
}
|
||
} extra_type_by_cause_iterate_end;
|
||
SANITY_TILE(ptile, terrain_index(pterrain) >= T_FIRST
|
||
SANITY_TILE(ptile, terrain_index(pterrain) >= T_FIRST
|
||
&& terrain_index(pterrain) < terrain_count());
|
||
} whole_map_iterate_end;
|
||
}
|
||
... | ... | |
/* Check diplomatic status of stacked units. */
|
||
unit_list_iterate(ptile->units, punit2) {
|
||
SANITY_TILE(ptile, pplayers_allied(unit_owner(punit),
|
||
SANITY_TILE(ptile, pplayers_allied(unit_owner(punit),
|
||
unit_owner(punit2)));
|
||
} unit_list_iterate_end;
|
||
if (pcity) {
|
||
SANITY_TILE(ptile, pplayers_allied(unit_owner(punit),
|
||
SANITY_TILE(ptile, pplayers_allied(unit_owner(punit),
|
||
city_owner(pcity)));
|
||
}
|
||
} unit_list_iterate_end;
|
server/sernet.c | ||
---|---|---|
/*************************************************************************//**
|
||
Simplify a loop by wrapping get_packet_from_connection.
|
||
*****************************************************************************/
|
||
static bool get_packet(struct connection *pconn,
|
||
static bool get_packet(struct connection *pconn,
|
||
struct packet_to_handle *ppacket)
|
||
{
|
||
ppacket->data = get_packet_from_connection(pconn, &ppacket->type);
|
||
... | ... | |
connection_do_unbuffer(pconn);
|
||
#if PROCESSING_TIME_STATISTICS
|
||
log_verbose("processed request %d in %gms", request_id,
|
||
log_verbose("processed request %d in %gms", request_id,
|
||
timer_read_seconds(request_time) * 1000.0);
|
||
#endif /* PROCESSING_TIME_STATISTICS */
|
||
... | ... | |
conn_list_append(game.all_connections, pconn);
|
||
log_verbose("connection (%s) from %s (%s)",
|
||
log_verbose("connection (%s) from %s (%s)",
|
||
pconn->username, pconn->addr, pconn->server.ipaddr);
|
||
/* Give a ping timeout to send the PACKET_SERVER_JOIN_REQ, or close
|
||
* the mute connection. This timer will be canceled into
|
||
... | ... | |
#ifndef FREECIV_HAVE_WINSOCK
|
||
/* SO_REUSEADDR considered harmful on Win, necessary otherwise */
|
||
if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR,
|
||
if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR,
|
||
(char *)&on, sizeof(on)) == -1) {
|
||
log_error("setsockopt SO_REUSEADDR failed: %s",
|
||
fc_strerror(fc_get_errno()));
|
||
... | ... | |
}
|
||
#endif /* FREECIV_HAVE_WINSOCK */
|
||
if (setsockopt(socksend, SOL_SOCKET, SO_BROADCAST,
|
||
if (setsockopt(socksend, SOL_SOCKET, SO_BROADCAST,
|
||
(const char*)&setting, sizeof(setting))) {
|
||
log_error("Lan response setsockopt failed: %s", fc_strerror(fc_get_errno()));
|
||
return;
|
server/spacerace.c | ||
---|---|---|
fc_assert_ret(ship->structurals <= NUM_SS_STRUCTURALS);
|
||
fc_assert_ret(ship->components <= NUM_SS_COMPONENTS);
|
||
fc_assert_ret(ship->modules <= NUM_SS_MODULES);
|
||
|
||
ship->mass = 0;
|
||
ship->support_rate = ship->energy_rate =
|
||
ship->success_rate = ship->travel_time = 0.0;
|
||
... | ... | |
if (!src || pplayer == src) {
|
||
struct packet_spaceship_info info;
|
||
struct player_spaceship *ship = &pplayer->spaceship;
|
||
|
||
info.player_num = player_number(pplayer);
|
||
info.sship_state = ship->state;
|
||
info.structurals = ship->structurals;
|
||
... | ... | |
info.success_rate = ship->success_rate;
|
||
info.travel_time = ship->travel_time;
|
||
info.structure = ship->structure;
|
||
|
||
lsend_packet_spaceship_info(dest, &info);
|
||
}
|
||
} players_iterate_end;
|
||
... | ... | |
enum spaceship_place_type type, int num)
|
||
{
|
||
struct player_spaceship *ship = &pplayer->spaceship;
|
||
|
||
if (ship->state == SSHIP_NONE) {
|
||
if (from == ACT_REQ_PLAYER) {
|
||
notify_player(pplayer, NULL, E_SPACESHIP, ftc_server,
|
||
... | ... | |
shuffled_players_iterate(pplayer) {
|
||
struct player_spaceship *ship = &pplayer->spaceship;
|
||
|
||
if (ship->state == SSHIP_LAUNCHED) {
|
||
result[n++] = pplayer;
|
||
}
|
server/techtools.c | ||
---|---|---|
&& is_great_wonder(pimprove)
|
||
&& (pcity = city_from_great_wonder(pimprove))) {
|
||
notify_player(city_owner(pcity), NULL, E_WONDER_OBSOLETE, ftc_server,
|
||
_("Discovery of %s OBSOLETES %s in %s!"),
|
||
_("Discovery of %s OBSOLETES %s in %s!"),
|
||
research_advance_name_translation
|
||
(research_get(city_owner(pcity)), tech_found),
|
||
improvement_name_translation(pimprove),
|
||
... | ... | |
j++;
|
||
}
|
||
} advance_index_iterate_max_end;
|
||
|
||
if (j == 0) {
|
||
/* We've moved on to future tech */
|
||
if (vresearch->future_tech > presearch->future_tech) {
|
||
... | ... | |
if (tech != A_FUTURE && !valid_advance_by_number(tech)) {
|
||
return;
|
||
}
|
||
|
||
if (tech != A_FUTURE
|
||
&& research_invention_state(research, tech) != TECH_PREREQS_KNOWN) {
|
||
return;
|