Skip to content

Commit

Permalink
Merge commit 'ad50e93' into ppa
Browse files Browse the repository at this point in the history
  • Loading branch information
o01eg committed Apr 16, 2024
2 parents d7edd13 + ad50e93 commit 5d3751f
Show file tree
Hide file tree
Showing 104 changed files with 3,237 additions and 2,433 deletions.
9 changes: 9 additions & 0 deletions .github/docker/void-musl/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM ghcr.io/void-linux/void-buildroot-musl:20231230R1

RUN echo noextract=/etc/hosts > /etc/xbps.d/test.conf

RUN xbps-install -Suy || xbps-install -uy xbps
RUN xbps-install -Suy

RUN xbps-install -y cmake godot boost-devel libvorbis-devel freetype-devel glew-devel libopenal-devel python3-devel SDL2-devel

12 changes: 8 additions & 4 deletions .github/workflows/_build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
- debian-sid-i386
- manjaro
- fedora-rawhide
- void-musl
env:
CACHE_NAME: linux
steps:
Expand Down Expand Up @@ -65,7 +66,7 @@ jobs:
mkdir build
docker run -v "$(pwd):/freeorion" -v "${{ runner.temp }}/ccache:/ccache_dir" -e CCACHE_DIR='/ccache_dir' -w /freeorion/build ${{ steps.prep.outputs.tagged_image }} cp ${{ steps.detect-godot.outputs.godot }} /freeorion/build/godot
- name: Generate godot API file
if: ${{ matrix.image != 'manjaro' }}
if: ${{ matrix.image != 'manjaro' && matrix.image != 'void-musl' }}
run: |
docker run -v "$(pwd):/freeorion" -v "${{ runner.temp }}/ccache:/ccache_dir" -e CCACHE_DIR='/ccache_dir' -w /freeorion/build ${{ steps.prep.outputs.tagged_image }} /freeorion/build/godot --gdnative-generate-json-api /freeorion/build/godot-api.json
- name: Generate godot API file
Expand All @@ -77,11 +78,11 @@ jobs:
run: |
docker run -v "$(pwd):/freeorion" -v "${{ runner.temp }}/ccache:/ccache_dir" -e CCACHE_DIR='/ccache_dir' -w /freeorion/build ${{ steps.prep.outputs.tagged_image }} /usr/bin/cmake -DBUILD_CLIENT_GODOT=ON -DGODOT_CUSTOM_API_FILE=/freeorion/build/godot-api.json -DBUILD_TESTING=ON -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_CXX_COMPILER=g++-12 ..
- name: Configure freeorion
if: ${{ matrix.image == 'manjaro' }}
if: ${{ matrix.image == 'manjaro' || matrix.image == 'void-musl' }}
run: |
docker run -v "$(pwd):/freeorion" -v "${{ runner.temp }}/ccache:/ccache_dir" -e CCACHE_DIR='/ccache_dir' -w /freeorion/build ${{ steps.prep.outputs.tagged_image }} /usr/bin/cmake -DBUILD_CLIENT_GODOT=Off -DBUILD_TESTING=ON ..
- name: Configure freeorion
if: ${{ matrix.image != 'ubuntu-23.04' && matrix.image != 'manjaro' }}
if: ${{ matrix.image != 'ubuntu-23.04' && matrix.image != 'manjaro' && matrix.image != 'void-musl' }}
run: |
docker run -v "$(pwd):/freeorion" -v "${{ runner.temp }}/ccache:/ccache_dir" -e CCACHE_DIR='/ccache_dir' -w /freeorion/build ${{ steps.prep.outputs.tagged_image }} /usr/bin/cmake -DBUILD_CLIENT_GODOT=ON -DGODOT_CUSTOM_API_FILE=/freeorion/build/godot-api.json -DBUILD_TESTING=ON ..
- name: Build freeorion
Expand All @@ -91,10 +92,13 @@ jobs:
run: |
docker run -v "$(pwd):/freeorion" -v "${{ runner.temp }}/ccache:/ccache_dir" -e CCACHE_DIR='/ccache_dir' -e FO_TEST_HOSTLESS_GAMES=1 -w /freeorion/build ${{ steps.prep.outputs.tagged_image }} /usr/bin/cmake --build . --target unittest
- name: Run godot
if: ${{ matrix.image != 'manjaro' }}
if: ${{ matrix.image != 'manjaro' && matrix.image != 'void-musl' }}
run: |
docker run -v "$(pwd):/freeorion" -v "${{ runner.temp }}/ccache:/ccache_dir" -e CCACHE_DIR='/ccache_dir' -w /freeorion/ ${{ steps.prep.outputs.tagged_image }} /freeorion/build/godot --disable-render-loop --verbose -s --path godot addons/gut/gut_cmdln.gd -gdir=res://test/ -ginclude_subdirs -gexit
- name: Run godot
if: ${{ matrix.image == 'manjaro' && false }} # Manjaro stopped to support Godot 3
run: |
docker run -v "$(pwd):/freeorion" -v "${{ runner.temp }}/ccache:/ccache_dir" -e CCACHE_DIR='/ccache_dir' -w /freeorion/ ${{ steps.prep.outputs.tagged_image }} /usr/bin/xvfb-run /freeorion/build/godot --no-window --disable-render-loop --video-driver GLES2 --verbose -s --path godot addons/gut/gut_cmdln.gd -gdir=res://test/ -ginclude_subdirs -gexit
- name: Cleanup
run: |
docker run -v "$(pwd):/freeorion" -w /freeorion/ ${{ steps.prep.outputs.tagged_image }} rm -rf /freeorion/build/
1 change: 1 addition & 0 deletions Empire/Diplomacy.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define _Diplomacy_h_

#include <compare>
#include <cstdint>
#include <string>
#include <boost/serialization/access.hpp>
#include "../util/Enum.h"
Expand Down
2 changes: 1 addition & 1 deletion Empire/Empire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ const Meter* Empire::GetMeter(std::string_view name) const {
return nullptr;
}

void Empire::BackPropagateMeters() {
void Empire::BackPropagateMeters() noexcept {
for (auto& meter : m_meters)
meter.second.BackPropagate();
}
Expand Down
2 changes: 1 addition & 1 deletion Empire/Empire.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ class FO_COMMON_API Empire final {

/** Returns the meter with the indicated \a name if it exists, or nullptr. */
[[nodiscard]] Meter* GetMeter(std::string_view name);
void BackPropagateMeters();
void BackPropagateMeters() noexcept;

/** Adds \a tech to the research queue, placing it before position \a pos.
* If \a tech is already in the queue, it is moved to \a pos, then removed
Expand Down
4 changes: 2 additions & 2 deletions Empire/EmpireManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ std::size_t EmpireManager::SizeInMemory() const {
}


void EmpireManager::BackPropagateMeters() {
void EmpireManager::BackPropagateMeters() noexcept {
for (auto& entry : m_empire_map)
entry.second->BackPropagateMeters();
}
Expand Down Expand Up @@ -173,7 +173,7 @@ boost::container::flat_set<int> EmpireManager::GetEmpireIDsWithDiplomaticStatusW

// find ids of empires with the specified diplomatic status with the specified empire
for (auto const [emp1, emp2] : statuses
| range_filter([diplo_status](const auto& ids_status) { return ids_status.second == diplo_status; })
| range_filter([diplo_status](const auto& ids_status) noexcept { return ids_status.second == diplo_status; })
| range_keys)
{
if (emp1 == empire_id)
Expand Down
2 changes: 1 addition & 1 deletion Empire/EmpireManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class FO_COMMON_API EmpireManager final {

[[nodiscard]] std::size_t SizeInMemory() const;

void BackPropagateMeters();
void BackPropagateMeters() noexcept;

void SetDiplomaticStatus(int empire1, int empire2, DiplomaticStatus status);
void HandleDiplomaticMessage(const DiplomaticMessage& message);
Expand Down
1 change: 0 additions & 1 deletion Empire/ProductionQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,6 @@ bool ProductionQueue::ProductionItem::EnqueueConditionPassedAt(int location_id,

namespace {
constexpr auto lookup_part = [](const auto& name) { return GetShipPart(name); };
constexpr auto not_null = [](const auto* p) -> bool { return p; };
}

std::map<std::string, std::map<int, float>>
Expand Down
8 changes: 3 additions & 5 deletions Empire/Supply.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,8 @@ bool SupplyManager::SystemHasFleetSupply(int system_id, int empire_id) const {
auto it = m_fleet_supplyable_system_ids.find(empire_id);
if (it == m_fleet_supplyable_system_ids.end())
return false;
const std::set<int>& sys_set = it->second;
if (sys_set.contains(system_id))
return true;
return false;
const auto& sys_set = it->second;
return sys_set.contains(system_id);
}

bool SupplyManager::SystemHasFleetSupply(int system_id, int empire_id, bool include_allies,
Expand Down Expand Up @@ -244,7 +242,7 @@ namespace {
if (empire_id == ALL_EMPIRES)
return 0.0f;

auto is_owned = [empire_id](const UniverseObject* obj) { return obj->OwnedBy(empire_id); };
auto is_owned = [empire_id](const UniverseObject* obj) noexcept { return obj->OwnedBy(empire_id); };

float accumulator_current = 0.0f;
for (auto* obj : objects.findRaw<Planet>(is_owned)) { // TODO: handle ships if they can have supply meters
Expand Down
6 changes: 5 additions & 1 deletion GG/GG/Font.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ class GG_API Font
/** True iff .first == .second. */
[[nodiscard]] bool empty() const noexcept { return first == second; }

[[nodiscard]] bool IsDefaultEmpty() const noexcept { return str == &EMPTY_STRING; }

/** Length, in original string chars, of the substring. */
[[nodiscard]] std::size_t size() const noexcept { return static_cast<std::size_t>(second - first); }
[[nodiscard]] auto offsets() const noexcept { return std::pair<uint32_t, uint32_t>{first, second}; }
Expand All @@ -203,7 +205,7 @@ class GG_API Font
{
assert(rhs.first <= rhs.second);
assert(std::distance(str->begin(), rhs.first) == second);
second = std::distance(str->begin(), rhs.second);
second = static_cast<decltype(second)>(std::distance(str->begin(), rhs.second));
return *this;
}

Expand Down Expand Up @@ -371,6 +373,8 @@ class GG_API Font
TextAndElementsAssembler& AddCloseTag(std::string_view tag);
/** Add a text element. Any whitespace in this text element will be non-breaking.*/
TextAndElementsAssembler& AddText(std::string_view text);
TextAndElementsAssembler& AddText(const char* text) { return AddText(std::string_view(text)); }
TextAndElementsAssembler& AddText(std::string&& text);
/** Add a white space element.*/
TextAndElementsAssembler& AddWhitespace(std::string_view whitespace);
/** Add a new line element.*/
Expand Down
8 changes: 8 additions & 0 deletions GG/GG/GLClientAndServerBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,14 @@ class GG_API GLRGBAColorBuffer : public GLClientAndServerBufferBase<uint8_t, 4>
base_t::store<ArrN>(data);
}

// same colour N times
void store(std::size_t N, Clr clr)
{
base_t::reserve(base_t::size() + N);
for (std::size_t n = 0; n < N; ++n)
base_t::store(clr.r, clr.g, clr.b, clr.a);
}

void activate() const override;
};

Expand Down
2 changes: 1 addition & 1 deletion GG/GG/ListBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ class GG_API ListBox : public Control
void VScrolled(int tab_low, int tab_high, int low, int high);///< signals from the vertical scroll bar are caught here
void HScrolled(int tab_low, int tab_high, int low, int high);///< signals from the horizontal scroll bar are caught here
void ClickAtRow(iterator it, Flags<ModKey> mod_keys); ///< handles to a mouse-click or spacebar-click on \a it, modified by \a keys
void NormalizeRow(Row* row); ///< adjusts a Row so that it has the same number of cells as other rows, and that each cell has the correct width and alignment
void NormalizeRow(Row* row) const; ///< adjusts a Row so that it has the same number of cells as other rows, and that each cell has the correct width and alignment
iterator FirstRowShownWhenBottomIs(iterator bottom_row); ///< Returns the first row shown when the last row shown is \a bottom_row
std::size_t FirstColShownWhenRightIs(std::size_t right_col, X client_width); ///< Returns the index of the first column shown when the last column shown is \a right_col

Expand Down
10 changes: 6 additions & 4 deletions GG/GG/Wnd.h
Original file line number Diff line number Diff line change
Expand Up @@ -988,14 +988,10 @@ class GG_API Wnd : public boost::signals2::trackable,
std::string m_name; ///< A user-significant name for this Wnd
std::vector<std::shared_ptr<Wnd>> m_children; ///< List of ptrs to child windows kept in order of decreasing area
std::string m_drag_drop_data_type; ///< The type of drag-and-drop data this Wnd represents, if any. If empty/blank, indicates that this Wnd cannot be drag-dropped.
ChildClippingMode m_child_clipping_mode = ChildClippingMode::DontClip;
Pt m_upperleft{X0, Y0}; ///< Upper left point of window
Pt m_lowerright{X1, Y1}; ///< Lower right point of window
Pt m_min_size{X0, Y0}; ///< Minimum window size
Pt m_max_size{X{MAX_WINDOW_SZ},Y{MAX_WINDOW_SZ}}; ///< Maximum window size
bool m_non_client_child = false;
bool m_visible = true;
bool m_needs_prerender = false; ///< Indicates if Wnd needs a PreRender();

/** The Wnds that are filtering this Wnd's events. These are in reverse
order: top of the stack is back(). */
Expand All @@ -1014,6 +1010,12 @@ class GG_API Wnd : public boost::signals2::trackable,
resizability, etc. */
Flags<WndFlag> m_flags;

ChildClippingMode m_child_clipping_mode = ChildClippingMode::DontClip;

bool m_non_client_child = false;
bool m_visible = true;
bool m_needs_prerender = false; ///< Indicates if Wnd needs a PreRender();

/** The default time to set for the first (and only) value in
m_browse_mode_times during Wnd contruction */
static unsigned int s_default_browse_time;
Expand Down
2 changes: 1 addition & 1 deletion GG/src/DynamicGraphic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ void DynamicGraphic::Render()
send_stopped_signal = true;
}
}
m_last_frame_time = curr_time;
m_last_frame_time = static_cast<decltype(m_last_frame_time)>(curr_time);
}
}

Expand Down
Loading

0 comments on commit 5d3751f

Please sign in to comment.