151#define ACTIVITY_OLD_POLLUTION_SG3 (ACTIVITY_LAST + 1)
152#define ACTIVITY_OLD_FALLOUT_SG3 (ACTIVITY_OLD_POLLUTION_SG3 + 1)
153#define ACTIVITY_LAST_SAVEGAME3 (ACTIVITY_OLD_FALLOUT_SG3 + 1)
155#ifdef FREECIV_TESTMATIC
156#define SAVE_DUMMY_TURN_CHANGE_TIME 1
172#define SAVE_MAP_CHAR(ptile, GET_XY_CHAR, secfile, secpath, ...) \
174 char _line[MAP_NATIVE_WIDTH + 1]; \
175 int _nat_x, _nat_y; \
177 for (_nat_y = 0; _nat_y < MAP_NATIVE_HEIGHT; _nat_y++) { \
178 for (_nat_x = 0; _nat_x < MAP_NATIVE_WIDTH; _nat_x++) { \
179 struct tile *ptile = native_pos_to_tile(&(wld.map), _nat_x, _nat_y); \
180 fc_assert_action(ptile != NULL, continue); \
181 _line[_nat_x] = (GET_XY_CHAR); \
182 sg_failure_ret(fc_isprint(_line[_nat_x] & 0x7f), \
183 "Trying to write invalid map data at position " \
184 "(%d, %d) for path %s: '%c' (%d)", _nat_x, _nat_y, \
185 secpath, _line[_nat_x], _line[_nat_x]); \
187 _line[MAP_NATIVE_WIDTH] = '\0'; \
188 secfile_insert_str(secfile, _line, secpath, ## __VA_ARGS__, _nat_y); \
219#define LOAD_MAP_CHAR(ch, ptile, SET_XY_CHAR, secfile, secpath, ...) \
221 int _nat_x, _nat_y; \
222 bool _printed_warning = FALSE; \
223 for (_nat_y = 0; _nat_y < MAP_NATIVE_HEIGHT; _nat_y++) { \
224 const char *_line = secfile_lookup_str(secfile, secpath, \
225 ## __VA_ARGS__, _nat_y); \
226 if (NULL == _line) { \
228 fc_snprintf(buf, sizeof(buf), secpath, ## __VA_ARGS__, _nat_y); \
229 log_verbose("Line not found='%s'", buf); \
230 _printed_warning = TRUE; \
232 } else if (strlen(_line) != MAP_NATIVE_WIDTH) { \
234 fc_snprintf(buf, sizeof(buf), secpath, ## __VA_ARGS__, _nat_y); \
235 log_verbose("Line too short (expected %d got " SIZE_T_PRINTF \
236 ")='%s'", MAP_NATIVE_WIDTH, strlen(_line), buf); \
237 _printed_warning = TRUE; \
240 for (_nat_x = 0; _nat_x < MAP_NATIVE_WIDTH; _nat_x++) { \
241 const char ch = _line[_nat_x]; \
242 struct tile *ptile = native_pos_to_tile(&(wld.map), _nat_x, _nat_y); \
246 if (_printed_warning) { \
248 log_sg(_("Saved game contains incomplete map data. This can" \
249 " happen with old saved games, or it may indicate an" \
250 " invalid saved game file. Proceed at your own risk.")); \
255#define halfbyte_iterate_extras(e, num_extras_types) \
258 for (e = 0; 4 * e < (num_extras_types); e++) {
260#define halfbyte_iterate_extras_end \
285 const char *save_reason,
301static char *
quote_block(
const void *
const data,
int length);
320 const char *path,
int plrno);
528 const char *save_reason,
591 loading->improvement.size = -1;
685 saving->secfile_options[0] =
'\0';
883 if (activity ==
achar) {
899 char *buffer =
fc_malloc(length * 3 + 10);
903 sprintf(buffer,
"%d:", length);
906 for (
i = 0;
i < length;
i++) {
907 sprintf(buffer + offset,
"%02x ", ((
unsigned char *) data)[
i]);
928 log_error(
_(
"Syntax error in attribute block."));
939 log_error(
_(
"Syntax error in attribute block."));
945 for (
i = 0;
i < length;
i++) {
951 log_error(
_(
"Syntax error in attribute block."));
955 ((
unsigned char *) dest)[
i] =
tmp;
985 for (
i = 0;
i <
pwl->length;
i++) {
1028 for (
i = 0;
i <
pwl->length;
i++) {
1106 if (!
pch ||
ch ==
'\0') {
1107 log_sg(
"Unknown hex value: '%c' (%d)",
ch,
ch);
1113 for (
i = 0;
i < 4;
i++) {
1116 if (pextra ==
NULL) {
1119 if ((
bin & (1 <<
i))
1139 if (!
pch ||
ch ==
'\0') {
1140 log_sg(
"Unknown hex value: '%c' (%d)",
ch,
ch);
1146 for (
i = 0;
i < 4;
i++) {
1149 if (pextra ==
NULL) {
1152 if ((
bin & (1 <<
i))
1171 for (
i = 0;
i < 4;
i++) {
1203 for (
i = 0;
i < 4;
i++) {
1234 if (pterrain->identifier_load ==
ch) {
1239 log_fatal(
"Unknown terrain identifier '%c' in savegame.",
ch);
1264 const char *path,
int plrno)
1367 const char *req_caps;
1377 "scenario.ruleset_caps");
1384 log_normal(
_(
"Scenario requires ruleset capabilities: %s"), req_caps);
1388 log_error(
_(
"Current ruleset %s not compatible with the scenario %s."
1389 " Trying to switch to the ruleset specified by the"
1399 const char *
ruleset, *alt_dir;
1403 "savefile.rulesetdir");
1412 log_verbose(
"Savegame specified ruleset '%s'. Really loading '%s'.",
1417 "savefile.ruleset_alt_dir");
1422 _(
"Failed to load either of rulesets '%s' or '%s' "
1423 "needed for savegame."),
1427 _(
"Failed to load ruleset '%s' needed for savegame."),
1448 const struct strvec **path;
1466 if (secfile ==
NULL) {
1467 log_error(
_(
"Failed to load scenario luadata file %s.luadata"),
1483 "savefile.last_updated_as_year");
1488 "savefile.improvement_size");
1489 if (
loading->improvement.size) {
1492 "savefile.improvement_vector");
1494 "Failed to load improvement order: %s",
1501 "savefile.technology_size");
1502 if (
loading->technology.size) {
1505 "savefile.technology_vector");
1507 "Failed to load technology order: %s",
1514 "savefile.activities_size");
1515 if (
loading->activities.size) {
1518 "savefile.activities_vector");
1520 "Failed to load activity order: %s",
1527 "savefile.trait_size");
1531 "savefile.trait_vector");
1533 "Failed to load trait order: %s",
1540 "savefile.extras_size");
1547 "savefile.extras_vector");
1549 "Failed to load extras order: %s",
1552 "Number of extras defined by the ruleset (= %d) are "
1553 "lower than the number in the savefile (= %d).",
1558 for (j = 0; j <
loading->extra.size; j++) {
1562 for (; j <
nmod; j++) {
1570 "savefile.multipliers_size");
1571 if (
loading->multiplier.size) {
1576 "savefile.multipliers_vector");
1578 "Failed to load multipliers order: %s",
1583 sizeof(*
loading->multiplier.order));
1584 for (j = 0; j <
loading->multiplier.size; j++) {
1586 if (!
loading->multiplier.order[j]) {
1587 log_verbose(
"Multiplier \"%s\" in savegame but not in ruleset, "
1597 "savefile.specialists_size");
1598 if (
loading->specialist.size) {
1604 "savefile.specialists_vector");
1606 "Failed to load specialists order: %s",
1609 "Number of specialists defined by the ruleset (= %d) are "
1610 "lower than the number in the savefile (= %d).",
1618 for (j = 0; j <
loading->specialist.size; j++) {
1622 for (; j <
nmod; j++) {
1629 "savefile.action_size");
1632 "Failed to load action order: %s",
1640 "savefile.action_vector");
1643 sizeof(*
loading->action.order));
1645 for (j = 0; j <
loading->action.size; j++) {
1662 "savefile.action_decision_size");
1665 "Failed to load action decision order: %s",
1673 "savefile.action_decision_vector");
1676 sizeof(*
loading->act_dec.order));
1678 for (j = 0; j <
loading->act_dec.size; j++) {
1689 "savefile.server_side_agent_size");
1692 "Failed to load server side agent order: %s",
1700 "savefile.server_side_agent_list");
1705 for (j = 0; j <
loading->ssa.size; j++) {
1716 "savefile.city_options_size");
1719 "Failed to load city options order: %s",
1727 "savefile.city_options_vector");
1730 sizeof(*
loading->coptions.order));
1732 for (j = 0; j <
loading->coptions.size; j++) {
1742 pterr->identifier_load =
'\0';
1747 "savefile.terrident%d.name",
i)) !=
NULL) {
1752 "savefile.terrident%d.identifier",
i);
1765 "%s and %s share a saved identifier",
1796 "savefile.orig_version");
1822 "savefile.improvement_size");
1831 "savefile.improvement_vector");
1838 "savefile.technology_size");
1847 "savefile.technology_vector");
1852 "savefile.activities_size");
1867 "savefile.activities_vector");
1873 "savefile.specialists_size");
1885 "savefile.specialists_vector");
1892 "savefile.trait_size");
1905 "savefile.trait_vector");
1911 "savefile.extras_size");
1924 "savefile.extras_vector");
1930 "savefile.multipliers_size");
1942 "savefile.multipliers_vector");
1948 "savefile.city_options_size");
1962 "savefile.city_options_vector");
1968 "savefile.action_size");
1982 "savefile.action_vector");
1988 "savefile.action_decision_size");
2002 "savefile.action_decision_vector");
2008 "savefile.server_side_agent_size");
2022 "savefile.server_side_agent_list");
2054 "savefile.options");
2074 "ruledata.government%d.name",
i));
2080 "ruledata.government%d.changes",
i);
2098 "game.server_state");
2110 "game.meta_patches");
2119 "game.meta_server"));
2149 "game.phase_mode_stored");
2172 "game.timeoutintinc");
2178 "game.timeoutincmult");
2181 "game.timeoutcounter");
2212 "game.global_advances");
2215 "Invalid length of 'game.global_advances' ("
2218 for (
i = 0;
i <
loading->technology.size;
i++) {
2220 "Undefined value '%c' within 'game.global_advances'.",
2222 if (
str[
i] ==
'1') {
2256 "%s.changes", path);
2281 "game.server_state");
2287 "game.phase_seconds");
2291 "game.meta_patches");
2302 "game.phase_mode_stored");
2311 "game.timeoutintinc");
2315 "game.timeoutincmult");
2317 "game.timeoutcounter");
2323 "game.year_0_hack");
2326 "game.globalwarming");
2330 "game.warminglevel");
2333 "game.nuclearwinter");
2337 "game.coolinglevel");
2344 "game.random_seed");
2351 global_advances[
i] =
'\0';
2362#ifndef SAVE_DUMMY_TURN_CHANGE_TIME
2364 "game.last_turn_change_time");
2367 "game.last_turn_change_time");
2371 "game.save_players");
2410 for (
i = 0;
i < 8;
i++) {
2451 for (
i = 0;
i < 8;
i++) {
2455 "%8x %8x %8x %8x %8x %8x %8x", rstate.
v[7 *
i],
2456 rstate.
v[7 *
i + 1], rstate.
v[7 *
i + 2],
2457 rstate.
v[7 *
i + 3], rstate.
v[7 *
i + 4],
2458 rstate.
v[7 *
i + 5], rstate.
v[7 *
i + 6]);
2513 "version 2.90.99 required.");
2526 if (
buf[0] !=
'\0') {
2531 "scenario.authors");
2532 if (
buf[0] !=
'\0') {
2539 "scenario.description");
2540 if (
buf[0] !=
'\0') {
2551 "scenario.startpos_nations");
2554 "scenario.prevent_new_cities");
2557 "scenario.lake_flooding");
2560 "scenario.handmade");
2563 "scenario.allow_ai_type_fallback");
2567 "scenario.ruleset_locked");
2570 "scenario.datafile");
2571 if (
buf[0] !=
'\0') {
2578 "Invalid scenario definition (server state '%s' and "
2596#ifdef EMERGENCY_VERSION
2615 "scenario.authors");
2622 "scenario.description");
2629 "scenario.startpos_nations");
2632 "scenario.prevent_new_cities");
2635 "scenario.lake_flooding");
2638 "scenario.handmade");
2642 "scenario.allow_ai_type_fallback");
2647 "scenario.datafile");
2650 "scenario.ruleset_locked");
2653 "scenario.ruleset_caps");
2709 "savefile.city_counters_order_size");
2719 "Failed to load counter's ruleset order: %s",
2722 "Counter vector in savegame have bad size: %s",
2736 "counters.c%d",
i))) {
2744 for (j = 0; j < length; j++) {
2767 "savefile.city_counters_order_size");
2775 for (j = 0; j < count; j++) {
2780 "savefile.city_counters_order_vector");
2794 for (
i = 0;
i < count; ++
i) {
2887 "map.have_resources");
2937 const char *spec_sprite;
2946 if (
NULL != ptile->spec_sprite) {
2947 ptile->spec_sprite =
fc_strdup(spec_sprite);
2949 if (label !=
NULL) {
2972 if (ptile->spec_sprite) {
2976 if (ptile->label !=
NULL) {
2996 const char *ptr = buffer;
3006 scanin(&ptr,
",", token,
sizeof(token));
3008 "Map size not correct (map.alt%d).",
y);
3010 "Got map alt %s in (%d, %d).", token,
x,
y);
3058 loading->extra.order + 4 * j),
3059 loading->file,
"map.e%02d_%04d", j);
3092 for (
l = 0;
l < 4;
l++) {
3100 saving->file,
"map.e%02d_%04d", j);
3133 "map.startpos%d.y",
i)) {
3134 log_sg(
"Warning: Undefined coordinates for startpos %d",
i);
3139 if (
NULL == ptile) {
3140 log_error(
"Start position native coordinates (%d, %d) do not exist "
3146 "map.startpos%d.exclude",
i);
3151 "map.startpos%d.nations",
i);
3157 for (start =
buf - 1;
NULL != start; start = end) {
3180 log_verbose(
"Number of starts (%d) are lower than rules.max_players "
3181 "(%d), lowering rules.max_players.",
3209 "map.startpos_count");
3221 "map.startpos%d.exclude",
i);
3239 "map.startpos%d.nations",
i);
3267 "map.owner%04d",
y);
3269 "map.source%04d",
y);
3271 "map.eowner%04d",
y);
3274 "map.placing%04d",
y);
3277 "map.infra_turns%04d",
y);
3303 "Map size not correct (map.owner%d).",
y);
3308 "Got map owner %s in (%d, %d).",
token1,
x,
y);
3314 "Map size not correct (map.source%d).",
y);
3319 "Got map source %s in (%d, %d).",
token2,
x,
y);
3325 "Map size not correct (map.eowner%d).",
y);
3330 "Got base owner %s in (%d, %d).",
token3,
x,
y);
3337 "Map size not correct (map.placing%d).",
y);
3352 "Map size not correct (map.infra_turns%d).",
y);
3516 "City worked map not loaded!");
3519 sizeof(*
loading->worked_tiles));
3524 const char *ptr = buffer;
3527 "Savegame corrupt - map line %d not found.",
y);
3533 scanin(&ptr,
",", token,
sizeof(token));
3535 "Savegame corrupt - map size not correct.");
3536 if (
strcmp(token,
"-") == 0) {
3540 "Savegame corrupt - got tile worked by city "
3541 "id=%s in (%d, %d).", token,
x,
y);
3603 "game.save_known")) {
3608 for (j = 0; j < 8; j++) {
3609 for (
i = 0;
i < 4;
i++) {
3616 loading->file,
"map.k%02d_%04d",
l * 8 + j);
3652 if (!
saving->save_players) {
3673 |= (1u << (p % 32));
3679 for (j = 0; j < 8; j++) {
3680 for (
i = 0;
i < 4;
i++) {
3687 saving->file,
"map.k%02d_%04d",
l * 8 + j);
3727 "players.destroyed_wonders");
3730 "Invalid length for 'players.destroyed_wonders' ("
3733 for (k = 0; k <
loading->improvement.size; k++) {
3735 "Undefined value '%c' within "
3736 "'players.destroyed_wonders'.",
str[k]);
3738 if (
str[k] ==
'1') {
3750 "players.identity_number_used");
3777 log_sg(
"Game has started, yet player %d has no color defined.",
3809 for (k = 0; k <
loading->multiplier.size; k++) {
3816 "player%d.multiplier%d.val",
3822 log_verbose(
"Player %d had illegal value for multiplier \"%s\": "
3831 "player%d.multiplier%d.target",
3837 log_verbose(
"Player %d had illegal value for multiplier_target "
3838 " \"%s\": was %d, clamped to %d",
pslot_id,
3845 "player%d.multiplier%d.changed",
3853 "player%d.border_vision",
3857 "player%d.autoselect_weight",
3864 "(%d) from the loaded game does not match the number of "
3876 "Invalid team definition for player %s (nb %d).",
3892 "players.shuffled_player_%d", 0) >= 0) {
3910 "players.shuffled_player_%d",
i);
3913 log_sg(
"Missing player shuffle information (index %d) "
3914 "- reshuffle player list!",
i);
3918 log_sg(
"Player shuffle %d used two times "
3919 "- reshuffle player list!",
shuffle);
3941 "Invalid player shuffle data!");
3949 log_debug(
"[load shuffle] id: %3d => slot: %3d | slot %3d: %s",
3990 if (
is_ai(pplayer)) {
3991 log_normal(
_(
"%s has been added as %s level AI-controlled player "
3996 log_normal(
_(
"%s has been added as human player."),
4019 log_sg(
_(
"%s had invalid nation; changing to %s."),
4035 log_sg(
"Illegal alliance structure detected: "
4036 "%s alliance to %s reduced to peace treaty.",
4079 BV_CLR_ALL(pplayer->server.really_gives_vision);
4090 "player%d.diplstate%d.gives_shared_vision", plr1, plr2)) {
4094 "player%d.diplstate%d.gives_shared_tiles", plr1, plr2)) {
4110 _(
"%s did not give shared vision to team member %s."),
4116 _(
"%s did not give shared vision to team member %s."),
4136 log_sg(
"%s doing illegal activity in savegame!",
4138 log_sg(
"Activity: %s, Target: %s, Tile: (%d, %d), Terrain: %s",
4194 "players.destroyed_wonders");
4198 "players.identity_number_used");
4205 "players.shuffled_player_%d",
i);
4247 "player%d.username",
plrno));
4249 "player%d.unassigned_user",
plrno),
4253 "player%d.orig_username",
plrno));
4256 "player%d.ranked_username",
4259 "player%d.unassigned_ranked",
plrno),
4262 "player%d.delegation_username",
4299 "player%d.target_government_name",
plrno);
4307 "player%d.revolution_finishes",
plrno);
4329 if (
ds->type ==
DS_WAR &&
ds->first_contact_turn <= 0) {
4331 "Player%d: War with player %d who has never been met. "
4332 "Reverted to No Contact state.",
plrno,
i);
4339 "Player%d: closest diplstate to player %d less than current. "
4341 ds->max_state =
ds->type;
4344 ds->first_contact_turn =
4346 "%s.first_contact_turn",
buf);
4349 ds->has_reason_to_cancel =
4351 "%s.has_reason_to_cancel",
buf);
4352 ds->contact_turns_left =
4354 "%s.contact_turns_left",
buf);
4377 "player%d.adv.wonder_city",
4389 "player%d.ai.level",
plrno);
4398 log_sg(
"Player%d: Invalid AI level \"%s\". "
4405 "player%d.ai.barb_type",
plrno);
4409 log_sg(
"Player%d: Invalid barbarian type \"%s\". "
4431 if (style ==
NULL) {
4433 log_sg(
"Player%d: unsupported city_style_name \"%s\". "
4440 "player%d.idle_turns",
plrno),
4449 "player%d.is_alive",
plrno),
4452 "player%d.turns_alive",
plrno),
4455 "player%d.last_war",
plrno),
4458 "player%d.phase_done",
plrno);
4460 "player%d.gold",
plrno),
4463 "player%d.rates.tax",
plrno),
4466 "player%d.rates.science",
plrno),
4469 "player%d.rates.luxury",
plrno),
4472 "player%d.infrapts",
4476 "player%d.research.bulbs_last_turn",
plrno);
4492 "player%d.trait%d.mod",
plrno,
i),
4504 "player%d.achievement_count",
plrno);
4507 for (
i = 0;
i < count;
i++) {
4513 "player%d.achievement%d.name",
plrno,
i);
4517 "Unknown achievement \"%s\".",
name);
4520 "player%d.achievement%d.first",
4525 "Multiple players listed as first to get achievement \"%s\".",
4540 "score%d.happy",
plrno);
4543 "score%d.content",
plrno);
4546 "score%d.unhappy",
plrno);
4549 "score%d.angry",
plrno);
4557 for (
i = 0;
i <
loading->specialist.size;
i++) {
4560 "score%d.specialists%d",
plrno,
i);
4565 "score%d.wonders",
plrno);
4568 "score%d.techs",
plrno);
4571 "score%d.techout",
plrno);
4574 "score%d.landarea",
plrno);
4577 "score%d.settledarea",
plrno);
4580 "score%d.population",
plrno);
4583 "score%d.cities",
plrno);
4586 "score%d.units",
plrno);
4589 "score%d.pollution",
plrno);
4592 "score%d.literacy",
plrno);
4595 "score%d.bnp",
plrno);
4598 "score%d.mfg",
plrno);
4601 "score%d.spaceship",
plrno);
4604 "score%d.units_built",
plrno);
4607 "score%d.units_killed",
plrno);
4610 "score%d.units_lost",
plrno);
4613 "score%d.units_used",
plrno);
4616 "score%d.culture",
plrno);
4619 "score%d.total",
plrno);
4632 "%s.state", prefix),
4638 "%s.structurals", prefix),
4641 "%s.components", prefix),
4644 "%s.modules", prefix),
4650 "%s.propulsion", prefix),
4653 "%s.habitation", prefix),
4656 "%s.life_support", prefix),
4659 "%s.solar_panels", prefix),
4666 "Undefined value '%c' within '%s.structure'.",
st[
i],
4669 if (!(
st[
i] ==
'0')) {
4675 "%s.launch_year", prefix),
4689 "Invalid length for 'player%d.lost_wonders' ("
4692 for (k = 0; k <
loading->improvement.size; k++) {
4694 "Undefined value '%c' within "
4695 "'player%d.lost_wonders'.",
plrno,
str[k]);
4697 if (
str[k] ==
'1') {
4735 "player%d.flags",
plrno);
4738 "player%d.ai_type",
plrno);
4740 "player%d.name",
plrno);
4742 "player%d.username",
plrno);
4744 "player%d.unassigned_user",
plrno);
4750 log_sg(
"Game has started, yet player %d has no color defined.",
plrno);
4754 "player%d.ranked_username",
plrno);
4756 "player%d.unassigned_ranked",
plrno);
4758 "player%d.orig_username",
plrno);
4762 "player%d.delegation_username",
plrno);
4764 "player%d.nation",
plrno);
4766 "player%d.team_no",
plrno);
4770 "player%d.government_name",
plrno);
4775 "player%d.target_government_name",
plrno);
4779 "player%d.style_by_name",
plrno);
4782 "player%d.idle_turns",
plrno);
4785 "player%d.kind",
plrno);
4788 "player%d.kind",
plrno);
4791 "player%d.is_alive",
plrno);
4793 "player%d.turns_alive",
plrno);
4795 "player%d.last_war",
plrno);
4797 "player%d.phase_done",
plrno);
4813 "%s.first_contact_turn",
buf);
4815 "%s.turns_left",
buf);
4817 "%s.has_reason_to_cancel",
buf);
4819 "%s.contact_turns_left",
buf);
4823 "%s.gives_shared_vision",
buf);
4825 "%s.gives_shared_tiles",
buf);
4832 "player%d.ai%d.love",
plrno,
i);
4837 "player%d.adv.wonder_city",
plrno);
4844 for (k = 0; k <
i; k++) {
4846 "player%d.multiplier%d.val",
plrno, k);
4848 "player%d.multiplier%d.target",
plrno, k);
4850 "player%d.multiplier%d.changed",
plrno, k);
4854 "player%d.ai.level",
plrno);
4856 "player%d.ai.barb_type",
plrno);
4858 "player%d.gold",
plrno);
4860 "player%d.rates.tax",
plrno);
4862 "player%d.rates.science",
plrno);
4864 "player%d.rates.luxury",
plrno);
4866 "player%d.infrapts",
plrno);
4868 "player%d.research.bulbs_last_turn",
plrno);
4877 "player%d.trait%d.val",
plrno, j);
4879 "player%d.trait%d.mod",
plrno, j);
4890 "player%d.achievement%d.name",
plrno, j);
4891 if (
pach->first == plr) {
4893 "player%d.achievement%d.first",
plrno, j);
4896 "player%d.achievement%d.first",
plrno, j);
4904 "player%d.achievement_count",
plrno);
4908 "player%d.revolution_finishes",
plrno);
4912 "score%d.happy",
plrno);
4914 "score%d.content",
plrno);
4916 "score%d.unhappy",
plrno);
4918 "score%d.angry",
plrno);
4921 "score%d.specialists%d",
plrno,
sp);
4924 "score%d.wonders",
plrno);
4926 "score%d.techs",
plrno);
4928 "score%d.techout",
plrno);
4930 "score%d.landarea",
plrno);
4932 "score%d.settledarea",
plrno);
4934 "score%d.population",
plrno);
4936 "score%d.cities",
plrno);
4938 "score%d.units",
plrno);
4940 "score%d.pollution",
plrno);
4942 "score%d.literacy",
plrno);
4944 "score%d.bnp",
plrno);
4946 "score%d.mfg",
plrno);
4948 "score%d.spaceship",
plrno);
4950 "score%d.units_built",
plrno);
4952 "score%d.units_killed",
plrno);
4954 "score%d.units_lost",
plrno);
4956 "score%d.units_used",
plrno);
4958 "score%d.culture",
plrno);
4960 "score%d.total",
plrno);
4973 "%s.structurals",
buf);
4975 "%s.components",
buf);
4982 "%s.life_support",
buf);
4984 "%s.solar_panels",
buf);
4993 "%s.launch_year",
buf);
5010 "player%d.lost_wonders",
plrno);
5014 "player%d.history",
plrno);
5016 "player%d.hut_count",
plrno);
5019 "player%d.border_vision",
plrno);
5031 "player%d.autoselect_weight",
plrno);
5034 "player%d.autoselect_weight",
plrno);
5053 "player%d.ncities",
plrno),
5062 "player%d.wl_max_length",
5065 "player%d.routes_max_length",
plrno);
5111 if (city_id != -1) {
5129 "Unknown workertask activity %s",
str);
5137 "Unknown workertask target %s",
str);
5149 "player%d.task%d.want",
plrno,
i);
5166 const char *kind, *
name, *
str;
5182 "%s has invalid center tile (%d, %d)",
5205 "Invalid city size: %d, set to %d", value,
size);
5208 for (
i = 0;
i <
loading->specialist.size;
i++) {
5218 for (
i = 0; partner != 0;
i++) {
5230 "No traderoute direction found for %s",
citystr);
5233 "Illegal route direction %s",
dir);
5236 "No good found for %s",
citystr);
5243 "%s.traderoute%d",
citystr,
i + 1);
5270 pcity->turn_plague =
5294 "%s.turn_last_built",
citystr),
5303 "%s.currently_building: unknown \"%s\" \"%s\".",
5320 "%s.changed_from: unknown \"%s\" \"%s\".",
5323 pcity->before_change_shields =
5325 "%s.before_change_shields",
citystr);
5326 pcity->caravan_shields =
5328 "%s.caravan_shields",
citystr);
5329 pcity->disbanded_shields =
5331 "%s.disbanded_shields",
citystr);
5332 pcity->last_turns_shield_surplus =
5334 "%s.last_turns_shield_surplus",
5344 if (
pcity->style < 0) {
5359 "Invalid length of '%s.improvements' ("
5362 for (
i = 0;
i <
loading->improvement.size;
i++) {
5364 "Undefined value '%c' within '%s.improvements'.",
5367 if (
str[
i] ==
'1') {
5378 "No worked tiles map defined.");
5393 log_sg(
"[%s] '%s' (%d, %d) has worker outside current radius "
5406 loading->worked_tiles[ptile->index] = -1;
5415 log_sg(
"[%s] city center of '%s' (%d,%d) [%d] is worked by '%s' "
5424 log_sg(
"[%s] city center of '%s' (%d,%d) [%d] is empty; repairing",
5436 log_sg(
"[%s] size mismatch for '%s' (%d,%d): size [%d] != "
5437 "(workers [%d] - free worked tiles [%d]) + specialists [%d]",
5450 for (
i = 0;
i <
loading->coptions.size;
i++) {
5464 "%s.rally_point_length",
citystr);
5473 pcity->rally_point.persistent
5475 "%s.rally_point_persistent",
citystr);
5478 "%s.rally_point_vigilant",
citystr);
5482 "%s.rally_point_orders",
citystr);
5485 "%s.rally_point_dirs",
citystr);
5488 "%s.rally_point_activities",
citystr);
5490 for (
i = 0;
i <
len;
i++) {
5495 log_sg(
"Invalid rally point.");
5506 "%s.rally_point_action_vec,%d",
5516 sg_regr(3020000,
"Invalid action id in order for city rally point %d",
5525 "%s.rally_point_tgt_vec,%d",
5529 "%s.rally_point_sub_tgt_vec,%d",
5548 "%s.rally_point_tgt_vec",
citystr);
5550 "%s.rally_point_sub_tgt_vec",
citystr);
5578 pcity->cm_parameter = param;
5584 "%s.cma_minimal_surplus,%d",
citystr,
i);
5626 log_sg(
"Citizens of an invalid nation for %s (player slot %d)!",
5633 "Invalid value for citizens of player %d in %s: %d.",
5646 log_sg(
"City size and number of citizens does not match in %s "
5670 "player%d.ncities",
plrno);
5713 "player%d.wl_max_length",
plrno);
5715 "player%d.routes_max_length",
plrno);
5734 "%s.original",
buf);
5751 "%s.route_direction%d",
buf, j);
5753 "%s.route_good%d",
buf, j);
5761 "%s.route_direction%d",
buf, j);
5763 "%s.route_good%d",
buf, j);
5791 "%s.turn_last_built",
buf);
5797 "%s.currently_building_kind",
buf);
5799 "%s.currently_building_name",
buf);
5805 "%s.current_want",
buf);
5808 "%s.current_want",
buf);
5812 "%s.changed_from_kind",
buf);
5814 "%s.changed_from_name",
buf);
5817 "%s.before_change_shields",
buf);
5819 "%s.caravan_shields",
buf);
5821 "%s.disbanded_shields",
buf);
5823 "%s.last_turns_shield_surplus",
buf);
5831 "player%d.c%d.city_radius_sq",
plrno,
i);
5845 "Invalid size of the improvement vector (%s.improvements: "
5855 "%s.option%d",
buf, j);
5874 "%s.rally_point_length",
buf);
5877 char orders[
len + 1], dirs[
len + 1], activities[
len + 1];
5880 int sub_targets[
len];
5883 "%s.rally_point_persistent",
buf);
5885 "%s.rally_point_vigilant",
buf);
5887 for (j = 0; j <
len; j++) {
5890 activities[j] =
'?';
5900 sub_targets[j] =
pcity->rally_point.
orders[j].sub_target;
5909 sub_targets[j] =
pcity->rally_point.
orders[j].sub_target;
5920 orders[
len] = dirs[
len] = activities[
len] =
'\0';
5925 "%s.rally_point_activities",
buf);
5928 "%s.rally_point_action_vec",
buf);
5937 "%s.rally_point_tgt_vec",
buf);
5942 "%s.rally_point_tgt_vec,%d",
buf, j);
5946 "%s.rally_point_sub_tgt_vec",
buf);
5982 "%s.rally_point_tgt_vec,%d",
buf, j);
5995 "%s.cma_enabled",
buf);
5996 if (
pcity->cm_parameter) {
5999 "%s.cma_minimal_surplus",
buf);
6002 "%s.cma_factor",
buf);
6004 "%s.max_growth",
buf);
6006 "%s.require_happy",
buf);
6008 "%s.allow_disorder",
buf);
6010 pcity->cm_parameter->allow_specialists,
6011 "%s.allow_specialists",
buf);
6013 "%s.happy_factor",
buf);
6019 "%s.cma_minimal_surplus",
buf);
6021 "%s.cma_factor",
buf);
6043 "player%d.task%d.activity",
6047 "player%d.task%d.target",
6051 "player%d.task%d.target",
6074 "player%d.nunits",
plrno),
6082 "player%d.orders_max_length",
6220 "%s.current_form_turn",
unitstr);
6276 "%s.changed_from_count",
unitstr);
6334 "%s.server_side_agent",
6340 log_sg(
"Invalid server side agent %d for unit %d",
6360 if (
str[0] !=
'\0') {
6378 "%s.action_decision",
unitstr),
6386 log_sg(
"Invalid action decision want for unit %d",
punit->
id);
6396 "%s.action_decision_tile_x",
unitstr)
6398 "%s.action_decision_tile_y",
unitstr)) {
6433 "%s.orders_vigilant",
unitstr);
6447 for (j = 0; j <
len; j++) {
6454 log_sg(
"Invalid unit orders.");
6473 sg_regr(3020000,
"Invalid action id in order for unit %d",
punit->
id);
6499 "%s.sub_tgt_vec,%d",
6509 log_sg(
"Cannot find building %d for %s to %s",
6523 log_sg(
"Cannot find tech %d for %s to steal",
6538 "Specified sub target for action %d unsupported.",
6544 "Bad action action %d.",
6556 log_sg(
"Cannot find extra %d for %s to build",
6569 act =
order->activity;
6583 log_sg(
"Unexpected sub_target %d (expected %d) for order type %d",
6592 "%s.action_vec,%d",
unitstr, j);
6596 "%s.sub_tgt_vec,%d",
unitstr, j);
6616 "%s.action_vec,%d",
unitstr, j);
6620 "%s.sub_tgt_vec,%d",
unitstr, j);
6643 "player%d.nunits",
plrno),
6661 "player%d.u%d.transported_by",
6672#ifndef FREECIV_NDEBUG
6696 "player%d.nunits",
plrno);
6709 "player%d.orders_max_length",
plrno);
6728 "%s.nationality",
buf);
6734 "%s.type_by_name",
buf);
6738 "%s.activity_count",
buf);
6748 "%s.activity_tgt",
buf);
6752 "%s.changed_from",
buf);
6754 "%s.changed_from_count",
buf);
6759 "%s.changed_from_tgt",
buf);
6763 "%s.done_moving",
buf);
6769 "%s.current_form_turn",
buf);
6771 "%s.battlegroup",
buf);
6786 "%s.server_side_agent",
buf);
6794 "%s.ord_city",
buf);
6797 "%s.paradropped",
buf);
6800 "%s.transported_by",
buf);
6803 "%s.carrying",
buf);
6809 "%s.action_decision",
buf);
6817 "%s.action_decision_tile_x",
buf);
6819 "%s.action_decision_tile_y",
buf);
6823 "%s.action_decision_tile_x",
buf);
6825 "%s.action_decision_tile_y",
buf);
6843 "%s.orders_index",
buf);
6845 "%s.orders_repeat",
buf);
6847 "%s.orders_vigilant",
buf);
6849 for (j = 0; j <
len; j++) {
6887 "%s.action_vec",
buf);
6903 "%s.sub_tgt_vec",
buf);
6967 loading->file, 0,
"player%d.attribute_v2_block_length",
plrno);
6970 log_sg(
"player%d.attribute_v2_block_length=%d too small",
plrno,
6974 log_sg(
"player%d.attribute_v2_block_length=%d too big (max %d)",
6981#ifndef FREECIV_NDEBUG
6987 "player%d.attribute_v2_block_length_quoted",
6991 "player%d.attribute_v2_block_parts",
plrno),
6998 const char *current =
7000 "player%d.attribute_v2_block_data.part%d",
7006 log_debug(
"attribute_v2_block_length_quoted=%d"
7013 "attribute_v2_block_length_quoted=%d"
7017#ifndef FREECIV_NDEBUG
7044#define PART_SIZE (3*256)
7045#define PART_ADJUST (3)
7058 "player%d.attribute_v2_block_length",
plrno);
7060 "player%d.attribute_v2_block_length_quoted",
plrno);
7073 "player%d.attribute_v2_block_parts",
plrno);
7082 "player%d.attribute_v2_block_data.part%d",
7098 "player%d.attribute_v2_block_data.part%d",
7120 "player%d.dc_total",
plrno);
7144 "game.save_private_map")) {
7173 "player%d.map_t%04d",
plrno);
7207 const char *ptr = buffer;
7211 "Savegame corrupt - map line %d not found.",
y);
7218 scanin(&ptr,
",", token,
sizeof(token));
7220 "Savegame corrupt - map size not correct.");
7221 if (
strcmp(token,
"-") == 0) {
7225 "Savegame corrupt - got tile owner=%s in (%d, %d).",
7232 "Savegame corrupt - map size not correct.");
7237 "Savegame corrupt - got extras owner=%s in (%d, %d).",
7246 for (
i = 0;
i < 4;
i++) {
7274 log_sg(
"Skipping seen city %d for player %d.",
i,
plrno);
7332 "%s has invalid owner (%d); skipping.",
citystr,
id);
7340 "%s has invalid original owner (%d); skipping.",
citystr,
id);
7342 pdcity->original =
nullptr;
7349 "%s has invalid id (%d); skipping.",
citystr,
id);
7356 "Invalid city size: %d; set to %d.",
size, city_size);
7364 "Invalid length of '%s.improvements' ("
7367 for (
i = 0;
i <
loading->improvement.size;
i++) {
7369 "Undefined value '%c' within '%s.improvements'.",
7372 if (
str[
i] ==
'1') {
7502 for (
l = 0;
l < 4;
l++) {
7514 saving->file,
"player%d.map_e%02d_%04d",
plrno, j);
7518 for (
i = 0;
i < 4;
i++) {
7545 if (
pdcity->original !=
nullptr) {
7547 "%s.original",
buf);
7555 "%s.occupied",
buf);
7574 "Invalid size of the improvement vector (%s.improvements: "
7616 for (
i = 0;
i < count;
i++) {
7618 "research.r%d.number",
i),
7622 "Invalid research number %d in 'research.r%d.number'",
7626 "research.r%d.goal",
i);
7629 "research.r%d.futuretech",
i),
7633 "research.r%d.bulbs",
i),
7637 "research.r%d.bulbs_before",
i),
7640 "research.r%d.saved",
i);
7642 "research.r%d.now",
i);
7645 "research.r%d.free_bulbs",
i),
7651 "Invalid length of 'research.r%d.done' ("
7654 for (j = 0; j <
loading->technology.size; j++) {
7656 "Undefined value '%c' within 'research.r%d.done'.",
7659 if (
str[j] ==
'1') {
7675 "research.r%d.vbs",
i);
7708 if (
saving->save_players) {
7711 "research.r%d.number",
i);
7715 "research.r%d.futuretech",
i);
7717 "research.r%d.bulbs_before",
i);
7725 "research.r%d.vbs",
i);
7733 "research.r%d.bulbs",
i);
7737 "research.r%d.free_bulbs",
i);
7800 "treaty%d.plr0", tidx)) !=
NULL ;
7813 log_error(
"Treaty between unknown players %s and %s", plr0, plr1);
7821 "treaty%d.clause%d.type",
7840 log_error(
"Clause giver %s is not participant of the treaty"
7841 "between %s and %s",
plrx, plr0, plr1);
7848 "treaty%d.clause%d.value",
7859 "treaty%d.accept0", tidx);
7861 "treaty%d.accept1", tidx);
7993 log_error(
"Invalid map image definition %4d: %s.",
i, p);
8044 log_verbose(
"Max players lower than current players, fixing");
8053 log_sg(
"Removing %s unferried %s in %s at (%d, %d)",
8090 log_error(
"[city id: %d] Bad worker task %d.",
8105 if (
loading->worked_tiles[ptile->index] != -1) {
8106 log_error(
"[city id: %d] Unused worked tile at (%d, %d).",
8120 log_sg(
_(
"%s had invalid researching technology."),
8130 log_sg(
_(
"%s had invalid technology goal."),
8150 log_sg(
_(
"%s has multiple units of type %s though it should be possible "
8151 "to have only one."),
8176 sizeof(
server.game_identifier));
bool achievement_player_has(const struct achievement *pach, const struct player *pplayer)
const char * achievement_rule_name(struct achievement *pach)
struct achievement * achievement_by_rule_name(const char *name)
#define achievements_iterate_end
#define achievements_iterate(_ach_)
static struct action * actions[MAX_NUM_ACTIONS]
const char * action_id_name_translation(action_id act_id)
struct action * action_by_rule_name(const char *name)
const char * action_id_rule_name(action_id act_id)
bool action_id_exists(const action_id act_id)
#define action_id_get_sub_target_kind(act_id)
#define action_id_get_activity(act_id)
void building_advisor(struct player *pplayer)
bool adv_data_phase_init(struct player *pplayer, bool is_new_phase)
void adv_data_phase_done(struct player *pplayer)
const char * ai_name(const struct ai_type *ai)
int ai_type_get_count(void)
#define CALL_FUNC_EACH_AI(_func,...)
#define CALL_PLR_AI_FUNC(_func, _player,...)
#define ai_type_iterate_end
#define ai_type_iterate(NAME_ai)
void ai_traits_init(struct player *pplayer)
int dbv_bits(struct dbv *pdbv)
void dbv_set(struct dbv *pdbv, int bit)
bool dbv_isset(const struct dbv *pdbv, int bit)
void dbv_clr_all(struct dbv *pdbv)
#define BV_ISSET(bv, bit)
bool has_capabilities(const char *us, const char *them)
citizens citizens_nation_get(const struct city *pcity, const struct player_slot *pslot)
void citizens_nation_set(struct city *pcity, const struct player_slot *pslot, citizens count)
citizens citizens_count(const struct city *pcity)
void citizens_init(struct city *pcity)
void citizens_update(struct city *pcity, struct player *plr)
void city_map_radius_sq_set(struct city *pcity, int radius_sq)
void city_name_set(struct city *pcity, const char *new_name)
const char * city_name_get(const struct city *pcity)
const char * city_style_rule_name(const int style)
struct city * create_city_virtual(struct player *pplayer, struct tile *ptile, const char *name)
int city_illness_calc(const struct city *pcity, int *ill_base, int *ill_size, int *ill_trade, int *ill_pollution)
void city_size_set(struct city *pcity, citizens size)
void city_add_improvement(struct city *pcity, const struct impr_type *pimprove)
void destroy_city_virtual(struct city *pcity)
int city_style_by_rule_name(const char *s)
#define cities_iterate_end
#define city_list_iterate(citylist, pcity)
#define city_tile(_pcity_)
#define cities_iterate(pcity)
#define CITY_MAP_MAX_RADIUS_SQ
static citizens city_size_get(const struct city *pcity)
#define output_type_iterate(output)
#define FREE_WORKED_TILES
#define city_list_iterate_end
#define city_tile_iterate(_nmap, _radius_sq, _city_tile, _tile)
#define city_tile_iterate_end
#define output_type_iterate_end
void auto_arrange_workers(struct city *pcity)
void city_repair_size(struct city *pcity, int change)
bool city_refresh(struct city *pcity)
struct counter * counter_by_index(int index, enum counter_target target)
int counter_index(const struct counter *pcount)
struct counter * counter_by_rule_name(const char *name)
const char * counter_rule_name(struct counter *pcount)
int counters_get_city_counters_count(void)
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit * punit
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit int const struct action *paction struct unit struct city * pcity
void set_ai_level_directer(struct player *pplayer, enum ai_level level)
enum diplstate_type valid_dst_closest(struct player_diplstate *dst)
void treaty_add(struct treaty *ptreaty)
void init_treaty(struct treaty *ptreaty, struct player *plr0, struct player *plr1)
bool add_clause(struct treaty *ptreaty, struct player *pfrom, enum clause_type type, int val, struct player *client_player)
void treaties_iterate(treaty_cb cb, void *data)
#define clause_list_iterate_end
#define clause_list_iterate(clauselist, pclause)
#define MAX_NUM_PLAYER_SLOTS
#define IDENTITY_NUMBER_ZERO
struct unit * game_unit_by_number(int id)
void initialize_globals(void)
struct city * game_city_by_number(int id)
#define GAME_DEFAULT_TIMEOUTINTINC
#define GAME_DEFAULT_SCORETURN
#define GAME_DEFAULT_TIMEOUTINT
#define GAME_DEFAULT_TIMEOUTINCMULT
#define GAME_DEFAULT_TIMEOUTINC
#define GAME_DEFAULT_RULESETDIR
#define GAME_DEFAULT_TIMEOUTCOUNTER
#define GAME_DEFAULT_PHASE_MODE
struct government * government_of_player(const struct player *pplayer)
const char * government_rule_name(const struct government *pgovern)
struct government * government_by_rule_name(const char *name)
#define governments_iterate(NAME_pgov)
#define governments_iterate_end
void idex_register_unit(struct world *iworld, struct unit *punit)
void idex_register_city(struct world *iworld, struct city *pcity)
struct impr_type * improvement_by_number(const Impr_type_id id)
bool great_wonder_is_destroyed(const struct impr_type *pimprove)
bool wonder_is_lost(const struct player *pplayer, const struct impr_type *pimprove)
const char * improvement_rule_name(const struct impr_type *pimprove)
Impr_type_id improvement_index(const struct impr_type *pimprove)
bool is_wonder(const struct impr_type *pimprove)
bool is_great_wonder(const struct impr_type *pimprove)
struct impr_type * improvement_by_rule_name(const char *name)
Impr_type_id improvement_count(void)
#define improvement_iterate_end
#define improvement_iterate(_p)
void adv_city_free(struct city *pcity)
void adv_city_alloc(struct city *pcity)
#define fc_assert_msg(condition, message,...)
#define fc_assert_ret(condition)
#define log_verbose(message,...)
#define fc_assert(condition)
#define log_fatal(message,...)
#define fc_assert_action(condition, action)
#define log_debug(message,...)
#define log_normal(message,...)
#define log_error(message,...)
bool startpos_disallow(struct startpos *psp, struct nation_type *pnation)
int sq_map_distance(const struct tile *tile0, const struct tile *tile1)
struct startpos * map_startpos_new(struct tile *ptile)
struct tile * startpos_tile(const struct startpos *psp)
bool startpos_allows_all(const struct startpos *psp)
const struct nation_hash * startpos_raw_nations(const struct startpos *psp)
void map_init_topology(struct civ_map *nmap)
void main_map_allocate(void)
struct tile * index_to_tile(const struct civ_map *imap, int mindex)
int map_startpos_count(void)
struct tile * native_pos_to_tile(const struct civ_map *nmap, int nat_x, int nat_y)
bool startpos_is_excluding(const struct startpos *psp)
bool startpos_allow(struct startpos *psp, struct nation_type *pnation)
#define map_startpos_iterate(NAME_psp)
#define map_startpos_iterate_end
#define whole_map_iterate(_map, _tile)
#define index_to_native_pos(pnat_x, pnat_y, mindex)
#define whole_map_iterate_end
void assign_continent_numbers(void)
void player_map_init(struct player *pplayer)
void update_player_tile_last_seen(struct player *pplayer, struct tile *ptile)
void map_claim_ownership(struct tile *ptile, struct player *powner, struct tile *psource, bool claim_bases)
bool map_is_known(const struct tile *ptile, const struct player *pplayer)
bool send_tile_suppression(bool now)
bool really_gives_vision(struct player *me, struct player *them)
void map_know_and_see_all(struct player *pplayer)
bool update_player_tile_knowledge(struct player *pplayer, struct tile *ptile)
struct vision_site * map_get_player_city(const struct tile *ptile, const struct player *pplayer)
void tile_claim_bases(struct tile *ptile, struct player *powner)
void map_set_known(struct tile *ptile, struct player *pplayer)
bool map_is_known_and_seen(const struct tile *ptile, const struct player *pplayer, enum vision_layer vlayer)
void change_playertile_site(struct player_tile *ptile, struct vision_site *new_site)
void map_calculate_borders(void)
void give_shared_vision(struct player *pfrom, struct player *pto)
struct player_tile * map_get_player_tile(const struct tile *ptile, const struct player *pplayer)
bool mapimg_id2str(int id, char *str, size_t str_len)
bool mapimg_define(const char *maparg, bool check)
bool mapimg_delete(int id)
#define fc_calloc(n, esz)
bool can_unit_exist_at_tile(const struct civ_map *nmap, const struct unit *punit, const struct tile *ptile)
const char * multiplier_rule_name(const struct multiplier *pmul)
Multiplier_type_id multiplier_count(void)
struct multiplier * multiplier_by_rule_name(const char *name)
Multiplier_type_id multiplier_index(const struct multiplier *pmul)
#define multipliers_iterate(_mul_)
#define multipliers_iterate_end
const char * nation_rule_name(const struct nation_type *pnation)
struct nation_type * nation_of_player(const struct player *pplayer)
struct nation_type * nation_by_rule_name(const char *name)
static struct nation_type * nations
const char * nation_plural_for_player(const struct player *pplayer)
#define nation_hash_iterate(nationhash, pnation)
#define nation_hash_iterate_end
#define NO_NATION_SELECTED
void event_cache_load(struct section_file *file, const char *section)
void event_cache_save(struct section_file *file, const char *section)
bool player_slot_is_used(const struct player_slot *pslot)
struct unit * player_unit_by_number(const struct player *pplayer, int unit_id)
struct player * player_by_number(const int player_id)
bool players_on_same_team(const struct player *pplayer1, const struct player *pplayer2)
int player_slot_count(void)
struct player_slot * player_slot_by_number(int player_id)
int player_number(const struct player *pplayer)
enum dipl_reason pplayer_can_make_treaty(const struct player *p1, const struct player *p2, enum diplstate_type treaty)
const char * player_name(const struct player *pplayer)
int player_slot_max_used_number(void)
int player_slot_index(const struct player_slot *pslot)
struct player * player_by_name(const char *name)
bool player_has_flag(const struct player *pplayer, enum plr_flag_id flag)
bool player_has_real_embassy(const struct player *pplayer, const struct player *pplayer2)
struct city * player_city_by_number(const struct player *pplayer, int city_id)
int player_index(const struct player *pplayer)
bool player_set_nation(struct player *pplayer, struct nation_type *pnation)
struct player_diplstate * player_diplstate_get(const struct player *plr1, const struct player *plr2)
bool pplayers_allied(const struct player *pplayer, const struct player *pplayer2)
struct player_slot * slots
bool gives_shared_tiles(const struct player *me, const struct player *them)
bool gives_shared_vision(const struct player *me, const struct player *them)
#define players_iterate_end
@ DIPL_ALLIANCE_PROBLEM_THEM
@ DIPL_ALLIANCE_PROBLEM_US
#define players_iterate(_pplayer)
#define MAX_ATTRIBUTE_BLOCK
#define player_list_iterate(playerlist, pplayer)
static bool is_barbarian(const struct player *pplayer)
#define player_slots_iterate(_pslot)
#define player_list_iterate_end
#define players_iterate_alive_end
#define player_slots_iterate_end
#define players_iterate_alive(_pplayer)
void server_player_set_name(struct player *pplayer, const char *name)
struct player * server_create_player(int player_id, const char *ai_tname, struct rgbcolor *prgbcolor, bool allow_ai_type_fallbacking)
int normal_player_count(void)
void player_limit_to_max_rates(struct player *pplayer)
struct nation_type * pick_a_nation(const struct nation_list *choices, bool ignore_conflicts, bool needs_startpos, enum barbarian_type barb_type)
void set_shuffled_players(int *shuffled_players)
void player_delegation_set(struct player *pplayer, const char *username)
void shuffle_players(void)
void server_remove_player(struct player *pplayer)
void server_player_init(struct player *pplayer, bool initmap, bool needs_team)
void assign_player_colors(void)
const char * player_delegation_get(const struct player *pplayer)
void fit_nationset_to_players(void)
#define shuffled_players_iterate_end
#define shuffled_players_iterate(NAME_pplayer)
bool fc_rand_is_init(void)
RANDOM_STATE fc_rand_state(void)
void fc_rand_set_state(RANDOM_STATE state)
struct section_file * secfile_load(const char *filename, bool allow_duplicates)
const char * secfile_error(void)
bool secfile_lookup_int(const struct section_file *secfile, int *ival, const char *path,...)
const char ** secfile_lookup_str_vec(const struct section_file *secfile, size_t *dim, const char *path,...)
struct entry * secfile_entry_lookup(const struct section_file *secfile, const char *path,...)
bool entry_str_set_gt_marking(struct entry *pentry, bool gt_marking)
const char * secfile_lookup_str(const struct section_file *secfile, const char *path,...)
int * secfile_lookup_int_vec(const struct section_file *secfile, size_t *dim, const char *path,...)
float secfile_lookup_float_default(const struct section_file *secfile, float def, const char *path,...)
bool secfile_lookup_bool_default(const struct section_file *secfile, bool def, const char *path,...)
int secfile_lookup_int_default(const struct section_file *secfile, int def, const char *path,...)
struct entry * secfile_entry_by_path(const struct section_file *secfile, const char *path)
struct section * secfile_section_lookup(const struct section_file *secfile, const char *path,...)
const char * secfile_lookup_str_default(const struct section_file *secfile, const char *def, const char *path,...)
bool secfile_lookup_bool(const struct section_file *secfile, bool *bval, const char *path,...)
#define secfile_insert_int(secfile, value, path,...)
#define secfile_insert_enum(secfile, enumerator, specenum_type, path,...)
#define secfile_insert_int_vec(secfile, values, dim, path,...)
#define secfile_lookup_enum_default(secfile, defval, specenum_type, path,...)
#define secfile_insert_str_vec(secfile, strings, dim, path,...)
#define secfile_insert_str(secfile, string, path,...)
#define secfile_insert_bool(secfile, value, path,...)
#define secfile_replace_str(secfile, string, path,...)
#define secfile_insert_float(secfile, value, path,...)
struct history_report * history_report_get(void)
const char * universal_rule_name(const struct universal *psource)
const char * universal_type_rule_name(const struct universal *psource)
struct universal universal_by_rule_name(const char *kind, const char *value)
bool research_invention_reachable(const struct research *presearch, const Tech_type_id tech)
const char * research_name_translation(const struct research *presearch)
enum tech_state research_invention_set(struct research *presearch, Tech_type_id tech, enum tech_state value)
struct research * research_by_number(int number)
int research_number(const struct research *presearch)
int recalculate_techs_researched(const struct research *presearch)
enum tech_state research_invention_state(const struct research *presearch, Tech_type_id tech)
void research_update(struct research *presearch)
#define researches_iterate(_presearch)
#define researches_iterate_end
void rgbcolor_destroy(struct rgbcolor *prgbcolor)
bool rgbcolor_load(struct section_file *file, struct rgbcolor **prgbcolor, char *path,...)
void rgbcolor_save(struct section_file *file, const struct rgbcolor *prgbcolor, char *path,...)
bool load_rulesets(const char *restore, const char *alt, bool compat_mode, rs_conversion_logger logger, bool act, bool buffer_script, bool load_luadata)
#define sanity_check_city(x)
int current_compat_ver(void)
char bin2ascii_hex(int value, int halfbyte_wanted)
void sg_load_compat(struct loaddata *loading, enum sgf_version format_class)
int ascii_hex2bin(char ch, int halfbyte)
void sg_load_post_load_compat(struct loaddata *loading, enum sgf_version format_class)
#define sg_check_ret(...)
#define sg_warn(condition, message,...)
#define sg_failure_ret_val(condition, _val, message,...)
#define sg_failure_ret(condition, message,...)
#define sg_regr(fixversion, message,...)
#define sg_warn_ret_val(condition, _val, message,...)
void savegame3_save(struct section_file *sfile, const char *save_reason, bool scenario)
static void sg_save_history(struct savedata *saving)
static char sg_extras_get_bv(bv_extras extras, struct extra_type *presource, const int *idx)
static void sg_save_counters(struct savedata *saving)
static void sg_save_map_altitude(struct savedata *saving)
static void unit_ordering_apply(void)
static void sg_load_players_basic(struct loaddata *loading)
static struct loaddata * loaddata_new(struct section_file *file)
static void worklist_save(struct section_file *file, const struct worklist *pwl, int max_length, const char *path,...)
static void sg_load_map_known(struct loaddata *loading)
static void sg_load_map_owner(struct loaddata *loading)
#define ACTIVITY_OLD_FALLOUT_SG3
static char * quote_block(const void *const data, int length)
#define halfbyte_iterate_extras_end
#define halfbyte_iterate_extras(e, num_extras_types)
static void sg_load_map(struct loaddata *loading)
static enum unit_orders char2order(char order)
static int unquote_block(const char *const quoted_, void *dest, int dest_length)
static void sg_save_map_tiles_extras(struct savedata *saving)
static void sg_save_map_worked(struct savedata *saving)
#define ACTIVITY_OLD_POLLUTION_SG3
static void sg_save_players(struct savedata *saving)
#define LOAD_MAP_CHAR(ch, ptile, SET_XY_CHAR, secfile, secpath,...)
static void treaty_save(struct treaty *ptr, void *data_in)
static void sg_save_player_cities(struct savedata *saving, struct player *plr)
static void sg_load_player_city_citizens(struct loaddata *loading, struct player *plr, struct city *pcity, const char *citystr)
static void sg_load_player_cities(struct loaddata *loading, struct player *plr)
static void sg_load_map_tiles(struct loaddata *loading)
static bool sg_load_player_unit(struct loaddata *loading, struct player *plr, struct unit *punit, int orders_max_length, const char *unitstr)
static char activity2char(int activity)
static struct savedata * savedata_new(struct section_file *file, const char *save_reason, bool scenario)
static void sg_load_savefile(struct loaddata *loading)
static enum unit_activity char2activity(char activity)
static void unit_ordering_calc(void)
static void sg_load_settings(struct loaddata *loading)
static void sg_load_player_units(struct loaddata *loading, struct player *plr)
static char terrain2char(const struct terrain *pterrain)
static void sg_save_random(struct savedata *saving)
static void sg_save_map_startpos(struct savedata *saving)
static void sg_load_researches(struct loaddata *loading)
static void sg_load_map_worked(struct loaddata *loading)
#define SAVE_MAP_CHAR(ptile, GET_XY_CHAR, secfile, secpath,...)
static void sg_save_savefile_options(struct savedata *saving, const char *option)
static void sg_load_random(struct loaddata *loading)
static void sg_save_savefile(struct savedata *saving)
static void sg_load_player_units_transport(struct loaddata *loading, struct player *plr)
static void sg_load_history(struct loaddata *loading)
static void sg_save_treaties(struct savedata *saving)
static void sg_save_map_owner(struct savedata *saving)
static void sg_save_researches(struct savedata *saving)
static void savegame3_save_real(struct section_file *file, const char *save_reason, bool scenario)
static void sg_load_script(struct loaddata *loading)
static void sg_load_scenario(struct loaddata *loading)
static void sg_load_game(struct loaddata *loading)
static void savedata_destroy(struct savedata *saving)
static void sg_load_player_main(struct loaddata *loading, struct player *plr)
static char order2char(enum unit_orders order)
static void sg_load_treaties(struct loaddata *loading)
static void sg_save_scenario(struct savedata *saving)
static void sg_extras_set_bv(bv_extras *extras, char ch, struct extra_type **idx)
static void sg_save_player_units(struct savedata *saving, struct player *plr)
static void sg_save_ruledata(struct savedata *saving)
static char sg_extras_get_dbv(struct dbv *extras, struct extra_type *presource, const int *idx)
static Tech_type_id technology_load(struct section_file *file, const char *path, int plrno)
static void sg_save_player_vision(struct savedata *saving, struct player *plr)
static enum direction8 char2dir(char dir)
#define ACTIVITY_LAST_SAVEGAME3
static bool sg_load_player_city(struct loaddata *loading, struct player *plr, struct city *pcity, const char *citystr, int wlist_max_length, int routes_max)
static struct terrain * char2terrain(char ch)
static void sg_save_sanitycheck(struct savedata *saving)
static void sg_load_mapimg(struct loaddata *loading)
static void sg_load_player_attributes(struct loaddata *loading, struct player *plr)
static void sg_save_player_attributes(struct savedata *saving, struct player *plr)
static void sg_load_ruledata(struct loaddata *loading)
static void sg_save_map(struct savedata *saving)
static void sg_load_player_vision(struct loaddata *loading, struct player *plr)
static void sg_save_map_tiles(struct savedata *saving)
static void worklist_load(struct section_file *file, int wlist_max_length, struct worklist *pwl, const char *path,...)
static void sg_save_mapimg(struct savedata *saving)
static const char savefile_options_default[]
static char dir2char(enum direction8 dir)
static bool sg_load_player_vision_city(struct loaddata *loading, struct player *plr, struct vision_site *pdcity, const char *citystr)
static void sg_load_counters(struct loaddata *loading)
static void sg_load_map_startpos(struct loaddata *loading)
static void loaddata_destroy(struct loaddata *loading)
static void sg_load_players(struct loaddata *loading)
static void sg_load_map_altitude(struct loaddata *loading)
static void technology_save(struct section_file *file, const char *path, int plrno, Tech_type_id tech)
static void sg_save_event_cache(struct savedata *saving)
static void sg_load_map_tiles_extras(struct loaddata *loading)
static void sg_load_sanitycheck(struct loaddata *loading)
static void sg_load_event_cache(struct loaddata *loading)
void savegame3_load(struct section_file *file)
static void sg_extras_set_dbv(struct dbv *extras, char ch, struct extra_type **idx)
static void sg_save_game(struct savedata *saving)
static void sg_save_player_main(struct savedata *saving, struct player *plr)
static void sg_save_script(struct savedata *saving)
static void sg_save_settings(struct savedata *saving)
static void sg_save_map_known(struct savedata *saving)
void script_server_state_save(struct section_file *file)
void script_server_state_load(struct section_file *file)
void settings_game_load(struct section_file *file, const char *section)
void settings_game_save(struct section_file *file, const char *section)
struct setting_list * level[OLEVELS_NUM]
sex_t sex_by_name(const char *name)
const char * sex_rule_name(sex_t kind)
const char * fileinfoname(const struct strvec *dirs, const char *filename)
bool str_to_int(const char *str, int *pint)
const struct strvec * get_scenario_dirs(void)
bool is_base64url(const char *s)
char scanin(const char **buf, char *delimiters, char *dest, int size)
void randomize_base64url_string(char *s, size_t n)
#define CLIP(lower, current, upper)
void spaceship_calc_derived(struct player_spaceship *ship)
void spaceship_init(struct player_spaceship *ship)
#define NUM_SS_STRUCTURALS
struct specialist * specialist_by_rule_name(const char *name)
struct specialist * specialist_by_number(const Specialist_type_id id)
Specialist_type_id specialist_index(const struct specialist *sp)
const char * specialist_rule_name(const struct specialist *sp)
Specialist_type_id specialist_count(void)
#define specialist_type_iterate_end
#define specialist_type_iterate(sp)
#define DEFAULT_SPECIALIST
void server_game_init(bool keep_ruleset_value)
const char * aifill(int amount)
bool game_was_started(void)
void identity_number_reserve(int id)
struct server_arguments srvarg
void init_game_seed(void)
void update_nations_with_startpos(void)
enum server_states server_state(void)
void server_game_free(void)
struct packet_scenario_description scenario_desc
struct packet_ruleset_control control
struct packet_game_info info
char rulesetdir[MAX_LEN_NAME]
int additional_phase_seconds
struct section_file * luadata
struct packet_scenario_info scenario
struct timer * phase_timer
char orig_game_version[MAX_LEN_NAME]
struct civ_game::@32::@36::@39 save_options
char * ruleset_capabilities
struct civ_game::@32::@36 server
struct civ_map::@44::@46 server
enum map_generator generator
int minimal_surplus[O_LAST]
struct section_file * file
int great_wonder_owners[B_LAST]
bool global_advances[A_LAST]
enum ai_level skill_level
enum phase_mode_type phase_mode
char version[MAX_LEN_NAME]
char alt_dir[MAX_LEN_NAME]
char description[MAX_LEN_CONTENT]
char datafile[MAX_LEN_NAME]
bool allow_ai_type_fallback
char authors[MAX_LEN_PACKET/3]
enum ai_level skill_level
enum barbarian_type barbarian_type
int love[MAX_NUM_PLAYER_SLOTS]
struct player * extras_owner
struct extra_type * resource
struct city_list * cities
struct player_ai ai_common
struct government * target_government
char username[MAX_LEN_NAME]
struct government * government
const struct ai_type * ai
char ranked_username[MAX_LEN_NAME]
struct player::@73::@75 server
struct player_economic economic
struct player_spaceship spaceship
struct attribute_block_s attribute_block
struct player_score score
struct multiplier_value multipliers[MAX_NUM_MULTIPLIERS]
struct nation_type * nation
struct nation_style * style
char orig_username[MAX_LEN_NAME]
struct section_file * file
char secfile_options[512]
char metaserver_addr[256]
struct extra_type * placing
struct section_file * file
struct clause_list * clauses
enum unit_activity activity
enum action_decision action_decision_want
enum unit_activity activity
struct extra_type * changed_from_target
struct unit::@84::@87 server
struct extra_type * activity_target
enum unit_activity changed_from
struct player * nationality
struct goods_type * carrying
struct tile * action_decision_tile
enum server_side_agent ssa_controller
int city_style(struct city *pcity)
struct nation_style * style_by_rule_name(const char *name)
struct nation_style * style_by_number(int id)
const char * style_rule_name(const struct nation_style *pstyle)
int fc_snprintf(char *str, size_t n, const char *format,...)
size_t fc_strlcpy(char *dest, const char *src, size_t n)
int fc_strcasecmp(const char *str0, const char *str1)
int cat_snprintf(char *str, size_t n, const char *format,...)
int fc_vsnprintf(char *str, size_t n, const char *format, va_list ap)
#define sz_strlcpy(dest, src)
#define RETURN_VALUE_AFTER_EXIT(_val_)
#define sz_strlcat(dest, src)
int team_index(const struct team *pteam)
struct team_slot * team_slot_by_number(int team_id)
bool team_add_player(struct player *pplayer, struct team *pteam)
struct team * team_new(struct team_slot *tslot)
const struct player_list * team_members(const struct team *pteam)
struct advance * advance_by_number(const Tech_type_id atype)
bool is_future_tech(Tech_type_id tech)
struct advance * valid_advance_by_number(const Tech_type_id id)
const char * advance_rule_name(const struct advance *padvance)
Tech_type_id advance_index(const struct advance *padvance)
struct advance * advance_by_rule_name(const char *name)
Tech_type_id advance_number(const struct advance *padvance)
#define advance_index_iterate_end
#define advance_iterate(_p)
#define advance_iterate_end
#define advance_index_iterate(_start, _index)
struct terrain * terrain_by_rule_name(const char *name)
char terrain_identifier(const struct terrain *pterrain)
const char * terrain_rule_name(const struct terrain *pterrain)
bool terrain_has_resource(const struct terrain *pterrain, const struct extra_type *presource)
#define terrain_type_iterate(_p)
#define TERRAIN_UNKNOWN_IDENTIFIER
#define terrain_type_iterate_end
bool tile_set_label(struct tile *ptile, const char *label)
void tile_set_resource(struct tile *ptile, struct extra_type *presource)
struct city * tile_city(const struct tile *ptile)
void tile_set_worked(struct tile *ptile, struct city *pcity)
#define tile_worked(_tile)
#define tile_terrain(_tile)
#define tile_has_extra(ptile, pextra)
#define tile_owner(_tile)
void timer_destroy(struct timer *t)
void timer_start(struct timer *t)
void timer_stop(struct timer *t)
struct timer * timer_new(enum timer_timetype type, enum timer_use use, const char *name)
double timer_read_seconds(struct timer *t)
int city_num_trade_routes(const struct city *pcity)
struct goods_type * goods_by_rule_name(const char *name)
const char * goods_rule_name(struct goods_type *pgood)
struct goods_type * goods_by_number(Goods_type_id id)
#define trade_routes_iterate_end
#define trade_routes_iterate(c, proute)
void free_unit_orders(struct unit *punit)
bool unit_transport_load(struct unit *pcargo, struct unit *ptrans, bool force)
struct player * unit_nationality(const struct unit *punit)
struct unit * unit_transport_get(const struct unit *pcargo)
bool can_unit_continue_current_activity(const struct civ_map *nmap, struct unit *punit)
struct unit * unit_virtual_create(struct player *pplayer, struct city *pcity, const struct unit_type *punittype, int veteran_level)
bool unit_order_list_is_sane(const struct civ_map *nmap, int length, const struct unit_order *orders)
void set_unit_activity_targeted(struct unit *punit, enum unit_activity new_activity, struct extra_type *new_target, enum gen_action trigger_action)
void unit_virtual_destroy(struct unit *punit)
void unit_tile_set(struct unit *punit, struct tile *ptile)
void set_unit_activity(struct unit *punit, enum unit_activity new_activity, enum gen_action trigger_action)
void unit_list_sort_ord_map(struct unit_list *punitlist)
void unit_list_sort_ord_city(struct unit_list *punitlist)
#define unit_list_iterate(unitlist, punit)
#define unit_list_iterate_safe(unitlist, _unit)
#define unit_list_iterate_end
#define unit_list_iterate_safe_end
const struct unit_type * unit_type_get(const struct unit *punit)
int utype_upkeep_cost(const struct unit_type *ut, struct player *pplayer, Output_type_id otype)
struct unit_type * unit_type_by_rule_name(const char *name)
const char * unit_rule_name(const struct unit *punit)
int utype_veteran_levels(const struct unit_type *punittype)
Unit_type_id utype_index(const struct unit_type *punittype)
const char * utype_name_translation(const struct unit_type *punittype)
static bool utype_has_flag(const struct unit_type *punittype, int flag)
#define unit_type_iterate(_p)
#define unit_type_iterate_end
const char * freeciv_datafile_version(void)
void vision_site_size_set(struct vision_site *psite, citizens size)
citizens vision_site_size_get(const struct vision_site *psite)
struct vision * vision_new(struct player *pplayer, struct tile *ptile)
bool vision_reveal_tiles(struct vision *vision, bool reveal_tiles)
struct vision_site * vision_site_new(int identity, struct tile *location, struct player *owner)
void vision_site_destroy(struct vision_site *psite)
#define vision_site_owner(v)
bool worker_task_is_sane(struct worker_task *ptask)
#define worker_task_list_iterate(tasklist, ptask)
#define worker_task_list_iterate_end
void worklist_init(struct worklist *pwl)
#define MAP_NATIVE_HEIGHT