Skip to content

Commit

Permalink
Merge pull request #825 from cazfi/srvup
Browse files Browse the repository at this point in the history
  • Loading branch information
cazfi authored Mar 31, 2024
2 parents 0964735 + 7a968f9 commit 6e3a22d
Show file tree
Hide file tree
Showing 7 changed files with 212 additions and 93 deletions.
16 changes: 8 additions & 8 deletions freeciv/apply_patches.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@
# https://osdn.net/projects/freeciv/ticket/?????
# https://redmine.freeciv.org/issues/???
#
# 0037-Correct-action_post_success_forced_ruleset_var_name-.patch
# Collect Ransom fix
# RM #221
# 0046-Fix-auto_arrange_workers-garbage-cmp.minimal_surplus.patch
# CM fix
# RM #245
# 0023-Improve-connecthand.-ch-coding-style.patch
# Set baseline for freeciv-web patches
# RM #264
Expand All @@ -21,6 +15,12 @@
# 0025-Purge-worklist-items-with-unfulfilled-local-range-im.patch
# Worklist handling fix
# osdn #48773
# 0002-Fix-allied-victory-of-all-players.patch
# Victory conditions fix
# RM #324
# 0041-Stop-sending-hidden-resources-to-the-client.patch
# Extra visibility fix
# RM #350

# Not in the upstream Freeciv server
# ----------------------------------
Expand All @@ -44,11 +44,11 @@ declare -a GIT_PATCHLIST=(
)

declare -a PATCHLIST=(
"backports/0037-Correct-action_post_success_forced_ruleset_var_name-"
"backports/0046-Fix-auto_arrange_workers-garbage-cmp.minimal_surplus"
"backports/0023-Improve-connecthand.-ch-coding-style"
"backports/0023-Fix-activity2char-assert-failure"
"backports/0025-Purge-worklist-items-with-unfulfilled-local-range-im"
"backports/0002-Fix-allied-victory-of-all-players"
"backports/0041-Stop-sending-hidden-resources-to-the-client"
"RevertAmplio2ExtraUnits"
"meson_webperimental"
"metachange"
Expand Down
109 changes: 109 additions & 0 deletions freeciv/patches/backports/0002-Fix-allied-victory-of-all-players.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
From 012bd29227e9ac423ac84e5956fca208f0347cda Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <[email protected]>
Date: Thu, 21 Mar 2024 20:20:24 +0200
Subject: [PATCH 02/57] Fix allied victory of all players

Allied victory was not occurring if nobody had been defeated
beforehand, i.e., if all the players just got in to the same alliance.

See RM #324

Signed-off-by: Marko Lindqvist <[email protected]>
---
server/srv_main.c | 76 ++++++++++++++++++++++++-----------------------
1 file changed, 39 insertions(+), 37 deletions(-)

diff --git a/server/srv_main.c b/server/srv_main.c
index 7edf693839..7538a17181 100644
--- a/server/srv_main.c
+++ b/server/srv_main.c
@@ -424,47 +424,49 @@ bool check_for_game_over(void)
_("Game is over."));
log_normal(_("Game is over."));
return TRUE;
- } else if (0 < defeated) {
- /* If nobody conceded the game, it mays be a solo game or a single team
- * game. */
- fc_assert(NULL != victor);
-
- /* Quit if we have team victory. */
- if (1 < team_count()) {
- teams_iterate(pteam) {
- const struct player_list *members = team_members(pteam);
- int team_candidates = 0, team_defeated = 0;
-
- if (1 == player_list_size(members)) {
- /* This is not really a team, single players are handled below. */
- continue;
- }
-
- player_list_iterate(members, pplayer) {
- if (pplayer->is_alive
- && !player_status_check((pplayer), PSTATUS_SURRENDER)) {
- team_candidates++;
- } else {
- team_defeated++;
+ } else {
+ if (0 < defeated) {
+ /* If nobody conceded the game, it mays be a solo game or a single team
+ * game. */
+ fc_assert(NULL != victor);
+
+ /* Quit if we have team victory. */
+ if (1 < team_count()) {
+ teams_iterate(pteam) {
+ const struct player_list *members = team_members(pteam);
+ int team_candidates = 0, team_defeated = 0;
+
+ if (1 == player_list_size(members)) {
+ /* This is not really a team, single players are handled below. */
+ continue;
}
- } player_list_iterate_end;

- fc_assert(team_candidates + team_defeated
- == player_list_size(members));
-
- if (team_candidates == candidates && team_defeated < defeated) {
- /* We need a player in a other team to conced the game here. */
- notify_conn(game.est_connections, NULL, E_GAME_END, ftc_server,
- _("Team victory to %s."),
- team_name_translation(pteam));
- log_normal(_("Team victory to %s."), team_name_translation(pteam));
- /* All players of the team win, even dead and surrended ones. */
player_list_iterate(members, pplayer) {
- pplayer->is_winner = TRUE;
+ if (pplayer->is_alive
+ && !player_status_check((pplayer), PSTATUS_SURRENDER)) {
+ team_candidates++;
+ } else {
+ team_defeated++;
+ }
} player_list_iterate_end;
- return TRUE;
- }
- } teams_iterate_end;
+
+ fc_assert(team_candidates + team_defeated
+ == player_list_size(members));
+
+ if (team_candidates == candidates && team_defeated < defeated) {
+ /* We need a player in a other team to conced the game here. */
+ notify_conn(game.est_connections, NULL, E_GAME_END, ftc_server,
+ _("Team victory to %s."),
+ team_name_translation(pteam));
+ log_normal(_("Team victory to %s."), team_name_translation(pteam));
+ /* All players of the team win, even dead and surrended ones. */
+ player_list_iterate(members, pplayer) {
+ pplayer->is_winner = TRUE;
+ } player_list_iterate_end;
+ return TRUE;
+ }
+ } teams_iterate_end;
+ }
}

/* Check for allied victory. */
--
2.43.0

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
From 2eed4eddb6623022dbcdf90270694d53f6f7ddaa Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <[email protected]>
Date: Sun, 24 Mar 2024 08:47:11 +0200
Subject: [PATCH 41/42] Stop sending hidden resources to the client

Hidden extras were not sent in the extras array,
but if they happened to be also a tile resource,
the resource information was still sent.

See RM #350

Signed-off-by: Marko Lindqvist <[email protected]>
---
server/maphand.c | 28 +++++++++++++++++++++-------
1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/server/maphand.c b/server/maphand.c
index ce4a086a49..68dcb7fa49 100644
--- a/server/maphand.c
+++ b/server/maphand.c
@@ -527,6 +527,8 @@ void send_tile_info(struct conn_list *dest, struct tile *ptile,
}

if (pplayer == NULL || (known && map_is_also_seen(ptile, pplayer, V_MAIN))) {
+ struct extra_type *resource;
+
info.known = TILE_KNOWN_SEEN;
info.continent = tile_continent(ptile);
owner = tile_owner(ptile);
@@ -540,9 +542,16 @@ void send_tile_info(struct conn_list *dest, struct tile *ptile,
info.terrain = (NULL != tile_terrain(ptile))
? terrain_number(tile_terrain(ptile))
: terrain_count();
- info.resource = (NULL != tile_resource(ptile))
- ? extra_number(tile_resource(ptile))
- : MAX_EXTRA_TYPES;
+
+ resource = tile_resource(ptile);
+ if (resource != NULL
+ && (pplayer == NULL
+ || player_knows_extra_exist(pplayer, resource, ptile))) {
+ info.resource = extra_number(resource);
+ } else {
+ info.resource = MAX_EXTRA_TYPES;
+ }
+
info.placing = (NULL != ptile->placing)
? extra_number(ptile->placing)
: -1;
@@ -778,17 +787,17 @@ void map_show_tile(struct player *src_player, struct tile *ptile)
if (!map_is_known_and_seen(ptile, pplayer, V_MAIN)) {
map_set_known(ptile, pplayer);

- /* as the tile may be fogged send_tile_info won't always do this for us */
+ /* As the tile may be fogged send_tile_info won't always do this for us */
update_player_tile_knowledge(pplayer, ptile);
update_player_tile_last_seen(pplayer, ptile);

send_tile_info(pplayer->connections, ptile, FALSE);

- /* remove old cities that exist no more */
+ /* Remove old cities that exist no more */
reality_check_city(pplayer, ptile);

if ((pcity = tile_city(ptile))) {
- /* as the tile may be fogged send_city_info won't do this for us */
+ /* As the tile may be fogged send_city_info won't do this for us */
update_dumb_city(pplayer, pcity);
send_city_info(pplayer, pcity);
}
@@ -1406,7 +1415,12 @@ bool update_player_tile_knowledge(struct player *pplayer, struct tile *ptile)
dbv_clr(&(plrtile->extras), extra_number(pextra));
}
} extra_type_iterate_end;
- plrtile->resource = ptile->resource;
+ if (ptile->resource != NULL
+ && player_knows_extra_exist(pplayer, ptile->resource, ptile)) {
+ plrtile->resource = ptile->resource;
+ } else {
+ plrtile->resource = NULL;
+ }
plrtile->owner = tile_owner(ptile);
plrtile->extras_owner = extra_owner(ptile);

--
2.43.0

This file was deleted.

15 changes: 7 additions & 8 deletions freeciv/patches/meson_webperimental.patch
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
diff -Nurd freeciv/meson.build freeciv/meson.build
--- freeciv/meson.build 2023-11-14 20:54:52.761945043 +0200
+++ freeciv/meson.build 2023-11-14 20:55:10.361982266 +0200
@@ -4322,7 +4322,8 @@
'sandbox',
--- freeciv/meson.build 2024-03-24 09:39:05.128314187 +0200
+++ freeciv/meson.build 2024-03-24 09:40:19.164840153 +0200
@@ -4356,7 +4356,8 @@
'civ1',
'civ2',
'granularity',
- 'stub'
+ 'stub',
+ 'webperimental'
]

ruleset_files = [
@@ -4350,6 +4351,8 @@
'data/sandbox.modpack',
@@ -4385,6 +4386,7 @@
'data/civ1.modpack',
'data/civ2.modpack',
+ 'data/webperimental.serv',
'data/granularity.modpack',
+ 'data/webperimental.modpack',
install_dir : join_paths(get_option('datadir'), 'freeciv')
)

@@ -4384,6 +4387,11 @@
@@ -4424,6 +4426,11 @@
)

install_data(
Expand Down
2 changes: 1 addition & 1 deletion freeciv/version.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# The Git SHA hash for the commit to checkout from
# https://github.com/freeciv/freeciv

FCREV=16048eb132118f21eb6c9bfbbf4193b9a9fbec08
FCREV=3540ac55eee1306701221fa4d4709ac1b521b4da

ORIGCAPSTR="+Freeciv.Devel-\${MAIN_VERSION}-2024.Feb.07"

Expand Down

0 comments on commit 6e3a22d

Please sign in to comment.