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[wld.map.xsize + 1]; \
175 int _nat_x, _nat_y; \
177 for (_nat_y = 0; _nat_y < wld.map.ysize; _nat_y++) { \
178 for (_nat_x = 0; _nat_x < wld.map.xsize; _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[wld.map.xsize] = '\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 < wld.map.ysize; _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) != wld.map.xsize) { \
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'", wld.map.xsize, strlen(_line), buf); \
237 _printed_warning = TRUE; \
240 for (_nat_x = 0; _nat_x < wld.map.xsize; _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);
526 const char *save_reason,
589 loading->improvement.size = -1;
683 saving->secfile_options[0] =
'\0';
881 if (activity ==
achar) {
897 char *buffer =
fc_malloc(length * 3 + 10);
901 sprintf(buffer,
"%d:", length);
904 for (
i = 0;
i < length;
i++) {
905 sprintf(buffer + offset,
"%02x ", ((
unsigned char *) data)[
i]);
926 log_error(
_(
"Syntax error in attribute block."));
937 log_error(
_(
"Syntax error in attribute block."));
943 for (
i = 0;
i < length;
i++) {
949 log_error(
_(
"Syntax error in attribute block."));
953 ((
unsigned char *) dest)[
i] =
tmp;
983 for (
i = 0;
i <
pwl->length;
i++) {
1026 for (
i = 0;
i <
pwl->length;
i++) {
1104 if (!
pch ||
ch ==
'\0') {
1105 log_sg(
"Unknown hex value: '%c' (%d)",
ch,
ch);
1111 for (
i = 0;
i < 4;
i++) {
1114 if (pextra ==
NULL) {
1117 if ((
bin & (1 <<
i))
1137 if (!
pch ||
ch ==
'\0') {
1138 log_sg(
"Unknown hex value: '%c' (%d)",
ch,
ch);
1144 for (
i = 0;
i < 4;
i++) {
1147 if (pextra ==
NULL) {
1150 if ((
bin & (1 <<
i))
1169 for (
i = 0;
i < 4;
i++) {
1201 for (
i = 0;
i < 4;
i++) {
1232 if (pterrain->identifier_load ==
ch) {
1237 log_fatal(
"Unknown terrain identifier '%c' in savegame.",
ch);
1262 const char *path,
int plrno)
1365 const char *req_caps;
1375 "scenario.ruleset_caps");
1382 log_normal(
_(
"Scenario requires ruleset capabilities: %s"), req_caps);
1386 log_error(
_(
"Current ruleset %s not compatible with the scenario %s."
1387 " Trying to switch to the ruleset specified by the"
1397 const char *
ruleset, *alt_dir;
1401 "savefile.rulesetdir");
1410 log_verbose(
"Savegame specified ruleset '%s'. Really loading '%s'.",
1415 "savefile.ruleset_alt_dir");
1420 _(
"Failed to load either of rulesets '%s' or '%s' "
1421 "needed for savegame."),
1425 _(
"Failed to load ruleset '%s' needed for savegame."),
1446 const struct strvec **path;
1464 if (secfile ==
NULL) {
1465 log_error(
_(
"Failed to load scenario luadata file %s.luadata"),
1481 "savefile.last_updated_as_year");
1486 "savefile.improvement_size");
1487 if (
loading->improvement.size) {
1490 "savefile.improvement_vector");
1492 "Failed to load improvement order: %s",
1499 "savefile.technology_size");
1500 if (
loading->technology.size) {
1503 "savefile.technology_vector");
1505 "Failed to load technology order: %s",
1512 "savefile.activities_size");
1513 if (
loading->activities.size) {
1516 "savefile.activities_vector");
1518 "Failed to load activity order: %s",
1525 "savefile.trait_size");
1529 "savefile.trait_vector");
1531 "Failed to load trait order: %s",
1538 "savefile.extras_size");
1545 "savefile.extras_vector");
1547 "Failed to load extras order: %s",
1550 "Number of extras defined by the ruleset (= %d) are "
1551 "lower than the number in the savefile (= %d).",
1556 for (j = 0; j <
loading->extra.size; j++) {
1560 for (; j <
nmod; j++) {
1568 "savefile.multipliers_size");
1569 if (
loading->multiplier.size) {
1574 "savefile.multipliers_vector");
1576 "Failed to load multipliers order: %s",
1581 sizeof(*
loading->multiplier.order));
1582 for (j = 0; j <
loading->multiplier.size; j++) {
1584 if (!
loading->multiplier.order[j]) {
1585 log_verbose(
"Multiplier \"%s\" in savegame but not in ruleset, "
1595 "savefile.specialists_size");
1596 if (
loading->specialist.size) {
1602 "savefile.specialists_vector");
1604 "Failed to load specialists order: %s",
1607 "Number of specialists defined by the ruleset (= %d) are "
1608 "lower than the number in the savefile (= %d).",
1616 for (j = 0; j <
loading->specialist.size; j++) {
1620 for (; j <
nmod; j++) {
1627 "savefile.action_size");
1630 "Failed to load action order: %s",
1638 "savefile.action_vector");
1641 sizeof(*
loading->action.order));
1643 for (j = 0; j <
loading->action.size; j++) {
1660 "savefile.action_decision_size");
1663 "Failed to load action decision order: %s",
1671 "savefile.action_decision_vector");
1674 sizeof(*
loading->act_dec.order));
1676 for (j = 0; j <
loading->act_dec.size; j++) {
1687 "savefile.server_side_agent_size");
1690 "Failed to load server side agent order: %s",
1698 "savefile.server_side_agent_list");
1703 for (j = 0; j <
loading->ssa.size; j++) {
1714 "savefile.city_options_size");
1717 "Failed to load city options order: %s",
1725 "savefile.city_options_vector");
1728 sizeof(*
loading->coptions.order));
1730 for (j = 0; j <
loading->coptions.size; j++) {
1740 pterr->identifier_load =
'\0';
1745 "savefile.terrident%d.name",
i)) !=
NULL) {
1750 "savefile.terrident%d.identifier",
i);
1763 "%s and %s share a saved identifier",
1794 "savefile.orig_version");
1820 "savefile.improvement_size");
1829 "savefile.improvement_vector");
1836 "savefile.technology_size");
1845 "savefile.technology_vector");
1850 "savefile.activities_size");
1865 "savefile.activities_vector");
1871 "savefile.specialists_size");
1883 "savefile.specialists_vector");
1890 "savefile.trait_size");
1903 "savefile.trait_vector");
1909 "savefile.extras_size");
1922 "savefile.extras_vector");
1928 "savefile.multipliers_size");
1940 "savefile.multipliers_vector");
1946 "savefile.city_options_size");
1960 "savefile.city_options_vector");
1966 "savefile.action_size");
1980 "savefile.action_vector");
1986 "savefile.action_decision_size");
2000 "savefile.action_decision_vector");
2006 "savefile.server_side_agent_size");
2020 "savefile.server_side_agent_list");
2052 "savefile.options");
2072 "ruledata.government%d.name",
i));
2078 "ruledata.government%d.changes",
i);
2096 "game.server_state");
2108 "game.meta_patches");
2117 "game.meta_server"));
2147 "game.phase_mode_stored");
2170 "game.timeoutintinc");
2176 "game.timeoutincmult");
2179 "game.timeoutcounter");
2208 "game.global_advances");
2211 "Invalid length of 'game.global_advances' ("
2214 for (
i = 0;
i <
loading->technology.size;
i++) {
2216 "Undefined value '%c' within 'game.global_advances'.",
2218 if (
str[
i] ==
'1') {
2252 "%s.changes", path);
2277 "game.server_state");
2283 "game.phase_seconds");
2287 "game.meta_patches");
2298 "game.phase_mode_stored");
2307 "game.timeoutintinc");
2311 "game.timeoutincmult");
2313 "game.timeoutcounter");
2318 "game.year_0_hack");
2321 "game.globalwarming");
2325 "game.warminglevel");
2328 "game.nuclearwinter");
2332 "game.coolinglevel");
2339 "game.random_seed");
2346 global_advances[
i] =
'\0';
2357#ifndef SAVE_DUMMY_TURN_CHANGE_TIME
2359 "game.last_turn_change_time");
2362 "game.last_turn_change_time");
2366 "game.save_players");
2405 for (
i = 0;
i < 8;
i++) {
2446 for (
i = 0;
i < 8;
i++) {
2450 "%8x %8x %8x %8x %8x %8x %8x", rstate.
v[7 *
i],
2451 rstate.
v[7 *
i + 1], rstate.
v[7 *
i + 2],
2452 rstate.
v[7 *
i + 3], rstate.
v[7 *
i + 4],
2453 rstate.
v[7 *
i + 5], rstate.
v[7 *
i + 6]);
2508 "version 2.90.99 required.");
2521 if (
buf[0] !=
'\0') {
2526 "scenario.authors");
2527 if (
buf[0] !=
'\0') {
2534 "scenario.description");
2535 if (
buf[0] !=
'\0') {
2546 "scenario.startpos_nations");
2549 "scenario.prevent_new_cities");
2552 "scenario.lake_flooding");
2555 "scenario.handmade");
2558 "scenario.allow_ai_type_fallback");
2562 "scenario.ruleset_locked");
2565 "scenario.datafile");
2566 if (
buf[0] !=
'\0') {
2573 "Invalid scenario definition (server state '%s' and "
2591#ifdef EMERGENCY_VERSION
2610 "scenario.authors");
2617 "scenario.description");
2624 "scenario.startpos_nations");
2627 "scenario.prevent_new_cities");
2630 "scenario.lake_flooding");
2633 "scenario.handmade");
2637 "scenario.allow_ai_type_fallback");
2642 "scenario.datafile");
2645 "scenario.ruleset_locked");
2648 "scenario.ruleset_caps");
2704 "savefile.city_counters_order_size");
2714 "Failed to load counter's ruleset order: %s",
2717 "Counter vector in savegame have bad size: %s",
2731 "counters.c%d",
i))) {
2739 for (j = 0; j < length; j++) {
2762 "savefile.city_counters_order_size");
2770 for (j = 0; j < count; j++) {
2775 "savefile.city_counters_order_vector");
2789 for (
i = 0;
i < count; ++
i) {
2874 "map.have_resources");
2919 const char *spec_sprite;
2928 if (
NULL != ptile->spec_sprite) {
2929 ptile->spec_sprite =
fc_strdup(spec_sprite);
2931 if (label !=
NULL) {
2954 if (ptile->spec_sprite) {
2958 if (ptile->label !=
NULL) {
2976 loading->extra.order + 4 * j),
2977 loading->file,
"map.e%02d_%04d", j);
3010 for (
l = 0;
l < 4;
l++) {
3018 saving->file,
"map.e%02d_%04d", j);
3051 "map.startpos%d.y",
i)) {
3052 log_sg(
"Warning: Undefined coordinates for startpos %d",
i);
3057 if (
NULL == ptile) {
3058 log_error(
"Start position native coordinates (%d, %d) do not exist "
3064 "map.startpos%d.exclude",
i);
3069 "map.startpos%d.nations",
i);
3075 for (start =
buf - 1;
NULL != start; start = end) {
3098 log_verbose(
"Number of starts (%d) are lower than rules.max_players "
3099 "(%d), lowering rules.max_players.",
3127 "map.startpos_count");
3139 "map.startpos%d.exclude",
i);
3157 "map.startpos%d.nations",
i);
3185 "map.owner%04d",
y);
3187 "map.source%04d",
y);
3189 "map.eowner%04d",
y);
3192 "map.placing%04d",
y);
3195 "map.infra_turns%04d",
y);
3220 "Map size not correct (map.owner%d).",
y);
3225 "Got map owner %s in (%d, %d).",
token1,
x,
y);
3231 "Map size not correct (map.source%d).",
y);
3236 "Got map source %s in (%d, %d).",
token2,
x,
y);
3242 "Map size not correct (map.eowner%d).",
y);
3247 "Got base owner %s in (%d, %d).",
token3,
x,
y);
3254 "Map size not correct (map.placing%d).",
y);
3269 "Map size not correct (map.infra_turns%d).",
y);
3423 "City worked map not loaded!");
3426 sizeof(*
loading->worked_tiles));
3431 const char *ptr = buffer;
3434 "Savegame corrupt - map line %d not found.",
y);
3440 scanin(&ptr,
",", token,
sizeof(token));
3442 "Savegame corrupt - map size not correct.");
3443 if (
strcmp(token,
"-") == 0) {
3447 "Savegame corrupt - got tile worked by city "
3448 "id=%s in (%d, %d).", token,
x,
y);
3481 if (pcity ==
NULL) {
3510 "game.save_known")) {
3515 for (j = 0; j < 8; j++) {
3516 for (
i = 0;
i < 4;
i++) {
3523 loading->file,
"map.k%02d_%04d",
l * 8 + j);
3559 if (!
saving->save_players) {
3580 |= (1u << (p % 32));
3586 for (j = 0; j < 8; j++) {
3587 for (
i = 0;
i < 4;
i++) {
3594 saving->file,
"map.k%02d_%04d",
l * 8 + j);
3634 "players.destroyed_wonders");
3637 "Invalid length for 'players.destroyed_wonders' ("
3640 for (k = 0; k <
loading->improvement.size; k++) {
3642 "Undefined value '%c' within "
3643 "'players.destroyed_wonders'.",
str[k]);
3645 if (
str[k] ==
'1') {
3657 "players.identity_number_used");
3684 log_sg(
"Game has started, yet player %d has no color defined.",
3716 for (k = 0; k <
loading->multiplier.size; k++) {
3723 "player%d.multiplier%d.val",
3729 log_verbose(
"Player %d had illegal value for multiplier \"%s\": "
3738 "player%d.multiplier%d.target",
3744 log_verbose(
"Player %d had illegal value for multiplier_target "
3745 " \"%s\": was %d, clamped to %d",
pslot_id,
3752 "player%d.multiplier%d.changed",
3760 "player%d.border_vision",
3764 "player%d.autoselect_weight",
3771 "(%d) from the loaded game does not match the number of "
3783 "Invalid team definition for player %s (nb %d).",
3799 "players.shuffled_player_%d", 0) >= 0) {
3817 "players.shuffled_player_%d",
i);
3820 log_sg(
"Missing player shuffle information (index %d) "
3821 "- reshuffle player list!",
i);
3825 log_sg(
"Player shuffle %d used two times "
3826 "- reshuffle player list!",
shuffle);
3848 "Invalid player shuffle data!");
3856 log_debug(
"[load shuffle] id: %3d => slot: %3d | slot %3d: %s",
3897 if (
is_ai(pplayer)) {
3898 log_normal(
_(
"%s has been added as %s level AI-controlled player "
3903 log_normal(
_(
"%s has been added as human player."),
3926 log_sg(
_(
"%s had invalid nation; changing to %s."),
3942 log_sg(
"Illegal alliance structure detected: "
3943 "%s alliance to %s reduced to peace treaty.",
3957 pcity->server.illness
3959 &(pcity->illness_trade),
NULL);
3986 BV_CLR_ALL(pplayer->server.really_gives_vision);
3997 "player%d.diplstate%d.gives_shared_vision", plr1, plr2)) {
4001 "player%d.diplstate%d.gives_shared_tiles", plr1, plr2)) {
4017 _(
"%s did not give shared vision to team member %s."),
4023 _(
"%s did not give shared vision to team member %s."),
4043 log_sg(
"%s doing illegal activity in savegame!",
4045 log_sg(
"Activity: %s, Target: %s, Tile: (%d, %d), Terrain: %s",
4101 "players.destroyed_wonders");
4105 "players.identity_number_used");
4112 "players.shuffled_player_%d",
i);
4154 "player%d.username",
plrno));
4156 "player%d.unassigned_user",
plrno),
4160 "player%d.orig_username",
plrno));
4163 "player%d.ranked_username",
4166 "player%d.unassigned_ranked",
plrno),
4169 "player%d.delegation_username",
4206 "player%d.target_government_name",
plrno);
4214 "player%d.revolution_finishes",
plrno);
4236 if (
ds->type ==
DS_WAR &&
ds->first_contact_turn <= 0) {
4238 "Player%d: War with player %d who has never been met. "
4239 "Reverted to No Contact state.",
plrno,
i);
4246 "Player%d: closest diplstate to player %d less than current. "
4248 ds->max_state =
ds->type;
4251 ds->first_contact_turn =
4253 "%s.first_contact_turn",
buf);
4256 ds->has_reason_to_cancel =
4258 "%s.has_reason_to_cancel",
buf);
4259 ds->contact_turns_left =
4261 "%s.contact_turns_left",
buf);
4284 "player%d.adv.wonder_city",
4296 "player%d.ai.level",
plrno);
4305 log_sg(
"Player%d: Invalid AI level \"%s\". "
4312 "player%d.ai.barb_type",
plrno);
4316 log_sg(
"Player%d: Invalid barbarian type \"%s\". "
4338 if (style ==
NULL) {
4340 log_sg(
"Player%d: unsupported city_style_name \"%s\". "
4347 "player%d.idle_turns",
plrno),
4356 "player%d.is_alive",
plrno),
4359 "player%d.turns_alive",
plrno),
4362 "player%d.last_war",
plrno),
4365 "player%d.phase_done",
plrno);
4367 "player%d.gold",
plrno),
4370 "player%d.rates.tax",
plrno),
4373 "player%d.rates.science",
plrno),
4376 "player%d.rates.luxury",
plrno),
4379 "player%d.infrapts",
4383 "player%d.research.bulbs_last_turn",
plrno);
4399 "player%d.trait%d.mod",
plrno,
i),
4411 "player%d.achievement_count",
plrno);
4414 for (
i = 0;
i < count;
i++) {
4420 "player%d.achievement%d.name",
plrno,
i);
4424 "Unknown achievement \"%s\".",
name);
4427 "player%d.achievement%d.first",
4432 "Multiple players listed as first to get achievement \"%s\".",
4447 "score%d.happy",
plrno);
4450 "score%d.content",
plrno);
4453 "score%d.unhappy",
plrno);
4456 "score%d.angry",
plrno);
4464 for (
i = 0;
i <
loading->specialist.size;
i++) {
4467 "score%d.specialists%d",
plrno,
i);
4472 "score%d.wonders",
plrno);
4475 "score%d.techs",
plrno);
4478 "score%d.techout",
plrno);
4481 "score%d.landarea",
plrno);
4484 "score%d.settledarea",
plrno);
4487 "score%d.population",
plrno);
4490 "score%d.cities",
plrno);
4493 "score%d.units",
plrno);
4496 "score%d.pollution",
plrno);
4499 "score%d.literacy",
plrno);
4502 "score%d.bnp",
plrno);
4505 "score%d.mfg",
plrno);
4508 "score%d.spaceship",
plrno);
4511 "score%d.units_built",
plrno);
4514 "score%d.units_killed",
plrno);
4517 "score%d.units_lost",
plrno);
4520 "score%d.units_used",
plrno);
4523 "score%d.culture",
plrno);
4526 "score%d.total",
plrno);
4539 "%s.state", prefix),
4545 "%s.structurals", prefix),
4548 "%s.components", prefix),
4551 "%s.modules", prefix),
4557 "%s.propulsion", prefix),
4560 "%s.habitation", prefix),
4563 "%s.life_support", prefix),
4566 "%s.solar_panels", prefix),
4573 "Undefined value '%c' within '%s.structure'.",
st[
i],
4576 if (!(
st[
i] ==
'0')) {
4582 "%s.launch_year", prefix),
4596 "Invalid length for 'player%d.lost_wonders' ("
4599 for (k = 0; k <
loading->improvement.size; k++) {
4601 "Undefined value '%c' within "
4602 "'player%d.lost_wonders'.",
plrno,
str[k]);
4604 if (
str[k] ==
'1') {
4642 "player%d.flags",
plrno);
4645 "player%d.ai_type",
plrno);
4647 "player%d.name",
plrno);
4649 "player%d.username",
plrno);
4651 "player%d.unassigned_user",
plrno);
4657 log_sg(
"Game has started, yet player %d has no color defined.",
plrno);
4661 "player%d.ranked_username",
plrno);
4663 "player%d.unassigned_ranked",
plrno);
4665 "player%d.orig_username",
plrno);
4669 "player%d.delegation_username",
plrno);
4671 "player%d.nation",
plrno);
4673 "player%d.team_no",
plrno);
4677 "player%d.government_name",
plrno);
4682 "player%d.target_government_name",
plrno);
4686 "player%d.style_by_name",
plrno);
4689 "player%d.idle_turns",
plrno);
4692 "player%d.kind",
plrno);
4695 "player%d.kind",
plrno);
4698 "player%d.is_alive",
plrno);
4700 "player%d.turns_alive",
plrno);
4702 "player%d.last_war",
plrno);
4704 "player%d.phase_done",
plrno);
4720 "%s.first_contact_turn",
buf);
4722 "%s.turns_left",
buf);
4724 "%s.has_reason_to_cancel",
buf);
4726 "%s.contact_turns_left",
buf);
4730 "%s.gives_shared_vision",
buf);
4732 "%s.gives_shared_tiles",
buf);
4739 "player%d.ai%d.love",
plrno,
i);
4744 "player%d.adv.wonder_city",
plrno);
4751 for (k = 0; k <
i; k++) {
4753 "player%d.multiplier%d.val",
plrno, k);
4755 "player%d.multiplier%d.target",
plrno, k);
4757 "player%d.multiplier%d.changed",
plrno, k);
4761 "player%d.ai.level",
plrno);
4763 "player%d.ai.barb_type",
plrno);
4765 "player%d.gold",
plrno);
4767 "player%d.rates.tax",
plrno);
4769 "player%d.rates.science",
plrno);
4771 "player%d.rates.luxury",
plrno);
4773 "player%d.infrapts",
plrno);
4775 "player%d.research.bulbs_last_turn",
plrno);
4784 "player%d.trait%d.val",
plrno, j);
4786 "player%d.trait%d.mod",
plrno, j);
4797 "player%d.achievement%d.name",
plrno, j);
4798 if (
pach->first == plr) {
4800 "player%d.achievement%d.first",
plrno, j);
4803 "player%d.achievement%d.first",
plrno, j);
4811 "player%d.achievement_count",
plrno);
4815 "player%d.revolution_finishes",
plrno);
4819 "score%d.happy",
plrno);
4821 "score%d.content",
plrno);
4823 "score%d.unhappy",
plrno);
4825 "score%d.angry",
plrno);
4828 "score%d.specialists%d",
plrno,
sp);
4831 "score%d.wonders",
plrno);
4833 "score%d.techs",
plrno);
4835 "score%d.techout",
plrno);
4837 "score%d.landarea",
plrno);
4839 "score%d.settledarea",
plrno);
4841 "score%d.population",
plrno);
4843 "score%d.cities",
plrno);
4845 "score%d.units",
plrno);
4847 "score%d.pollution",
plrno);
4849 "score%d.literacy",
plrno);
4851 "score%d.bnp",
plrno);
4853 "score%d.mfg",
plrno);
4855 "score%d.spaceship",
plrno);
4857 "score%d.units_built",
plrno);
4859 "score%d.units_killed",
plrno);
4861 "score%d.units_lost",
plrno);
4863 "score%d.units_used",
plrno);
4865 "score%d.culture",
plrno);
4867 "score%d.total",
plrno);
4880 "%s.structurals",
buf);
4882 "%s.components",
buf);
4889 "%s.life_support",
buf);
4891 "%s.solar_panels",
buf);
4900 "%s.launch_year",
buf);
4917 "player%d.lost_wonders",
plrno);
4921 "player%d.history",
plrno);
4923 "player%d.hut_count",
plrno);
4926 "player%d.border_vision",
plrno);
4938 "player%d.autoselect_weight",
plrno);
4941 "player%d.autoselect_weight",
plrno);
4960 "player%d.ncities",
plrno),
4969 "player%d.wl_max_length",
4972 "player%d.routes_max_length",
plrno);
5018 if (city_id != -1) {
5022 if (pcity !=
NULL) {
5036 "Unknown workertask activity %s",
str);
5044 "Unknown workertask target %s",
str);
5056 "player%d.task%d.want",
plrno,
i);
5073 const char *kind, *
name, *
str;
5089 "%s has invalid center tile (%d, %d)",
5112 "Invalid city size: %d, set to %d", value,
size);
5115 for (
i = 0;
i <
loading->specialist.size;
i++) {
5125 for (
i = 0; partner != 0;
i++) {
5137 "No traderoute direction found for %s",
citystr);
5140 "Illegal route direction %s",
dir);
5143 "No good found for %s",
citystr);
5150 "%s.traderoute%d",
citystr,
i + 1);
5201 "%s.turn_last_built",
citystr),
5210 "%s.currently_building: unknown \"%s\" \"%s\".",
5227 "%s.changed_from: unknown \"%s\" \"%s\".",
5232 "%s.before_change_shields",
citystr);
5235 "%s.caravan_shields",
citystr);
5238 "%s.disbanded_shields",
citystr);
5241 "%s.last_turns_shield_surplus",
5251 if (pcity->
style < 0) {
5266 "Invalid length of '%s.improvements' ("
5269 for (
i = 0;
i <
loading->improvement.size;
i++) {
5271 "Undefined value '%c' within '%s.improvements'.",
5274 if (
str[
i] ==
'1') {
5285 "No worked tiles map defined.");
5298 if (
loading->worked_tiles[ptile->index] == pcity->
id) {
5300 log_sg(
"[%s] '%s' (%d, %d) has worker outside current radius "
5313 loading->worked_tiles[ptile->index] = -1;
5322 log_sg(
"[%s] city center of '%s' (%d,%d) [%d] is worked by '%s' "
5331 log_sg(
"[%s] city center of '%s' (%d,%d) [%d] is empty; repairing",
5343 log_sg(
"[%s] size mismatch for '%s' (%d,%d): size [%d] != "
5344 "(workers [%d] - free worked tiles [%d]) + specialists [%d]",
5357 for (
i = 0;
i <
loading->coptions.size;
i++) {
5371 "%s.rally_point_length",
citystr);
5382 "%s.rally_point_persistent",
citystr);
5385 "%s.rally_point_vigilant",
citystr);
5389 "%s.rally_point_orders",
citystr);
5392 "%s.rally_point_dirs",
citystr);
5395 "%s.rally_point_activities",
citystr);
5397 for (
i = 0;
i <
len;
i++) {
5402 log_sg(
"Invalid rally point.");
5413 "%s.rally_point_action_vec,%d",
5423 sg_regr(3020000,
"Invalid action id in order for city rally point %d",
5432 "%s.rally_point_tgt_vec,%d",
5436 "%s.rally_point_sub_tgt_vec,%d",
5455 "%s.rally_point_tgt_vec",
citystr);
5457 "%s.rally_point_sub_tgt_vec",
citystr);
5491 "%s.cma_minimal_surplus,%d",
citystr,
i);
5533 log_sg(
"Citizens of an invalid nation for %s (player slot %d)!",
5540 "Invalid value for citizens of player %d in %s: %d.",
5553 log_sg(
"City size and number of citizens does not match in %s "
5577 "player%d.ncities",
plrno);
5620 "player%d.wl_max_length",
plrno);
5622 "player%d.routes_max_length",
plrno);
5639 if (pcity->original !=
NULL) {
5641 "%s.original",
buf);
5658 "%s.route_direction%d",
buf, j);
5660 "%s.route_good%d",
buf, j);
5668 "%s.route_direction%d",
buf, j);
5670 "%s.route_good%d",
buf, j);
5698 "%s.turn_last_built",
buf);
5704 "%s.currently_building_kind",
buf);
5706 "%s.currently_building_name",
buf);
5712 "%s.current_want",
buf);
5715 "%s.current_want",
buf);
5719 "%s.changed_from_kind",
buf);
5721 "%s.changed_from_name",
buf);
5724 "%s.before_change_shields",
buf);
5726 "%s.caravan_shields",
buf);
5728 "%s.disbanded_shields",
buf);
5730 "%s.last_turns_shield_surplus",
buf);
5738 "player%d.c%d.city_radius_sq",
plrno,
i);
5752 "Invalid size of the improvement vector (%s.improvements: "
5762 "%s.option%d",
buf, j);
5781 "%s.rally_point_length",
buf);
5782 if (pcity->rally_point.length) {
5783 int len = pcity->rally_point.length;
5784 char orders[
len + 1], dirs[
len + 1], activities[
len + 1];
5787 int sub_targets[
len];
5790 "%s.rally_point_persistent",
buf);
5792 "%s.rally_point_vigilant",
buf);
5794 for (j = 0; j <
len; j++) {
5795 orders[j] =
order2char(pcity->rally_point.orders[j].order);
5797 activities[j] =
'?';
5801 switch (pcity->rally_point.orders[j].order) {
5804 dirs[j] =
dir2char(pcity->rally_point.orders[j].dir);
5807 sub_targets[j] = pcity->rally_point.orders[j].sub_target;
5812 actions[j] = pcity->rally_point.orders[j].action;
5813 targets[j] = pcity->rally_point.orders[j].target;
5814 sub_targets[j] = pcity->rally_point.orders[j].sub_target;
5825 orders[
len] = dirs[
len] = activities[
len] =
'\0';
5830 "%s.rally_point_activities",
buf);
5833 "%s.rally_point_action_vec",
buf);
5842 "%s.rally_point_tgt_vec",
buf);
5847 "%s.rally_point_tgt_vec,%d",
buf, j);
5851 "%s.rally_point_sub_tgt_vec",
buf);
5887 "%s.rally_point_tgt_vec,%d",
buf, j);
5900 "%s.cma_enabled",
buf);
5901 if (pcity->cm_parameter) {
5903 pcity->cm_parameter->minimal_surplus,
O_LAST,
5904 "%s.cma_minimal_surplus",
buf);
5906 pcity->cm_parameter->factor,
O_LAST,
5907 "%s.cma_factor",
buf);
5909 "%s.max_growth",
buf);
5911 "%s.require_happy",
buf);
5913 "%s.allow_disorder",
buf);
5915 pcity->cm_parameter->allow_specialists,
5916 "%s.allow_specialists",
buf);
5918 "%s.happy_factor",
buf);
5924 "%s.cma_minimal_surplus",
buf);
5926 "%s.cma_factor",
buf);
5948 "player%d.task%d.activity",
5952 "player%d.task%d.target",
5956 "player%d.task%d.target",
5979 "player%d.nunits",
plrno),
5987 "player%d.orders_max_length",
6113 "%s.current_form_turn",
unitstr);
6169 "%s.changed_from_count",
unitstr);
6227 "%s.server_side_agent",
6233 log_sg(
"Invalid server side agent %d for unit %d",
6253 if (
str[0] !=
'\0') {
6271 "%s.action_decision",
unitstr),
6279 log_sg(
"Invalid action decision want for unit %d",
punit->
id);
6289 "%s.action_decision_tile_x",
unitstr)
6291 "%s.action_decision_tile_y",
unitstr)) {
6326 "%s.orders_vigilant",
unitstr);
6340 for (j = 0; j <
len; j++) {
6347 log_sg(
"Invalid unit orders.");
6366 sg_regr(3020000,
"Invalid action id in order for unit %d",
punit->
id);
6391 "%s.sub_tgt_vec,%d",
6401 log_sg(
"Cannot find building %d for %s to %s",
6415 log_sg(
"Cannot find tech %d for %s to steal",
6430 "Specified sub target for action %d unsupported.",
6436 "Bad action action %d.",
6448 log_sg(
"Cannot find extra %d for %s to build",
6461 act =
order->activity;
6475 log_sg(
"Unexpected sub_target %d (expected %d) for order type %d",
6484 "%s.action_vec,%d",
unitstr, j);
6488 "%s.sub_tgt_vec,%d",
unitstr, j);
6508 "%s.action_vec,%d",
unitstr, j);
6512 "%s.sub_tgt_vec,%d",
unitstr, j);
6535 "player%d.nunits",
plrno),
6553 "player%d.u%d.transported_by",
6564#ifndef FREECIV_NDEBUG
6588 "player%d.nunits",
plrno);
6601 "player%d.orders_max_length",
plrno);
6620 "%s.nationality",
buf);
6626 "%s.type_by_name",
buf);
6630 "%s.activity_count",
buf);
6635 "%s.activity_tgt",
buf);
6639 "%s.changed_from",
buf);
6641 "%s.changed_from_count",
buf);
6646 "%s.changed_from_tgt",
buf);
6650 "%s.done_moving",
buf);
6656 "%s.current_form_turn",
buf);
6658 "%s.battlegroup",
buf);
6673 "%s.server_side_agent",
buf);
6681 "%s.ord_city",
buf);
6684 "%s.paradropped",
buf);
6687 "%s.transported_by",
buf);
6690 "%s.carrying",
buf);
6696 "%s.action_decision",
buf);
6704 "%s.action_decision_tile_x",
buf);
6706 "%s.action_decision_tile_y",
buf);
6710 "%s.action_decision_tile_x",
buf);
6712 "%s.action_decision_tile_y",
buf);
6730 "%s.orders_index",
buf);
6732 "%s.orders_repeat",
buf);
6734 "%s.orders_vigilant",
buf);
6736 for (j = 0; j <
len; j++) {
6773 "%s.action_vec",
buf);
6789 "%s.sub_tgt_vec",
buf);
6853 loading->file, 0,
"player%d.attribute_v2_block_length",
plrno);
6856 log_sg(
"player%d.attribute_v2_block_length=%d too small",
plrno,
6860 log_sg(
"player%d.attribute_v2_block_length=%d too big (max %d)",
6867#ifndef FREECIV_NDEBUG
6873 "player%d.attribute_v2_block_length_quoted",
6877 "player%d.attribute_v2_block_parts",
plrno),
6884 const char *current =
6886 "player%d.attribute_v2_block_data.part%d",
6892 log_debug(
"attribute_v2_block_length_quoted=%d"
6899 "attribute_v2_block_length_quoted=%d"
6903#ifndef FREECIV_NDEBUG
6930#define PART_SIZE (3*256)
6931#define PART_ADJUST (3)
6944 "player%d.attribute_v2_block_length",
plrno);
6946 "player%d.attribute_v2_block_length_quoted",
plrno);
6959 "player%d.attribute_v2_block_parts",
plrno);
6968 "player%d.attribute_v2_block_data.part%d",
6984 "player%d.attribute_v2_block_data.part%d",
7006 "player%d.dc_total",
plrno);
7030 "game.save_private_map")) {
7045 if (
NULL != pcity) {
7059 "player%d.map_t%04d",
plrno);
7093 const char *ptr = buffer;
7097 "Savegame corrupt - map line %d not found.",
y);
7104 scanin(&ptr,
",", token,
sizeof(token));
7106 "Savegame corrupt - map size not correct.");
7107 if (
strcmp(token,
"-") == 0) {
7111 "Savegame corrupt - got tile owner=%s in (%d, %d).",
7118 "Savegame corrupt - map size not correct.");
7123 "Savegame corrupt - got extras owner=%s in (%d, %d).",
7132 for (
i = 0;
i < 4;
i++) {
7160 log_sg(
"Skipping seen city %d for player %d.",
i,
plrno);
7175 if (
NULL != pcity) {
7218 "%s has invalid owner (%d); skipping.",
citystr,
id);
7224 "%s has invalid id (%d); skipping.",
citystr,
id);
7231 "Invalid city size: %d; set to %d.",
size, city_size);
7239 "Invalid length of '%s.improvements' ("
7242 for (
i = 0;
i <
loading->improvement.size;
i++) {
7244 "Undefined value '%c' within '%s.improvements'.",
7247 if (
str[
i] ==
'1') {
7377 for (
l = 0;
l < 4;
l++) {
7389 saving->file,
"player%d.map_e%02d_%04d",
plrno, j);
7393 for (
i = 0;
i < 4;
i++) {
7424 "%s.occupied",
buf);
7443 "Invalid size of the improvement vector (%s.improvements: "
7485 for (
i = 0;
i < count;
i++) {
7487 "research.r%d.number",
i),
7491 "Invalid research number %d in 'research.r%d.number'",
7495 "research.r%d.goal",
i);
7498 "research.r%d.techs",
i),
7502 "research.r%d.futuretech",
i),
7506 "research.r%d.bulbs",
i),
7510 "research.r%d.bulbs_before",
i),
7513 "research.r%d.saved",
i);
7515 "research.r%d.now",
i);
7518 "research.r%d.free_bulbs",
i),
7524 "Invalid length of 'research.r%d.done' ("
7527 for (j = 0; j <
loading->technology.size; j++) {
7529 "Undefined value '%c' within 'research.r%d.done'.",
7532 if (
str[j] ==
'1') {
7548 "research.r%d.vbs",
i);
7581 if (
saving->save_players) {
7584 "research.r%d.number",
i);
7588 "research.r%d.techs",
i);
7590 "research.r%d.futuretech",
i);
7592 "research.r%d.bulbs_before",
i);
7600 "research.r%d.vbs",
i);
7608 "research.r%d.bulbs",
i);
7612 "research.r%d.free_bulbs",
i);
7675 "treaty%d.plr0", tidx)) !=
NULL ;
7688 log_error(
"Treaty between unknown players %s and %s", plr0, plr1);
7696 "treaty%d.clause%d.type",
7715 log_error(
"Clause giver %s is not participant of the treaty"
7716 "between %s and %s",
plrx, plr0, plr1);
7723 "treaty%d.clause%d.value",
7734 "treaty%d.accept0", tidx);
7736 "treaty%d.accept1", tidx);
7868 log_error(
"Invalid map image definition %4d: %s.",
i, p);
7919 log_verbose(
"Max players lower than current players, fixing");
7928 log_sg(
"Removing %s unferried %s in %s at (%d, %d)",
7965 log_error(
"[city id: %d] Bad worker task %d.",
7966 pcity->id,
ptask->act);
7980 if (
loading->worked_tiles[ptile->index] != -1) {
7981 log_error(
"[city id: %d] Unused worked tile at (%d, %d).",
7997 log_sg(
_(
"%s had invalid researching technology."),
8007 log_sg(
_(
"%s had invalid technology goal."),
8016 _(
"%s had finished researches count wrong."),
8034 log_sg(
_(
"%s has multiple units of type %s though it should be possible "
8035 "to have only one."),
8060 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
void set_ai_level_directer(struct player *pplayer, enum ai_level level)
enum diplstate_type valid_dst_closest(struct player_diplstate *dst)
void init_treaty(struct Treaty *ptreaty, struct player *plr0, struct player *plr1)
void treaties_iterate(treaty_cb cb, void *data)
bool add_clause(struct Treaty *ptreaty, struct player *pfrom, enum clause_type type, int val, struct player *client_player)
void treaty_add(struct Treaty *ptreaty)
#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,...)
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,...)
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 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 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 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 treaty_save(struct Treaty *ptr, void *data_in)
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 clause_list * clauses
struct worker_task_list * task_reqs
enum city_wl_cancel_behavior wlcb
struct built_status built[B_LAST]
int last_turns_shield_surplus
bv_city_options city_options
enum city_acquire_type acquire_t
struct trade_route_list * routes
struct universal production
struct unit_order * orders
struct city::@16 rally_point
int before_change_shields
citizens specialists[SP_MAX]
struct city::@17::@19 server
struct cm_parameter * cm_parameter
struct universal changed_from
struct unit_list * units_supported
struct packet_scenario_description scenario_desc
struct packet_ruleset_control control
struct civ_game::@31::@35::@37 save_options
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::@31::@35 server
char * ruleset_capabilities
struct civ_map::@42::@44 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_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
struct player::@70::@72 server
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
enum unit_activity activity
enum action_decision action_decision_want
enum unit_activity activity
struct extra_type * changed_from_target
struct unit::@81::@84 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)
const struct impr_type * building
void free_unit_orders(struct unit *punit)
bool unit_transport_load(struct unit *pcargo, struct unit *ptrans, bool force)
void set_unit_activity(struct unit *punit, enum unit_activity new_activity)
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)
void set_unit_activity_targeted(struct unit *punit, enum unit_activity new_activity, struct extra_type *new_target)
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 unit_virtual_destroy(struct unit *punit)
void unit_tile_set(struct unit *punit, struct tile *ptile)
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)