Bug #2330 ยป 0077-Setup-unit-scout-vision-on-savegame-load.patch
| server/savegame/savegame3.c | ||
|---|---|---|
|
int unconverted;
|
||
|
const char *str;
|
||
|
enum gen_action action;
|
||
|
int gnat_x, gnat_y;
|
||
|
sg_warn_ret_val(secfile_lookup_int(loading->file, &punit->id, "%s.id",
|
||
|
unitstr), FALSE, "%s", secfile_error());
|
||
| ... | ... | |
|
if (secfile_lookup_bool_default(loading->file, FALSE,
|
||
|
"%s.go", unitstr)) {
|
||
|
int gnat_x, gnat_y;
|
||
|
sg_warn_ret_val(secfile_lookup_int(loading->file, &gnat_x,
|
||
|
"%s.goto_x", unitstr), FALSE,
|
||
|
"%s", secfile_error());
|
||
| ... | ... | |
|
secfile_entry_ignore(loading->file, "%s.goto_y", unitstr);
|
||
|
}
|
||
|
sg_warn_ret_val(secfile_lookup_int(loading->file, &gnat_x,
|
||
|
"%s.scout_x", unitstr), FALSE,
|
||
|
"%s", secfile_error());
|
||
|
sg_warn_ret_val(secfile_lookup_int(loading->file, &gnat_y,
|
||
|
"%s.scout_y", unitstr), FALSE,
|
||
|
"%s", secfile_error());
|
||
|
if (gnat_x >= 0) {
|
||
|
if (gnat_y >= 0) {
|
||
|
struct tile *scout_tile = native_pos_to_tile(&(wld.map), gnat_x, gnat_y);
|
||
|
unit_scout_vision_gain(punit, scout_tile);
|
||
|
} else {
|
||
|
log_sg("Unit %d has valid scout tile x-coordinate, "
|
||
|
"but invalid y-coordinate.",
|
||
|
punit->id);
|
||
|
punit->server.scout_vision = nullptr;
|
||
|
}
|
||
|
} else {
|
||
|
if (gnat_y >= 0) {
|
||
|
log_sg("Unit %d has valid scout tile y-coordinate, "
|
||
|
"but invalid x-coordinate.",
|
||
|
punit->id);
|
||
|
}
|
||
|
punit->server.scout_vision = nullptr;
|
||
|
}
|
||
|
/* Load AI data of the unit. */
|
||
|
CALL_FUNC_EACH_AI(unit_load, loading->file, punit, unitstr);
|
||