-
Notifications
You must be signed in to change notification settings - Fork 334
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #841 from cazfi/srvup
- Loading branch information
Showing
6 changed files
with
138 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
freeciv/patches/backports/0048-Handle-CoastStrict-units-correctly-on-city-removal.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
From 89783a69caa289e5300ef7f49fe3d0678d170464 Mon Sep 17 00:00:00 2001 | ||
From: Marko Lindqvist <[email protected]> | ||
Date: Thu, 2 May 2024 19:46:44 +0300 | ||
Subject: [PATCH 48/49] Handle CoastStrict units correctly on city removal | ||
|
||
See RM #525 | ||
|
||
Signed-off-by: Marko Lindqvist <[email protected]> | ||
--- | ||
server/citytools.c | 17 +++++++++++------ | ||
1 file changed, 11 insertions(+), 6 deletions(-) | ||
|
||
diff --git a/server/citytools.c b/server/citytools.c | ||
index 24fc2bad71..efe6df6691 100644 | ||
--- a/server/citytools.c | ||
+++ b/server/citytools.c | ||
@@ -1710,6 +1710,7 @@ void remove_city(struct city *pcity) | ||
struct dbv tile_processed; | ||
struct tile_list *process_queue; | ||
const char *ctl = city_tile_link(pcity); | ||
+ const struct civ_map *nmap = &(wld.map); | ||
|
||
CALL_PLR_AI_FUNC(city_lost, powner, powner, pcity); | ||
CALL_FUNC_EACH_AI(city_destroyed, pcity); | ||
@@ -1742,19 +1743,23 @@ void remove_city(struct city *pcity) | ||
bool moved; | ||
const struct unit_type *punittype = unit_type_get(punit); | ||
|
||
- if (is_native_tile(punittype, pcenter)) { | ||
+ /* can_exist_at_tile() would give wrong results, as | ||
+ * the city is still on map. */ | ||
+ if (is_native_tile(punittype, pcenter) | ||
+ && (!utype_has_flag(punittype, UTYF_COAST_STRICT) | ||
+ || is_safe_ocean(nmap, pcenter))) { | ||
continue; | ||
} | ||
|
||
unit_activity_handling(punit, ACTIVITY_IDLE, ACTION_NONE); | ||
moved = FALSE; | ||
- adjc_iterate(&(wld.map), pcenter, tile1) { | ||
+ adjc_iterate(nmap, pcenter, tile1) { | ||
struct unit *ptrans; | ||
|
||
- if (!moved && is_native_tile(punittype, tile1)) { | ||
+ if (!moved && can_exist_at_tile(nmap, punittype, tile1)) { | ||
if (adv_could_unit_move_to_tile(punit, tile1) == 1) { | ||
/* Move */ | ||
- if (!can_unit_survive_at_tile(&(wld.map), punit, tile1)) { | ||
+ if (!can_unit_survive_at_tile(nmap, punit, tile1)) { | ||
/* It may be impossible to survive at the tile even if it is | ||
* native. See UTYF_COAST_STRICT */ | ||
ptrans = transporter_for_unit_at(punit, tile1); | ||
@@ -1798,7 +1803,7 @@ void remove_city(struct city *pcity) | ||
|
||
tile_list_pop_front(process_queue); | ||
dbv_set(&tile_processed, tile_index(ptile)); | ||
- adjc_iterate(&(wld.map), ptile, piter) { | ||
+ adjc_iterate(nmap, ptile, piter) { | ||
struct city *other_city; | ||
|
||
if (dbv_isset(&tile_processed, tile_index(piter))) { | ||
@@ -1814,7 +1819,7 @@ void remove_city(struct city *pcity) | ||
|
||
if (!uclass_has_flag(pclass, UCF_BUILD_ANYWHERE) | ||
&& !is_native_tile(punit->utype, piter) | ||
- && !is_city_channel_tile(&(wld.map), pclass, piter, pcenter)) { | ||
+ && !is_city_channel_tile(nmap, pclass, piter, pcenter)) { | ||
notify_player(unit_owner(punit), unit_tile(punit), | ||
E_UNIT_LOST_MISC, ftc_server, | ||
_("When %s was disbanded your %s in %s was trapped, " | ||
-- | ||
2.43.0 | ||
|
47 changes: 47 additions & 0 deletions
47
freeciv/patches/backports/0061-savegame-Correct-loading-last-turn-change-time.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
From bc38b9d85bc11632745a040edfd12bfe0954b160 Mon Sep 17 00:00:00 2001 | ||
From: Marko Lindqvist <[email protected]> | ||
Date: Fri, 3 May 2024 23:34:48 +0300 | ||
Subject: [PATCH 61/61] savegame: Correct loading last turn change time | ||
|
||
The value was erroneously rounded down to full seconds, | ||
while it's stored with 1/100 second accuracy in the savegame. | ||
|
||
Reported by alain_bkr | ||
|
||
See RM #545 | ||
|
||
Signed-off-by: Marko Lindqvist <[email protected]> | ||
--- | ||
server/savegame/savegame2.c | 2 +- | ||
server/savegame/savegame3.c | 2 +- | ||
2 files changed, 2 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/server/savegame/savegame2.c b/server/savegame/savegame2.c | ||
index f5bbd75fdf..ad319a2033 100644 | ||
--- a/server/savegame/savegame2.c | ||
+++ b/server/savegame/savegame2.c | ||
@@ -1971,7 +1971,7 @@ static void sg_load_game(struct loaddata *loading) | ||
= !secfile_lookup_bool_default(loading->file, TRUE, "game.save_players"); | ||
|
||
game.server.turn_change_time | ||
- = secfile_lookup_int_default(loading->file, 0, "game.last_turn_change_time") / 100; | ||
+ = secfile_lookup_int_default(loading->file, 0, "game.last_turn_change_time") / 100.0; | ||
} | ||
|
||
/* ======================================================================= | ||
diff --git a/server/savegame/savegame3.c b/server/savegame/savegame3.c | ||
index 31a2ed11e0..f3d8fbed42 100644 | ||
--- a/server/savegame/savegame3.c | ||
+++ b/server/savegame/savegame3.c | ||
@@ -2234,7 +2234,7 @@ static void sg_load_game(struct loaddata *loading) | ||
= !secfile_lookup_bool_default(loading->file, TRUE, "game.save_players"); | ||
|
||
game.server.turn_change_time | ||
- = secfile_lookup_int_default(loading->file, 0, "game.last_turn_change_time") / 100; | ||
+ = secfile_lookup_int_default(loading->file, 0, "game.last_turn_change_time") / 100.0; | ||
} | ||
|
||
/************************************************************************//** | ||
-- | ||
2.43.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters