1
0
forked from 0ad/0ad
Commit Graph

1148 Commits

Author SHA1 Message Date
1b844606aa Implement mul_round in checkrefs.
Missed in 19f600cfa2. In use since 2078abdcc4.

This was SVN commit r25247.
2021-04-12 16:33:54 +00:00
d73a3f59ad Allow arbitrary compositions in TemplateLoader template names.
- Allows compositing any two templates in TemplateLoader, and not just
filters: 'A|B|C' is now valid for any template A, B and C.
- Allows parents to be composited paths 'A|B|C'. In such a schema, if A
or B themselves specify a parent, the actual composition becomes
A|pA|B|pB|C and so on.

This allows, by leveraging the common schema of our entities, to reduce
duplication.

For convenience, templates in "special/filters/" and "mixins/" can be
included by their direct name. Others have to be completely specified.

See the two provided cases for examples:
- 'hoplite' becomes a mixin that can be used to apply the Phalanx
formation
- 'builder' becomes a mixin that can be give a template the ability to
build the standard structures, and gives the 'Builder' identity class.
This also allows deduplicating that list of tokens.

Update checkrefs & swap std::map for std::unordered_map in
TemplateLoader.

Differential Revision: https://code.wildfiregames.com/D3801
This was SVN commit r25223.
2021-04-09 15:43:50 +00:00
7321509d5f Fix crash in ActorViewer.
Fixes 76acc4e146 (and some 2007-2010 commit).
ObjectManager needs the Simulation to be initialised, thus needs to come
after it in the class.

Tested by: langbart
Differential Revision: https://code.wildfiregames.com/D3827
This was SVN commit r25222.
2021-04-09 15:34:51 +00:00
76acc4e146 Implement quality levels for actors & corresponding setting.
An actor file, as referenced by the VisualActor, can now define
different actors for different "quality level" setting.
In this initial version, the quality is handled directly by the object
manager.

Actor format impact:
- '<qualitylevels>' may be used as the root node, containing actor nodes
as children.
  - such actor nodes can refer to a file, or to an inline actor, or
simply be inlined.
  - such actor nodes may have a 'quality' attribute, specifying the
maximum quality level of this actor. By default, 255 (the maximum) is
implied.
- The actor format remains valid, but 'groups', 'variants', 'material',
'castshadow' and 'float' can be given a [minquality, maxquality[ range
via XML attributes. Outside of this range, the XML node is ignored
(making it possible to define, in a single actor file, several quality
levels).

Quality is a 0-255 value, with:
- Range 0-99 intended for lower level-of-detail actors (billboards,
etc.)
- Range 100-200 the 'normal' range for models. 100 is "low", 150
"medium", and 200 "high".
- Range 201-255 used for higher quality actors that might be used for
e.g. cinematics.
The range is wide to make it easier to add intermediate levels in the
future and it seemed easier given that an integer value of some kind was
required anyways.

Engine impacts:
- A new CActorDef class is introduced, wrapping an art/actors XML file
and its different quality levels. ObjectBase remains the definition of a
given 'actor', now at a given quality level.
- CActorDef imposes a maximal # of quality level for a particular actor
definition (5 currently).
- CUnit is made to refer to an Actor Definition explicitly, not a
particular ObjectBase.
- As a minor optimisation, variation keys are calculated on
pointer-to-sets-of-selections, instead of raw sets-of-selections, as
this reduces copying.
- some refactoring, including better const-correctness and hotloading
support via std::shared_ptr.

Differential Revision: https://code.wildfiregames.com/D3787
This was SVN commit r25210.
2021-04-08 07:22:24 +00:00
742b636f70 Moves CRect from ps to maths to related geometric primitives.
This was SVN commit r25165.
2021-03-30 21:14:36 +00:00
de02f9870c Make WxWidgets High-DPI aware / Upgrade WXWidgets to 3.1.4 on MacOS
Fixes issues on Big Sur with the development 0 A.D. (bundles were
working correctly because they are Low-DPI).

Thanks to @wik for investigations on High-DPI in WxWidgets.

Differential Revision: https://code.wildfiregames.com/D3326
This was SVN commit r25111.
2021-03-23 15:47:29 +00:00
1867b70d3a Properly unset the civilisation when unchecked in Atlas.
Previously, atlas would save the default value when the 'civilisation'
checkbox was unset.

Patch by: nwtour
Differential Revision: https://code.wildfiregames.com/D3725
This was SVN commit r25108.
2021-03-23 13:16:53 +00:00
3b3a297cca Fix checkrefs following D11 / 1c9efa6fb5
Fixes D11 / 1c9efa6fb5.

The problem is that some GUI pages were simply named "page.xml" which
the regex didn't like.

Accepted By: Nescio
Differential Revision: https://code.wildfiregames.com/D3644
This was SVN commit r25022.
2021-03-06 13:57:11 +00:00
e104b41be2 Cleanups includes for cassert and streams.
This was SVN commit r25002.
2021-03-03 22:26:49 +00:00
5e5ea5cba5 Fix replayprofile/ graphing tool for Profiler1
All modern browsers block ajax request to local file.
This changes extract.pl to generate a single HTML file with data
embedded.
This is now the default behaviour, --to-json to export, --from-json to
load exported.

Patch by: nwtour
Reviewed By: wraitii
Differential Revision: https://code.wildfiregames.com/D3621
This was SVN commit r24975.
2021-03-02 08:35:39 +00:00
ac72fb4486 Fix compilation of Atlas on UNICODE BUILDS
Patch by: @madpilot
Tested by: nwtour
Differential Revision: https://code.wildfiregames.com/D1593
This was SVN commit r24970.
2021-03-01 23:32:23 +00:00
6dc0ffd86f Add a 'debug' catalog & PEP8 the long string file
- Adds a function to generate a 'debug' catalog. This prepends 'X_X '
to strings, to make it obvious in-game which are translated and which
aren't, while still remaining usable.
 - cleans up the code and formats to PEP8 properly (except for line
lengths).

Differential Revision: https://code.wildfiregames.com/D3617
This was SVN commit r24966.
2021-03-01 16:37:33 +00:00
df18102e96 Add an 'Evaluate' RL endpoint, intended for dynamic game balancing
This adds a new endpoint to the RL interface for evaluating custom
JavaScript. When combined with the ability to create arbitrary
modifiers, this provides the required functionality for exploring
quantitative game balancing.

Patch By: irishninja
Fixes #5981

Differential Revision: https://code.wildfiregames.com/D3479
This was SVN commit r24962.
2021-02-28 12:16:32 +00:00
c6f50b253f Fix *nix tarballs to extract in a subfolder.
Also incorporate retry improvements by Stan

Reported by: madPilot
Differential Revision: https://code.wildfiregames.com/D3585
This was SVN commit r24944.
2021-02-27 10:19:31 +00:00
110402eae0 Update credits again. I failed to notice not all languages were included.
- Remove not included languages from the installer.
- Add credits for other languages, even if they are not included.
Differential Revision:  https://code.wildfiregames.com/D3568
This was SVN commit r24927.
2021-02-14 14:00:30 +00:00
c59d569767 Port remaining python2 helper scripts to python3, fixes #5694.
Differential Revision: https://code.wildfiregames.com/D2501
This was SVN commit r24892.
2021-02-12 21:25:33 +00:00
c009eae0a5 Lobbybots: update readme to reflect mod_ipstamp being optional
Following #5913, mod_ipstamp is no longer required to enable STUN
hosting (it can only be useful to enable non-STUN hosting).
This updates the readme to reflect that, and fixes some markdown issues.

Differential Revision: https://code.wildfiregames.com/D3473
This was SVN commit r24857.
2021-02-08 14:22:01 +00:00
53100974d9 Fix blurry textures in Bundle by bundling with mod mod in CI
The "public" archive needs to be built with the mod mod active, to load
textures.xml files. This saves a few MBs as a side effect.

Fixes #6000

Differential Revision: https://code.wildfiregames.com/D3534
This was SVN commit r24847.
2021-02-07 11:36:34 +00:00
42b068d9c9 RL: Update template paths & remove debug-print.
debug-print was removed in 992d740a58, templates were changed in
b57abe806c

Patch by: irishninja
Differential Revision: https://code.wildfiregames.com/D3502
This was SVN commit r24816.
2021-02-01 14:53:40 +00:00
3becf25fac Update bundle dist tools
- The MacOs script was not exporting the SVN revision properly.
- Rename the DMG to match the other's conventions.
- Clean up windows installer files ( Fixes #5955 )

Differential Revision: https://code.wildfiregames.com/D3370
This was SVN commit r24763.
2021-01-22 12:53:54 +00:00
1cb4ee1634 Combines terrain and units ambient colors into the single color.
Tested By: Stan
Differential Revision: https://code.wildfiregames.com/D3237
This was SVN commit r24661.
2021-01-17 13:10:00 +00:00
6ddbf75db1 Increase PMP version for checkrefs.pl after 2f8c7cf575.
This was SVN commit r24660.
2021-01-17 11:01:11 +00:00
6ed6dcdfd9 Fix xmlvalidator following a4852c4c01
The xmlValidator complained about GUI pages.
ff924aaffc missed that script.

Fixes #5912

Differential Revision: https://code.wildfiregames.com/D3349
This was SVN commit r24594.
2021-01-13 10:33:01 +00:00
5ee8354e99 Fix windows SEH hook when crashing in an std::thread
Follows 107d3d461f and other 'pthread->std::thread' diffs.

Windows uses Structured Exception Handling to allow reporting errors
(both C++ and hardware) nicely. This works by wrapping the code in a
__try __catch block.
The pthread wrapper did this automatically, but we now need to do it
explicitly for std::thread.

Tested by: Stan
Differential Revision: https://code.wildfiregames.com/D3261
This was SVN commit r24530.
2021-01-10 08:39:54 +00:00
4942cabab5 Fix most Clang 10 Warnings
Refs: #5550, #5294

Remove dead code from f71be3c764
Fix buggy code from ff50b0b74c
Comments by: @wraitii, @vladislavbelov
Differential Revision: https://code.wildfiregames.com/D3177
This was SVN commit r24487.
2020-12-31 14:25:37 +00:00
a395a0ab66 [BOOST 1.75 2/2] Update binaries for windows (1.65 → 1.75).
Refs #3004

This was SVN commit r24484.
2020-12-31 12:13:25 +00:00
bb
3726db16b1 Treat code between [] and {} as one blob for translations.
Agreed By: wraitii
Comments By: elexis
Differential Revision: D3032
Obsoletes: D2451

This was SVN commit r24400.
2020-12-16 21:12:54 +00:00
5e754a86a9 Associate .zip and .pyromod files with 0 A.D. on MacOS
- Change the .Plist to associate 0 A.D. with .pyromod files (as owner,
so the default choice), and .zip (as alternate, so not the default, but
will appaer in the 'open with' dropdown).
- Make 0 A.D. actually load mods opened like that on MacOS. The files
aren't actually opened with command line arguments, but via Cocoa stuff,
which SDL2 handles via the 'DropEvent' event. This ought also work on
windows and linux.

Closes #5357

Differential Revision: https://code.wildfiregames.com/D3190
This was SVN commit r24377.
2020-12-11 15:43:25 +00:00
764440e017 Remove the Engine threading when using Atlas
MacOS requires some UI-related API calls to happen on the main thread.
There are several SDL functions that call UI-things, and those were,
since #500 / 08b4d96cf2, in a separate thread.
This crashes on Catalina, instead of simply warning (see #5470).

It is not the first time we had such issues, as originally the Engine
was on the main thread and AtlasUI on a separate thread.
That didn't work on MacOS, so the threading was inverted in #500 /
08b4d96cf2, with AtlasUI on the main thread and the Engine in another
thread.
Unfortunately, this still wasn't enough.

This formally unthreads the engine, running it on a wxTimer, to avoid
these issues.

Future work should focus on:
- Further decoupling the simulation from the engine itself, as what
Atlas really needs is a threaded simulation, not a threaded engine.
- Making the simulation itself more threaded
- Making it possible to do tasks asynchronously under Atlas.

Refs #500
Fixes #5470

Differential Revision: https://code.wildfiregames.com/D2752
This was SVN commit r24361.
2020-12-10 09:42:58 +00:00
69f31a67a4 More improvements to the release scripts.
- Add a 'dev' option to the mac bundle that's much faster, intended to
quickly test bundle-like behaviour.
- Add an option to only archive the 'mod' folder, intended to speed up
the CI weekly builds and avoid taking too much disk
space.
- Tweak the windows installer, add an option to create a shortcut to the
desktop (Fixes #1637). This uses the readme 'hack'
 which appears to be a relatively standard way of doing that.
- Make the scripts executable.
- Update jenkinsfile.

Follows d95550248b

Differential Revision: https://code.wildfiregames.com/D3191
This was SVN commit r24353.
2020-12-09 15:22:24 +00:00
369c2e8801 Further header & precompiled cleanup, fix no-PCH builds.
GUIObjectBase is made a IGUIObject* to avoid including those headers
un-necessarily. Subsequent diffs ought to clean up the various of
pointers for that with a similar type with reference semantics.

Also:
- Add standard C and C++ headers (mostly cstring for memcpy, string and
vector) where needed.
- Swap out some includes for forward declarations
- Clean up un-necessary boost includes in precompiled and other headers.
- Clean up precompiled headers, including fewer things.
- Move ACPI to the windows-specific folder as it's included there only
and mostly specific to that platform.

Thanks Stan for the testing.

Differential Revision: https://code.wildfiregames.com/D3129
This was SVN commit r24352.
2020-12-09 14:39:14 +00:00
d95550248b Rework bundle creation scripts.
This reworks the OSX bundle script, to run it easily on CI and to
further also build the unix tarballs and the windows installer.

Clean up the MacOS bundle detection, by not forcing a compilation-time
switch.
Clean up shared library compilation: changing the installation name
isn't necessary for 0 A.D.

Differential Revision: https://code.wildfiregames.com/D3161
This was SVN commit r24343.
2020-12-07 13:44:42 +00:00
421fbfd278 Make Profiler2 configurable in visual mode. Non visual doesn't load the config so it's not possible. Also update the profiler2 page to be able to change the port
Differential Revision: https://code.wildfiregames.com/D2444
This was SVN commit r24340.
2020-12-07 08:11:23 +00:00
1b150b303f Update i18n scripts to run on Python3
The `pology` library runs on Python2 and development appears stalled. It
is also not available on pip.
The `babel` library, BSD-licensed, provides, amongst many other things,
a replacement for .POT / .PO manipulation.

The `poediff` tool that we used to detect spurious i18n change is
replaced with a Python script that does a simpler but good enough job
(it is also much, much faster).

These replacements let the i18n scripts run on Python3 entirely.

Makes D506 redundant.

Comments by: Itms
Reviewed By: Gallaecio
Refs #5694

Differential Revision: https://code.wildfiregames.com/D2757
This was SVN commit r24313.
2020-12-02 10:05:27 +00:00
7e91806be3 Use C++17 to compile 0 A.D.
Supported compilers are Clang 5, GCC 7, Visual Studio 17, Xcode 9.3

Update Atlas alongside since the replacement APIs are c++17 only.
De-activate the StyledTextCtrl module of WxWidgets on mac, since that is
a wrapper around the Scintilla Text editor and doesn't compile with
C++17 (as it uses auto_ptr). We don't use the editor, so this is also a
win on the compilation time front.

Closes #5862

Differential Revision: https://code.wildfiregames.com/D3166
This was SVN commit r24308.
2020-12-01 14:17:12 +00:00
02578e46bf [SM68 2/2] Update to Spidermonkey 68 APIs
No noteworthy API changes.

Details:
- Remove UTF16 script execution since UTF8 is supported in SM68 and
going forward
- Several new headers includes are required
- Realms replace Compartments as "global holders" (see meta-Bug 1357862)
- JSRequests are removed entirely (Bug 722345), see also aae417bd29
- Trivial API updates in ProxyHandlers, ArrayBuffer, Warnings, GC
reasons, Context options, ObjectIsFunction, ValueVectors and
JSCompartment

See also the migration guide:
https://github.com/mozilla-spidermonkey/spidermonkey-embedding-examples/blob/esr78/docs/Migration%20Guide.md

Tested by: Freagarach, Stan, Subitaneo
Fixes #5860

Differential Revision: https://code.wildfiregames.com/D3144
This was SVN commit r24297.
2020-11-30 09:03:20 +00:00
2cfd1b9fac Fix MacOs bundle for Python3
Update the lib used to handle plists, as dmgbuild changed things for
Python3.

Refs #5694

Differential Revision: https://code.wildfiregames.com/D3157
This was SVN commit r24282.
2020-11-28 10:23:06 +00:00
4b76e33e4d Fix MacOS bundle build
clean-workspaces.sh now cleans SM libs, so it needs to be called before
building libraries.

Differential Revision: https://code.wildfiregames.com/D3153
This was SVN commit r24274.
2020-11-27 11:00:53 +00:00
9ae084519f Fix most of the new vs2017 induced warnings.
Refs: https://code.wildfiregames.com/D3096
https://code.wildfiregames.com/D3103 #5862
Reviewed by: @wraitii
Comments by: @Angen
Differential Revision: https://code.wildfiregames.com/D3126
This was SVN commit r24268.
2020-11-26 22:28:50 +00:00
9a1c7cb8d2 Upgrade Mac OS libraries
All are updated except:
- WxWidgets (not sure about compatibility)
- libogg (doesn't compile)
- zlib/libsodimum which have no update.

This drops supports for 10.11 and earlier, meaning we can now assume
SSE4.1 is present.
Updates the build system to account for this.

Closes #5777 (by virtue of upgrading to SDL 2.12)

Refs #4362

Differential Revision: https://code.wildfiregames.com/D3111
This was SVN commit r24257.
2020-11-26 07:20:10 +00:00
f6348b9617 Clean up header includes, add new forward declarations.
This cleans up many un-necessary header includes, either simply
providing nothing or forward declarations in their place.

No major compilation time change here, though this does reduce depencies
in some headers.

Also fix up old MacOS STL-include fixes that are no longer relevant.

Differential Revision: https://code.wildfiregames.com/D3128
This was SVN commit r24227.
2020-11-21 11:20:29 +00:00
ff924aaffc Fix no-PCH builds and checkrefs following a4852c4c01
Fixes D2814 / a4852c4c01.


Differential Revision: https://code.wildfiregames.com/D3123
This was SVN commit r24222.
2020-11-20 11:41:56 +00:00
a4852c4c01 Let players remap hotkeys in-game, fix default hotkeys being qwerty-specific.
- Provide a "Hotkey" screen to let players remap hotkeys in-game using a
convenient setup.
- Make all .cfg hotkeys refer to scancodes (i.e. position on the
keyboard), so that default hotkeys now translate correctly for AZERTY,
QWERTZ and other layouts.
- 'BackSpace' is now an alias for 'Delete', and works for killing units.
This fixes #1917, as macs don't have a proper delete key and would need
to use Fn+Del otherwise. This shifts "timewarp" to Shift+BackSpace.

Functionally, this switches hotkeys to scancodes, as that makes more
sense (they are combinations of key positions, not actual text output).
SDL includes are cleaned and key names are reused.

Fixes #2850, Fixes #2604, Refs #1810, Fixes #1917.

Follows work in 3d7784d2af.

Various diffs tested by: Angen, Stan, Freagarach
Comments by: Nescio
Differential Revision: https://code.wildfiregames.com/D2814
This was SVN commit r24215.
2020-11-19 09:27:26 +00:00
6bb08fb424 [SM52 1/2] Upgrade Spidermonkey build system and binaries to 52.9.1
Of note is the change to static linking on *nix (MacOS already used it).
The logic is that we can only use one single version of SM, so that
advantage of dynamic linking is lost regardless. We might also see
performance gains in the future with LTO enabled. It is also slightly
easier to distribute the program as a result. Expect a negligible size
increase in the binary size (offset somewhat by no longer needing to
distribute .so files). Finally, it streamlines the build script.

Also noteworthy in this commit:
- The MacOS build script is folded back into the general build script.
- the perl/sed command is replaced by patching the configuration file,
which at least warns if it starts failing in the future.

Binaries for windows provided by @Itms
The bulk of the patching was also done by @Itms.

Tested by: Stan, Freagarach
Refs #4893

Differential Revision: https://code.wildfiregames.com/D3094
This was SVN commit r24202.
2020-11-18 14:34:17 +00:00
25490bfec3 Improve JS Exception handling.
- Check for pending exceptions after function calls and script
executions.
- Call LOGERROR instead of JS_ReportError when there is a conversion
error in FromJSVal, since that can only be called from C++ (where JS
errors don't really make sense). Instead, C++ callers of FromJSVal
should handle the failure and, themselves, either report an error or
simply do something else.
- Wrap JS_ReportError since that makes updating it later easier.

This isn't a systematical fix since ToJSVal also ought return a boolean
for failures, and we probably should trigger errors instead of warnings
on 'implicit' conversions, rather a preparation diff.

Part of the SM52 migration, stage: SM45 compatible (actually SM52
incompatible, too).

Based on a patch by: Itms
Comments by: Vladislavbelov, Stan`
Refs #742, #4893

Differential Revision: https://code.wildfiregames.com/D3093
This was SVN commit r24187.
2020-11-15 18:29:17 +00:00
aa15066c69 Rename ScriptRuntime to ScriptContext
SM52 essentially replaces JSRuntime with JSContext (though JSContext
itself was replaced with JSCompartment).
To prepare for this migration, rename all Runtime-related things to
Context.

Part of the SM52 migration, stage: SM45 compatible.

Patch by: Itms
Refs #4893

Differential Revision: https://code.wildfiregames.com/D3091
This was SVN commit r24181.
2020-11-14 10:57:50 +00:00
ee0d204bf6 Wrap JSAutoRequest and replace usage of JSContext* with the wrapper.
JSAutoRequest is required before calling into most JSAPI methods, for GC
reasons.
Calling it is required and fragile as one must not forget.
Further, SM52 and later make manipulating JSContext* dangerous as that
can cross Compartment(Realm in SM68) barriers (and ScriptInterface now
matches a Compartment).

The solution to both problems is to avoid using JSContext* in 0 A.D.
itself. To achieve this, a Request class is introduced, and must be used
to access a JSContext* from a scriptInterface. Further, Request is
passed to other ScriptInterface functions isntead of JSContext*, making
it obvious that the caller has already called it, reducing errors and
redundant JSAutoRequest calls.
Only JSNative functions now get a naked JSContext* without protection,
but the likelihood of forgetting a request is lower since many
ScriptInterface functions now expect it.

JSContext* is directly passed to JSAPI functions only.

Part of the SM52 migration, stage: SM45 compatible

Based on a patch by: Itms
Tested By: Freagarach
Refs #4893

Differential Revision: https://code.wildfiregames.com/D3088
This was SVN commit r24176.
2020-11-13 13:18:22 +00:00
6a029d2a84 Fix incorrect README.txt following 849cbc13ee.
This was SVN commit r24175.
2020-11-13 10:50:48 +00:00
4b52e87934 Adds wireframe mode to overlays and replace the private m_TerrainRenderMode usages by related getter.
This was SVN commit r24143.
2020-11-08 11:31:32 +00:00
770280436b Removes FFP option from Atlas and adds ARB/GLSL selection.
Tested By: Stan
Differential Revision: https://code.wildfiregames.com/D3055
This was SVN commit r24123.
2020-11-04 12:21:55 +00:00