Compare commits

...

5 commits

Author SHA1 Message Date
Dunedan
6fdcd68172
Update the actions used by the lint workflow
Some checks are pending
checkrefs / lfscheck (push) Waiting to run
checkrefs / checkrefs (push) Waiting to run
lint / cppcheck (push) Waiting to run
lint / copyright (push) Waiting to run
lint / jenkinsfiles (push) Waiting to run
pre-commit / build (push) Waiting to run
2026-08-04 10:09:22 +02:00
Dunedan
e4f4030a5e
Update the actions used by the checkrefs workflow
The workaround for the authentication problems isn't necessary with the
new version of the checkout action anymore.
2026-08-04 10:09:09 +02:00
Ralph Sennhauser
2fb6347125
Delete .already-built file prior to new build
In case the build fails this will allow other Jenkins jobs to restore
the old working state themselves.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-08-03 20:54:04 +02:00
phosit
7aa756f6a4
Remove line numbers from cppcheck supression list
Some checks are pending
checkrefs / lfscheck (push) Waiting to run
checkrefs / checkrefs (push) Waiting to run
lint / cppcheck (push) Waiting to run
lint / copyright (push) Waiting to run
lint / jenkinsfiles (push) Waiting to run
pre-commit / build (push) Waiting to run
They have to be changed to ofthen when code gets moved.
2026-08-02 14:03:28 +02:00
phosit
e712601602
PreInitGame and InitGame in the Loader
This makes the frame before the simulation starts less stuttery. Doing
it in the Loader also allows to make the progressbar more acurate.
2026-08-02 14:03:28 +02:00
12 changed files with 49 additions and 42 deletions

View file

@ -11,7 +11,7 @@ jobs:
lfscheck: lfscheck:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v7
- name: Fetch the base branch - name: Fetch the base branch
run: git fetch origin ${{ env.BASE_SHA }} run: git fetch origin ${{ env.BASE_SHA }}
@ -24,27 +24,14 @@ jobs:
env: env:
GIT_LFS_SKIP_SMUDGE: "1" GIT_LFS_SKIP_SMUDGE: "1"
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v7
- uses: actions/setup-python@v5 - uses: actions/setup-python@v7
with: with:
python-version: "3.11" python-version: "3.11"
- name: Add remote fork origin for LFS - name: Add remote fork origin for LFS
run: | run: |
PR_REPO="${{ gitea.event.pull_request.head.repo.full_name || gitea.repository }}" PR_REPO="${{ gitea.event.pull_request.head.repo.full_name || gitea.repository }}"
git remote add ${{ gitea.actor }} https://gitea.wildfiregames.com/${PR_REPO}.git git remote add ${{ gitea.actor }} https://gitea.wildfiregames.com/${PR_REPO}.git
- name: Workaround for authentication problem with LFS
# https://gitea.com/gitea/act_runner/issues/164
run: |
git config --local \
http.${{ gitea.server_url }}/${{ gitea.repository }}.git/info/lfs/objects/.extraheader ''
PR_REPO="${{ gitea.event.pull_request.head.repo.full_name || gitea.repository }}"
EXTRAHEADER="$(git config --get --local http.${{ gitea.server_url }}/.extraheader)"
git config --local \
http.${{ gitea.server_url }}/${PR_REPO}.git/info/lfs/objects/batch.extraheader \
'${EXTRAHEADER}'
git config --local \
http.${{ gitea.server_url }}/${PR_REPO}.git/info/lfs/objects/.extraheader ''
- name: Download necessary LFS assets - name: Download necessary LFS assets
shell: sh {0} shell: sh {0}
run: | run: |

View file

@ -12,7 +12,7 @@ jobs:
cppcheck: cppcheck:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v7
# cache only works for items in workspace, so configure apt to allow for caching. # cache only works for items in workspace, so configure apt to allow for caching.
- name: Setup apt cache locations - name: Setup apt cache locations
@ -26,7 +26,7 @@ jobs:
- name: Cache apt pkg db and and deb files - name: Cache apt pkg db and and deb files
id: apt-cache id: apt-cache
uses: actions/cache@v4 uses: actions/cache@v6
with: with:
path: | path: |
apt-cache apt-cache
@ -49,11 +49,11 @@ jobs:
copyright: copyright:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v7
with: with:
fetch-depth: 100 fetch-depth: 100
- uses: actions/setup-python@v5 - uses: actions/setup-python@v7
with: with:
python-version: "3.11" python-version: "3.11"
@ -66,10 +66,10 @@ jobs:
jenkinsfiles: jenkinsfiles:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v7
- name: Set up Node.js - name: Set up Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v7
with: with:
node-version: '20' node-version: '20'

View file

@ -33,6 +33,8 @@ echo "Building cpp-httplib..."
if [ -e .already-built ] && [ "$(cat .already-built || true)" = "${LIB_VERSION}" ]; then if [ -e .already-built ] && [ "$(cat .already-built || true)" = "${LIB_VERSION}" ]; then
echo "Skipping - already built (use --force-rebuild to override)" echo "Skipping - already built (use --force-rebuild to override)"
exit exit
else
rm -f .already-built
fi fi
# fetch # fetch

View file

@ -33,6 +33,8 @@ done
if [ -e .already-built ] && [ "$(cat .already-built || true)" = "${LIB_VERSION}" ]; then if [ -e .already-built ] && [ "$(cat .already-built || true)" = "${LIB_VERSION}" ]; then
echo "Skipping - already built (use --force-rebuild to override)" echo "Skipping - already built (use --force-rebuild to override)"
exit exit
else
rm -f .already-built
fi fi
# fetch # fetch

View file

@ -49,6 +49,8 @@ done
if [ -e .already-built ] && [ "$(cat .already-built || true)" = "${LIB_VERSION}" ]; then if [ -e .already-built ] && [ "$(cat .already-built || true)" = "${LIB_VERSION}" ]; then
echo "Skipping - already built (use --force-rebuild to override)" echo "Skipping - already built (use --force-rebuild to override)"
exit exit
else
rm -f .already-built
fi fi
# fetch # fetch

View file

@ -49,6 +49,8 @@ done
if [ -e .already-built ] && [ "$(cat .already-built || true)" = "${LIB_VERSION}" ]; then if [ -e .already-built ] && [ "$(cat .already-built || true)" = "${LIB_VERSION}" ]; then
echo "Skipping - already built (use --force-rebuild to override)" echo "Skipping - already built (use --force-rebuild to override)"
exit exit
else
rm -f .already-built
fi fi
# fetch # fetch

View file

@ -36,6 +36,8 @@ done
if [ -e .already-built ] && [ "$(cat .already-built || true)" = "${LIB_VERSION}" ]; then if [ -e .already-built ] && [ "$(cat .already-built || true)" = "${LIB_VERSION}" ]; then
echo "Skipping - already built (use --force-rebuild to override)" echo "Skipping - already built (use --force-rebuild to override)"
exit exit
else
rm -f .already-built
fi fi
# fetch # fetch

View file

@ -56,6 +56,8 @@ echo "Building SpiderMonkey..."
if [ -e .already-built ] && [ "$(cat .already-built || true)" = "${LIB_VERSION}" ]; then if [ -e .already-built ] && [ "$(cat .already-built || true)" = "${LIB_VERSION}" ]; then
echo "Skipping - already built (use --force-rebuild to override)" echo "Skipping - already built (use --force-rebuild to override)"
exit exit
else
rm -f .already-built
fi fi
OS="${OS:=$(uname -s)}" OS="${OS:=$(uname -s)}"

View file

@ -33,6 +33,8 @@ done
if [ -e .already-built ] && [ "$(cat .already-built || true)" = "${LIB_VERSION}" ]; then if [ -e .already-built ] && [ "$(cat .already-built || true)" = "${LIB_VERSION}" ]; then
echo "Skipping - already built (use --force-rebuild to override)" echo "Skipping - already built (use --force-rebuild to override)"
exit exit
else
rm -f .already-built
fi fi
# fetch # fetch

View file

@ -90,7 +90,6 @@ CGame::CGame(bool replayLog, const SimulationDebugOptions debugOptions):
m_SimRate(1.0f), m_SimRate(1.0f),
m_PlayerID(-1), m_PlayerID(-1),
m_ViewedPlayerID(-1), m_ViewedPlayerID(-1),
m_IsSavedGame(false),
m_IsVisualReplay(false), m_IsVisualReplay(false),
m_ReplayStream(NULL) m_ReplayStream(NULL)
{ {
@ -224,7 +223,7 @@ void CGame::RegisterInit(const JS::HandleValue attribs, const std::string& saved
const Script::Interface& scriptInterface = m_Simulation2->GetScriptInterface(); const Script::Interface& scriptInterface = m_Simulation2->GetScriptInterface();
Script::Request rq(scriptInterface); Script::Request rq(scriptInterface);
m_IsSavedGame = !savedState.empty(); const bool isSavedGame{!savedState.empty()};
m_Simulation2->SetInitAttributes(attribs); m_Simulation2->SetInitAttributes(attribs);
@ -285,7 +284,7 @@ void CGame::RegisterInit(const JS::HandleValue attribs, const std::string& saved
co_return g_Renderer.GetSceneRenderer().GetWaterManager().LoadWaterTextures(); co_return g_Renderer.GetSceneRenderer().GetWaterManager().LoadWaterTextures();
}, L"LoadWaterTextures", 80); }, L"LoadWaterTextures", 80);
if (m_IsSavedGame) if (isSavedGame)
PS::Loader::Register(std::bind_front( PS::Loader::Register(std::bind_front(
[](CGame* game, const std::string& state) -> PS::Loader::Task [](CGame* game, const std::string& state) -> PS::Loader::Task
{ {
@ -298,13 +297,32 @@ void CGame::RegisterInit(const JS::HandleValue attribs, const std::string& saved
co_return game->LoadVisualReplayData(); co_return game->LoadVisualReplayData();
}, this), L"Loading visual replay data", 1000); }, this), L"Loading visual replay data", 1000);
// Call the script function InitGame only for new games, not saved games
if (!isSavedGame)
{
// Perform some simulation initializations (replace skirmish entities, explore territories, etc.)
// that needs to be done before setting up the AI and shouldn't be done in Atlas
if (!g_AtlasGameLoop->running)
{
PS::Loader::Register(std::bind_front([](CGame* game) -> PS::Loader::Task
{
game->m_Simulation2->PreInitGame();
co_return 0;
}, this), L"PreInitGame", 5000);
}
PS::Loader::Register(std::bind_front([](CGame* game) -> PS::Loader::Task
{
game->m_Simulation2->InitGame();
co_return 0;
}, this), L"InitGame", 4000);
}
PS::Loader::EndRegistering(); PS::Loader::EndRegistering();
} }
int CGame::LoadInitialState(const std::string& savedState) int CGame::LoadInitialState(const std::string& savedState)
{ {
ENSURE(m_IsSavedGame);
std::stringstream stream(savedState); std::stringstream stream(savedState);
bool ok = m_Simulation2->DeserializeState(stream); bool ok = m_Simulation2->DeserializeState(stream);
@ -324,17 +342,6 @@ int CGame::LoadInitialState(const std::string& savedState)
**/ **/
PSRETURN CGame::ReallyStartGame() PSRETURN CGame::ReallyStartGame()
{ {
// Call the script function InitGame only for new games, not saved games
if (!m_IsSavedGame)
{
// Perform some simulation initializations (replace skirmish entities, explore territories, etc.)
// that needs to be done before setting up the AI and shouldn't be done in Atlas
if (!g_AtlasGameLoop->running)
m_Simulation2->PreInitGame();
m_Simulation2->InitGame();
}
// We need to do an initial Interpolate call to set up all the models etc, // We need to do an initial Interpolate call to set up all the models etc,
// because Update might never interpolate (e.g. if the game starts paused) // because Update might never interpolate (e.g. if the game starts paused)
// and we could end up rendering before having set up any models (so they'd // and we could end up rendering before having set up any models (so they'd

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2025 Wildfire Games. /* Copyright (C) 2026 Wildfire Games.
* This file is part of 0 A.D. * This file is part of 0 A.D.
* *
* 0 A.D. is free software: you can redistribute it and/or modify * 0 A.D. is free software: you can redistribute it and/or modify
@ -226,7 +226,6 @@ private:
std::vector<CColor> m_PlayerColors; std::vector<CColor> m_PlayerColors;
int LoadInitialState(const std::string& savedState); int LoadInitialState(const std::string& savedState);
bool m_IsSavedGame; // true if loading a saved game; false for a new game
bool m_CheatsEnabled; bool m_CheatsEnabled;

View file

@ -65,8 +65,8 @@ unknownMacro:source/lib/sysdep/os/win/wfirmware.cpp
unknownMacro:source/lib/sysdep/os/win/wposix/wutsname.cpp unknownMacro:source/lib/sysdep/os/win/wposix/wutsname.cpp
unknownMacro:source/ps/CStr.cpp unknownMacro:source/ps/CStr.cpp
uninitvar:source/ps/Game.cpp:246 uninitvar:source/ps/Game.cpp
uninitvar:source/ps/scripting/JSInterface_SavedGame.cpp:149 uninitvar:source/ps/scripting/JSInterface_SavedGame.cpp
danglingLifetime:source/renderer/backend/gl/Device.cpp danglingLifetime:source/renderer/backend/gl/Device.cpp