32 static const char *
special_names[] = {
"Irrigation",
"Mine",
"Pollution",
33 "Hut",
"Farmland",
"Fallout",
83 #ifdef FREECIV_DEV_SAVE_COMPAT
84 static void compat_load_dev(
struct loaddata *loading);
85 static void compat_post_load_dev(
struct loaddata *loading);
111 {0,
nullptr,
nullptr},
115 {3,
nullptr,
nullptr},
131 #define compat_current (compat_num - 1)
151 "Invalid savefile format version (%d).", loading->
version);
154 qCritical(
"Savegame version newer than this build found (%d > %d). "
155 "Trying to load the game nevertheless ...",
161 "Unknown savefile format version (%d).", loading->
version);
166 qInfo(
_(
"Run compatibility function for version: <%d "
167 "(save file: %d; server: %d)."),
174 #ifdef FREECIV_DEV_SAVE_COMPAT
176 compat_load_dev(loading);
202 qInfo(
_(
"Run post load compatibility function for version: <%d "
203 "(save file: %d; server: %d)."),
210 #ifdef FREECIV_DEV_SAVE_COMPAT
212 compat_post_load_dev(loading);
229 return hex_chars[((value) >> ((halfbyte_wanted) *4)) & 0xf];
253 "Unknown hex value: '%c' %d", ch, ch);
254 return (pch -
hex_chars) << (halfbyte * 4);
258 "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-+";
271 "Unknown ascii value for num: '%c' %d", ch, ch);
307 struct extra_type_list *elist =
310 if (spe < extra_type_list_size(elist)) {
311 return extra_type_list_get(elist, spe);
325 if (presource->data.resource->id_old_save == identifier) {
347 log_debug(
"Upgrading data from savegame to version 2.4.0");
367 "player%d.ncities", plrno);
369 for (i = 0; i < ncities; i++) {
371 "player%d.c%d.size", plrno, i);
390 "savefile.options"))) {
398 if (strncmp(
name,
"kvb", 3) == 0) {
419 const int maxslots = 128, maxmapsize = 512;
420 const int lines = maxslots / 32;
421 int xsize = 0, y, l, j, x;
422 unsigned int known_row_old[
lines * maxmapsize],
423 known_row[
lines * maxmapsize];
425 for (y = 0; y < maxmapsize; y++) {
428 memset(known_row_old, 0,
sizeof(known_row_old));
429 for (l = 0; l <
lines; l++) {
430 for (j = 0; j < 8; j++) {
432 loading->
file,
nullptr,
"map.k%02d_%04d", l * 8 + j, y);
439 "Inconsistent xsize in map.k%02d_%04d",
441 for (x = 0; x < xsize; x++) {
452 memset(known_row, 0,
sizeof(known_row));
454 for (p = 0; p < maxslots; p++) {
456 for (x = 0; x < xsize; x++) {
460 if (known_row_old[l * xsize + x] & (1u << (p - l * 8))) {
461 known_row[l * xsize + x] |= (1u << (p - l * 32));
467 for (l = 0; l <
lines; l++) {
468 for (j = 0; j < 8; j++) {
472 for (x = 0; x < xsize; x++) {
489 "settings.set_count")) {
490 int i, new_opt = set_count;
492 loading->
file,
false,
"settings.gamestart_valid");
493 for (i = 0; i < set_count; i++) {
506 const char *
const nosave =
"GAMEOVER|QUITIDLE|INTERRUPT";
507 const char *
const save =
"TURN|GAMEOVER|QUITIDLE|INTERRUPT";
511 "settings.set%d.value", i)) {
515 "settings.set%d.value", new_opt);
518 "settings.set%d.value", i);
526 if (gamestart_valid) {
528 "settings.set%d.gamestart", i)) {
532 "settings.set%d.gamestart", new_opt);
535 "settings.set%d.gamestart", i);
538 "settings.set%d.gamestart", new_opt);
547 log_sg(
"Unexpected \"autosaves\" setting found in pre-2.4 "
548 "savefile. It may have been overridden.");
578 const char *modname[] = {
"Road",
"Railroad"};
579 const char *old_activities_names[] = {
580 "Idle",
"Pollution",
"Unused Road",
581 "Mine",
"Irrigate",
"Mine",
582 "Irrigate",
"Fortified",
"Fortress",
583 "Sentry",
"Unused Railroad",
"Pillage",
584 "Goto",
"Explore",
"Transform",
585 "Unused",
"Unused Airbase",
"Fortifying",
586 "Fallout",
"Unused Patrol",
"Base"};
591 log_debug(
"Upgrading data from savegame to version 2.5.0");
600 "savefile.activities_vector");
607 "settings.set_count")) {
610 loading->
file,
false,
"settings.gamestart_valid");
611 for (i = 0; i < set_count; i++) {
625 "settings.set%d.value", i)) {
631 "settings.set%d.value", i);
634 "settings.set%d.value", i);
639 if (gamestart_valid) {
642 "settings.set%d.gamestart", i)) {
648 "settings.set%d.gamestart", i);
651 "settings.set%d.gamestart", i);
696 log_debug(
"Upgrading data from savegame to version 2.6.0");
706 "savefile.terrident%d.name", ti);
719 "settings.set_count")) {
720 char value_buffer[1024] =
"";
721 char gamestart_buffer[1024] =
"";
728 loading->
file,
false,
"settings.gamestart_valid");
731 for (i = 0; i < set_count; i++) {
744 "settings.set%d.value", i)) {
746 if (value_buffer[0] !=
'\0') {
755 "settings.set%d.gamestart", i)) {
757 if (gamestart_buffer[0] !=
'\0') {
775 "settings.set%d.value", i)) {
777 if (value_buffer[0] !=
'\0') {
786 "settings.set%d.gamestart", i)) {
788 if (gamestart_buffer[0] !=
'\0') {
800 "settings.set%d.value", i)) {
813 "settings.set%d.gamestart", i)) {
818 "settings.set%d.gamestart", i);
829 "settings.set%d.value", i)) {
833 "settings.set%d.value", i);
836 "settings.set%d.value", i);
842 "settings.set%d.gamestart", i)) {
847 "settings.set%d.gamestart", i);
850 "settings.set%d.gamestart", i);
857 "settings.set%d.value", i),
862 "settings.set%d.value", i)) {
868 "settings.set%d.gamestart", i)) {
877 "settings.set%d.value", i)) {
887 new_set_count = set_count + 2;
894 "settings.set_count");
903 "settings.set%d.value", set_count + 1);
907 "settings.set%d.name", set_count + 2);
911 "settings.set%d.name", set_count + 3);
916 if (gamestart_valid) {
918 "settings.set%d.gamestart", set_count);
920 "settings.set%d.gamestart", set_count + 1);
924 "settings.set%d.gamestart", set_count + 2);
926 "settings.set%d.gamestart", set_count + 3);
943 enum barbarian_type new_barb_type;
956 "player%d.capital", plrno)) {
958 "player%d.got_first_city", plrno);
965 "player%d.unassigned_user", plrno);
968 "player%d.ranked_username", plrno);
970 "player%d.unassigned_ranked", plrno);
974 loading->
file, 0,
"player%d.ai.is_barbarian", plrno);
977 "player%d.ai.barb_type", plrno);
989 for (i = 0; i < tsize; i++) {
993 "player%d.trait.val%d", plrno, i);
1000 "player%d.trait.mod%d", plrno, i),
1007 "player%d.units_built", plrno);
1013 "player%d.units_killed", plrno);
1020 "player%d.units_lost", plrno);
1027 "player%d.nunits", plrno);
1029 for (i = 0; i < units_num; i++) {
1033 "player%d.u%d.orders_last_move_safe",
1039 loading->
file, 0,
"player%d.u%d.orders_length", plrno, i);
1041 char orders_str[
len + 1];
1046 "player%d.u%d.orders_list", plrno, i));
1047 if ((p = strrchr(orders_str,
'm'))
1048 || (p = strrchr(orders_str,
'M'))) {
1051 "player%d.u%d.orders_list", plrno, i);
1062 "savefile.specialists_size");
1064 const char **modname;
1075 "savefile.specialists_vector");
1093 "player%d.ncities", plrno);
1095 for (i = 0; i < ncities; i++) {
1104 "player%d.c%d.n%s", plrno, i,
1132 for (i = 0; i <
ARRAY_SIZE(researches); i++) {
1150 if (team_pooled_research) {
1152 "player%d.team_no", plrno);
1158 "Research out of bounds (%d)!", i);
1161 if (researches[i] == -1) {
1164 researches[i] = count;
1171 switch (entries[j].type) {
1174 "player%d.research.%s", plrno,
1182 "player%d.research.%s", plrno,
1191 plrno, entries[j].
name))) {
1198 "Research related entry marked as float.");
1215 const char **modname;
1219 modname =
new const char *[DS_LAST]();
1220 for (j = 0; j < DS_LAST; j++) {
1221 modname[i++] = diplstate_type_name(
static_cast<diplstate_type
>(j));
1224 "savefile.diplstate_type_vector");
1249 fc_snprintf(buf,
sizeof(buf),
"player%d.diplstate%d", plrno, i);
1257 "%s.max_state", buf);
1259 if (closest == DS_NO_CONTACT
1260 && (current == DS_PEACE || current == DS_ALLIANCE)) {
1262 loading->
file,
"",
"player%d.name", plrno);
1264 "player%d.name", i);
1269 _(
"The save game is wrong about what the closest"
1270 " relationship %s (player %d) and %s (player %d) have had is."
1272 name1, plrno, name2, i);
1286 const char *key,
int old_def,
1293 if (value != old_def || !keep_default) {
1318 log_debug(
"Upgrading data from savegame to version 3.0.0");
1329 "game.save_players")) {
1343 const char *flag_names[1];
1351 "player%d.ai.control", plrno)) {
1352 flag_names[0] = plr_flag_id_name(PLRF_AI);
1360 "player%d.nunits", plrno);
1363 for (i = 0; i < num; i++) {
1366 fc_snprintf(buf,
sizeof(buf),
"player%d.u%d.born", plrno, i);
1374 for (i = 0; i < num; i++) {
1377 fc_snprintf(buf,
sizeof(buf),
"player%d.c%d.turn_founded", plrno, i);
1391 "game.meta_usermessage")) {
1392 const char *metamessage;
1424 "savefile.server_side_agent_size");
1426 if (ssa_size != 0) {
1433 "savefile.server_side_agent_size");
1434 const char **modname;
1438 modname =
new const char *[SSA_COUNT]();
1439 for (j = 0; j < SSA_COUNT; j++) {
1440 modname[i++] = server_side_agent_name(
static_cast<server_side_agent
>(j));
1443 "savefile.server_side_agent_list");
1460 "player%d.nunits", plrno);
1466 loading->
file,
"player%d.u%d.server_side_agent", plrno,
unit)
1473 "player%d.u%d.ai", plrno,
unit);
1479 "player%d.u%d.server_side_agent", plrno,
unit);
1482 "player%d.u%d.server_side_agent", plrno,
unit);
1501 log_debug(
"Upgrading data from savegame to version 3.1.0");
1517 "player%d.nunits", plrno);
1520 const char *action_unitstr;
1524 loading->
file, 0,
"player%d.u%d.orders_length", plrno,
unit);
1526 loading->
file,
"",
"player%d.u%d.action_list", plrno,
unit);
1527 if (action_unitstr) {
1530 if (order_len > qstrlen(action_unitstr)) {
1531 order_len = qstrlen(action_unitstr);
1534 for (order_num = 0; order_num < order_len; order_num++) {
1535 int unconverted_action_id;
1537 if (action_unitstr[order_num] ==
'?') {
1538 unconverted_action_id = -1;
1540 unconverted_action_id =
char2num(action_unitstr[order_num]);
1543 if (order_num == 0) {
1546 "player%d.u%d.action_vec", plrno,
unit);
1549 "player%d.u%d.action_vec,%d", plrno,
unit,
1576 switch (
order->activity) {
1577 case ACTIVITY_FALLOUT:
1578 case ACTIVITY_POLLUTION:
1580 case ACTIVITY_IRRIGATE:
1581 case ACTIVITY_PLANT:
1582 case ACTIVITY_CULTIVATE:
1583 case ACTIVITY_TRANSFORM:
1584 case ACTIVITY_CONVERT:
1585 case ACTIVITY_FORTIFYING:
1587 case ACTIVITY_GEN_ROAD:
1588 case ACTIVITY_PILLAGE:
1601 case ACTIVITY_SENTRY:
1604 case ACTIVITY_EXPLORE:
1607 case ACTIVITY_FORTIFIED:
1608 case ACTIVITY_OLD_ROAD:
1609 case ACTIVITY_OLD_RAILROAD:
1610 case ACTIVITY_FORTRESS:
1611 case ACTIVITY_AIRBASE:
1612 case ACTIVITY_PATROL_UNUSED:
1614 case ACTIVITY_UNKNOWN:
1615 qCritical(
"Activity %d is not supposed to appear in unit orders",
1625 static enum direction8
dir_opposite(
enum direction8 dir)
1630 case DIR8_NORTHEAST:
1631 return DIR8_SOUTHWEST;
1634 case DIR8_SOUTHEAST:
1635 return DIR8_NORTHWEST;
1638 case DIR8_SOUTHWEST:
1639 return DIR8_NORTHEAST;
1642 case DIR8_NORTHWEST:
1643 return DIR8_SOUTHEAST;
1655 struct tile *current_tile;
1656 struct tile *tgt_tile;
1672 && direction8_is_valid(prev_order->
dir)) {
1689 if (!direction8_is_valid(
order->dir)) {
1691 tgt_tile = current_tile;
1710 current_tile = tgt_tile;
1713 current_tile = tgt_tile;
1727 if (punit->activity == ACTIVITY_EXPLORE) {
1728 punit->ssa_controller = SSA_AUTOEXPLORE;
1754 if (!punit->has_orders) {
1759 || punit->orders.list !=
nullptr,
1762 for (i = 0; i < punit->orders.length; i++) {
1765 && punit->orders.list[i].action == ACTION_ATTACK
1768 punit->orders.list[i].action = ACTION_SUICIDE_ATTACK;
1774 && ((punit->orders.list[i].action
1775 == ACTION_SPY_TARGETED_SABOTAGE_CITY)
1776 || (punit->orders.list[i].action
1777 == ACTION_SPY_TARGETED_SABOTAGE_CITY_ESC))) {
1778 punit->orders.list[i].sub_target -= 1;
1781 && (punit->orders.list[i].action
1782 == ACTION_SPY_TARGETED_SABOTAGE_CITY)
1783 && punit->orders.list[i].sub_target == -1) {
1784 punit->orders.list[i].action =
1785 ACTION_SPY_SABOTAGE_CITY_PRODUCTION;
1788 && (punit->orders.list[i].action
1789 == ACTION_SPY_TARGETED_SABOTAGE_CITY_ESC)
1790 && punit->orders.list[i].sub_target == -1) {
1791 punit->orders.list[i].action =
1792 ACTION_SPY_SABOTAGE_CITY_PRODUCTION_ESC;
1833 &punit->activity_target);
1844 #ifdef FREECIV_DEV_SAVE_COMPAT
1845 static void compat_load_dev(
struct loaddata *loading)
1852 log_debug(
"Upgrading data between development revisions");
1855 "scenario.game_version")) {
1856 game_version = 2060000;
1859 #ifdef FREECIV_DEV_SAVE_COMPAT_3_1
1861 if (game_version < 3009200) {
1868 const char **modname;
1872 "savefile.action_vector");
1875 if (
fc_strcasecmp(modname[j],
"Targeted Steal Tech Escape") == 0) {
1877 "Targeted Steal Tech Escape Expected",
1878 "savefile.action_vector,%d", j);
1879 }
else if (
fc_strcasecmp(modname[j],
"Steal Tech Escape") == 0) {
1881 "savefile.action_vector,%d", j);
1884 "savefile.action_vector,%d", j);
1905 "player%d.nunits", plrno);
1908 size_t old_tgt_size;
1912 "player%d.u%d.tgt_vec", plrno,
unit);
1915 "player%d.u%d.sub_tgt_vec", plrno,
unit);
1916 delete[] old_tgt_vec;
1917 old_tgt_vec =
nullptr;
1938 "player%d.nunits", plrno);
1941 size_t extra_vec_size;
1945 loading->
file, &extra_vec_size,
"player%d.u%d.extra_vec",
1949 for (order_num = 0; order_num < extra_vec_size; order_num++) {
1950 if (extra_vec[order_num] != -1) {
1953 "player%d.u%d.sub_tgt_vec,%d", plrno,
1957 "player%d.u%d.sub_tgt_vec", plrno,
unit);
1973 "player%d.culture", plrno);
1988 "savefile.action_size");
1989 if (action_count > 0) {
1990 const char **modname;
1991 const char **modname_new;
1992 const char *plant_name =
"Plant";
1993 const char *cultivate_name =
"Cultivate";
1999 modname_new =
new action_count();
2000 for (j = 0; j < action_count; j++) {
2001 const char *aname = modname[j];
2004 modname_new[j] = plant_name;
2006 modname_new[j] = cultivate_name;
2008 modname_new[j] = aname;
2013 "savefile.action_vector");
2033 "player%d.nunits", plrno);
2036 const char *action_unitstr;
2040 loading->
file, 0,
"player%d.u%d.orders_length", plrno,
unit);
2042 loading->
file,
"",
"player%d.u%d.action_list", plrno,
unit);
2043 if (action_unitstr) {
2046 if (order_len > qstrlen(action_unitstr)) {
2047 order_len = qstrlen(action_unitstr);
2050 for (order_num = 0; order_num < order_len; order_num++) {
2051 int unconverted_action_id;
2053 if (action_unitstr[order_num] ==
'?') {
2054 unconverted_action_id = -1;
2056 unconverted_action_id =
char2num(action_unitstr[order_num]);
2059 if (order_num == 0) {
2062 "player%d.u%d.action_vec", plrno,
unit);
2065 "player%d.u%d.action_vec,%d", plrno,
unit,
2086 "player%d.ncities", plrno);
2089 const char *action_citystr;
2093 loading->
file, 0,
"player%d.c%d.rally_point_length", plrno,
2096 loading->
file,
"",
"player%d.c%d.rally_point_actions", plrno,
2098 if (action_citystr) {
2101 if (order_len > qstrlen(action_citystr)) {
2102 order_len = qstrlen(action_citystr);
2105 for (order_num = 0; order_num < order_len; order_num++) {
2106 int unconverted_action_id;
2108 if (action_citystr[order_num] ==
'?') {
2109 unconverted_action_id = -1;
2111 unconverted_action_id =
char2num(action_citystr[order_num]);
2114 if (order_num == 0) {
2117 "player%d.c%d.rally_point_action_vec",
2121 "player%d.c%d.rally_point_action_vec,%d",
2122 plrno,
city, order_num);
2131 if (game_version < 3009300) {
2145 static void compat_post_load_dev(
struct loaddata *loading)
2153 "scenario.game_version")) {
2154 game_version = 2060000;
2157 if (game_version < 3009300) {
2164 if (!punit->has_orders) {
2169 || punit->orders.list !=
nullptr,
2172 for (i = 0; i < punit->orders.length; i++) {
2175 && punit->orders.list[i].action == ACTION_ATTACK
2178 punit->orders.list[i].action = ACTION_SUICIDE_ATTACK;
2218 &punit->activity_target);
2232 switch (old_level) {
2234 return AI_LEVEL_AWAY;
2236 return AI_LEVEL_NOVICE;
2238 return AI_LEVEL_EASY;
2240 return AI_LEVEL_NORMAL;
2242 return AI_LEVEL_HARD;
2244 return AI_LEVEL_CHEATING;
2246 #ifdef FREECIV_DEBUG
2247 return AI_LEVEL_EXPERIMENTAL;
2249 return AI_LEVEL_HARD;
2253 return ai_level_invalid();
2263 return NOT_A_BARBARIAN;
2265 return LAND_BARBARIAN;
2267 return SEA_BARBARIAN;
2270 return barbarian_type_invalid();
2312 struct tile *tgt_tile)
2322 return ACTION_JOIN_CITY;
2325 return ACTION_FOUND_CITY;
2329 return ACTION_HELP_WONDER;
2332 return ACTION_TRADE_ROUTE;
2340 return ACTION_RECYCLE_UNIT;
2342 return ACTION_HOME_CITY;
int action_number(const struct action *action)
Get the universal number of the action.
struct action * action_by_number(action_id act_id)
Return the action with the given id.
enum unit_activity action_get_activity(const struct action *paction)
Returns the unit activity this action may cause or ACTIVITY_LAST if the action doesn't result in a un...
#define action_iterate_end
#define action_iterate(_act_)
const char * default_ai_type_name()
Return name of default ai type.
struct extra_type * base_extra_get(const struct base_type *pbase)
Return extra that base is.
struct base_type * base_by_number(const Base_type_id id)
Returns base_type entry for an ID value.
bool has_capability(const char *cap, const char *capstr)
Wrapper for fc_has_capability() for nullptr terminated strings.
struct player * city_owner(const struct city *pcity)
Return the owner of the city.
static void road(QVariant data1, QVariant data2)
Action "Build Road" for choice dialog.
static void base(QVariant data1, QVariant data2)
Action "Build Base" for choice dialog.
#define MAX_NUM_PLAYER_SLOTS
#define GAME_DEFAULT_REVOLENTYPE
#define GAME_DEFAULT_SCORETURN
#define GAME_DEFAULT_SAVETURNS
#define GAME_DEFAULT_TEAM_POOLED_RESEARCH
#define fc_assert(condition)
#define fc_assert_action(condition, action)
#define log_debug(message,...)
struct tile * index_to_tile(const struct civ_map *imap, int mindex)
Return the tile for the given index position.
struct tile * mapstep(const struct civ_map *nmap, const struct tile *ptile, enum direction8 dir)
Step from the given tile in the given direction.
int player_slot_index(const struct player_slot *pslot)
Returns the index of the player slot.
#define player_slots_iterate(_pslot)
#define players_iterate_alive_end
#define player_slots_iterate_end
#define players_iterate_alive(_pplayer)
const char * secfile_error()
Returns the last error which occurred in a string.
bool secfile_lookup_int(const struct section_file *secfile, int *ival, const char *path,...)
Lookup a integer value in the secfile.
bool secfile_entry_delete(struct section_file *secfile, const char *path,...)
Delete an entry.
bool entry_set_name(struct entry *pentry, const char *name)
Sets the name of the entry.
bool secfile_lookup_enum_data(const struct section_file *secfile, int *pvalue, bool bitwise, secfile_enum_name_data_fn_t name_fn, secfile_data_t data, const char *path,...)
Lookup a value saved as string in the secfile.
int * secfile_lookup_int_vec(const struct section_file *secfile, size_t *dim, const char *path,...)
Lookup a integer vector in the secfile.
const char * entry_name(const struct entry *pentry)
Returns the name of this entry.
const char * secfile_lookup_str(const struct section_file *secfile, const char *path,...)
Lookup a string value in the secfile.
const char ** secfile_lookup_str_vec(const struct section_file *secfile, size_t *dim, const char *path,...)
Lookup a string vector in the secfile.
struct section * secfile_section_by_name(const struct section_file *secfile, const QString &name)
Returns the first section matching the name.
bool secfile_lookup_bool_default(const struct section_file *secfile, bool def, const char *path,...)
Lookup a boolean value in the secfile.
const char * secfile_lookup_str_default(const struct section_file *secfile, const char *def, const char *path,...)
Lookup a string value in the secfile.
int secfile_lookup_int_default(const struct section_file *secfile, int def, const char *path,...)
Lookup a integer value in the secfile.
struct section * secfile_section_lookup(const struct section_file *secfile, const char *path,...)
Find a section by path.
const struct entry_list * section_entries(const struct section *psection)
Returns a list containing all the entries.
bool secfile_lookup_bool(const struct section_file *secfile, bool *bval, const char *path,...)
Lookup a boolean value in the secfile.
#define secfile_replace_str_vec(secfile, strings, dim, path,...)
#define secfile_insert_int(secfile, value, path,...)
#define secfile_insert_int_vec(secfile, values, dim, path,...)
#define secfile_insert_str_vec(secfile, strings, dim, path,...)
#define secfile_replace_int(secfile, value, path,...)
#define entry_list_iterate_end
#define secfile_insert_str(secfile, string, path,...)
#define secfile_insert_bool(secfile, value, path,...)
#define secfile_replace_str(secfile, string, path,...)
#define entry_list_iterate(entlist, pentry)
#define secfile_replace_bool(secfile, value, path,...)
const void * secfile_data_t
struct road_type * road_by_number(Road_type_id id)
Return road type of given id.
struct extra_type * road_extra_get(const struct road_type *proad)
Return extra that road is.
struct extra_type * resource_by_identifier(const char identifier)
Return the resource type matching the identifier, or nullptr when none matches.
static void compat_post_load_030100(struct loaddata *loading, enum sgf_version format_class)
Update loaded game data from 3.0.x to something usable by 3.1.0.
static const char * killcitizen_enum_str(secfile_data_t data, int bit)
Callback to get name of old killcitizen setting bit.
int sg_order_to_action(int order, struct unit *act_unit, struct tile *tgt_tile)
Returns the action id corresponding to the specified order id.
const char * special_rule_name(enum tile_special_type type)
Return the untranslated name of the given special.
static void compat_load_030000(struct loaddata *loading, enum sgf_version format_class)
Translate savegame secfile data from 2.6.x to 3.0.0 format.
static const char num_chars[]
enum barbarian_type barb_type_convert(int old_type)
Convert old barbarian type value to barbarian_type.
static struct compatibility compat[]
void set_unit_activity_road(struct unit *punit, Road_type_id road)
Assign a new road building task to unit.
static void compat_load_020400(struct loaddata *loading, enum sgf_version format_class)
Translate savegame secfile data from 2.3.x to 2.4.0 format.
static void upgrade_unit_order_targets(struct unit *act_unit)
Upgrade unit action order target encoding.
static const char * special_names[]
struct extra_type * special_extra_get(int spe)
Get extra of the given special.
char bin2ascii_hex(int value, int halfbyte_wanted)
This returns an ascii hex value of the given half-byte of the binary integer.
static const int compat_num
static void compat_load_020600(struct loaddata *loading, enum sgf_version format_class)
Translate savegame secfile data from 2.5.x to 2.6.0 format.
static enum direction8 dir_opposite(enum direction8 dir)
Returns the opposite direction.
void(* load_version_func_t)(struct loaddata *loading, enum sgf_version format_class)
int char2num(char ch)
Converts single character into numerical value.
static void upgrade_server_side_agent(struct loaddata *loading)
void sg_load_compat(struct loaddata *loading, enum sgf_version format_class)
Compatibility functions for loaded game.
static void unit_order_activity_to_action(struct unit *act_unit)
Upgrade unit activity orders to unit action orders.
static int increase_secfile_turn_int(struct loaddata *loading, const char *key, int old_def, bool keep_default)
Increase turn value in secfile by one.
enum ai_level ai_level_convert(int old_level)
Translate savegame secfile data from earlier development version format to current one.
void set_unit_activity_base(struct unit *punit, Base_type_id base)
Assign a new base building task to unit.
int ascii_hex2bin(char ch, int halfbyte)
This returns a binary integer value of the ascii hex char, offset by the given number of half-bytes.
static void compat_load_020500(struct loaddata *loading, enum sgf_version format_class)
Translate savegame secfile data from 2.4.x to 2.5.0 format.
enum tile_special_type special_by_rule_name(const char *name)
Return the special with the given name, or S_LAST.
void sg_load_post_load_compat(struct loaddata *loading, enum sgf_version format_class)
Compatibility functions for loaded game that needs game state.
static void compat_load_030100(struct loaddata *loading, enum sgf_version format_class)
Translate savegame secfile data from 3.0.x to 3.1.0 format.
static void insert_server_side_agent(struct loaddata *loading, enum sgf_version format_class)
int current_compat_ver()
Return current compatibility version.
static const char * revolentype_str(enum revolen_type type)
Return string representation of revolentype.
#define sg_check_ret(...)
#define sg_warn(condition, message,...)
#define sg_failure_ret_val(condition, _val, message,...)
#define sg_failure_ret(condition, message,...)
#define ORDER_OLD_BUILD_WONDER
#define ORDER_OLD_BUILD_CITY
#define ORDER_OLD_DISBAND
#define ORDER_OLD_HOMECITY
#define ORDER_OLD_TRADE_ROUTE
const char * specialist_rule_name(const struct specialist *sp)
Return the (untranslated) rule name of the specialist type.
struct specialist * specialist_by_number(const Specialist_type_id id)
Return the specialist pointer for the given number.
Specialist_type_id specialist_count()
Return the number of specialist_types.
#define specialist_type_iterate_end
#define specialist_type_iterate(sp)
struct civ_map::@39::@41 server
const load_version_func_t post_load
const load_version_func_t load
struct loaddata::@104 action
struct section_file * file
struct name_translation name
enum unit_activity activity
int fc_snprintf(char *str, size_t n, const char *format,...)
See also fc_utf8_snprintf_trunc(), fc_utf8_snprintf_rep().
int fc_strcasecmp(const char *str0, const char *str1)
Compare strings like strcmp(), but ignoring case.
#define sz_strlcpy(dest, src)
#define sz_strlcat(dest, src)
int team_slot_count()
Returns the total number of team slots (including used slots).
char terrain_identifier(const struct terrain *pterrain)
Return the terrain identifier.
const char * terrain_rule_name(const struct terrain *pterrain)
Return the (untranslated) rule name of the terrain.
#define terrain_type_iterate(_p)
#define terrain_type_iterate_end
struct city * tile_city(const struct tile *ptile)
Return the city on this tile (or nullptr), checking for city center.
bool unit_can_do_action(const struct unit *punit, const action_id act_id)
Return TRUE iff this unit can do the specified generalized (ruleset defined) action enabler controlle...
void set_unit_activity_targeted(struct unit *punit, enum unit_activity new_activity, struct extra_type *new_target)
assign a new targeted task to a unit.
bool unit_has_orders(const struct unit *punit)
Return TRUE iff the unit is following client-side orders.
#define unit_list_iterate(unitlist, punit)
#define unit_list_iterate_end
const struct unit_type * unit_type_get(const struct unit *punit)
Return the unit type for this unit.
bool utype_is_moved_to_tgt_by_action(const struct action *paction, const struct unit_type *utype)
Returns TRUE iff successfully performing the specified action always will move the actor unit of the ...
bool utype_is_unmoved_by_action(const struct action *paction, const struct unit_type *utype)
Returns TRUE iff successfully performing the specified action never will move the actor unit from its...