Compare commits

...

12 Commits

Author SHA1 Message Date
phosit a6403f27d5 Update appdata for the next RC
(cherry picked from commit 759406dd77)
Signed-off-by: phosit <phosit@autistici.org>
2025-12-03 18:15:06 +01:00
Ralph Sennhauser d90f4400ed Fix autostart-host
Commit b90280855f added support for
multiplayer saved games changing the signature of StartNetworkHost
without updating all callers.

Fixes: #7684
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
(cherry picked from commit 31a262ff7e)
Signed-off-by: phosit <phosit@autistici.org>
2025-12-03 18:15:05 +01:00
Dunedan 7575a04305 Add Vietnamese as supported language
As 0 A.D. supports full unicode now and Vietnamese language coverage is
at a good level, let's include Vietnamese as supported language.

(cherry picked from commit 0086f005d4)
Signed-off-by: phosit <phosit@autistici.org>
2025-11-30 14:24:26 +01:00
Dunedan 3e8f296c72 Re-add Catalan as supported language
While Catalan got removed for Alpha 27 because of low coverage, its
coverage is now good enough again to get re-added as supported language.

(cherry picked from commit ed1bd1d75b)
Signed-off-by: phosit <phosit@autistici.org>
2025-11-30 14:24:26 +01:00
real_tabasco_sauce 1087e020d1 Add capture animations for citizens
Fixes #8557

(cherry picked from commit a32a28a5e3)
Signed-off-by: phosit <phosit@autistici.org>
2025-11-30 14:24:26 +01:00
Vantha e961288e89 Correct some settings of the Germans' sandbox map
(cherry picked from commit 36e93989d4)
Signed-off-by: phosit <phosit@autistici.org>
2025-11-30 14:24:26 +01:00
phosit 7ec2d3f0e0 Throw error when simulation script can't be loaded
When a script in "simulation/helpers/" contained an error. Files in
"simulation/components" aren't loaded. The return value of
`LoadDefaultScripts` indicated an error but was ignored. The simulation
still tried to start.

Now instead of returning a ignoreable error code the error is thrown. In
the common path the error is implicitly rethrown to the JS-function
which tried to start the game.

fixes: #8133
(cherry picked from commit 9a526bcae1)
Signed-off-by: phosit <phosit@autistici.org>
2025-11-24 20:20:17 +01:00
phosit 97eca26d58 Don't pass the AppHooks as pointer
It's not permitted to pass a nullptr to the `app_hooks_update`. So a
reference should be used.

CppCheck says one shouldn't take pointer to a temporary.

(cherry picked from commit 977bf5c0d1)
Signed-off-by: phosit <phosit@autistici.org>
2025-11-24 20:20:17 +01:00
phosit 2e4caf5d19 Use designatet initializers for AppHooks
CppCheck wasn't able to handle `{0}`. C++20 allows to use designated
initializers.

(cherry picked from commit b17c2fb80f)
Signed-off-by: phosit <phosit@autistici.org>
2025-11-24 20:20:17 +01:00
Vantha 490434948d Remove some invalid entries from messages.json
'StatusName', 'ApplierTooltip' and 'ReceiverTooltip' are attributes of status
effects, which are defined in JSON files (and already extracted
correctly from there), not XMLs.

(cherry picked from commit 44984699f1)
Signed-off-by: phosit <phosit@autistici.org>
2025-11-19 20:28:48 +01:00
Vantha 6a55830f1f Add context and comment attributes where useful
Add context and comment attributes to all translated XML elements in the
simulation that can specify any string -- unlike "Rank", which has to be
"Basic", "Advanced", or "Elite".
Most of them aren't used right now, but they can be in the
future and by mods, without touching the schemas again.

Fixes #8540

(cherry picked from commit 7032293207)
Signed-off-by: phosit <phosit@autistici.org>
2025-11-19 20:28:48 +01:00
Ralph Sennhauser bf314cbb4c Add Atlas support to Appimage
Include the shared library libAtlasUI.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
(cherry picked from commit 5609492731)
Signed-off-by: phosit <phosit@autistici.org>
2025-11-19 20:28:48 +01:00
48 changed files with 178 additions and 67 deletions
@@ -32,6 +32,7 @@
</group>
<group>
<variant frequency="1" name="Idle"/>
<variant file="biped/attack_capture.xml"/>
<variant file="biped/attack_melee_female.xml"/>
<variant file="biped/attack_slaughter.xml"/>
<variant file="biped/female_death.xml"/>
@@ -32,6 +32,7 @@
</group>
<group>
<variant frequency="1" name="Idle"/>
<variant file="biped/attack_capture.xml"/>
<variant file="biped/attack_melee_female.xml"/>
<variant file="biped/attack_slaughter.xml"/>
<variant file="biped/gather_tree.xml"/>
@@ -48,6 +48,7 @@
</group>
<group>
<variant frequency="1" name="Idle"/>
<variant file="biped/attack_capture.xml"/>
<variant file="biped/attack_melee_female.xml"/>
<variant file="biped/attack_slaughter.xml"/>
<variant file="biped/female_death.xml"/>
@@ -48,6 +48,7 @@
</group>
<group>
<variant frequency="1" name="Idle"/>
<variant file="biped/attack_capture.xml"/>
<variant file="biped/attack_melee_female.xml"/>
<variant file="biped/attack_slaughter.xml"/>
<variant file="biped/attack_capture.xml"/>
@@ -32,6 +32,7 @@
</group>
<group>
<variant frequency="1" name="Idle"/>
<variant file="biped/attack_capture.xml"/>
<variant file="biped/attack_melee_female.xml"/>
<variant file="biped/attack_slaughter.xml"/>
<variant file="biped/female_death.xml"/>
@@ -68,6 +68,7 @@
</group>
<group>
<variant frequency="1" name="Idle"/>
<variant file="biped/attack_capture.xml"/>
<variant file="biped/attack_melee_female.xml"/>
<variant file="biped/attack_slaughter.xml"/>
<variant file="biped/attack_capture.xml"/>
@@ -63,6 +63,7 @@
</group>
<group>
<variant frequency="1" name="Idle"/>
<variant file="biped/attack_capture.xml"/>
<variant file="biped/attack_melee_female.xml"/>
<variant file="biped/attack_slaughter.xml"/>
<variant file="biped/female_death.xml"/>
@@ -48,6 +48,7 @@
</group>
<group>
<variant frequency="1" name="Idle"/>
<variant file="biped/attack_capture.xml"/>
<variant file="biped/attack_melee_female.xml"/>
<variant file="biped/attack_slaughter.xml"/>
<variant file="biped/gather_tree.xml"/>
@@ -73,6 +73,7 @@
</group>
<group>
<variant name="Idle" frequency="1"/>
<variant file="biped/attack_capture.xml"/>
<variant file="biped/attack_melee_female.xml"/>
<variant file="biped/attack_slaughter.xml"/>
<variant file="biped/female_death.xml"/>
@@ -75,6 +75,7 @@
</group>
<group>
<variant frequency="1" name="Idle"/>
<variant file="biped/attack_capture.xml"/>
<variant file="biped/attack_melee_female.xml"/>
<variant file="biped/attack_slaughter.xml"/>
<variant file="biped/attack_capture.xml"/>
@@ -36,6 +36,7 @@
</group>
<group>
<variant frequency="1" name="Idle"/>
<variant file="biped/attack_capture.xml"/>
<variant file="biped/attack_melee_female.xml"/>
<variant file="biped/attack_slaughter.xml"/>
<variant file="biped/female_death.xml"/>
@@ -36,6 +36,7 @@
</group>
<group>
<variant frequency="1" name="Idle"/>
<variant file="biped/attack_capture.xml"/>
<variant file="biped/attack_melee_female.xml"/>
<variant file="biped/attack_slaughter.xml"/>
<variant file="biped/attack_capture.xml"/>
@@ -32,6 +32,7 @@
</group>
<group>
<variant frequency="1" name="Idle"/>
<variant file="biped/attack_capture.xml"/>
<variant file="biped/attack_melee_female.xml"/>
<variant file="biped/attack_slaughter.xml"/>
<variant file="biped/female_death.xml"/>
@@ -17,6 +17,7 @@
<group>
<variant frequency="1" name="Idle"/>
<variant file="biped/attack_capture.xml"/>
<variant file="biped/attack_capture.xml"/>
<variant file="biped/attack_slaughter.xml"/>
<variant file="biped/attack_melee_female.xml"/>
<variant file="biped/gather_tree.xml"/>
@@ -54,6 +54,7 @@
</group>
<group>
<variant frequency="1" name="Idle"/>
<variant file="biped/attack_capture.xml"/>
<variant file="biped/attack_melee_female.xml"/>
<variant file="biped/attack_slaughter.xml"/>
<variant file="biped/female_death.xml"/>
@@ -58,6 +58,7 @@
</group>
<group>
<variant frequency="1" name="Idle"/>
<variant file="biped/attack_capture.xml"/>
<variant file="biped/attack_melee_female.xml"/>
<variant file="biped/attack_slaughter.xml"/>
<variant file="biped/gather_tree.xml"/>
@@ -139,6 +139,7 @@
</group>
<group>
<variant frequency="1" name="Idle"/>
<variant file="biped/attack_capture.xml"/>
<variant file="biped/attack_melee_female.xml"/>
<variant file="biped/attack_slaughter.xml"/>
<variant file="biped/female_death.xml"/>
@@ -79,6 +79,7 @@
</group>
<group>
<variant frequency="1" name="Idle"/>
<variant file="biped/attack_capture.xml"/>
<variant file="biped/attack_melee_female.xml"/>
<variant file="biped/attack_slaughter.xml"/>
<variant file="biped/gather_tree.xml"/>
@@ -51,6 +51,7 @@
</group>
<group>
<variant frequency="1" name="Idle"/>
<variant file="biped/attack_capture.xml"/>
<variant file="biped/attack_melee_female.xml"/>
<variant file="biped/attack_slaughter.xml"/>
<variant file="biped/female_death.xml"/>
@@ -97,6 +97,7 @@
</group>
<group>
<variant frequency="1" name="Idle"/>
<variant file="biped/attack_capture.xml"/>
<variant file="biped/attack_melee_female.xml"/>
<variant file="biped/attack_slaughter.xml"/>
<variant file="biped/attack_capture.xml"/>
@@ -54,6 +54,7 @@
</group>
<group>
<variant name="Idle" frequency="1"/>
<variant file="biped/attack_capture.xml"/>
<variant file="biped/attack_melee_female.xml"/>
<variant file="biped/attack_slaughter.xml"/>
<variant file="biped/female_death.xml"/>
@@ -77,6 +77,7 @@
</group>
<group>
<variant frequency="1" name="Idle"/>
<variant file="biped/attack_capture.xml"/>
<variant file="biped/attack_melee_female.xml"/>
<variant file="biped/attack_slaughter.xml"/>
<variant file="biped/gather_tree.xml"/>
@@ -35,6 +35,7 @@
<group>
<!-- In this group, define overloads for other animation types, since they presumably do not collide with each other -->
<variant name="Idle" frequency="1"/>
<variant file="biped/attack_capture.xml"/>
<variant file="biped/attack_melee_female.xml"/>
<variant file="biped/attack_slaughter.xml"/>
<variant file="biped/female_death.xml"/>
@@ -32,6 +32,7 @@
</group>
<group>
<variant frequency="1" name="Idle"/>
<variant file="biped/attack_capture.xml"/>
<variant file="biped/attack_melee_female.xml"/>
<variant file="biped/attack_slaughter.xml"/>
<variant file="biped/gather_tree.xml"/>
@@ -40,6 +40,7 @@
<group>
<!-- In this group, define overloads for other animation types, since they presumably do not collide with each other -->
<variant frequency="1" name="Idle"/>
<variant file="biped/attack_capture.xml"/>
<variant file="biped/attack_melee_female.xml"/>
<variant file="biped/attack_slaughter.xml"/>
<variant file="biped/female_death.xml"/>
@@ -32,6 +32,7 @@
</group>
<group>
<variant frequency="1" name="Idle"/>
<variant file="biped/attack_capture.xml"/>
<variant file="biped/attack_melee_female.xml"/>
<variant file="biped/attack_slaughter.xml"/>
<variant file="biped/gather_tree.xml"/>
@@ -45,6 +45,7 @@
<group>
<!-- In this group, define overloads for other animation types, since they presumably do not collide with each other -->
<variant frequency="1" name="Idle"/>
<variant file="biped/attack_capture.xml"/>
<variant file="biped/attack_melee_female.xml"/>
<variant file="biped/attack_slaughter.xml"/>
<variant file="biped/female_death.xml"/>
@@ -75,6 +75,7 @@
</group>
<group>
<variant frequency="1" name="Idle"/>
<variant file="biped/attack_capture.xml"/>
<variant file="biped/attack_melee_female.xml"/>
<variant file="biped/attack_slaughter.xml"/>
<variant file="biped/attack_capture.xml"/>
@@ -78,6 +78,7 @@
<group>
<!-- In this group, define overloads for other animation types, since they presumably do not collide with each other -->
<variant frequency="1" name="Idle"/>
<variant file="biped/attack_capture.xml"/>
<variant file="biped/attack_melee_female.xml"/>
<variant file="biped/attack_slaughter.xml"/>
<variant file="biped/female_death.xml"/>
@@ -48,6 +48,7 @@
</group>
<group>
<variant frequency="1" name="Idle"/>
<variant file="biped/attack_capture.xml"/>
<variant file="biped/attack_melee_female.xml"/>
<variant file="biped/attack_slaughter.xml"/>
<variant file="biped/gather_tree.xml"/>
@@ -14,7 +14,7 @@ class AutoStartHost
const port = +(cmdLineArgs['autostart-port'] ?? 5073);
// Password not implemented for autostart.
Engine.StartNetworkHost(playerName, port, "", !('autostart-disable-replay' in cmdLineArgs));
Engine.StartNetworkHost(playerName, port, "", false, !('autostart-disable-replay' in cmdLineArgs));
}
catch (e)
{
@@ -480,15 +480,6 @@
"AttackName": {
"customContext": "Name of an attack, usually the weapon."
},
"StatusName": {
"customContext": "status effect"
},
"ApplierTooltip": {
"customContext": "status effect"
},
"ReceiverTooltip": {
"customContext": "status effect"
},
"GenericName": {},
"SpecificName": {},
"History": {},
@@ -523,15 +514,6 @@
"AttackName": {
"customContext": "Name of an attack, usually the weapon."
},
"StatusName": {
"customContext": "status effect"
},
"ApplierTooltip": {
"customContext": "status effect"
},
"ReceiverTooltip": {
"customContext": "status effect"
},
"GenericName": {},
"SpecificName": {},
"History": {},
@@ -47,18 +47,16 @@
"PlayerData": [
null,
{
"Civ": "germ",
"Color": {
"b": 0,
"g": 92,
"r": 183
}
},
{}
}
],
"Preview": "sandbox-thegermans.png",
"VictoryConditions": [
"conquest"
]
"VictoryConditions": []
}
]]></ScriptSettings>
<Entities>
@@ -105,12 +105,17 @@ Attack.prototype.Schema =
"<element>" +
"<anyName a:help='Currently one of Melee, Ranged, Capture or Slaughter.'/>" +
"<interleave>" +
"<element name='AttackName' a:help='Name of the attack, to be displayed in the GUI. Optionally includes a translate context attribute.'>" +
"<element name='AttackName' a:help='Name of the attack, to be displayed in the GUI.'>" +
"<optional>" +
"<attribute name='context'>" +
"<text/>" +
"</attribute>" +
"</optional>" +
"<optional>" +
"<attribute name='comment'>" +
"<text/>" +
"</attribute>" +
"</optional>" +
"<text/>" +
"</element>" +
AttackHelper.BuildAttackEffectsSchema() +
@@ -44,6 +44,16 @@ BuildRestrictions.prototype.Schema =
"<element name='Distance' a:help='Specifies distance restrictions on this building, relative to buildings from the given category.'>" +
"<interleave>" +
"<element name='FromClass'>" +
"<optional>" +
"<attribute name='context'>" +
"<text/>" +
"</attribute>" +
"</optional>" +
"<optional>" +
"<attribute name='comment'>" +
"<text/>" +
"</attribute>" +
"</optional>" +
"<text/>" +
"</element>" +
"<optional><element name='MinDistance'><data type='positiveInteger'/></element></optional>" +
@@ -9,6 +9,16 @@ Formation.prototype.Schema =
"</data>" +
"</element>" +
"<element name='DisabledTooltip' a:help='Tooltip shown when the formation is disabled.'>" +
"<optional>" +
"<attribute name='context'>" +
"<text/>" +
"</attribute>" +
"</optional>" +
"<optional>" +
"<attribute name='comment'>" +
"<text/>" +
"</attribute>" +
"</optional>" +
"<text/>" +
"</element>" +
"<element name='SpeedMultiplier' a:help='The speed of the formation is determined by the minimum speed of all members, multiplied with this number.'>" +
@@ -25,10 +25,30 @@ Identity.prototype.Schema =
"</element>" +
"</optional>" +
"<element name='GenericName' a:help='Generic English-language name for this entity.'>" +
"<optional>" +
"<attribute name='context'>" +
"<text/>" +
"</attribute>" +
"</optional>" +
"<optional>" +
"<attribute name='comment'>" +
"<text/>" +
"</attribute>" +
"</optional>" +
"<text/>" +
"</element>" +
"<optional>" +
"<element name='SpecificName' a:help='Specific native-language name for this entity.'>" +
"<optional>" +
"<attribute name='context'>" +
"<text/>" +
"</attribute>" +
"</optional>" +
"<optional>" +
"<attribute name='comment'>" +
"<text/>" +
"</attribute>" +
"</optional>" +
"<text/>" +
"</element>" +
"</optional>" +
@@ -39,16 +59,46 @@ Identity.prototype.Schema =
"</optional>" +
"<optional>" +
"<element name='Tooltip'>" +
"<optional>" +
"<attribute name='context'>" +
"<text/>" +
"</attribute>" +
"</optional>" +
"<optional>" +
"<attribute name='comment'>" +
"<text/>" +
"</attribute>" +
"</optional>" +
"<text/>" +
"</element>" +
"</optional>" +
"<optional>" +
"<element name='History'>" +
"<optional>" +
"<attribute name='context'>" +
"<text/>" +
"</attribute>" +
"</optional>" +
"<optional>" +
"<attribute name='comment'>" +
"<text/>" +
"</attribute>" +
"</optional>" +
"<text/>" +
"</element>" +
"</optional>" +
"<optional>" +
"<element name='Rank'>" +
"<optional>" +
"<attribute name='context'>" +
"<text/>" +
"</attribute>" +
"</optional>" +
"<optional>" +
"<attribute name='comment'>" +
"<text/>" +
"</attribute>" +
"</optional>" +
"<choice>" +
"<value>Basic</value>" +
"<value>Advanced</value>" +
@@ -66,6 +116,16 @@ Identity.prototype.Schema =
"</optional>" +
"<optional>" +
"<element name='VisibleClasses' a:help='Optional list of space-separated classes applying to this entity. These classes will also be visible in various GUI elements. Choices include: Academy, Amphitheater, Archer, ArmyCamp, ArrowShip, Arsenal, ArtilleryTower, Auxiliary, Axeman, Barracks, BoltShooter, BoltTower, Bribable, Builder, Camel, Cataphract, Cavalry, Centurion, Champion, Chariot, Citizen, City, Civilian, Civic, CivilCentre, Colony, Corral, Council, Crossbowman, Defensive, Dock, Dog, Economic, Elephant, ElephantStable, Embassy, Farmstead, Field, Fireship, FishingBoat, Forge, Fortress, Gate, Gladiator, GreatTower, Gymnasium, Hall, Healer, Heavy, Hero, House, IceHouse, Ignited, Immortal, ImperialCourt, ImperialMinistry, Infantry, Javelineer, Kennel, LaoziGate, Legionary, Library, Lighthouse, Longsword, Maceman, Melee, Market, Mercenary, Military, Minister, Monument, Naval, NavalRam, NavalSiege, Outpost, Palace, Palisade, Pikeman, Pillar, Pirate, Pyramid, Ram, Range, Ranged, Relic, Resource, RotaryMill, ScoutShip, SentryTower, Ship, Shipyard, Shrine, Siege, SiegeTower, SiegeWall, Slave, Slinger, Soldier, Spearman, Stable, Stoa, StoneThrower, StoneTower, Storehouse, Support, Swordsman, Syssiton, Temple, TempleOfAmun, TempleOfApedemak, TempleOfIsis, TempleOfMars, TempleOfVesta, Tent, Theater, Tower, Town, Trade, Trader, TriumphalArch, Trumpeter, Village, Wall, Warship, Wonder, Worker.'>" +
"<optional>" +
"<attribute name='context'>" +
"<text/>" +
"</attribute>" +
"</optional>" +
"<optional>" +
"<attribute name='comment'>" +
"<text/>" +
"</attribute>" +
"</optional>" +
"<attribute name='datatype'>" +
"<value>tokens</value>" +
"</attribute>" +
+1 -1
View File
@@ -40,7 +40,7 @@
<url type="translate">https://gitea.wildfiregames.com/0ad/0ad/wiki/Localization</url>
<url type="donation">https://play0ad.com/community/donate/</url>
<releases>
<release version="0.28.0" date="2025-11-12">
<release version="0.28.0" date="2025-12-03">
<url type="details">https://wildfiregames.com/forum/topic/137892-release-28-branch/</url>
<description>
<p>Wildfire Games proudly announces the release of 0 A.D. 0.28.0: "Boiorix".</p>
+2 -4
View File
@@ -76,11 +76,9 @@ static AppHooks default_ah = ah;
// register the specified hook function pointers. any of them that
// are non-zero override the previous function pointer value
// (these default to the stub hooks which are functional but basic).
void app_hooks_update(AppHooks* new_ah)
void app_hooks_update(const AppHooks& new_ah)
{
ENSURE(new_ah);
#define OVERRIDE_IF_NONZERO(HOOKNAME) if(new_ah->HOOKNAME) ah.HOOKNAME = new_ah->HOOKNAME;
#define OVERRIDE_IF_NONZERO(HOOKNAME) if(new_ah.HOOKNAME) ah.HOOKNAME = new_ah.HOOKNAME;
OVERRIDE_IF_NONZERO(get_log_dir)
OVERRIDE_IF_NONZERO(bundle_logs)
OVERRIDE_IF_NONZERO(display_error)
+1 -1
View File
@@ -153,7 +153,7 @@ struct AppHooks
* override the previous function pointer value
* (these default to the stub hooks which are functional but basic).
**/
void app_hooks_update(AppHooks* ah);
void app_hooks_update(const AppHooks& ah);
/**
* was the app hook changed via app_hooks_update from its default value?
+17 -10
View File
@@ -208,11 +208,11 @@ void InitVfs(const CmdLineArgs& args)
psSetLogDir(logs);
// desired location for crashlog is now known. update AppHooks ASAP
// (particularly before the following error-prone operations):
AppHooks hooks = {0};
hooks.bundle_logs = psBundleLogs;
hooks.get_log_dir = psLogDir;
hooks.display_error = psDisplayError;
app_hooks_update(&hooks);
app_hooks_update({
.get_log_dir = psLogDir,
.bundle_logs = psBundleLogs,
.display_error = psDisplayError
});
g_VFS = CreateVfs();
@@ -594,11 +594,18 @@ bool Init(const CmdLineArgs& args, int flags)
// on anything else.)
if (args.Has("dumpSchema"))
{
CSimulation2 sim{NULL, *g_ScriptContext, NULL};
sim.LoadDefaultScripts();
std::ofstream f("entity.rng", std::ios_base::out | std::ios_base::trunc);
f << sim.GenerateSchema();
debug_printf("Generated entity.rng\n");
try
{
CSimulation2 sim{NULL, *g_ScriptContext, NULL};
sim.LoadDefaultScripts();
std::ofstream f("entity.rng", std::ios_base::out | std::ios_base::trunc);
f << sim.GenerateSchema();
debug_printf("Generated entity.rng\n");
}
catch (const CSimulation2::LoadScriptError& e)
{
LOGERROR("%s", e.what());
}
return false;
}
+14 -18
View File
@@ -114,8 +114,8 @@ public:
componentManager.AddSystemComponents(skipScriptedComponents, skipAI);
}
static bool LoadDefaultScripts(CComponentManager& componentManager, std::set<VfsPath>* loadedScripts);
static bool LoadScripts(CComponentManager& componentManager, std::set<VfsPath>* loadedScripts, const VfsPath& path);
static void LoadDefaultScripts(CComponentManager& componentManager, std::set<VfsPath>* loadedScripts);
static void LoadScripts(CComponentManager& componentManager, std::set<VfsPath>* loadedScripts, const VfsPath& path);
static bool LoadTriggerScripts(CComponentManager& componentManager, JS::HandleValue mapSettings, std::set<VfsPath>* loadedScripts);
Status ReloadChangedFile(const VfsPath& path);
@@ -193,31 +193,27 @@ public:
}
};
bool CSimulation2Impl::LoadDefaultScripts(CComponentManager& componentManager, std::set<VfsPath>* loadedScripts)
void CSimulation2Impl::LoadDefaultScripts(CComponentManager& componentManager, std::set<VfsPath>* loadedScripts)
{
return (
LoadScripts(componentManager, loadedScripts, L"simulation/components/interfaces/") &&
LoadScripts(componentManager, loadedScripts, L"simulation/helpers/") &&
LoadScripts(componentManager, loadedScripts, L"simulation/components/")
);
LoadScripts(componentManager, loadedScripts, L"simulation/components/interfaces/");
LoadScripts(componentManager, loadedScripts, L"simulation/helpers/");
LoadScripts(componentManager, loadedScripts, L"simulation/components/");
}
bool CSimulation2Impl::LoadScripts(CComponentManager& componentManager, std::set<VfsPath>* loadedScripts, const VfsPath& path)
void CSimulation2Impl::LoadScripts(CComponentManager& componentManager, std::set<VfsPath>* loadedScripts, const VfsPath& path)
{
VfsPaths pathnames;
if (vfs::GetPathnames(g_VFS, path, L"*.js", pathnames) < 0)
return false;
throw CSimulation2::LoadScriptError{"Error enumerating " + path.string8()};
bool ok = true;
for (const VfsPath& scriptPath : pathnames)
{
if (loadedScripts)
loadedScripts->insert(scriptPath);
LOGMESSAGE("Loading simulation script '%s'", scriptPath.string8());
if (!componentManager.LoadScript(scriptPath))
ok = false;
throw CSimulation2::LoadScriptError{"Error loading " + scriptPath.string8()};
}
return ok;
}
bool CSimulation2Impl::LoadTriggerScripts(CComponentManager& componentManager, JS::HandleValue mapSettings, std::set<VfsPath>* loadedScripts)
@@ -425,7 +421,7 @@ void CSimulation2Impl::Update(int turnLength, const std::vector<SimulationComman
m_SecondaryComponentManager->LoadComponentTypes();
m_SecondaryLoadedScripts = std::make_unique<std::set<VfsPath>>();
ENSURE(LoadDefaultScripts(*m_SecondaryComponentManager, m_SecondaryLoadedScripts.get()));
LoadDefaultScripts(*m_SecondaryComponentManager, m_SecondaryLoadedScripts.get());
ResetComponentState(*m_SecondaryComponentManager, false, false);
ScriptRequest rq(scriptInterface);
@@ -782,14 +778,14 @@ float CSimulation2::GetLastFrameOffset() const
return m->m_LastFrameOffset;
}
bool CSimulation2::LoadScripts(const VfsPath& path)
void CSimulation2::LoadScripts(const VfsPath& path)
{
return m->LoadScripts(m->m_ComponentManager, &m->m_LoadedScripts, path);
m->LoadScripts(m->m_ComponentManager, &m->m_LoadedScripts, path);
}
bool CSimulation2::LoadDefaultScripts()
void CSimulation2::LoadDefaultScripts()
{
return m->LoadDefaultScripts(m->m_ComponentManager, &m->m_LoadedScripts);
m->LoadDefaultScripts(m->m_ComponentManager, &m->m_LoadedScripts);
}
void CSimulation2::SetStartupScript(const std::string& code)
+7 -2
View File
@@ -53,6 +53,11 @@ class CSimulation2
NONCOPYABLE(CSimulation2);
public:
struct LoadScriptError : std::runtime_error
{
using std::runtime_error::runtime_error;
};
// TODO: CUnitManager should probably be handled automatically by this
// module, but for now we'll have it passed in externally instead
CSimulation2(CUnitManager* unitManager, ScriptContext& cx, CTerrain* terrain);
@@ -68,13 +73,13 @@ public:
* should be called immediately after constructing the CSimulation2 object.
* @return false on failure
*/
bool LoadScripts(const VfsPath& path);
void LoadScripts(const VfsPath& path);
/**
* Call LoadScripts for each of the game's standard simulation script paths.
* @return false on failure
*/
bool LoadDefaultScripts();
void LoadDefaultScripts();
/**
* Loads the player settings script (called before map is loaded)
+3 -3
View File
@@ -65,7 +65,7 @@ public:
{
CXeromycesEngine xeromycesEngine;
CSimulation2 sim{nullptr, *g_ScriptContext, &m_Terrain};
TS_ASSERT(sim.LoadScripts(L"simulation/components/addentity/"));
sim.LoadScripts(L"simulation/components/addentity/");
sim.ResetState(true, true);
@@ -86,7 +86,7 @@ public:
{
CXeromycesEngine xeromycesEngine;
CSimulation2 sim{nullptr, *g_ScriptContext, &m_Terrain};
TS_ASSERT(sim.LoadScripts(L"simulation/components/addentity/"));
sim.LoadScripts(L"simulation/components/addentity/");
sim.ResetState(true, true);
@@ -149,7 +149,7 @@ public:
copyFile(L"simulation/components/test-hotload1.js", L"simulation/components/hotload/hotload.js");
TS_ASSERT_OK(g_VFS->RemoveFile(L"simulation/components/hotload/hotload.js"));
TS_ASSERT_OK(g_VFS->RepopulateDirectory(L"simulation/components/hotload/"));
TS_ASSERT(sim.LoadScripts(L"simulation/components/hotload/"));
sim.LoadScripts(L"simulation/components/hotload/");
sim.ResetState(true, true);
@@ -320,7 +320,14 @@ ActorViewer::ActorViewer()
}
// Prepare the simulation
m.Simulation2.LoadDefaultScripts();
try
{
m.Simulation2.LoadDefaultScripts();
}
catch (const CSimulation2::LoadScriptError& e)
{
LOGERROR("%s", e.what());
}
m.Simulation2.ResetState();
// Set player data
+2
View File
@@ -90,6 +90,7 @@
!insertmacro MUI_LANGUAGE "English" ; The first language is the default language
!insertmacro MUI_LANGUAGE "Asturian"
!insertmacro MUI_LANGUAGE "Basque"
!insertmacro MUI_LANGUAGE "Catalan"
!insertmacro MUI_LANGUAGE "Czech"
!insertmacro MUI_LANGUAGE "Dutch"
!insertmacro MUI_LANGUAGE "Finnish"
@@ -113,6 +114,7 @@
!insertmacro MUI_LANGUAGE "TradChinese"
!insertmacro MUI_LANGUAGE "Turkish"
!insertmacro MUI_LANGUAGE "Ukrainian"
!insertmacro MUI_LANGUAGE "Vietnamese"
;--------------------------------
;Installer Sections
+2 -1
View File
@@ -76,7 +76,8 @@ for lib in \
patchelf --set-rpath "${lib}:${ROOT}/binaries/system" "${APPDIR}/usr/bin/pyrogenesis" || die
done
# dlopen lib
# dlopen libs
doins binaries/system/libAtlasUI.so "${APPDIR}/usr/lib"
doins binaries/system/libCollada.so "${APPDIR}/usr/lib"
doins binaries/data/config/default.cfg "${APPDIR}/usr/data/config"
+1 -1
View File
@@ -16,7 +16,7 @@ echo "Filtering languages"
# Included languages
# Note: Needs to be edited manually at each release.
# Keep in sync with the installer languages in 0ad.nsi.
LANGS="ast cs de el en_GB es eu fi fr gl hu id it ja ko nl pl pt_BR pt_PT ru sk sv tr uk zh zh_TW"
LANGS="ast ca cs de el en_GB es eu fi fr gl hu id it ja ko nl pl pt_BR pt_PT ru sk sv tr uk vi zh zh_TW"
# shellcheck disable=SC2086
REGEX=$(printf "\|%s" ${LANGS} | cut -c 2-)