Project

General

Profile

Bug #577 ยป 0073-savecompat-Fix-adding-ACTION_NONE-actions-for-units-.patch

Marko Lindqvist, 05/09/2024 06:14 PM

View differences:

server/savegame/savecompat.c
"player%d.u%d.activity", plrno, unro);
if (ei >= 0 && ei < loading->activities.size) {
bool found = FALSE;
activity = unit_activity_by_name(loading->activities.order[ei],
fc_strcasecmp);
act = activity_default_action(activity);
for (i = 0; i < loading->action.size; i++) {
if (act == loading->action.order[i]) {
secfile_insert_int(loading->file, i, "player%d.u%d.action",
plrno, unro);
found = TRUE;
break;
}
}
if (!found) {
secfile_insert_int(loading->file, ACTION_NONE, "player%d.u%d.action",
plrno, unro);
}
}
}
} player_slots_iterate_end;
......
"player%d.u%d.activity", plrno, unro);
if (ei >= 0 && ei < loading->activities.size) {
bool found = FALSE;
activity = unit_activity_by_name(loading->activities.order[ei],
fc_strcasecmp);
act = activity_default_action(activity);
......
if (act == loading->action.order[i]) {
secfile_insert_int(loading->file, i, "player%d.u%d.action",
plrno, unro);
found = TRUE;
break;
}
}
if (!found) {
secfile_insert_int(loading->file, ACTION_NONE, "player%d.u%d.action",
plrno, unro);
}
}
}
} player_slots_iterate_end;
server/savegame/savegame3.c
sg_warn_ret_val(secfile_lookup_int(loading->file, &ei,
"%s.action", unitstr), FALSE,
"%s", secfile_error());
action = loading->action.order[ei];
if (ei == ACTION_NONE) {
action = ACTION_NONE;
} else {
action = loading->action.order[ei];
}
punit->birth_turn
= secfile_lookup_int_default(loading->file, game.info.turn,
    (1-1/1)