Skip to content

Commit

Permalink
Merge pull request #756 from cazfi/srvup
Browse files Browse the repository at this point in the history
  • Loading branch information
cazfi authored Oct 5, 2023
2 parents 5ca1cff + 04057e7 commit f351b05
Show file tree
Hide file tree
Showing 9 changed files with 280 additions and 280 deletions.
24 changes: 16 additions & 8 deletions freeciv/apply_patches.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@
# osdn #????? is ticket in freeciv.org tracker:
# https://osdn.net/projects/freeciv/ticket/?????
#
# 0022-AI-Set-countdown-correctly-if-senate-blocks-war-comp.patch
# AI assert failure fix
# osdn #47786
# 0022-Lua-Fix-Unit-is_on_possible_city_tile.patch
# Fix finding cities from huts
# osdn #48582
# 0014-build_flatpak.sh-Support-build-outside-srcdir.patch
# Form baseline for 0030-Flatpak-Build-with-meson.patch
# osdn #48625
Expand All @@ -29,6 +23,18 @@
# 0036-tile_move_cost_ptrs-Make-cardinal_move-signed.patch
# Unit movemenet handling fix
# osdn #48737
# 0047-Meson-Turn-audio-option-to-a-combo.patch
# Rework disabling audio
# osdn #48757
# 0008-Add-new-bitvector-utility-functions.patch
# New bitvector utility functions
# osdn #48731
# 0047-Add-bv_match_dbv-utility-function.patch
# New bitvector utility function
# osdn #48771
# 0057-Fix-bitvector-copy-functions.patch
# Fix to bitvector utility functions
# osdn #48772

# Not in the upstream Freeciv server
# ----------------------------------
Expand All @@ -51,14 +57,16 @@ declare -a GIT_PATCHLIST=(
)

declare -a PATCHLIST=(
"backports/0022-AI-Set-countdown-correctly-if-senate-blocks-war-comp"
"backports/0022-Lua-Fix-Unit-is_on_possible_city_tile"
"backports/0014-build_flatpak.sh-Support-build-outside-srcdir"
"backports/0030-Flatpak-Build-with-meson"
"backports/0013-Meson-Replace-boolean-ruledit-option-with-tools-arra"
"backports/0031-Lua-Always-pass-lua_Integer-to-API_TYPE_INT"
"backports/0042-Meson-Make-manual-generator-build-optional"
"backports/0036-tile_move_cost_ptrs-Make-cardinal_move-signed"
"backports/0047-Meson-Turn-audio-option-to-a-combo"
"backports/0008-Add-new-bitvector-utility-functions"
"backports/0047-Add-bv_match_dbv-utility-function"
"backports/0057-Fix-bitvector-copy-functions"
"meson_webperimental"
"metachange"
"text_fixes"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
From ef337f93a4c8d4147da296703ef466252a449137 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <[email protected]>
Date: Tue, 26 Sep 2023 12:32:50 +0300
Subject: [PATCH 08/47] Add new bitvector utility functions

- dbv_copy()
- dbv_to_bv()
- bv_to_dbv()

See osdn #48731

Signed-off-by: Marko Lindqvist <[email protected]>
---
utility/bitvector.c | 30 ++++++++++++++++++++++++++++++
utility/bitvector.h | 4 ++++
2 files changed, 34 insertions(+)

diff --git a/utility/bitvector.c b/utility/bitvector.c
index 2d1851b68b..65047bfda6 100644
--- a/utility/bitvector.c
+++ b/utility/bitvector.c
@@ -198,6 +198,36 @@ bool dbv_are_equal(const struct dbv *pdbv1, const struct dbv *pdbv2)
_BV_BYTES(pdbv2->bits));
}

+/***********************************************************************//**
+ Copy dynamic bit vector content from another.
+***************************************************************************/
+void dbv_copy(struct dbv *dest, const struct dbv *src)
+{
+ if (dest->bits != src->bits) {
+ dbv_resize(dest, src->bits);
+ }
+
+ memcpy(&dest->vec, &src->vec, _BV_BYTES(src->bits));
+}
+
+/***********************************************************************//**
+ Copy dynamic bit vector content to static bitvector. Static vector
+ is assumed to be at least same size as the dynamic one.
+***************************************************************************/
+void dbv_to_bv(unsigned char *dest, const struct dbv *src)
+{
+ memcpy(dest, &(src->vec), _BV_BYTES(src->bits));
+}
+
+/***********************************************************************//**
+ Copy static bit vector content to dynamic bitvector. Static vector
+ is assumed to be at least same size as the dynamic one.
+***************************************************************************/
+void bv_to_dbv(struct dbv *dest, const unsigned char *src)
+{
+ memcpy(&(dest->vec), dest, _BV_BYTES(dest->bits));
+}
+
/***********************************************************************//**
Debug a dynamic bitvector.
***************************************************************************/
diff --git a/utility/bitvector.h b/utility/bitvector.h
index cccde12a83..9ce4230853 100644
--- a/utility/bitvector.h
+++ b/utility/bitvector.h
@@ -50,6 +50,10 @@ void dbv_clr(struct dbv *pdbv, int bit);
void dbv_clr_all(struct dbv *pdbv);

bool dbv_are_equal(const struct dbv *pdbv1, const struct dbv *pdbv2);
+void dbv_copy(struct dbv *dest, const struct dbv *src);
+
+void dbv_to_bv(unsigned char *dest, const struct dbv *src);
+void bv_to_dbv(struct dbv *dest, const unsigned char *src);

void dbv_debug(struct dbv *pdbv);

--
2.40.1

This file was deleted.

This file was deleted.

Loading

0 comments on commit f351b05

Please sign in to comment.