Project

Profile

Help

HostedRedmine.com has moved to the Planio platform. All logins and passwords remained the same. All users will be able to login and use Redmine just as before. *Read more...*

Feature #820479 ยป 0017-Move-instances-of-or-still-in-the-end-of-line-to-nex.patch

Marko Lindqvist, 2019-06-08 12:15 AM

View differences:

ai/default/aiparatrooper.c
/* Second, we search for undefended enemy cities */
square_iterate(&(wld.map), unit_tile(punit), range, ptile) {
acity = tile_city(ptile);
if (acity && pplayers_at_war(unit_owner(punit), city_owner(acity)) &&
(unit_list_size(ptile->units) == 0)) {
if (acity && pplayers_at_war(unit_owner(punit), city_owner(acity))
&& (unit_list_size(ptile->units) == 0)) {
if (!map_is_known_and_seen(ptile, pplayer, V_MAIN)
&& has_handicap(pplayer, H_FOG)) {
continue;
ai/default/aiunit.c
} else {
/* if we are not being transported then ask for a boat again */
alive = TRUE;
if (!unit_transported(punit) &&
(tile_continent(unit_tile(punit))
!= tile_continent(dest_city->tile))) {
if (!unit_transported(punit)
&& (tile_continent(unit_tile(punit))
!= tile_continent(dest_city->tile))) {
alive = dai_find_boat_for_unit(ait, punit);
}
}
ai/default/daidiplomacy.c
struct player *giver, struct player *taker,
int tech_id, bool *is_dangerous)
{
int worth;
worth = dai_goldequiv_tech(ait, taker, tech_id);
*is_dangerous = FALSE;
/* Share and expect being shared brotherly between allies */
if (pplayers_allied(giver, taker)) {
worth /= 2;
}
if (players_on_same_team(giver, taker)) {
return 0;
int worth;
worth = dai_goldequiv_tech(ait, taker, tech_id);
*is_dangerous = FALSE;
/* Share and expect being shared brotherly between allies */
if (pplayers_allied(giver, taker)) {
worth /= 2;
}
if (players_on_same_team(giver, taker)) {
return 0;
}
/* Do not bother wanting a tech that we already have. */
if (research_invention_state(research_get(taker), tech_id)
== TECH_KNOWN) {
return 0;
}
/* Calculate in tech leak to our opponents, guess 50% chance */
players_iterate_alive(eplayer) {
if (eplayer == giver
|| eplayer == taker
|| research_invention_state(research_get(eplayer),
tech_id) == TECH_KNOWN) {
continue;
}
/* Do not bother wanting a tech that we already have. */
if (research_invention_state(research_get(taker), tech_id)
== TECH_KNOWN) {
return 0;
/* Don't risk it falling into enemy hands */
if (pplayers_allied(taker, eplayer)
&& adv_is_player_dangerous(giver, eplayer)) {
*is_dangerous = TRUE;
}
/* Calculate in tech leak to our opponents, guess 50% chance */
players_iterate_alive(eplayer) {
if (eplayer == giver
|| eplayer == taker
|| research_invention_state(research_get(eplayer),
tech_id) == TECH_KNOWN) {
continue;
}
if (pplayers_allied(taker, eplayer)
&& !pplayers_allied(giver, eplayer)) {
/* Taker can enrichen his side with this tech */
worth += dai_goldequiv_tech(ait, eplayer, tech_id) / 4;
}
} players_iterate_alive_end;
/* Don't risk it falling into enemy hands */
if (pplayers_allied(taker, eplayer) &&
adv_is_player_dangerous(giver, eplayer)) {
*is_dangerous = TRUE;
}
if (pplayers_allied(taker, eplayer) &&
!pplayers_allied(giver, eplayer)) {
/* Taker can enrichen his side with this tech */
worth += dai_goldequiv_tech(ait, eplayer, tech_id) / 4;
}
} players_iterate_alive_end;
return worth;
return worth;
}
/******************************************************************//**
ai/default/daimilitary.c
if ((best_unit_cost > limit_cost
&& build_cost < best_unit_cost)
|| ((desire > best ||
(desire == best && build_cost <= best_unit_cost))
|| ((desire > best
|| (desire == best && build_cost <= best_unit_cost))
&& (best_unit_type == NULL
/* In case all units are more expensive than limit_cost */
|| limit_cost <= pcity->shield_stock + 40))) {
client/agents/agents.c
****************************************************************************/
static bool is_outstanding_request(struct my_agent *agent)
{
if (agent->first_outstanding_request_id != 0 &&
client.conn.client.request_id_of_currently_handled_packet != 0 &&
agent->first_outstanding_request_id <=
client.conn.client.request_id_of_currently_handled_packet &&
agent->last_outstanding_request_id >=
if (agent->first_outstanding_request_id != 0
&& client.conn.client.request_id_of_currently_handled_packet != 0
&& agent->first_outstanding_request_id <=
client.conn.client.request_id_of_currently_handled_packet
&& agent->last_outstanding_request_id >=
client.conn.client.request_id_of_currently_handled_packet) {
log_debug("A:%s: ignoring packet; outstanding [%d..%d] got=%d",
agent->agent.name, agent->first_outstanding_request_id,
client/control.c
{
struct tile *ptile = find_a_focus_unit_tile_to_center_on();
if (ptile && gui_options.auto_center_on_unit &&
!tile_visible_and_not_on_border_mapcanvas(ptile)) {
if (ptile && gui_options.auto_center_on_unit
&& !tile_visible_and_not_on_border_mapcanvas(ptile)) {
center_tile_mapcanvas(ptile);
}
}
client/gui-gtk-3.0/citydlg.c
}
gtk_widget_set_sensitive(pdialog->show_units_command,
can_client_issue_orders() &&
have_present_units);
can_client_issue_orders()
&& have_present_units);
} else {
/* Set the buttons we do not want live while a Diplomat investigates */
gtk_widget_set_sensitive(pdialog->show_units_command, FALSE);
client/gui-gtk-3.0/cityrep.c
found = 0;
city_list_iterate(client.conn.playing->cities, pcity) {
if (!cma_is_city_under_agent(pcity, NULL)) {
found = 1;
break;
found = 1;
break;
}
} city_list_iterate_end;
......
w = gtk_menu_item_new_with_label(_("none"));
gtk_menu_shell_append(GTK_MENU_SHELL(menu), w);
g_signal_connect(w, "activate", G_CALLBACK(select_cma_callback),
GINT_TO_POINTER(CMA_NONE));
GINT_TO_POINTER(CMA_NONE));
}
/*
......
*/
found = 0;
city_list_iterate(client.conn.playing->cities, pcity) {
if (cma_is_city_under_agent(pcity, &parameter) &&
cmafec_preset_get_index_of_parameter(&parameter) == -1) {
found = 1;
break;
if (cma_is_city_under_agent(pcity, &parameter)
&& cmafec_preset_get_index_of_parameter(&parameter) == -1) {
found = 1;
break;
}
} city_list_iterate_end;
......
gtk_menu_shell_append(GTK_MENU_SHELL(menu), w);
g_signal_connect(w, "activate",
G_CALLBACK(select_cma_callback), GINT_TO_POINTER(CMA_CUSTOM));
G_CALLBACK(select_cma_callback),
GINT_TO_POINTER(CMA_CUSTOM));
}
/* only fill in presets that are being used. */
for (i = 0; i < cmafec_preset_num(); i++) {
found = 0;
city_list_iterate(client.conn.playing->cities, pcity) {
if (cma_is_city_under_agent(pcity, &parameter) &&
cm_are_parameter_equal(&parameter,
cmafec_preset_get_parameter(i))) {
found = 1;
break;
}
if (cma_is_city_under_agent(pcity, &parameter)
&& cm_are_parameter_equal(&parameter,
cmafec_preset_get_parameter(i))) {
found = 1;
break;
}
} city_list_iterate_end;
if (found) {
w = gtk_menu_item_new_with_label(cmafec_preset_get_descr(i));
w = gtk_menu_item_new_with_label(cmafec_preset_get_descr(i));
gtk_menu_shell_append(GTK_MENU_SHELL(menu), w);
g_signal_connect(w, "activate",
G_CALLBACK(select_cma_callback), GINT_TO_POINTER(i));
gtk_menu_shell_append(GTK_MENU_SHELL(menu), w);
g_signal_connect(w, "activate",
G_CALLBACK(select_cma_callback), GINT_TO_POINTER(i));
}
}
}
g_object_set_data(G_OBJECT(menu), "freeciv_change_cma",
GINT_TO_POINTER(change_cma));
GINT_TO_POINTER(change_cma));
gtk_widget_show_all(menu);
}
client/gui-gtk-3.0/diplodlg.c
struct player *plr1 = player_by_number(other_player_id);
dialog_list_iterate(dialog_list, pdialog) {
if ((pdialog->treaty.plr0 == plr0 && pdialog->treaty.plr1 == plr1) ||
(pdialog->treaty.plr0 == plr1 && pdialog->treaty.plr1 == plr0)) {
if ((pdialog->treaty.plr0 == plr0 && pdialog->treaty.plr1 == plr1)
|| (pdialog->treaty.plr0 == plr1 && pdialog->treaty.plr1 == plr0)) {
return pdialog;
}
} dialog_list_iterate_end;
client/gui-gtk-3.0/gui_stuff.c
action_area = gtk_grid_new();
gtk_grid_set_row_spacing(GTK_GRID(action_area), 4);
gtk_grid_set_column_spacing(GTK_GRID(action_area), 4);
if (GUI_GTK_OPTION(enable_tabs) &&
(check_top && notebook != GTK_NOTEBOOK(top_notebook))
if (GUI_GTK_OPTION(enable_tabs)
&& (check_top && notebook != GTK_NOTEBOOK(top_notebook))
&& !GUI_GTK_OPTION(small_display_layout)) {
/* We expect this to be short (as opposed to tall); maximise usable
* height by putting buttons down the right hand side */
client/gui-gtk-3.0/helpdlg.c
gtk_tree_model_get(model, &it, 1, &pitem, -1);
if (help_history_pos >= 0 &&
g_ptr_array_index(help_history, help_history_pos) == (gpointer) pitem) {
if (help_history_pos >= 0
&& g_ptr_array_index(help_history, help_history_pos)
== (gpointer) pitem) {
return;
}
client/gui-gtk-3.22/citydlg.c
}
gtk_widget_set_sensitive(pdialog->show_units_command,
can_client_issue_orders() &&
have_present_units);
can_client_issue_orders()
&& have_present_units);
} else {
/* Set the buttons we do not want live while a Diplomat investigates */
gtk_widget_set_sensitive(pdialog->show_units_command, FALSE);
client/gui-gtk-3.22/cityrep.c
found = 0;
city_list_iterate(client.conn.playing->cities, pcity) {
if (!cma_is_city_under_agent(pcity, NULL)) {
found = 1;
break;
found = 1;
break;
}
} city_list_iterate_end;
......
w = gtk_menu_item_new_with_label(_("none"));
gtk_menu_shell_append(GTK_MENU_SHELL(menu), w);
g_signal_connect(w, "activate", G_CALLBACK(select_cma_callback),
GINT_TO_POINTER(CMA_NONE));
GINT_TO_POINTER(CMA_NONE));
}
/*
......
*/
found = 0;
city_list_iterate(client.conn.playing->cities, pcity) {
if (cma_is_city_under_agent(pcity, &parameter) &&
cmafec_preset_get_index_of_parameter(&parameter) == -1) {
found = 1;
break;
if (cma_is_city_under_agent(pcity, &parameter)
&& cmafec_preset_get_index_of_parameter(&parameter) == -1) {
found = 1;
break;
}
} city_list_iterate_end;
......
for (i = 0; i < cmafec_preset_num(); i++) {
found = 0;
city_list_iterate(client.conn.playing->cities, pcity) {
if (cma_is_city_under_agent(pcity, &parameter) &&
cm_are_parameter_equal(&parameter,
cmafec_preset_get_parameter(i))) {
found = 1;
break;
}
if (cma_is_city_under_agent(pcity, &parameter)
&& cm_are_parameter_equal(&parameter,
cmafec_preset_get_parameter(i))) {
found = 1;
break;
}
} city_list_iterate_end;
if (found) {
w = gtk_menu_item_new_with_label(cmafec_preset_get_descr(i));
w = gtk_menu_item_new_with_label(cmafec_preset_get_descr(i));
gtk_menu_shell_append(GTK_MENU_SHELL(menu), w);
g_signal_connect(w, "activate",
G_CALLBACK(select_cma_callback), GINT_TO_POINTER(i));
gtk_menu_shell_append(GTK_MENU_SHELL(menu), w);
g_signal_connect(w, "activate",
G_CALLBACK(select_cma_callback), GINT_TO_POINTER(i));
}
}
}
g_object_set_data(G_OBJECT(menu), "freeciv_change_cma",
GINT_TO_POINTER(change_cma));
GINT_TO_POINTER(change_cma));
gtk_widget_show_all(menu);
}
client/gui-gtk-3.22/diplodlg.c
struct player *plr1 = player_by_number(other_player_id);
dialog_list_iterate(dialog_list, pdialog) {
if ((pdialog->treaty.plr0 == plr0 && pdialog->treaty.plr1 == plr1) ||
(pdialog->treaty.plr0 == plr1 && pdialog->treaty.plr1 == plr0)) {
if ((pdialog->treaty.plr0 == plr0 && pdialog->treaty.plr1 == plr1)
|| (pdialog->treaty.plr0 == plr1 && pdialog->treaty.plr1 == plr0)) {
return pdialog;
}
} dialog_list_iterate_end;
client/gui-gtk-3.22/gui_stuff.c
action_area = gtk_grid_new();
gtk_grid_set_row_spacing(GTK_GRID(action_area), 4);
gtk_grid_set_column_spacing(GTK_GRID(action_area), 4);
if (GUI_GTK_OPTION(enable_tabs) &&
(check_top && notebook != GTK_NOTEBOOK(top_notebook))
if (GUI_GTK_OPTION(enable_tabs)
&& (check_top && notebook != GTK_NOTEBOOK(top_notebook))
&& !GUI_GTK_OPTION(small_display_layout)) {
/* We expect this to be short (as opposed to tall); maximise usable
* height by putting buttons down the right hand side */
client/gui-gtk-4.0/citydlg.c
}
gtk_widget_set_sensitive(pdialog->show_units_command,
can_client_issue_orders() &&
have_present_units);
can_client_issue_orders()
&& have_present_units);
} else {
/* Set the buttons we do not want live while a Diplomat investigates */
gtk_widget_set_sensitive(pdialog->show_units_command, FALSE);
client/gui-gtk-4.0/cityrep.c
found = 0;
city_list_iterate(client.conn.playing->cities, pcity) {
if (!cma_is_city_under_agent(pcity, NULL)) {
found = 1;
break;
found = 1;
break;
}
} city_list_iterate_end;
......
w = gtk_menu_item_new_with_label(_("none"));
gtk_menu_shell_append(GTK_MENU_SHELL(menu), w);
g_signal_connect(w, "activate", G_CALLBACK(select_cma_callback),
GINT_TO_POINTER(CMA_NONE));
GINT_TO_POINTER(CMA_NONE));
}
/*
......
*/
found = 0;
city_list_iterate(client.conn.playing->cities, pcity) {
if (cma_is_city_under_agent(pcity, &parameter) &&
cmafec_preset_get_index_of_parameter(&parameter) == -1) {
found = 1;
break;
if (cma_is_city_under_agent(pcity, &parameter)
&& cmafec_preset_get_index_of_parameter(&parameter) == -1) {
found = 1;
break;
}
} city_list_iterate_end;
......
gtk_menu_shell_append(GTK_MENU_SHELL(menu), w);
g_signal_connect(w, "activate",
G_CALLBACK(select_cma_callback), GINT_TO_POINTER(CMA_CUSTOM));
G_CALLBACK(select_cma_callback),
GINT_TO_POINTER(CMA_CUSTOM));
}
/* only fill in presets that are being used. */
for (i = 0; i < cmafec_preset_num(); i++) {
found = 0;
city_list_iterate(client.conn.playing->cities, pcity) {
if (cma_is_city_under_agent(pcity, &parameter) &&
cm_are_parameter_equal(&parameter,
cmafec_preset_get_parameter(i))) {
found = 1;
break;
}
if (cma_is_city_under_agent(pcity, &parameter)
&& cm_are_parameter_equal(&parameter,
cmafec_preset_get_parameter(i))) {
found = 1;
break;
}
} city_list_iterate_end;
if (found) {
w = gtk_menu_item_new_with_label(cmafec_preset_get_descr(i));
w = gtk_menu_item_new_with_label(cmafec_preset_get_descr(i));
gtk_menu_shell_append(GTK_MENU_SHELL(menu), w);
g_signal_connect(w, "activate",
G_CALLBACK(select_cma_callback), GINT_TO_POINTER(i));
gtk_menu_shell_append(GTK_MENU_SHELL(menu), w);
g_signal_connect(w, "activate",
G_CALLBACK(select_cma_callback), GINT_TO_POINTER(i));
}
}
}
client/gui-gtk-4.0/diplodlg.c
struct player *plr1 = player_by_number(other_player_id);
dialog_list_iterate(dialog_list, pdialog) {
if ((pdialog->treaty.plr0 == plr0 && pdialog->treaty.plr1 == plr1) ||
(pdialog->treaty.plr0 == plr1 && pdialog->treaty.plr1 == plr0)) {
if ((pdialog->treaty.plr0 == plr0 && pdialog->treaty.plr1 == plr1)
|| (pdialog->treaty.plr0 == plr1 && pdialog->treaty.plr1 == plr0)) {
return pdialog;
}
} dialog_list_iterate_end;
client/gui-qt/hudwidget.cpp
if (can_unit_do_activity(current_unit, ACTIVITY_MINE)) {
struct terrain *pterrain = tile_terrain(unit_tile(current_unit));
a = new hud_action(this);
a->action_shortcut = SC_BUILDMINE;
actions.append(a);
......
if (can_unit_do_activity(current_unit, ACTIVITY_IRRIGATE)) {
struct terrain *pterrain = tile_terrain(unit_tile(current_unit));
a = new hud_action(this);
a->action_shortcut = SC_BUILDIRRIGATION;
if (pterrain->irrigation_result != T_NONE
&& pterrain->irrigation_result != pterrain) {
if ((!strcmp(terrain_rule_name(pterrain), "Forest") ||
!strcmp(terrain_rule_name(pterrain), "Jungle"))) {
if ((!strcmp(terrain_rule_name(pterrain), "Forest")
|| !strcmp(terrain_rule_name(pterrain), "Jungle"))) {
a->set_pixmap(fc_icons::instance()->get_pixmap("chopchop"));
} else {
a->set_pixmap(fc_icons::instance()->get_pixmap("transform"));
client/gui-qt/mapview.cpp
**************************************************************************/
void map_view::update_font(const QString &name, const QFont &font)
{
if (name == fonts::city_names ||
name == fonts::city_productions) {
if (name == fonts::city_names
|| name == fonts::city_productions) {
update_map_canvas_visible();
}
}
client/gui-qt/ratesdlg.cpp
x_max = static_cast<float>(current_max) / 10 *
((width() - 1) - 2 * cursor_size) + cursor_size;
on_min = (((x_mouse > (x_min - cursor_size * 1.1)) &&
(x_mouse < (x_min + cursor_size * 1.1)))
on_min = (((x_mouse > (x_min - cursor_size * 1.1))
&& (x_mouse < (x_min + cursor_size * 1.1)))
&& (!on_max))
|| (moved == 1);
on_max = (((x_mouse > (x_max - cursor_size * 1.1)) &&
(x_mouse < (x_max + cursor_size * 1.1)))
on_max = (((x_mouse > (x_max - cursor_size * 1.1))
&& (x_mouse < (x_max + cursor_size * 1.1)))
&& !on_min)
|| (moved == 2);
if (event->buttons() & Qt::LeftButton) {
client/gui-sdl2/mapview.c
}
if (Main.rects_count >= RECT_LIMIT) {
if ((C_S_RUNNING == client_state()) &&
(get_client_page() == PAGE_GAME)) {
if ((C_S_RUNNING == client_state())
&& (get_client_page() == PAGE_GAME)) {
flush_mapcanvas(0, 0, main_window_width(), main_window_height());
refresh_overview();
}
client/gui-sdl2/optiondlg.c
widget_redraw(widget);
widget_mark_dirty(widget);
if (!new_worklist_widget->gfx &&
(get_wflags(new_worklist_widget) & WF_RESTORE_BACKGROUND)) {
if (!new_worklist_widget->gfx
&& (get_wflags(new_worklist_widget) & WF_RESTORE_BACKGROUND)) {
refresh_widget_background(new_worklist_widget);
}
widget_redraw(new_worklist_widget);
client/helpdata.c
{
const char *types[utype_count()];
int i = 0;
unit_type_iterate(utype2) {
if (utype2->converted_to == utype &&
utype_can_do_action(utype2, ACTION_CONVERT)) {
if (utype2->converted_to == utype
&& utype_can_do_action(utype2, ACTION_CONVERT)) {
types[i++] = utype_name_translation(utype2);
}
} unit_type_iterate_end;
if (i > 0) {
struct astring list = ASTRING_INIT;
astr_build_or_list(&list, types, i);
cat_snprintf(buf, bufsz,
/* TRANS: %s is a list of unit types separated by "or". */
client/packhand.c
popup_combat_info(packet->attacker_unit_id, packet->defender_unit_id,
packet->attacker_hp, packet->defender_hp,
packet->make_att_veteran, packet->make_def_veteran);
if (tile_visible_mapcanvas(unit_tile(punit0)) &&
tile_visible_mapcanvas(unit_tile(punit1))) {
if (tile_visible_mapcanvas(unit_tile(punit0))
&& tile_visible_mapcanvas(unit_tile(punit1))) {
show_combat = TRUE;
} else if (gui_options.auto_center_on_combat) {
if (unit_owner(punit0) == client.conn.playing) {
......
int hp0 = packet->attacker_hp, hp1 = packet->defender_hp;
audio_play_sound(unit_type_get(punit0)->sound_fight,
unit_type_get(punit0)->sound_fight_alt);
unit_type_get(punit0)->sound_fight_alt);
audio_play_sound(unit_type_get(punit1)->sound_fight,
unit_type_get(punit1)->sound_fight_alt);
unit_type_get(punit1)->sound_fight_alt);
if (gui_options.smooth_combat_step_msec > 0) {
decrease_unit_hp_smooth(punit0, hp0, punit1, hp1);
} else {
punit0->hp = hp0;
punit1->hp = hp1;
punit0->hp = hp0;
punit1->hp = hp1;
set_units_in_combat(NULL, NULL);
refresh_unit_mapcanvas(punit0, unit_tile(punit0), TRUE, FALSE);
refresh_unit_mapcanvas(punit1, unit_tile(punit1), TRUE, FALSE);
set_units_in_combat(NULL, NULL);
refresh_unit_mapcanvas(punit0, unit_tile(punit0), TRUE, FALSE);
refresh_unit_mapcanvas(punit1, unit_tile(punit1), TRUE, FALSE);
}
}
if (packet->make_att_veteran && punit0) {
......
pplayer = player_new(pslot);
if ((pplayer->rgb == NULL) != !pinfo->color_valid
|| (pinfo->color_valid &&
(pplayer->rgb->r != pinfo->color_red
|| pplayer->rgb->g != pinfo->color_green
|| pplayer->rgb->b != pinfo->color_blue))) {
|| (pinfo->color_valid
&& (pplayer->rgb->r != pinfo->color_red
|| pplayer->rgb->g != pinfo->color_green
|| pplayer->rgb->b != pinfo->color_blue))) {
struct rgbcolor *prgbcolor;
if (pinfo->color_valid) {
common/diptreaty.c
/* same clause already there */
return FALSE;
}
if (is_pact_clause(type) &&
is_pact_clause(old_clause->type)) {
if (is_pact_clause(type)
&& is_pact_clause(old_clause->type)) {
/* pact clause already there */
ptreaty->accept0 = FALSE;
ptreaty->accept1 = FALSE;
common/generate_packets.py
# the delta_stats_report() function.
def get_report_part(self):
return '''
if (stats_%(name)s_sent > 0 &&
stats_%(name)s_discarded != stats_%(name)s_sent) {
if (stats_%(name)s_sent > 0
&& stats_%(name)s_discarded != stats_%(name)s_sent) {
log_test(\"%(name)s %%d out of %%d got discarded\",
stats_%(name)s_discarded, stats_%(name)s_sent);
for (i = 0; i < %(bits)d; i++) {
common/improvement.c
return FALSE;
}
}
if (space_part &&
(get_player_bonus(p, EFT_ENABLE_SPACE) <= 0
|| p->spaceship.state >= SSHIP_LAUNCHED)) {
if (space_part
&& (get_player_bonus(p, EFT_ENABLE_SPACE) <= 0
|| p->spaceship.state >= SSHIP_LAUNCHED)) {
return FALSE;
}
common/unit.c
return AR_BAD_SRC_CITY;
}
if (pdest_city &&
punit_owner != city_owner(pdest_city)
if (pdest_city
&& punit_owner != city_owner(pdest_city)
&& !(game.info.airlifting_style & AIRLIFTING_ALLIED_DEST
&& pplayers_allied(punit_owner, city_owner(pdest_city)))) {
/* Not allowed to airlift to this destination. */
server/citytools.c
pimprove = improvement_by_number(n);
fc_assert_action(!is_great_wonder(pimprove), continue);
if (first_city ||
(game.server.savepalace
&& improvement_has_flag(pimprove, IF_SAVE_SMALL_WONDER))) {
if (first_city
|| (game.server.savepalace
&& improvement_has_flag(pimprove, IF_SAVE_SMALL_WONDER))) {
city_add_improvement(pcity, pimprove);
if (is_small_wonder(pimprove)) {
has_small_wonders = TRUE;
......
}
pimprove = improvement_by_number(n);
if (first_city ||
(game.server.savepalace
&& improvement_has_flag(pimprove, IF_SAVE_SMALL_WONDER))) {
if (first_city
|| (game.server.savepalace
&& improvement_has_flag(pimprove, IF_SAVE_SMALL_WONDER))) {
city_add_improvement(pcity, pimprove);
if (is_small_wonder(pimprove)) {
has_small_wonders = TRUE;
server/connecthand.c
if (was_connected && !pplayer->is_connected) {
/* Player just lost its controlling connection. */
if (remove_unused_player &&
!pplayer->was_created && !game_was_started()) {
if (remove_unused_player
&& !pplayer->was_created && !game_was_started()) {
/* Remove player. */
conn_list_iterate(pplayer->connections, aconn) {
/* Detach all. */
server/diplhand.c
struct Treaty *find_treaty(struct player *plr0, struct player *plr1)
{
treaty_list_iterate(treaties, ptreaty) {
if ((ptreaty->plr0 == plr0 && ptreaty->plr1 == plr1) ||
(ptreaty->plr0 == plr1 && ptreaty->plr1 == plr0)) {
if ((ptreaty->plr0 == plr0 && ptreaty->plr1 == plr1)
|| (ptreaty->plr0 == plr1 && ptreaty->plr1 == plr0)) {
return ptreaty;
}
} treaty_list_iterate_end;
server/maphand.c
aplrtile = map_get_player_tile(ptile, aplayer);
/* Free vision sites (cities) for removed and other players */
if (aplrtile && aplrtile->site &&
vision_site_owner(aplrtile->site) == pplayer) {
if (aplrtile && aplrtile->site
&& vision_site_owner(aplrtile->site) == pplayer) {
change_playertile_site(aplrtile, NULL);
changed = TRUE;
}
server/rssanity.c
**************************************************************************/
static bool sanity_check_metadata(void)
{
if (game.ruleset_summary != NULL &&
strlen(game.ruleset_summary) > MAX_LEN_CONTENT) {
if (game.ruleset_summary != NULL
&& strlen(game.ruleset_summary) > MAX_LEN_CONTENT) {
log_error("Too long ruleset summary. It can be only %d bytes long. "
"Put longer explanations to ruleset description.",
MAX_LEN_CONTENT);
server/settings.c
static bool mapsize_callback(int value, struct connection *caller,
char *reject_msg, size_t reject_msg_len)
{
if (value == MAPSIZE_XYSIZE && MAP_IS_ISOMETRIC &&
wld.map.ysize % 2 != 0) {
if (value == MAPSIZE_XYSIZE && MAP_IS_ISOMETRIC
&& wld.map.ysize % 2 != 0) {
/* An isometric map needs a even ysize. Is is calculated automatically
* for all settings but mapsize=XYSIZE. */
settings_snprintf(reject_msg, reject_msg_len,
......
"%d tiles."), wld.map.xsize, value, size,
MAP_MAX_SIZE * 1000);
return FALSE;
} else if (wld.map.server.mapsize == MAPSIZE_XYSIZE && MAP_IS_ISOMETRIC &&
value % 2 != 0) {
} else if (wld.map.server.mapsize == MAPSIZE_XYSIZE && MAP_IS_ISOMETRIC
&& value % 2 != 0) {
/* An isometric map needs a even ysize. Is is calculated automatically
* for all settings but mapsize=XYSIZE. */
settings_snprintf(reject_msg, reject_msg_len,
......
static bool topology_callback(unsigned value, struct connection *caller,
char *reject_msg, size_t reject_msg_len)
{
if (wld.map.server.mapsize == MAPSIZE_XYSIZE &&
((value & (TF_ISO)) != 0 || (value & (TF_HEX)) != 0) &&
wld.map.ysize % 2 != 0) {
if (wld.map.server.mapsize == MAPSIZE_XYSIZE
&& ((value & (TF_ISO)) != 0 || (value & (TF_HEX)) != 0)
&& wld.map.ysize % 2 != 0) {
/* An isometric map needs a even ysize. Is is calculated automatically
* for all settings but mapsize=XYSIZE. */
settings_snprintf(reject_msg, reject_msg_len,
server/stdinhand.c
{
char real_filename[1024], buf[256];
FILE *script_file;
interpret_tilde(real_filename, sizeof(real_filename), script_filename);
if (is_reg_file_for_access(real_filename, TRUE)
......
fprintf(script_file, "%s\n",
ai_level_cmd(game.info.skill_level));
if (*srvarg.metaserver_addr != '\0' &&
((0 != strcmp(srvarg.metaserver_addr, DEFAULT_META_SERVER_ADDR)))) {
if (*srvarg.metaserver_addr != '\0'
&& ((0 != strcmp(srvarg.metaserver_addr, DEFAULT_META_SERVER_ADDR)))) {
fprintf(script_file, "metaserver %s\n", meta_addr_port());
}
utility/ioz.c
last_read = BZ2_bzRead(&fp->u.bz2.error, fp->u.bz2.file,
buffer + i, 1);
}
if (fp->u.bz2.error != BZ_OK &&
(fp->u.bz2.error != BZ_STREAM_END ||
i == 0)) {
if (fp->u.bz2.error != BZ_OK
&& (fp->u.bz2.error != BZ_STREAM_END
|| i == 0)) {
retval = NULL;
} else {
retval = buffer;
utility/timing.c
} else {
#ifdef HAVE_GETTIMEOFDAY
int ret = gettimeofday(&t->start.tv, NULL);
if (ret == -1) {
report_gettimeofday_failed(t);
return;
......
}
if (t->type == TIMER_CPU) {
clock_t now = clock();
if (now == (clock_t) -1) {
report_clock_failed(t);
return;
......
#ifdef HAVE_GETTIMEOFDAY
struct timeval now;
int ret = gettimeofday(&now, NULL);
if (ret == -1) {
report_gettimeofday_failed(t);
return;
......
t->sec -= 1.0;
} else if (t->usec >= N_USEC_PER_SEC) {
long sec = t->usec / N_USEC_PER_SEC;
t->sec += sec;
t->usec -= sec * N_USEC_PER_SEC;
}
......
t->sec -= 1.0;
} else if (t->usec >= N_USEC_PER_SEC) {
long sec = t->usec / N_USEC_PER_SEC;
t->sec += sec;
t->usec -= sec * N_USEC_PER_SEC;
}
t->start.tp = now;
#else
time_t now = time(NULL);
if (now == (time_t) -1) {
report_time_failed(t);
return;
......
ret = gettimeofday(&tv_now, NULL);
if ((ret == -1) ||
(t->type != TIMER_USER) ||
(t->use != TIMER_ACTIVE) ||
(t->state != TIMER_STARTED)) {
if ((ret == -1)
|| (t->type != TIMER_USER)
|| (t->use != TIMER_ACTIVE)
|| (t->state != TIMER_STARTED)) {
fc_usleep(usec);
return;
}
    (1-1/1)