1
0
forked from 0ad/0ad
Commit Graph

2062 Commits

Author SHA1 Message Date
0c23e595fa Include CStrInternStatic where necessary only.
This makes incremental recompilation faster when changing static
interned strings.

Differential Revision: https://code.wildfiregames.com/D3975
This was SVN commit r25457.
2021-05-18 11:09:54 +00:00
e908733220 Speed up GetAvailableMods for archives.
Refs 64bfa089af and 44ec2e324e

When a .zip file is encountered by the VFS population, it reads the info
for all files in the archives. This is quite slow for the public archive
(400-500ms on my computer), which means calling GetEngineInfo()
repeatedly is impossible.

By only opening the external mod.json, we skip most of the work. The
archive can still be opened if needed as fallback.


Differential Revision: https://code.wildfiregames.com/D3216
This was SVN commit r25446.
2021-05-16 13:50:05 +00:00
5ff4fa19c0 Removes unused and outdated includes, replaces some includes by forward declarations.
This was SVN commit r25444.
2021-05-15 17:27:01 +00:00
41a29a590a Fixes broken PCH after wraitii commits (4f972bc623, 0f60bf3a97) and Itms (833c9f108c).
This was SVN commit r25443.
2021-05-15 14:50:24 +00:00
507f44f7f9 Remove all external usage of CmptPrivate. Header cleanup.
This removes usage of CmptPrivate outside of ScriptInterface.
ScriptRequest can now be used to safely recover the scriptInterface from
a JSContext instead of going through ScriptInterface, which allows more
code cleanup.

Follows 34b1920e7b

Differential Revision: https://code.wildfiregames.com/D3963
This was SVN commit r25442.
2021-05-15 13:54:58 +00:00
4f972bc623 Split off JSON-related function from ScriptInterface, clean up headers.
Follows 34b1920e7b.

JSON functions and ToString are movec to their own headers.
Also clean out a few PersistentRooted usage to use the 2-phase init to
clean up scriptInterface usage.

With these functions split off, we can finally clean out headers and
remove ScriptInterface.h from most of them, in favour of smaller and
more precise headers.


Take the opportunity to clarify some comments regarding Mutability.

Differential Revision: https://code.wildfiregames.com/D3961
This was SVN commit r25434.
2021-05-14 10:18:03 +00:00
0f60bf3a97 Split off Object-related functions from ScriptInterface
Follows 34b1920e7b.

This splits off the object-related functions, such as
[Set/Get/Has]Property, CreateObject, CreateArray, FreezeObject.

It also puts the definitions in the header itself, which might end up
with faster code here & there, though perhaps slower compilation time
(somewhat doubtful since we already included most things anyways).

Differential Revision: https://code.wildfiregames.com/D3956
This was SVN commit r25430.
2021-05-13 17:23:52 +00:00
61e0aef0b4 Split JS conversions from ScriptInterface.
All ToJSVal/FromJSVal definitions are put in a separate header.
Remove AssignOr[To/From]JSVal duplication.

The functions were already static so this is rather straightforward.

Follows 34b1920e7b and 2bae30c454

Differential Revision: https://code.wildfiregames.com/D3953
This was SVN commit r25428.
2021-05-13 09:43:33 +00:00
4ad78018f9 Fix no-pch build. Potentially fixes bb49fbe793, 0198942a79, 34b1920e7b, 8b08f4ae7a 0dbf417171, 3af1fc64d2, 5fbdbaa3bc, 6fbf036ae4.
Comments by: @vladislavbelov, @wraitii.
Differential Revision: https://code.wildfiregames.com/D3948
This was SVN commit r25423.
2021-05-12 13:48:55 +00:00
6fbf036ae4 Split off StructuredClone from ScriptInterface
Follows 34b1920e7b.

This separates StructuredClone & DeepCopy logic into its own header,
reducing the size of the monolithic ScriptInterface header.

Differential Revision: https://code.wildfiregames.com/D3922
This was SVN commit r25419.
2021-05-10 11:51:32 +00:00
Angen
b4d11bda89 Fix warnings and missing break from f1acd22455
make linter happy
add missing break to loop if correct comparator has been found, reported
by @Langbart

Differential revision: D3945
Tested by: @Langbart
This was SVN commit r25414.
2021-05-09 17:05:02 +00:00
Angen
f1acd22455 Do not allow to start pyrogenesis with incompatible mods
Fixing following problems:
Issue number one:
Enable mod with a23 compatibility in a23b.
Save configuration.
Start a24.
Better result:
Mod will be enabled and invisible in mod selection screen producing
various errors.
Worse result:
Game will crash and refuse to start.

Issue number two:
Mods can silently set loaded mods without restarting the engine, so mods
can unlist themselves from compatibility detection.

Solution:
Enable necessary mods instead if running with gui and open mod page.
Open information window on top of mod page to infom why mod page is
showing up.
On mod page show mods which failed in compatibility check and color the
resposnible ones.
Disable start button without enabled mods.
Show non existed mods if they failed in compatibility check.

Else just log to mainlog and close.

Another fixes:
Display in enabled mods really enabled mods as current logic confuses
players about which mods they have enabled and is not helpful (ref
#4881)

Note:
this will not solve issue with mods claiming being compatible with
engine version while in fact being incompatible.

Comments by: @vladislavbelov, @Stan, @Imarok
Tested by: @wraitii
Differential revision: D3592
Fixes: #6044 #4881

This was SVN commit r25410.
2021-05-09 13:53:25 +00:00
64b475b390 Fix Profiler1 "time per turn".
Actually call Turn() when a turn is processed.

Fixes #6144

Differential Revision: https://code.wildfiregames.com/D3885
This was SVN commit r25394.
2021-05-06 16:49:34 +00:00
0198942a79 Fix warning in cdd75deafb
GCC complained, even if the path cannot be taken.

This was SVN commit r25377.
2021-05-04 14:01:18 +00:00
911f49c655 Gamesetup: make sure GameSpeed is a number
The dropdown converted the numbers to string, and the code expected
numbers.

Differential Revision: https://code.wildfiregames.com/D3924
This was SVN commit r25376.
2021-05-04 13:59:30 +00:00
cdd75deafb XMB Improvements, parse JS into XMB, make strings more efficient.
XMB format is bumped to 4, invalidating all cached files. The
differences are:
 - element/attribute names are stored after the elements themselves, and
not before. This allows writing XMB data in one pass instead of two.
 - names themselves becomes offsets (instead of arbitrary integers),
making getting the string from the int name much more efficient.

XMBFile is renamed to XMBData to clarify that it does not, in fact,
refer to a file on disk.

XMBData::GetElementString is also changed to return a const char*, thus
not creating an std::string. A string_view version is added where
convenient.

The XML->XMB and JS->XMB conversion functions and the corresponding
storage are moved to `ps/XMB`, since that format doesn't particularly
relate to XML. CXeromyces becomes lighter and more focused as a result.
The XML->XMB conversion also benefits from the above streamlining.

Note that in a few cases, string_view gets printed to CLogger via
data(), which is generally not legal, but we know that the strings are
null-terminated here. Our libfmt (version 4) doesn't support
string_view, that would be v5.

Differential Revision: https://code.wildfiregames.com/D3909
This was SVN commit r25375.
2021-05-04 13:02:34 +00:00
34b1920e7b Split ScriptRequest in its own header.
We often only need to include ScriptRequest.h and not the full
ScriptInterface.h

Differential Revision: https://code.wildfiregames.com/D3920
This was SVN commit r25366.
2021-05-03 16:07:26 +00:00
0406c4dfde Throw errors instead of warnings on wrong implicit conversions.
This prints out a stack trace, which is quite helpful when debugging.
Also fixes an issue with stack trace not always being reported.

Differential Revision: https://code.wildfiregames.com/D3210
This was SVN commit r25365.
2021-05-03 15:44:06 +00:00
d46a417748 Replace ScriptInterface::Call* with new ScriptFunction functions
Finishes work started in f3aedf88a6.
This removes the boost-CPP function wrappers entirely, in favour of pure
templated code in FunctionWrapper.h
The Call* functions were already heavily templated, so there is nothing
really new here. I just use tag dispatch to reduce the number of
overloads slightly.

The new functions do not need the script interface, only the script
request.

Differential Revision: https://code.wildfiregames.com/D3912
This was SVN commit r25354.
2021-05-01 14:04:53 +00:00
66fbc23f2c De-singletonify CConfigDB, make hooks RAII.
CConfigDB is no longer a singleton, and its members are no longer
static.
This makes it possible to have several instances of it, useful for
testing of if we ever want to have different config profiles.

Also updates hooks to delete themselves on destruction, to fit a more
natural RAII pattern. Long-lived objects must take care to destroy hooks
before ConfigDB is reset.

Differential Revision: https://code.wildfiregames.com/D3866
This was SVN commit r25326.
2021-04-27 07:45:40 +00:00
89032c4d2b Improvements on 76acc4e146
See 76acc4e146. Follows comments by @vladislavbelov.

Differential Revision: https://code.wildfiregames.com/D3852
This was SVN commit r25279.
2021-04-16 16:04:01 +00:00
4a51012442 Adds line drawing to DebugRenderer.
This was SVN commit r25271.
2021-04-15 22:51:25 +00:00
a6cb77a204 Disables depth test for GUI rendering.
Tested By: Langbart
Differential Revision: https://code.wildfiregames.com/D3835
This was SVN commit r25231.
2021-04-11 19:36:52 +00:00
35ed55cfd6 ParamNode: switch to utf8, ToXML -> ToXMLString, test tweak, PCH tweak
This changes ParamNode to use UTF8 values internally (XMB files are UTF8
since cb9d0733ef).
This removes the need for a lot of conversions, speeding things up and
allows cleaning up the validator interface & a few other callsites.
ConstructJSVal could be a tad slower because of UTF8->16 conversions
within Spidermonkey; but the difference is unlikely to be noticeable in
practica.

Also:
- Changes `ToXML` to `ToXMLString` for clarity.
- Add a simple "op" test & show a particular behaviour of merge nodes
that I intend to change somewhat in D3830.
- Remove Component.h from simulation2 PCH - brought in too much.

Tested by: langbart
Differential Revision: https://code.wildfiregames.com/D3834
This was SVN commit r25228.
2021-04-11 09:23:10 +00:00
fcc6bbe797 Fix d73a3f59ad - wstring_view on a temporary & wrong utf16->8 conversion.
Two issues:
- The wstring_view was created on a temporary string - the data got
overwritten sometimes.
- there was some weird UTF16->UTF8 conversion going on.


Reported by: langbart
Differential Revision: https://code.wildfiregames.com/D3828
This was SVN commit r25226.
2021-04-09 18:08:37 +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
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
80f354a125 Fix nopch / tiny hotkey optimisation
Swap an std::set for an std::vector, the set was useful only in an
earlier iteration of the diff. This fixes nopch.

Differential Revision: https://code.wildfiregames.com/D3790
This was SVN commit r25195.
2021-04-06 12:26:34 +00:00
7032a3c12a Further hotkey work: clear hotkeys when an input box/the console gets focus.
This is necessary following 2d53308e1b, which now handles key-up in
input to prevent hotkeys from firing then.
Hotkeys are a global system, which means opening e.g. the chat window or
the summary does't reset things. If you press "S" to scroll the in-game
camera down, then press 'return' to open the chat, the camera keeps
scrolling down. Following 2d53308e1b, it never released since it never
got the keyup.

To handle this nicely, we need to explicitly clear hotkeys when input
boxes get focus (respectively the console).

Differential Revision: https://code.wildfiregames.com/D3797
This was SVN commit r25186.
2021-04-03 20:12:40 +00:00
8ed1bc2fd1 Don't error in the network delay notifier.
Differential Revision: https://code.wildfiregames.com/D3788
This was SVN commit r25181.
2021-04-02 14:20:37 +00:00
2d53308e1b Fix console not preventing hotkeys from firing / Clean up hotkey-input conflict.
- Fix mistake in 4b46c09222 (similar to one in a4852c4c01) that allowed
hotkeys to fire while typing in the console.
- Prevent Alt+key to fire hotkeys in input boxes & console as that is
often text input.
- Split the hotkey triggering logic in two: a preparatory phase & an
actual firing phase.
This allows the GUI code to check which hotkeys are about to fire and
selectively allow them to go through. This makes it easier to change
hardcoded hotkeys, such as the console toggling one.

Differential Revision: https://code.wildfiregames.com/D3786
This was SVN commit r25180.
2021-04-02 14:18:20 +00:00
0232c0d017 Fix 4b46c09222 - Mouse wheel hotkeys behaving erratically.
Mouse wheel hotkeys behave differently from other hotkeys (mouse
button/keys) in that they are transient: they're always pressed/released
in one go.
As such:
- They shouldn't be added to the stored pressedHotkeys
- They shouldn't be added to active scancodes.

This fixes these issues from 4b46c09222 & also skips un-necessary
processing in those cases.

Reported by: Imarok.
Differential Revision: https://code.wildfiregames.com/D3782
This was SVN commit r25176.
2021-04-01 14:51:22 +00:00
4b46c09222 Do not trigger "HotkeyPress" events when releasing a key.
Follows d0a42f2f00.
Because only the most specific hotkeys can be active at any time,
releasing a key may require re-activating less specific hotkeys.
There were two issues with this behaviour:
- It was buggy, as it only checked one active key, when any still active
key can trigger hotkeys.
- "HotkeyPress" and "HotkeyDown" events where sent, as if the hotkey was
pressed, which was unexpected for most code/users (it is unusual to have
a "Press" event on key release).

This fixes these issues by "silently" re-triggering the hotkeys in such
a case. It also makes it easier for JS code to use "hotkeyPress" instead
of "hotkeyDown" for non-continuous behaviour.

Accepted By: nani
Fixes #6123
Refs #6064 (fixes the problem, but not the code weirdness)

Differential Revision: https://code.wildfiregames.com/D3766
This was SVN commit r25169.
2021-03-31 15:50:25 +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
5ebf2020b0 Netcode: allow observers to lag behind the live game.
Observers no longer lag the game for players. There is still some time
to serialise the game when sending it to a joining observer, and
depending on the chosen 'max lag' the game may stop while observers
sufficiently catch up, but this impact too is reduced.

- Make the NetServerTurnManager ignore players marked as 'observers' for
the purpose of ending a turn, effectively making it possible for
observers to lag without it affecting the players in any way.
- Add a config option (network.observermaxlag) that specifies how many
turns behind the live game observers are allowed to be. Default to 10
turns, or 2 seconds, to keep them 'largely live'.
- The controller is not treated as an observer.
- Implement a simple UI to show this delay & allow the game to speed up
automatically to try and catch up. This can be deactivated via
network.autocatchup.
- Move network options to the renamed 'Network / Lobby' options page.
- Do not debug_warn/crash when receiving commands from the past -
instead warn and carry on, to avoid DOS and "coop play" issues.

Refs #5903, Refs #4210

Differential Revision: https://code.wildfiregames.com/D3737
This was SVN commit r25156.
2021-03-29 07:53:06 +00:00
969112b9c8 Replaces CPos by more a consistent CVector2D, reduces geometry code duplication.
Tested By: Freagarach, Langbart
Differential Revision: https://code.wildfiregames.com/D3759
This was SVN commit r25152.
2021-03-28 21:55:13 +00:00
b477892440 Fix issues in 87a2c3347f
Fixes 87a2c3347f:
- NoPCH was broken
- two warnings slipped through.

Differential Revision: https://code.wildfiregames.com/D3751
This was SVN commit r25147.
2021-03-28 07:01:34 +00:00
db84c2a9b2 Moves CSize into a separate file and renames it to CSize2D according to other geometric entities.
This was SVN commit r25143.
2021-03-27 16:08:06 +00:00
87a2c3347f Make real directory paths on the VFS predictable (retry)
This is the same commit as 4bb31f084e, reverted in 5d1899785a. Noted
issues were fixed.

Partial revert/fix of 2f19cf86d3 and 2567fee329.

Before this diff, it was possible for a mod containing a cache/ or a
config/ folder to get written to incorrectly.
The issue is VFS can map multiple directories to one 'virtual' path, for
reading mods. However, writing data is problematic: which path to
choose?
The only viable solution is to use a path relative to the highest
priority directory encountered in the VFS path, or write paths could be
'hijacked' by lower-priority mods.

This fixes these issues by:
- Adding a new lookup mode ('Real-path') that explicitly picks the real
path relative to the highest-priority subdirectory in the VFS Path.
- Preventing overwriting a real directory with a lower priority one in
general.
- Revert c0c8132dd4's GetRealPath change, re-introducing the function as
GetOriginalPath.

This also cleans up some duplication that led to empty mod folders in
the user mod path, and cleans up loading the 'user' mod.
It also makes it explicit that a directory must be passed to Mount().

Note that the new 'realpath' lookup can still be somewhat complex with
many mount points at various hierarchy levels, but it is at least
predictable/deterministic without having to be careful about populating
order.

Fixes #2553

Differential Revision: https://code.wildfiregames.com/D3728
This was SVN commit r25107.
2021-03-23 12:46:59 +00:00
5d1899785a Revert 4bb31f084e
4bb31f084e led to an issue in windows-specific code not detected by the
tests. I'll debug later.

This was SVN commit r25105.
2021-03-22 19:52:07 +00:00
4bb31f084e Make real directory paths on the VFS predictable.
Partial revert/fix of 2f19cf86d3 and 2567fee329.

Before this diff, it was possible for a mod containing a cache/ or a
config/ folder to get written to incorrectly.
The issue is VFS can map multiple directories to one 'virtual' path, for
reading mods. However, writing data is problematic: which path to
choose?
The only viable solution is to use a path relative to the highest
priority directory encountered in the VFS path, or write paths could be
'hijacked' by lower-priority mods.

This fixes these issues by:
- Adding a new lookup mode ('Real-path') that explicitly picks the real
path relative to the highest-priority subdirectory in the VFS Path.
- Preventing overwriting a real directory with a lower priority one in
general.
- Revert c0c8132dd4's GetRealPath change, re-introducing the function as
GetOriginalPath.

This also cleans up some duplication that led to empty mod folders in
the user mod path, and cleans up loading the 'user' mod.

Note that the new 'realpath' lookup can still be somewhat complex with
many mount points at various hierarchy levels, but it is at least
predictable/deterministic without having to be careful about populating
order.

Fixes #2553

Differential Revision: https://code.wildfiregames.com/D3217
This was SVN commit r25104.
2021-03-22 18:49:42 +00:00
87fc52b780 MP: don't enforce game init attributes synchronization in PREGAME.
The NetServer stored a complete copy of the game Init Attributes, which
it sent to new clients on updates from the controller. This worked well,
but prevents incremental updates and other unrelated messages from being
sent.

This changes the system so that:
- in PREGAME state, the server does not update its copy of the game init
attributes
- the server forwards game setup messages from the controller to all
clients
- Joining clients get a full copy of the Settings, when joining, from
the controller (this is a js-driven behaviour - other situations might
not need do it).
- Make the StartNetworkGame message take a copy of the final init
attributes, to ensure synchronization (and simplify some logic).

In practice, this:
- makes it possible to send different types of gamesetup messages (this
introduces two: a regular update and the full 'initial-update' for new
clients).
- moves some C++ hardcoding into JS - here in essence the PREGAME server
state is now init-attributes-agnostic.
- does not change much for readiness control - the server already needed
to force a change at game start to set random elements.

Note that the loading page is currently still receiving the 'local' game
attributes, which assumes that all clients are correctly synchronized
(they should be).

Refs #3806, #3049

Differential Revision: https://code.wildfiregames.com/D3714
This was SVN commit r25099.
2021-03-22 10:13:27 +00:00
92f94e25c6 Adds ortho projection type and its test.
This was SVN commit r25073.
2021-03-17 23:03:35 +00:00
839cd0ec12 Update the replay cache to consider modification time.
This makes the cache work consistently if replays are changed
externally.

Patch by: nwtour
Differential Revision: https://code.wildfiregames.com/D3615
This was SVN commit r25026.
2021-03-07 08:55:27 +00:00
40399011f7 Fixes revealed missed include after e104b41be2.
This was SVN commit r25008.
2021-03-04 08:55:49 +00:00
2e4639e6dc Removes unused containers included in headers.
This was SVN commit r25004.
2021-03-03 23:01:08 +00:00
c29423c723 Fixes revealed missed includes after e104b41be2.
This was SVN commit r25003.
2021-03-03 22:38:59 +00:00
e104b41be2 Cleanups includes for cassert and streams.
This was SVN commit r25002.
2021-03-03 22:26:49 +00:00
c16d961cd2 Enable support for powerpc64 systems. New problems with NVTT will be addressed in another diff.
Patch by: @tpearson-raptor
Comments by: @q66
Refs:
https://github.com/void-linux/void-packages/blob/master/srcpkgs/0ad/patches/ppc64.patch

Differential Revision: https://code.wildfiregames.com/D1619
This was SVN commit r24995.
2021-03-03 15:13:47 +00:00
a4223c87f6 Fix NoPCH following cb346e207b
Broken in cb346e207b

Differential Revision: https://code.wildfiregames.com/D3629
This was SVN commit r24994.
2021-03-03 11:08:57 +00:00
cb346e207b Refactor all usage of RegisterFunction to ScriptFunction::Register
- Replace ScriptInterface::RegisterFunction with
ScriptFunction::Register
 - Mostly removing unused cmpPrivate*
 - Some usage introduces specific getters (mapgenerator, AIWorker,
XmppClient,...)
 - Several passthrough functions are simply removed in favour of calling
the original, reducing duplication
 - Make use of ScriptRequest/ScriptInterface capabilities where
relevant.
- Make JSI_* headers only expose necessary functions, lightening them
considerably and reducing duplication
 - Reuse namespaces in JSI_* implementations directly, reducing visual
noise there

Follows f3aedf88a6

Differential Revision: https://code.wildfiregames.com/D3626
This was SVN commit r24983.
2021-03-02 20:01:14 +00:00
1c9efa6fb5 Implement Single-Player campaigns - Barebones tutorial campaign included.
This implements necessary tooling to create a simple SP campaign.
The architecture is intended to be easily extensible in the future.

'Campaign Run' contains the metadata of a campaign, e.g. maps
played/won. It's saved in the user folder under
saves/campaigns/*.0adcampaign
Campaign templates are JSON files in campaigns/

Campaigns can specify which Menu interface they will use. This is
intended to allow more complex layouts/presentation.
For now, a simple list interface is provided. This allows making
campaigns without any fancy art required (and effectively mimics AoE1's
campaign interface).

The behaviour on game end is also intended to be extensible, supporting
things such as carrying over units between scenarios - for now, it
simply records won games.

GameSetup is not available for now - scenarios are triggered with the
settings defined in the map/default settings. Improving on this requires
refactoring the gamesetup further.

The load/save game page has been extended slightly to support
showing/hiding campaign games (campaign gamed are saved under saves/
directly, there is no strong motivation to do otherwise at this point)

Closes #4387

Differential Revision: https://code.wildfiregames.com/D11
This was SVN commit r24979.
2021-03-02 15:43:44 +00:00
f3aedf88a6 Introduce C++ templates replacements for DEFINE_INTERFACE_X and RegisterFunction macros
The new methods:
- aren't included in ScriptInterface.h directly, lightening that header
- don't use boost CPP
- don't need argument types or number or constness to be specified
- can work with object methods somewhat transparently
- support optional cmptPrivate (allowing removal of many UNUSED macro)
- support optional const ScriptRequest&, which is safer.

This first diff changes only some of the JSI files & the component
manager. Further diffs will update other files and finally delete the
current code.

Differential Revision: https://code.wildfiregames.com/D2818
This was SVN commit r24969.
2021-03-01 20:52:24 +00:00
113fefeeb7 Netcode: Identify controller client via a secret key
The 'controller' of an MP game (the host in general, though dedicated
servers would change that) is currently whoever first tells the server
that it is. This can be abused since it relies on trusting the clients.

This changes that logic: the server defines a 'controller secret', and
the first client to sent the correct controller secret is the
controller. This is safe assuming the secret is unknowable enough (the
current solution wouldn't pass strict cryptography tests, but it's
likely good enough).

Reverts 1a3fb29ff3, which introduced the 'trust the clients' mechanic,
as a change over 'the first local IP is controller'.

Necessary step towards dedicated server, if we want to use the regular
gamesetup (Refs #3556)

Differential Revision: https://code.wildfiregames.com/D3075
This was SVN commit r24952.
2021-02-27 17:44:59 +00:00
68b81f63b1 Bump version to alpha 25.
Last alpha 24 commit was [[SVN:24937]]. [[SVN:24938]] was because the CI
wasn't turned off.

Comments by: @wraitii, @Freagarach, @Nescio,
Differential Revision: https://code.wildfiregames.com/D3571
This was SVN commit r24939.
2021-02-27 08:48:30 +00:00
98f2510632 Fixes config crash in case of an empty value
Patch by: @vladislavbelov
Differential Revision: https://code.wildfiregames.com/D3567
This was SVN commit r24922.
2021-02-14 02:10:46 +00:00
7a71011149 Refactors smart pointers creation, reduces code duplication and improves exception safety.
This was SVN commit r24915.
2021-02-13 23:53:40 +00:00
f175bc4f8d Fixes big screenshots with water (reflection or refraction camera), adds big screenshot customization.
Commented By: Stan, wraitii
Differential Revision: https://code.wildfiregames.com/D3557
This was SVN commit r24891.
2021-02-12 21:20:07 +00:00
e3c44f0bde Fix more issues with the RLInterface
Patch by: @Stan, @irishninja
Differential Revision: https://code.wildfiregames.com/D3385
This was SVN commit r24839.
2021-02-05 12:23:02 +00:00
321e3652f9 Fix and disable some pesky Windows warnings.
Differential Revision: https://code.wildfiregames.com/D3511
This was SVN commit r24838.
2021-02-05 12:20:06 +00:00
e7e6fe139e Allows to override GL version for SDL.
Tested By: Stan
Differential Revision: https://code.wildfiregames.com/D3448
This was SVN commit r24768.
2021-01-22 19:40:02 +00:00
8c429b9a68 Fix unit-only Attack move.
attackmoveUnit is more specific than attackMove, so since d0a42f2f00
won't fire at the same time. However the GUI code expected that,
breaking it.

Instead, properly check for either attackmove or attackmoveUnit.

Also fix an issue with d0a42f2f00 where hotkeys would be release if
switching to a more specific combination of the same hotkey.

Reported by: snelius
Fixes #5944

Differential Revision: https://code.wildfiregames.com/D3436
This was SVN commit r24752.
2021-01-21 15:58:33 +00:00
37729586dc Don't pause music when pausing the game / Fix victory music in SP.
Victory music doesn't work in A24 SP. That's because the modal pauses
the game, and pausing the game pauses music.
This has been the case since c9a5d5cee5.

Auto-pausing the game (structree, ...) didn't really happen in the past,
but A24 makes it relatively common, and I think pausing the music is a
bit jarring then, so this simply removes that.

Reported by: Langbart
Fixes #5941

Differential Revision: https://code.wildfiregames.com/D3433
This was SVN commit r24744.
2021-01-21 09:34:20 +00:00
9df127f9d1 Removes shader code duplication to calculate LOS.
Tested By: Stan
Differential Revision: https://code.wildfiregames.com/D3428
This was SVN commit r24732.
2021-01-20 18:46:32 +00:00
Angen
1a8de6d2b8 Hide ip and port from users until they want to join, add optional password
Current issue with the lobby, is that we make ips of hosts public for
anyone to read. This patch consists of 3 parts.
1.) Removing ips and ports from lobby javascript
2.) Removing need of script on the server to attach public ips to game
stanza by asking the host using xmppclient as proxy.
3.) Implementing password protected matches, to deny this information to
not trusted players.

Further description:
Do not send ports and stunip to the bots.

Removed from stanza.
Do not send ip to the lobby.

Removed from mapping gamelist from backend to gui (still on the backend
side, because it is done by script on 0ad server).
Get ip and ports on request when trying to connect.

On the host side, ask stun server what is host's public ip and remember
it.
On the client side, send iq through xmppclient to the hosting player and
ask for ip, port and if Stun is used, then if answer is success,
continue
   with connecting, else fail.
Add optional password for matches.

Add password required identifier to the stanza.
Allow host to setup password for the match. Hash it on the host side and
store inside Netserver. If no password is given, matches will behave
as it is not required.
On the client side, if password for the match is required, show
additional window before trying to connect and ask for password, then
hash it
and send with iq request for ip, port and stun.
Server will answer with ip, port and stun only if passwords matches,
else will asnwer with error string.
Some security:
Passwords are hashed before sending, so it is not easy to guess what
users typed. (per wraitii)
Hashes are using different salt as lobby hashing and not using usernames
as salt (as that is not doable), so they are different even typing the
same password as for the lobby account.
Client remembers which user was asked for connection data and iq's id of
request. If answer doesn't match these things, it is ignored. (thnx
user1)
Every request for connection data is logged with hostname of the
requester to the mainlog file (no ips).
If user gets iq to send connection data and is not hosting the match,
will respond with error string "not_server".
If server gets iq::result with connection data, request is ignored.

Differential revision: D3184
Reviewed by: @wraitii
Comments by: @Stan, @bb, @Imarok, @vladislavbelov
Tested in lobby

This was SVN commit r24728.
2021-01-20 18:31:39 +00:00
876ac2fead Prevent double-click when moving the mouse.
SDL 2.0.9 introduced a 32-pixel leeway for double clicks to register,
which makes it possible to trigger "select all units of the same type"
behaviour while trying to select different units that are close by.

This effectively reverts that by setting the "hint" to 1.

Fixes #5920

Differential Revision: https://code.wildfiregames.com/D3420
This was SVN commit r24698.
2021-01-19 13:13:00 +00:00
d0a42f2f00 Further Hotkey fixes.
12cceed3d9 broke meta-key releases. This fixes that.
Also fix a much older issue where pressing new keys would not release
less specific hotkeys.

Add tests.

Reported by: Imarok
Tested by: langbart
Fixes #5930
Fixes #5927

Differential Revision: https://code.wildfiregames.com/D3396
This was SVN commit r24675.
2021-01-18 10:58:16 +00:00
1eb342c595 Fix missing 'else return' in isPressed following 12cceed3d9
Reported by Vladislavbelov & nephele

This was SVN commit r24650.
2021-01-16 17:16:02 +00:00
55fd2b3441 Fix typos in 12cceed3d9
Fix 12cceed3d9

This was SVN commit r24648.
2021-01-16 15:46:56 +00:00
12cceed3d9 Fix hotkeys not releasing properly.
a4852c4c01 changed hotkeys to use scancode, but didn't change g_keys to
reflect that, and this could break hotkey release.
This fixes that by explicitly using scancodes. Note that we might want a
g_keys map in the future, but it seems un-necessary at the moment.

Also remove the last remnants of 'negated' hotkeys, which were disabled
following b995135138.

Tested By: OptimusShepard
Fixes #5922

Differential Revision: https://code.wildfiregames.com/D3379
This was SVN commit r24645.
2021-01-16 15:24:58 +00:00
6a67e9a52d Address concerns in 5473393e30 (RL interface)
Fixes 5473393e30.

This:
- Puts RL code under the RL namespace to avoid name collisions
- Avoids usage of new/delete
- Adds more documentation
- Does general cleanup (const-correctness, move semantics, argument
types, early returns...)

Patch by: irishninja
Comments by: Vladislavbelov, wraitii
Differential Revision: https://code.wildfiregames.com/D2947
This was SVN commit r24631.
2021-01-15 16:30:05 +00:00
6282960991 Removes useless option for shadows on water
Reviewed By: wraitii
Differential Revision: https://code.wildfiregames.com/D3368
This was SVN commit r24630.
2021-01-15 15:45:39 +00:00
b1a89fbd89 Replaces UNICODE characters in the code by consistent ASCII characters.
Beside consistency improves reading for such console tools like svn diff
or vim diff.

This was SVN commit r24625.
2021-01-15 10:07:36 +00:00
0944856cc1 Allow hotkeys/config settings to be empty.
This changes ConfigDB to support empty settings, marked with `= ""`. It
also changes hotkey to handle unused hotkeys, but stil have them appear
in the hotkey editor.
Fixes an issue where the current editor would bug when saving an empty
hotkey.
Removes the old system for unused hotkeys, adjust hotkey files
accordingly.

Reported by: FeldFeld
Differential Revision: https://code.wildfiregames.com/D3307
This was SVN commit r24618.
2021-01-15 08:05:10 +00:00
205486d6f3 Fix sound errors when no sound card is detected.
Based on a patch by: @Imarok
Refs: #3285

Differential Revision: https://code.wildfiregames.com/D1481
This was SVN commit r24551.
2021-01-11 18:56:33 +00:00
687a9335f0 Remove cache detection
Reviewed by: wraitii
Fixes: #4360
Differential Revision: https://code.wildfiregames.com/D3165
This was SVN commit r24550.
2021-01-11 17:30:16 +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
1bb336829d Add initial support for MCST Elbrus 2000 (e2k) CPU architecture
patch by: @r-a-sattarov
Reviewed by: @Stan
Fixes #5877, Refs #5869

Differential Revision: https://code.wildfiregames.com/D3162
This was SVN commit r24490.
2020-12-31 15:52:12 +00:00
d28d17e96c Remove SSE detection duplication in Colors and ModelRenderer
- Rename macros to be more explicit
 - Move detection code to a separate file
 - Remove a lot of checks in ARB mode (ModelDef.cpp would check for sse
multiple times per frame)
 - Make explicit the SSE2 dependency for Windows

Comments by: @vladislavbelov @wraitii @OptimusShepard
Differential Revision: https://code.wildfiregames.com/D3212
This was SVN commit r24489.
2020-12-31 15:37:28 +00:00
e009d322cc Add missing files in 4942cabab5
This was SVN commit r24488.
2020-12-31 14:27:02 +00:00
82d079d06c Add a Dev Overlay checkbox to activate RejoinTest from the session.
This makes this feature, very useful for checking for OOS, more easily
accessible.

Differential Revision: https://code.wildfiregames.com/D3199
This was SVN commit r24407.
2020-12-17 17:53:13 +00:00
dd0b56c8aa Replace DISCARD macro with ignore_result template.
Fixes eb7940b418.
As reported by Vladislav, there is possibly confusion on what exactly is
being ignored when there are multiple statements after DISCARD. Explicit
wrapping avoids that.

Differential Revision: https://code.wildfiregames.com/D3206
This was SVN commit r24397.
2020-12-15 09:03:44 +00:00
aa3bd08513 Fix non-visual replay on Windows. Use the actual detected resolution.
Differential Revision: https://code.wildfiregames.com/D3208
This was SVN commit r24381.
2020-12-12 08:18:24 +00:00
ea38089853 Fix userreport detection of sound cards
Differential Revision: https://code.wildfiregames.com/D3025
This was SVN commit r24367.
2020-12-10 18:36:05 +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
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
d92a2118b0 [SM78 2/2] Update to Spidermonkey 78 APIs
This ugprades 0 A.D. to the latest ESR at the moment of writing.

Mostly straighforward API changes (see meta-Bug 1633145)
- js::Class is merged with JSClass
- JSNewArrayObject becomes JS::NewArrayObject
- ArrayObject-functions are moved to a new public header Array.h
- JSMSG error messages have again been changed, requiring some tweaks.
- AutoValueArray becomes RootedBalueArray (Bug 1634435)
- 'uneval' is behind a Realm flag (Bug 1565170), but no removal is
planned in the short-term future.
- Some minor GC API changes (Bugs 1569564 and 1633405)
- Error reporting has had some tweaks, and error flags have been removed
(Bug 1620583)
- StructuredClone are now always thread-safe, simplifying an API change
introduced in SM52 (Bug 1607791)

Tested by: Stan, Freagarach, mammadori
Closes #5861

Differential Revision: https://code.wildfiregames.com/D3168
This was SVN commit r24333.
2020-12-06 14:03:02 +00:00
f44390f3fc Fix 3391542fec: AA / Sharpness not being correctly enabled at the start.
Reported by: OptimusShepard
Tested By: OptimusShepard, Stan
Differential Revision: https://code.wildfiregames.com/D3138
This was SVN commit r24318.
2020-12-03 12:19:44 +00:00
46399371ed Remove binary_function usage.
std::binary_function was a pre-C++11 construct, that is removed entirely
in c++17, and no longer necessary regardless.

Refs #5862

Differential Revision: https://code.wildfiregames.com/D3164
This was SVN commit r24301.
2020-11-30 15:45:05 +00:00
ad2f08a355 Use a more common locale, en_US.UTF-8 is not always present.
Refs https://code.wildfiregames.com/D2101
Thread:
https://wildfiregames.com/forum/topic/28209-binariessystemtest-fmtsprintf-f-with-separator/?tab=comments#comment-396875

This was SVN commit r24300.
2020-11-30 13:59:05 +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
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
d7d0f142d8 Update (and debundle) fmt dependancy
We now support the most recent released version of `fmt` available (at
the time
of committing).

As we no longer patch `fmt` to get it to work within `pyrogenesis`, this
commit
also mostly removes its source from our code-tree (some headers are
retained for
Windows builds).


If you are a user of...

Linux/BSD: You will now need to have `fmt` installed from your
distribution's
           package repository. The minimum supported version of `fmt` is
`4.0`.

      OSX: The source is acquired and compiled (in `build-osx-libs.sh`),
           then included and linked automatically.

  Windows: The relevant header files are retained and, along with a
pre-built
           library, are the only things still bundled.


Accepted by: wraitii
Tested by:
* Freagarach (Lubuntu 18.04, `fmt 4.0.0`)
* Krinkle (MacOS 10.14, `fmt 6.1.2`)
* nephele (Alpine Linux)
* wraitii (MacOS 10.14)
* Nescio (Fedora 33, `fmt 7.0.3`)

Windows library files built by: Stan
Fixes: #3190
Differential Revision: https://code.wildfiregames.com/D2689
This was SVN commit r24267.
2020-11-26 21:01:32 +00:00
eb7940b418 Silence warnings about unused result.
Introduce a DISCARD macro to ignore the warn_unused_result attribute
used by Spidermonkey, and reuse it elsewhere.

Differential Revision: https://code.wildfiregames.com/D3147
This was SVN commit r24261.
2020-11-26 13:58:59 +00:00
3391542fec Fix rendering options failures following 8a1b3d6769
Two issues are fixed:
- Atlas on non-Mac crashed when started from within the game.
- MSAA options crashed if enabled on startup.

The underlying issues where improper shutdown, and assuming the renderer
was initialised than it might not be (in particular, the post-processor
wasn't).

Tested by: Stan
Differential Revision: https://code.wildfiregames.com/D3131
This was SVN commit r24233.
2020-11-22 11:09:13 +00:00
8a1b3d6769 Allow registering hooks that trigger on config changes.
Rendering options use this capability to simplify their implementation.
This makes it easier to add new options.

Comments by: vladislavbelov
Differential Revision: https://code.wildfiregames.com/D2293
This was SVN commit r24228.
2020-11-21 11:57:14 +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
640efa557e Add a hashing function for CStr8 & CStrW
Reviewed by: @wraitii
Differential Revision: https://code.wildfiregames.com/D3106
This was SVN commit r24218.
2020-11-19 15:25:27 +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
fd8f5abd2e [SM52 2/2] Update to Spidermonkey 52 APIs.
No particularly noteworthy changes, as most complex API changes were
already supported in SM45 and done.
The addition of JSStructuredCloneData allows to remove our custom class.

Changes:
- InformalValueTypeName is back in the API, so remove our
implementation.
- Stop using JSRuntime entirely in favour of JSContext*
- JSPropertyDescriptor is renamed.
- CompartmentOptions are tweaked slightly (no functional changes)
- JS::Construct - API update.
- JSClass split - API update.
- A js.msg error message was removed, so we had to use a different one.
- Tests fix: fix comparison of union instances
- Disable warning in spidermonkey Vector.h
- Update error reporting to SM52 (minor API updates)
- Ignore warnings about unused return values (would come from OOM, which
isn't recoverable)

Most of the patching was done by Itms.

Tested by: Stan, Freagarach
Fixes #4893

Differential Revision: https://code.wildfiregames.com/D3095
This was SVN commit r24203.
2020-11-18 14:39:04 +00:00
935af751b9 Fix building without precompiled headers.
Broken in several recent diffs.
This also fixes (very) old missing standard headers.

Differential Revision: https://code.wildfiregames.com/D3110
This was SVN commit r24200.
2020-11-18 11:35:36 +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
88bc973530 Delete useless JS::Value forward declaration.
ProfileViewer.h forward-declares JS::Value but doesn't use it. Starting
in SM68, JS::Value is a union, and this breaks at compilation.

Last modified in c02a7e1a7b, useless since 2af94c5898

Differential Revision: https://code.wildfiregames.com/D3102
This was SVN commit r24186.
2020-11-15 07:51:15 +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
aae417bd29 Explicitly make ScriptInterface a Compartment wrapper.
ScriptInterface is now a wrapper around a JSCompartment, and thus always
has a well-defined global.

The error reporter is moved to ScriptRuntime in anticipation of that
handling JSContext in a later diff.

Part of the SM52 migration, stage: SM45 compatible.

Patch by: Itms
Tested By: Freagarach
Refs #4893

Differential Revision: https://code.wildfiregames.com/D3090
This was SVN commit r24180.
2020-11-14 08:46:32 +00:00
ab5616b4c4 Mass rename CxPrivate to CmptPrivate.
As part of the SM45->52 migration, a ScriptInterface becomes a wrapper
around a JSCompartment, not a JSContext, thus we ought to store private
data for the compartment and not the context.
This is a mass rename of CxPrivate to CmptPrivate to match that before
the actual changes.

Part of the SM52 migration, stage: SM45 compatible

Patch by: Itms
Tested By: Freagarach
Refs #4893

Differential Revision: https://code.wildfiregames.com/D3089
This was SVN commit r24177.
2020-11-13 16:44:15 +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
66cc595c53 Encapsulate runtime creation.
- Makes it easier to change down the line (and change is coming)
- Allows making g_ScriptRuntime thread-local easily.
- Remove ParentRuntime, which is not used at the moment.

Part of the SM52 migration, stage: SM45 compatible.

Patch by: Itms
Tested By: Freagarach
Refs #4893

Differential Revision: https://code.wildfiregames.com/D3087
This was SVN commit r24171.
2020-11-12 09:34:40 +00:00
90367cdc53 Remove DefPersistentRooted and unneeded includes.
DefPersistentRooted is essentially a wrapper around unique_ptr and has
no real reason to exist.

Part of SM52 migration, stage: SM45 compatible.

Patch by: Itms
Tested by: Freagarach
Refs #4893

Differential Revision: https://code.wildfiregames.com/D3086
This was SVN commit r24170.
2020-11-12 08:24:30 +00:00
9669b5f1a9 Removes additional depth texture copying and reusing existing refraction depth.
Tested By: Stan, wraitii
Differential Revision: https://code.wildfiregames.com/D3084
This was SVN commit r24160.
2020-11-11 18:46:52 +00:00
e038f7844b Fixes terrain overlays by removing fixed pipeline dependency.
Tested By: Freagarach, wraitii
Differential Revision: https://code.wildfiregames.com/D3074
This was SVN commit r24154.
2020-11-09 18:50:40 +00:00
9d53bed0bd Adds a LOS mask to Minimap.
Commented By: elexis, Stan
Differential Revision: https://code.wildfiregames.com/D2216
This was SVN commit r24141.
2020-11-08 08:51:54 +00:00
b7cbfecd19 Replacing losMap usages by existed and more consistent losTex.
losMap was introduces in fe21c5e023.

This was SVN commit r24130.
2020-11-04 22:55:34 +00:00
ad965e167d Moves simple water from fixed pipeline to shader pipelines (ARB/GLSL).
Commented By: Stan
Reported By: Freagarach
Tested By: Freagarach, Stan
Differential Revision: https://code.wildfiregames.com/D3059
This was SVN commit r24129.
2020-11-04 22:25:08 +00:00
acc254533b Refactors water shader to move refraction in a separate function.
Commented By: Angen, asterix, linkmauve, Stan, wraitii
Reviewed By: Angen
Tested By: Angen, asterix, linkmauve, Stan
Differential Revision: https://code.wildfiregames.com/D2908
This was SVN commit r24110.
2020-10-25 21:00:52 +00:00
acfd466c32 Fixes crash with mod packing on a wrong path.
Reviewed By: Stan
Differential Revision: https://code.wildfiregames.com/D3026
This was SVN commit r24087.
2020-10-04 10:17:34 +00:00
1273307b58 Don't detect audio card when audio is disabled, Fix compilation with --without-audio, fix a few warnings.
Reviewed by: @bb
Comments by: @vladislavbelov, @wraitii
Differential Revision: https://code.wildfiregames.com/D2809
This was SVN commit r24079.
2020-10-02 07:35:59 +00:00
92cbf5ead0 Reduces memory usage for fancy water by merging two textures.
Two textures were added in 9ce51f4357.

Reviewed By: wraitii
Tested By: Angen, Freagarach
Differential Revision: https://code.wildfiregames.com/D2983
This was SVN commit r24046.
2020-09-16 18:03:51 +00:00
26ae55cad0 Adds contrast-adaptiv-sharpening filter, also helps to partly remove FXAA texture blurring.
Patch By: OptimusShepard
Tested By: Stan
Differential Revision: https://code.wildfiregames.com/D2642
This was SVN commit r23947.
2020-08-07 22:16:55 +00:00
395a10beb0 Fix compilation error on arch introduced by 5473393e30
CLogger.h uses std::deque but doesn't include the required header file.
This fails since 5473393e30 on Arch Linux

Reported by: navigo_ps91
Reviewed By: irishninja
Differential Revision: https://code.wildfiregames.com/D2928
This was SVN commit r23933.
2020-08-05 09:25:24 +00:00
01118c1196 Fix issues relating to SDL and wxWidgets interaction in Atlas.
This fixes the transfer of key inputs from WxWidgets to SDL, making it
possible to type in the in-game GUI from Atlas.

Also fixes whitespace issues in some Atlas files.

The following improvements are OSX specific:
- fixes an SDL assertion related to unused subsystems in Atlas.
- Remove the 'osxguiapplication' override. This fixes the editor
starting up in the background and not accepting input when launched from
in-game.
- To prevent an issue with sdl/wxwidgets conflict when running from
inside the game, actually boot a new instance (see #2427)


Reported by: wik (Many thanks for your investigations)
Tested by: trompetin17, Stan
Fixes #2427
Fixes #2846

Differential Revision: https://code.wildfiregames.com/D2788
This was SVN commit r23926.
2020-08-03 12:23:16 +00:00
21cdcf44bc Fix segfault when sending a very large net chat message.
This crash occured on the receiver machine, making it effectively a
remote crash attack.

Reported by: Riddler66
Based on a patch by: elexis
Fixes #5726

Differential Revision: https://code.wildfiregames.com/D2629
This was SVN commit r23918.
2020-08-01 15:25:13 +00:00
eb0d89e220 Delete unused function left behind in e9361705ae
e9361705ae cleaned up our config setup, but left behind isOverriden,
triggering a compilation warning.

Reported by: Imarok
This was SVN commit r23885.
2020-07-25 07:05:36 +00:00
Angen
6f1d17c954 Stop failing if mod is broken and display invalid mods in downloader [Mod Io]
If one mod is not signed or broken in any other way, mod.io downloader
fails and does not display any mod.
The problem with unsigned mod is that its metadata are empty.

That means one cannot break mod io downloader with mods having invalid
data.

mark mod as invalid and display in list as disabled and display reason
instead description to not spam ugly error messages on screen as this is
not error by the game but of the moder
report failed signatures back to list of mods
fail if property is not set using strict mode when getting from js
check in js for undefined values

Allow to filter only valid mods.

Differential Revision: https://code.wildfiregames.com/D2114
Reviewed by: @Itms
Fixes: #5459

This was SVN commit r23821.
2020-07-12 09:25:03 +00:00
9f4e398585 Fix rooting mistake in CGame::ReallyStartGame, detected by Bellaz89, fixes #5776.
Differential Revision: https://code.wildfiregames.com/D2869
Accepted By: Bellaz89
This was SVN commit r23815.
2020-07-11 14:24:09 +00:00
409c436ae2 Remove obsolete GetVideoMode platform-specifics, replaces by platform-agnostic SDL2`s APIs.
Before and after the commit we don't support multiple displays and HiDPI
properly.

Patch By: linkmauve
Tested By: Angen, elexis, Stan
Differential Revision: https://code.wildfiregames.com/D2476
This was SVN commit r23754.
2020-06-08 17:49:26 +00:00
b62308a301 Fix error in e9361705ae.
The HWDetect changes were not working properly.

Reported by: Nescio
Tested by: Nescio
Differential Revision: https://code.wildfiregames.com/D2799
This was SVN commit r23748.
2020-06-07 20:11:37 +00:00
e9361705ae Refactor HWDetect and rendering options setup.
Remove duplication when setting graphic options by reading the configDB
directly.
Properly protect the ModIO config keys.

Approved By: linkmauve
Refs #5538

Differential Revision: https://code.wildfiregames.com/D1931
This was SVN commit r23747.
2020-06-07 13:16:57 +00:00
945ac4fc3b Do not change the gamma of the display on startup.
Added in df6fceba62 to (most likely) have some control over brightness,
this conflicted with dimming utilities and would not play nice with
starting 0 A.D. in windowed mode.

If gamma handling were to be reintroduced later, it should only affect
the 0 A.D. window.

Reviewed By: vladislavbelov
Differential Revision: https://code.wildfiregames.com/D1976
This was SVN commit r23722.
2020-06-01 05:12:51 +00:00
ebd9786268 Add missing cpp files in last commit refs D2503
This was SVN commit r23704.
2020-05-28 18:18:00 +00:00
bb
5cfce692e7 Implement keyDown event
Change HotkeyPress event to be non-repeating (HotkeyDown to replace the
repeating case)
Fix shiftlag
Make toggle hotkeys only respond to the first SDL event.

Many iterations of review by: elexis
Test done by: Imarok
Comments By: vladislav, Stan
Reviewed By: wraitii
Fixes: #5055
Differential Revision: https://code.wildfiregames.com/D1398
This was SVN commit r23701.
2020-05-26 21:47:03 +00:00
76909984b2 Removes obsolete clipboard, replaces by platform-agnostic SDL2`s APIs. Refs D2476.
Patch By: linkmauve
Tested By: bb, elexis, Stan
This was SVN commit r23624.
2020-05-05 11:18:00 +00:00
32a105d6f8 Update cppformat from v0.11.0 to v1.1.0, fixes #5646, refs #3190.
Use the opportunity to rename the lib from cppformat to fmt, refs #4148.

Patch By: adrian
Rebased By: s0600204
Differential Revision: https://code.wildfiregames.com/D2613
This was SVN commit r23562.
2020-04-01 07:29:33 +00:00
c50a621cea Disable Quicksave during multiplayer, since the feature is not implemented and triggering it can crash the turnmanager.
Differential Revision: https://code.wildfiregames.com/D2584
Comments By: Stan
This was SVN commit r23429.
2020-01-22 14:05:17 +00:00
Angen
d33f1c7321 Remove not needed checks and code for VS2015 [VS2013 -> VS2015]
Some pragma warnings are not more needed for VS2015 compilation this
removes them.
Removing some specific code for older version than VS2015.
Forcing build to fail if compiling with VS older than VS2015.

Differential Revision: https://code.wildfiregames.com/D1396
Reviewed by: @Itms
This was SVN commit r23416.
2020-01-19 12:43:41 +00:00
7c72cb7bb9 Reports SDL builtin and runtime versions and video backend in hwdetect report.
Patch By: linkmauve
Differential Revision: https://code.wildfiregames.com/D2485
This was SVN commit r23412.
2020-01-18 16:45:50 +00:00
1750b0b34c Fixes GLES mode builds on Mesa and running on Intel Iris drivers.
Patch By: linkmauve
Tested By: Stan
Differential Revision: https://code.wildfiregames.com/D2448
This was SVN commit r23410.
2020-01-17 21:13:51 +00:00
eafd44cfc5 Remove counterproductive lowercasing of GUI ScriptEvent names, refs #127.
a8f48ff7e0 introduced XeroXMB lowercasing of element and attribute names
as a feature.
cf9d8b9797, 4d390f501c, dda6268466 added bugfixes and TODOs because of
that.
f76d0ffdc6, 44fe226dd2 removed the XeroXMB lowercase feature.
This patch removes the lowercasing GUI bugfixes that don't fix any bug
anymore while increasing code complexity and lowering performance
(string copies).

Do not send mouse coordinates objects for events that do not relate to
the mouse.

Store event names in static const members to:
(1) improve performance, ensuring that the CStr is not reconstructed
every call,
(2) obtain compile errors when misspelling event names,
(3) allow reuse of the strings in inherited and friend classes.

Differential Revision: https://code.wildfiregames.com/D2445
Comments by Matei, Philip on 2006-03-11-QuakeNet-#wfg-Meeting-0126.log
and 2006-06-24-QuakeNet-#wfg-Meeting-0139.log

This was SVN commit r23403.
2020-01-15 16:00:37 +00:00
bbcd9b34cc Removes obsolete sys_cursor. Refs D2557.
sys_cursor was introduced in 7e1bcd5159 and partially in 5299dcad86.
Usage of sys_cursor was completely removed in 9a2d0f803e. At the moment
we use SDL and GL cursors.

Patch By: linkmauve
Comments By: Stan
This was SVN commit r23364.
2020-01-10 23:45:40 +00:00
8abc7c051b Include Pyrogenesis.h and os_path.h where needed
These two headers were missing in various places, preventing build in
some cases.

Patch By: linkmauve
Tested By: Freagarach
Differential Revision: https://code.wildfiregames.com/D2481
This was SVN commit r23321.
2020-01-02 18:07:40 +00:00
dd891f6193 Fix User Reporter worker thread always using a full CPU-Thread
Summary:
This bug was introduced in 62dd922bc0.
Fixed by not using the predicate of the `wait` command.
It was wrong and even if it was right it wouldn't be really usefull.

Reviewed by: Angen
Fixes: #5620

Differential Revision: https://code.wildfiregames.com/D2373
This was SVN commit r23259.
2019-12-18 17:19:56 +00:00
aef0c3c13a Move Ogre3D GLSL Preprocessor to a third_party folder and restore its original name. Also restore the Wrapper name to reflect what it's wrapping and move it to renderer.
Reviewed by: @Angen
Comments by: @elexis
Differential Revision: https://code.wildfiregames.com/D2338
This was SVN commit r23215.
2019-12-07 11:48:03 +00:00
5d2c20beb0 Replace boost::unordered_map, boost::unordered_set with std::unordered_map, std::unordered_set to establish consistency.
Replace boost::hash_combine with a lib/hash.h hash_combine performing
the same statement.
Replace inconspicuous global boost hash_value specializations with
std::hash specializations.
No performance difference was observed in three simple MeshManager
measurements.

Remove unused TAG_MASK and h_tag in h_mgr.cpp following 0748c5a75e.
Replace typedef with using keyword and sort header includes.

Differential Revision: https://code.wildfiregames.com/D2441
Tested on: clang  9.0.0, gcc 9.2.0, Jenkins/vs2015, Jenkins/gcc6

This was SVN commit r23191.
2019-11-25 14:30:25 +00:00
6a97c59c67 Change CGUIManager::SendEventToAll to send to all GUI pages.
Notably enables processing of GuiInterface messages when dialogs are
opened.

Differential Revision: https://code.wildfiregames.com/D2408
Tested on: clang 9.0.0, Jenkins/vs2015

This was SVN commit r23138.
2019-11-06 00:30:18 +00:00
a01e68a4ea Don't leak all GUI objects on name ambiguity following 5cc814759f and remove ERROR_GROUP GUI.
Delete CGUI::UpdateObjects and don't recreate the entire object
hierarchy by recursing through the existing one each time when inserting
one GUI Object.
Change CGUI::AddObject to only insert the one relevant pointer into the
map hierarchy, return success value and delete the child upon failed
insertion in the caller instead of leaking it.
Defer GUIM_LOAD and UpdateCachedSize recursion until all XML files
linked in the page XML file were loaded.
Delete related ERROR_TYPE NameAmbiguity, ObjectNeedsName, and unrelated
JSOpenFailed and in consistency with the rest, do the LOGERROR in the
scope where the error occurs.
Delete ERROR_TYPE InvalidSetting from 90f6641c1d unused following
85a622b13a, 1a49ccb294, ERROR_TYPE OperationNeedsGUIObject from
90f6641c1d unused following d3e56f0f57, see also e1014aad3b, refs #128.

This was SVN commit r23067.
2019-10-11 16:20:50 +00:00
d7ea078583 Removes unused variables after 7f38bef8e1 and 75d9c6293b. Reported by elexis.
This was SVN commit r23046.
2019-10-04 22:06:52 +00:00
75d9c6293b Adds projection type to CCamera to control usages of projection dependent properties.
Commented By: elexis
Differential Revision: https://code.wildfiregames.com/D2351
This was SVN commit r23036.
2019-10-03 18:51:40 +00:00
a19b14aeb7 Cleanup Camera related code and uses constant references where possible.
Commented By: elexis
Differential Revision: https://code.wildfiregames.com/D2350
This was SVN commit r23033.
2019-10-03 12:58:47 +00:00
1679510bb8 Resolve Loader memory leak from 1f1642bfe3.
Use C++11 featured shared_ptr to avoid conditional deletion in multiple
locations.
Drops C compatibility(?) of Loader.h.

Differential Revision: https://code.wildfiregames.com/D2331
Tested on: clang 8.0.1., Jenkins
Comments on IRC #wfg 2005-05-07
Refs 77d3c5d0b5, 5e3b0f06ec, f19d8dafee.

This was SVN commit r23019.
2019-09-30 08:49:00 +00:00
fc08fe60ab Support testing rejoins on turn 0, refs #3460, #4242, #5185, #5162, 2bf1dbfd13
Differential Revision: https://code.wildfiregames.com/D1522
This was SVN commit r22998.
2019-09-26 12:09:19 +00:00
00b58fc2ed Fix previous, don't save replay metadata if a multiplayer gamesetup page was opened and closed, refs 35408e7e7e / D2197, refs #5565.
This was SVN commit r22992.
2019-09-25 16:41:14 +00:00
35408e7e7e Save replay metadata for non-visual games too, refs #4577, #5548, fixes #5565.
Remove gui/common/ hack by going through the GUIInterface and fragile
EndGame() hardcoding by saving if and only if a ReplayLogger exists
following 7470e88624, refs #4020.
Refs D2211, D2213.

Differential Revision: https://code.wildfiregames.com/D2197
Based on patch by: irishninja
Tested on: clang 8.0.1, Jenkins

This was SVN commit r22991.
2019-09-25 10:06:12 +00:00
b9d413852b Cleanup GUI includes, whitespace, map iterators, nullptr.
Remove TODO comment about m_Children deletion from e21ebb37f5, refs
e05f939fab / D2311.

Differential Revision: https://code.wildfiregames.com/D2321
Tested on: clang 8.0.1, Jenkins

This was SVN commit r22976.
2019-09-22 23:28:25 +00:00
734d21464b Fix missing JSAutoRequest before JS_ReportError in various commits.
Differential Revision: https://code.wildfiregames.com/D2256
Tested on: clang 8.0.1, Jenkins

This was SVN commit r22949.
2019-09-20 19:18:07 +00:00
1bc6d778bb Delete GUI.h umbrella include following 8d0cb1b954.
Differential Revision: https://code.wildfiregames.com/D2304
Tested on: clang 8.0.1., VS2015, Jenkins
Comments By: Vladislav, Angen, Stan
Tested by: Angen
This was SVN commit r22941.
2019-09-20 13:11:18 +00:00
a936cc618a Move CGUIDummyObject class used for empty GUI objects to a separate file, and put the according CGUI page base object on the stack.
Differential Revision: https://code.wildfiregames.com/D2206
Tested on: clang 8.0.1., Jenkins

This was SVN commit r22931.
2019-09-18 20:51:45 +00:00
f1de8eb4ba Removes usages of duplication of Clamp function in gui, ps and renderer. Refs D1763.
This was SVN commit r22926.
2019-09-18 14:44:31 +00:00
003d588d13 Happy savegame hack removal following e0ea53a8ee, refs #2030.
Simply pass the JS value to the Save functions instead of letting those
obtain the data later from the topmost GUI page.
The JS hack incidence appears to be unused since 4b1297b328.

Differential Revision: https://code.wildfiregames.com/D2302
Tested on: clang 8.0.1, Jenkins

This was SVN commit r22922.
2019-09-18 00:17:56 +00:00
93fed19c6a Reliably report and reject invalid XML files following a18fbd12ec, refs #245, fixes #5222.
Don't write XMB files for XML files that failed the validation,
otherwise the XML validation error will not be reported on consecutive
program starts anymore (as the XMB is loaded, skipping validation).
This had resulted in invalid XML  going unnoticed and committed in
credentials.xml in 80dbd1f2a3.

Differential Revision: https://code.wildfiregames.com/D1574
Reported by: gameboy
Comments By: bb
Tested on: clang 8.0.1, Jenkins

This was SVN commit r22921.
2019-09-17 23:00:36 +00:00
61e3f1ec0d Fix hotkey events synching with hotkey state.
This is a semi-revert of 78bc56f33e and a correct fix for #3194.

The core issue is that the GUI handler must come behore the hotkey
handler, otherwise typing in boxes can set off hotkeys, and the hotkey
handler is repsonsible for updating the hotkey state.
Thus the GUI handler never has an up-to-date hotkey state, since that's
done later. 78bc56f33e fixed that by calling HotkeyInputHandler
manually, but that was still broken in some (unused) cases and was hacky
(indeed, it even looked hacky as noted by elexis).

The simplest fix is to split the 'hotkey creator' handler from the
'hotkey state change' handler, and run the 'hotkey state change handler'
before any other handler. Thus the gui handler remains in front of the
'hotkey creator' handler, but it has a correct hotkey state at any time.

Differential Revision: https://code.wildfiregames.com/D1839
This was SVN commit r22909.
2019-09-15 12:16:28 +00:00
c6e5c83b6d Workaround differences between libc and libstd string stream parsing of float/doubles.
libc and libstd differ on how they parse strings. This has a remote
chance of breaking mods and 0 A.D. code, and it broke tests on MacOS.

Add a workaround to ensure they are consistent.

Comments by: vladislavbelov
Fixes #2780

Differential Revision: https://code.wildfiregames.com/D1988
This was SVN commit r22908.
2019-09-15 12:02:26 +00:00
89e511def9 Allow JS GUI pages to find out if the game is running.
Differential Revision: https://code.wildfiregames.com/D2289
Tested on: clang 8.0.1.

This was SVN commit r22900.
2019-09-14 15:33:46 +00:00
a84e2e57df Use ScriptInterface::CreateObject for ToJSVal<CColor>, and for ToJSVal<Grid<u8> >, ToJSVal<Grid<u16> > used by the AIManager obtaining the pathfinder grid.
Make that function static, so that it can be used for these functions
without slowly having to obtain the ScriptInterface instance using
GetScriptInterfaceAndCBData just to get the JSContext again.
Remove few redundant conversions for CreateObject arguments.

Differential Revision: https://code.wildfiregames.com/D2128
Tested on: gcc 9.1.0, clang 8.0.1, Jenkins
Tedious performance testing in: D2128, D2127

This was SVN commit r22894.
2019-09-13 00:56:51 +00:00
508da732af Implement NetClient PushGuiMessage using parameter pack and ScriptInterface::CreateObject from D2080 / b4626359f5 to replace remaining Eval function calls.
Specialize ToJSVal<char[n]> to allow passing string literals as
arguments.
Freeze NetClient GUI messages.
Supersede related c-style casts with static casts.
Remove few unneeded conversions.

Differential Revision: https://code.wildfiregames.com/D2267
Tested: clang 8.0.1, Jenkins

This was SVN commit r22867.
2019-09-07 16:51:44 +00:00
de050ef7e2 Remove some unused Profiler.h and CLogger.h includes.
NativeWrapperDefns.h from 4e87fef3da, found in audit of 7c21a0cf8e.

Differential Revision: https://code.wildfiregames.com/D2268
Tested on: clang 8.0.1, Jenkins

This was SVN commit r22863.
2019-09-07 13:35:45 +00:00
d5c1fd09a4 Add ToJSVal<CRect> to make the conversion reusable, remove unused PSERROR_Scripting_ConversionFailed and dead catch.
Avoids the CRect copy or stops relying on optimization to avoid the
copy.
Split from D2142.

Differential Revision: https://code.wildfiregames.com/D2259
Tested on: gcc 9.1.0, Jenkins

This was SVN commit r22847.
2019-09-04 16:15:37 +00:00
c25ab670e6 Don't crash if a JS GUI author calls Engine.PopGuiPage too often.
Differential Revision: https://code.wildfiregames.com/D2255
Tested On: clang 8.0.1, Jenkins
Comments By: Stan
This was SVN commit r22846.
2019-09-04 15:45:48 +00:00
719f2d7967 Remove default CGame constructor values to make the code less error-prone, use CRenderer::IsInitialised() to test if the CGame should be rendered to remove indirection/proxies, making the code easier to read.
1c0536bf08 introduced a disableGraphics bool with a default value and
relied on the default being reasonable except for the few needed cases.
be93b31411 introduced the replayLog argument with a default value and
relied on the default being reasonable except for the few needed cases.
5747619c39 fixed a bug in that commit because the default value hadn't
actually been considered to be correct for all CGame constructor calls
and was wrong for two.

By requiring callers to specify the value, authors are forced to
establish thought which value is the correct one, as opposed to hoping
that a default value will be good by default.
As you can see in the diff, it also makes it easier to compare what
values changed if they are always defined in the caller.

Use CRenderer::IsInitialised() to determine if this is a non-visual
CGame,
for the purpose of removing less transparent proxy functions that are
unneeded as long as there are about 30 other calls testing for
CRenderer::IsInitialised() to determine if the Game should be rendered.

Supersedes:
* CGame constructor argument bool disableGraphics from 1c0536bf08.
* CGame::IsGraphicsDisabled() proxy from a533fff883 to the proxy from
1c0536bf08 and two local nonVisual = args.Has("autostart-nonvisual")
variables in GameSetup.cpp from a533fff883.

Call the Renderer destructor instead of calling delete on the
non-pointer (SAFE_DELETE would not be supported for instance).

Started as a preparation for D2197, but actually independent.

Differential Revision: https://code.wildfiregames.com/D2211
This was SVN commit r22785.
2019-08-25 11:02:55 +00:00
4919a6185e Remove unused GUIUtil functions, unused GUI includes and some tails in GUIUtil.
HasSetting from 3dfa23cd25 is actually redundant with
IGUIObject::SettingExists.
GetSettingPointer from 8f4f8e240f is superseded by GetSetting reference
following 3dfa23cd25 and 040624acff.
Deregister copying SetSetting variants for CStr and CStrW following copy
removal in 040624acff.
The default template <typename T=int> from c2a71e41bf can be removed
following FallBackSprite/FallBackColor removal in 9985fcf5bd and
RecurseObject unification in d4d5187c9d.
Delete all unused GUI includes, refs D1478.
Remove GUIUtil friend class following something.

Differential Revision: https://code.wildfiregames.com/D2225
Tested on: gcc 9.1.0, Jenkins

This was SVN commit r22779.
2019-08-25 08:57:36 +00:00
62dd922bc0 pthread -> std::thread (5/7) - Replace sdl semaphore with condition variable
This removes a dependency on the SDL_Thread header.

Differential Revision: https://code.wildfiregames.com/D1921
This was SVN commit r22772.
2019-08-24 11:26:58 +00:00
24f97d9fd5 Fix unreported glooxwrapper leaks following 61261d14fc, refs #2305.
Fixes an occurring leak indicated by the reported clang unused variable
compiler warning, refs #5294, #5550,
by adding the missing glooxwrapper::Jingle::Session::Session destructor
.

Fix two leaks that would have occurred if the according code had been
used:
Delete unused glooxwrapper::Jingle::ICEUDP::ICEUDP instead of adding the
missing destructor.
Delete unused glooxwrapper::Jingle::Content::Content instead of adding
the missing destructor.

Explain why glooxwrapper::Client::registerStanzaExtension doesn't leak
the new StanzaExtensionWrapper.
Explain why glooxwrapper::Jingle::Session::sessionInitiate doesn't leak
the new gloox::Jingle::Content, nor the new gloox::Jingle::ICEUDP.
Explain why glooxwrapper::SessionManager::registerPlugins doesn't leak
the new gloox::Jingle::Content and new gloox::Jingle::ICEUDP.
Explain why glooxwrapper::SessionManager::createSession doesn't leak the
gloox::Jingle::Session.

I will not leak memory in the glooxwrapper.
I will not leak memory in the glooxwrapper.
I will not leak memory in the glooxwrapper.

Use references in the StunClient and glooxwrapper to anticipate any
confusion as to whose obligation it is to delete variables when they are
passed around across several files.
Use static_cast and reinterpret_cast instead of C-style casts in the
StunClient.

Differential Revision: https://code.wildfiregames.com/D2094
Refs D2093 for the reported leaks.
Reviewed By: Josh
Comments By: fcxSanya, Vladislav for D2094, and echotangoecho, leper in
61261d14fc

This was SVN commit r22678.
2019-08-17 00:12:19 +00:00
107d3d461f pthread -> std::thread (3/7) - Replace pthread in other engine files
MapGenerator, TextureConverter, and some other files used pthread.

Differential Revision: https://code.wildfiregames.com/D1917
This was SVN commit r22649.
2019-08-12 08:16:28 +00:00
64b477625d Upgrade SpiderMonkey to version 45.0.2, refs #4893.
- Various build changes, in particular NSPR is not needed on Unix
anymore
- Add js/Initialization.h to source/scriptinterface/ScriptEngine.h
- Use nullptr instead of JS::NullPtr(), see
https://bugzilla.mozilla.org/show_bug.cgi?id=1164602
- Remove `JS::RuntimeOptionsRef.varObjFix`, see
https://bugzilla.mozilla.org/show_bug.cgi?id=1171177
- Remove uses of `AutoIdArray`, see
https://bugzilla.mozilla.org/show_bug.cgi?id=1191529
- `JS_InternUCStringN` has been renamed, see
https://bugzilla.mozilla.org/show_bug.cgi?id=1178581
- `JS::Evaluate` now takes scope chains explicitly, see
https://bugzilla.mozilla.org/show_bug.cgi?id=1097987
- Array functions (such as `JS_IsArrayObject`) are fallible and output
to params, see https://bugzilla.mozilla.org/show_bug.cgi?id=f3d35d8
- Remove `JSCLASS_CACHED_PROTO_WIDTH` workaround in our code, see
https://bugzilla.mozilla.org/show_bug.cgi?id=1236373
- Remove compile'n go (`setCompileAndGo`) and replace it by
`setIsRunOnce` which will become the default in the future, see
https://bugzilla.mozilla.org/show_bug.cgi?id=679939
- Mark shared memory in direct access operations
(`JS_GetUint16ArrayData` and `JS_GetUint8ArrayData`), see
https://bugzilla.mozilla.org/show_bug.cgi?id=1176214
- Use new `JS::ObjectOpResult`, see
https://bugzilla.mozilla.org/show_bug.cgi?id=1113369

Thanks to wraitii, elexis, Krinkle and historic_bruno for contributions
and comments, and to gentz, madpilot, s0600204 and Stan for testing and
indirect contributions.

Differential Revision: https://code.wildfiregames.com/D1510
This was SVN commit r22627.
2019-08-07 22:37:43 +00:00
7876ca7acb Fix gcc 8 compiler warning in FileIo.cpp about truncating use of strncpy [-Wstringop-truncation].
Refs #5294
Differential Revision: https://code.wildfiregames.com/D2159
Tested on: gcc 9, Jenkins

This was SVN commit r22626.
2019-08-07 15:38:40 +00:00
82f765b4cc Add Profiler2 static const member definition, since the declaration itself is insufficient for const ref access, as revealed in debug builds but not release builds following f89f90d56e and 9965f43067.
Differential Revision: https://code.wildfiregames.com/D2158
This was SVN commit r22625.
2019-08-07 14:45:13 +00:00
f89f90d56e Fix Profiler2 gcc 8 compiler warning about possible out-of-bounds array access and replace auto with their type, refs #5294, 3cbe96d24c.
Tested with gcc 9, clang 8

This was SVN commit r22624.
2019-08-07 09:12:28 +00:00
df40b88c71 Fix ModIo.cpp gcc 7 compiler warning about extended alignment by using a pointer for hash_state as expected by sodium anyhow, following 833c9f108c, refs #5294.
Differential Revision: https://code.wildfiregames.com/D2102
Reviewed By: Itms
Comments By: historic_bruno
This was SVN commit r22619.
2019-08-06 13:06:15 +00:00
bb
7e1f959db0 redo 2d57478781, Create a ConfigDB_CreateAndWriteValueToFile function to absorb some duplication in the gui
Move two duplicated lines from 7e14a33411 in a function

fixes 2d57478781
Reviewed By: elexis
Comments By: Stan, vladislav
Differential Revision: https://code.wildfiregames.com/D1939
This was SVN commit r22615.
2019-08-05 14:12:55 +00:00
5c4d124d2a Refactor renderer options.
This moves the renderer options into their own class to:@
  - allow one to only include the rendering options, not the whole
renderer header, when one wants access to rendering options.
  - centralise rendering changes and their side-effects.
  - clean up code.

Tested by: historic_bruno, Freagarach
Commented by: historic_bruno
Differential Revision: https://code.wildfiregames.com/D1929
This was SVN commit r22610.
2019-08-04 08:28:30 +00:00
9ece3e7088 Pthread -> std::thread (2/7) - Remove pthread in Profilers
Use std::thread and thread_local instead of pthread specific calls.

Differential Revision: https://code.wildfiregames.com/D1916
This was SVN commit r22608.
2019-08-04 08:11:58 +00:00
da4e601d8f Move GetDefaultGuiMatrix to a separate file.
The function was located in the wrong file, because it is not logically
related to IGUIObject settings.
The separate file allows the various users to include it without
including the GUIRenderer.

This was SVN commit r22605.
2019-08-04 03:52:00 +00:00
ad4de3d3be Delete CInternalCGUIAccessorBase class from c2a71e41bf.
Delete GetSetting/SetSetting variants that operate on a GUI page other
than the one that the setting is defined in; introduced in c2a71e41bf,
obsolete since f0d9806b3f.

Delete CInternalCGUIAccessorBase::GetObjectPointer as these variants
were the only caller for that.
Delete CInternalCGUIAccessorBase::HandleMessage from a08cbd2f74 as it's
an unnecessary proxy.
Delete CInternalCGUIAccessorBase::QueryResetting from 953f72a91c by
making ResetStates public, equal to UpdateCachedSize from 90bbd48a14
(public required for VS2015 but not gcc 9).
Move ResetStates to implementation file.

Tested on: gcc 9, VS2015

This was SVN commit r22563.
2019-07-28 02:39:52 +00:00
b7d1ea671f Update Errors definition file following:
I18n Script SetupFailed removal in 818ea52c3b,
Renderer VBOFailed removal in 2f28b07356,
CVFSFile InvalidBufferAccess removal in b253cbbee6.

Differential Revision: https://code.wildfiregames.com/D2124
This was SVN commit r22559.
2019-07-26 19:27:10 +00:00
1e9cc3d43e Fixes missing Engine.DisplayErrorDialog in hwdetect.js (lost in 4b1297b328).
Fixes #5533.
Reviewed By: elexis
Differential Revision: https://code.wildfiregames.com/D2123
This was SVN commit r22549.
2019-07-25 05:21:25 +00:00
ae7e43ff19 Alt+tab fix for ca9109be75 - call sound IdleTask in Atlas and swap buffers only once in Atlas.
- ca9109be75 moved SwapBuffers inside Render - this makes Atlas call it
twice in a row which might behave oddly (did not seem to though) and
anyways was wasteful.
- ca9109be75 moved IdleTask from the sound manager outside of Render.
This means atlas never called IdleTask, and this broke sounds after a
few seconds.

Reviewed By: Angen
Differential Revision: https://code.wildfiregames.com/D2029
This was SVN commit r22544.
2019-07-24 16:40:34 +00:00
b4626359f5 Provide ScriptInterface CreateObject and CreateArray functions to replace Eval calls following 7c2e9027c2, 1c0536bf08 and later.
Differential Revision: https://code.wildfiregames.com/D2080
Previous version reviewed By: Krinkle
Comments By: historic_bruno, wraitii
This was SVN commit r22528.
2019-07-22 19:35:14 +00:00
13209c3183 Revert 09916ce6cb which broken jenkins build.
This was SVN commit r22519.
2019-07-20 13:10:53 +00:00
09916ce6cb Fix incorrect use of setlocale() in cppformat CStr tests following 61db02790c
Reported By: elexis
Differential Revision: https://code.wildfiregames.com/D2013
This was SVN commit r22518.
2019-07-20 12:57:03 +00:00
feb88a337a Pass arbitrary arguments to GUI events / SendEventToAll and remove loading screen progess workaround, refs D1716, 6d792365aa, bd3bd084c0, 4b1297b328, db5d4bb5f1.
Differential Revision: https://code.wildfiregames.com/D1754
Reviewed By: Itms
Comments By: leper
This was SVN commit r22515.
2019-07-19 21:15:04 +00:00
8a32b0b3d4 Fix some gcc 8 and gcc 9 compiler warnings that were thrown 4500 times.
Refs #5294
Differential Revision: https://code.wildfiregames.com/D2055
Reviewed By: Vladislav
This was SVN commit r22443.
2019-07-09 00:18:48 +00:00
01161e3451 Fix build without precompiled headers following the Atlas UTF8 fix in 800bf0da24 and ThreadUtil include removal in ba736916fc.
Differential Revision: https://code.wildfiregames.com/D2043
Reviewed By: Vladislav, wraitii
This was SVN commit r22437.
2019-07-07 21:52:52 +00:00
da2f644428 Adds a possibility to disable saving of replay in autostart mode.
Reviewed By: elexis
Differential Revision: https://code.wildfiregames.com/D2017
This was SVN commit r22432.
2019-07-03 21:36:40 +00:00
8babfe2330 Refactors camera projections - makes projection functions of camera more clear.
Reviewed By: elexis
Tested By: Stan
Differential Revision: https://code.wildfiregames.com/D2012
This was SVN commit r22404.
2019-06-26 22:54:05 +00:00
61db02790c Fix cppformat failures on MacOS tests.
cppformat tests failed on MacOS - the global locale was not set and
defaulted to something unexcpeted.
It is now fixed to US notation.

Patch By: Krinkle
Reviewed By: wraitii
Differential Revision: https://code.wildfiregames.com/D1978
This was SVN commit r22378.
2019-06-16 15:25:17 +00:00
ba736916fc Clean up ThreadUtil, use standard C++11 constructs instead of custom ones.
ThreadUtil shipped a scope lock and a mutex implementation, which can be
removed since we now have these in the standard library.
This lets us clean up this header which get included everywhere (through
profiler includes).

Tested By: Angen and Stan
Differential Revision: https://code.wildfiregames.com/D1915
This was SVN commit r22344.
2019-06-06 19:30:48 +00:00
ca9109be75 Fix a crash on some system when Alt-tabbing during game setup.
Move checks for rendering a frame in Render() to avoid missing calls to
this functions, which can crash on certain systems.

Move the sound manager's idle task out of Render().
Move the buffer swapping in Render() since we do not need to swap
buffers unless we are rendering.

Patch By: Angen
Reviewed By: wraitii
Differential Revision: https://code.wildfiregames.com/D1495
This was SVN commit r22314.
2019-05-28 13:18:32 +00:00
dc34d9c5d0 Fix possibly using uninitialized global in 80635665f7 and rename GetDirectoryName
Reviewed by: weberkai
Fixes: #4789
Differential Revision: https://code.wildfiregames.com/D1852
This was SVN commit r22284.
2019-05-14 10:13:02 +00:00
75d0c56070 Don't crash when calling the profiler from a 'non-main' thread
Motive behind the change: calls to Profile() currently crash unless they
are triggered from the main thread, but it's somewhat difficult to know
that from the code. It makes more sense to silently ignore those
particularly so we can easily have the same code be threaded or not.

This also removes a few profiling calls that don't make much sense.

Differential Revision: https://code.wildfiregames.com/D1853
This was SVN commit r22248.
2019-05-04 15:03:10 +00:00
3a031128f7 Refactor and cleanup of CGameView.
Commented By: asterix, elexis, Stan, wraitii
Differential Revision: https://code.wildfiregames.com/D1571
This was SVN commit r22214.
2019-04-22 22:12:08 +00:00
285db48813 Simple cleanup of Shapes, removes old style format.
Reviewed By: wraitii
Commented By: elexis
Differential Revision: https://code.wildfiregames.com/D1809
This was SVN commit r22213.
2019-04-22 21:53:11 +00:00
3a7335d723 Removes unused iterator in Xeromyces. Its usage was removed in a07add11c6.
Patch By: Angen
Differential Revision: https://code.wildfiregames.com/D1814
This was SVN commit r22170.
2019-04-07 18:23:04 +00:00
bb
702127b8df Add autostart conquest default description to readme.txt and add endless support for autostart in both readme.txt and GameSetup.cpp
Reported By: elexis
Fixes: 6d54ab4c1f, 22903b09a6

This was SVN commit r22112.
2019-03-16 14:20:28 +00:00
db5d4bb5f1 SpiderMonkey-related changes in preparation for the upgrade to SpiderMonkey 45, refs #4893.
- Remove JSVAL_ZERO and JSVAL_NULL
https://bugzilla.mozilla.org/show_bug.cgi?id=1177825
- Remove *_TO_JSVAL https://bugzilla.mozilla.org/show_bug.cgi?id=1177892
- Drop support for parent object in the deserializer
https://bugzilla.mozilla.org/show_bug.cgi?id=1136345,
https://bugzilla.mozilla.org/show_bug.cgi?id=805052
- Correctly use boolean values in JS::RuntimeOptionsRef
- Use JS_FN instead of JS_FS: in future versions, JS_FS is not public
because it isn't supposed to be used in JSAPI code
- Allow to select flags for global objects, and correctly mark progress
bars in the loading screen as not readonly+permanent
- Remove empty JSI_props in IGUIObject

Reviewed By: wraitii, elexis
Differential Revision: https://code.wildfiregames.com/D1716
This was SVN commit r22052.
2019-01-13 16:37:41 +00:00
651cf8b364 Split CColor from Shapes.
Reviewed By: wraitii
Tested By: Stan
Differential Revision: https://code.wildfiregames.com/D1515
This was SVN commit r22051.
2019-01-13 15:38:41 +00:00
43a291a071 Simple refactoring of Singleton. Make it non-copyable.
Reviewed By: wraitii
Tested By: Stan
Differential Revision: https://code.wildfiregames.com/D1564
This was SVN commit r22050.
2019-01-13 15:11:40 +00:00
43758bcb92 Fix warnings in vs2015 when building tests.
Reviewed by: @Angen, @Itms
Differential Revision: https://code.wildfiregames.com/D1678
This was SVN commit r22048.
2019-01-12 16:23:47 +00:00
74a26820f2 Add a confirmation message when packaging ends.
Reviewed by: elexis
Differential Revision: https://code.wildfiregames.com/D1585
This was SVN commit r22042.
2019-01-07 23:57:18 +00:00
14a7147540 Removes active values from UserReport, they are not hardware statistics.
Reviewed By: elexis
Differential Revision: https://code.wildfiregames.com/D1621
This was SVN commit r22038.
2019-01-06 21:18:55 +00:00
2d56e62e11 Refactor build information getters and remove the useless code.
Reviewed By: elexis, Stan
Tested By: Stan
Differential Revision: https://code.wildfiregames.com/D1348
This was SVN commit r22035.
2019-01-06 14:32:54 +00:00
962815c898 Fix build without PCH for some targets.
Patch By: Angen
Reviewed By: vladislavbelov
Tested By: Stan, vladislavbelov
Differential Revision: https://code.wildfiregames.com/D1361
This was SVN commit r21964.
2018-12-28 14:58:35 +00:00
6fe427664b Bump version to alpha 24.
Last alpha 23 commit was 0044c5c2e8.

Differential Revision: https://code.wildfiregames.com/D1705
Reviewed By: Itms
Comments By: Stan, smiley, bb
This was SVN commit r21951.
2018-12-26 11:28:37 +00:00
d7ff9722c6 Don't delay the pyrogenesis shutdown for 5 minutes but at most 10 seconds if the server is not responding, refs #968;
in particular Philips server not responding to SSL which became a
requirement by the client following 209bab0255 or following GDPR 32.1.a,
refs #5257 while the new backend is not ready yet.

Mark file emptied in 209bab0255 as deleted.
Add scrolling to the UserReporter window, so that the timeout error
strings that became visible following the bugfixes in b496168d0a and
c898c19735 and don't overlap with the buttons.

This was SVN commit r21900.
2018-10-09 16:27:42 +00:00
209bab0255 New UserReporter Terms and Conditions, hopefully GDPR compliant, refs #5257.
Require SSL for the UserReporter clientside.

Differential Revision: https://code.wildfiregames.com/D1598
Includes contributions by bb and Itms

This was SVN commit r21898.
2018-10-05 22:19:28 +00:00
b496168d0a Fix UserReporter passing uninitialized data through the JS Interface and displaying it in the UI following 0da7e822ff if the curl connection failed.
Display a generic error message using curl_easy_strerror if the detailed
error description is unavailable.

Differential Revision: https://code.wildfiregames.com/D1625
This was SVN commit r21892.
2018-09-23 00:20:17 +00:00
d19e32b2ea Fix mod.io curl error handling, following 833c9f108c / D1029 / cdc324f7f5.
Displays if the server is down instead of a misleading unrelated later
error message.

Differential Revision: https://code.wildfiregames.com/D1608
This was SVN commit r21891.
2018-09-23 00:06:25 +00:00
27c107a448 Inform users that they are subject to the mod.io Terms and Conditions and Privacy Policy and provide links following 833c9f108c / D1029. Refs GDPR #5257.
Add link to feedback.wildfiregames.com, which demonstrates users how
their data is going to be used.

Add link buttons to the Terms dialog (refs #4583), so that users are
informed of the terms prior to becoming subject to them.
Don't link the DMCA / copyright terms of mod.io now since I found no UI
with support for 3 buttons that doesn't appear unsatisfyingly ugly.
Adds 3 button captions and 1 tooltip string.

Differential Revision: https://code.wildfiregames.com/D1627
A Comment and a relatable patch in D1601 by smiley / (-_-).

This was SVN commit r21890.
2018-09-22 16:27:49 +00:00
dd008af2f8 Write UserReport data to local logfiles, so that users can review the personal data impact without exposing the data to JS/mods, refs #5257, b3438cabd2.
Write the logfiles even if the UserReporter is disabled, so that the
assessment can be done prior to use.

This was SVN commit r21868.
2018-08-22 22:17:42 +00:00
b3438cabd2 Hide userreporter ID from mods and logfiles, since it shall be used as an authentication token for GDPR personal data requests, refs #5257, f51f78c999 / D1563.
Comments by: Vladislav in irc on 2018-08-13
This was SVN commit r21867.
2018-08-22 16:02:05 +00:00
9e712fa0c5 Move UserReporter C++/JS functions from JSInterface_Debug.cpp to JSInterface_UserReport.cpp, refs #4772.
This way it stands out more as a separate feature that can be more
easily exchanged, extended, maintained or conditionally removed from the
build and leaves more transparent includes, refs #5257.

Add missing string includes following 7c2e9027c2 and d6cb9c845b.
Remove unused Profile include following 38d6f81d71 and d6cb9c845b.
Remove unused CLogger include, add missing debug include following
d6cb9c845b.
Remove unused CConsole include following 9f0484e5ce / D1073.
Remove unused ProfilerViewer include following 2af94c5898.

This was SVN commit r21866.
2018-08-22 12:48:27 +00:00
ecce63628c Unify duplicate u8* to hex string functions in a new Hexify function variant, similar to bb1f86f515, used by Tests, CacheLoader, Terms and Conditions, Lobby and mod.io.
Removes the call to the sprintf_s function from test_MD5.h in 17718981cf
and JSInterface_Main.cpp in 468d963e78.
As reported by Vladislav that function might not null-terminate strings
on untested/newer platforms, but the caller requires it here.
The sprintf_s calls in other places have the same problem.

Differential Revision: https://code.wildfiregames.com/D1591
Accepted By: Vladislav
This was SVN commit r21863.
2018-08-08 12:59:05 +00:00
f7783fb4bb Fix biome-specific mappreviews in 7f602037ba for zipped mods, refs #4962.
Add TextureExists to avoid needless redundant hardcoding of the
filenames.
Remove mapBiome.Preview from gamedescription.js, obsolete following
8cde469501.

Differential Revision: https://code.wildfiregames.com/D1583
Accepted By: Vladislav
This was SVN commit r21859.
2018-08-05 21:50:00 +00:00
2af94c5898 Remove disabled remains of the performance data (= profiler data + text input) upload feature from the UserReporter from 0da7e822ff.
User-submitted text upload was removed in 2779512c6e in preference of
the bugtracker.
Remove leftover mainmenu.js function that this commit should have
removed.

Profiler data upload was disabled in b9e46f386b because the data amount
was too large and because the two timing snapshots are inconclusive
without further data.
The hereby removed exposed JS functions could have been exploited by JS
mods to upload 0ad userdata to arbitrary places.

The performance data upload feature can be redesigned, implemented
without JS exposure, with a more transparent privacy policy (refs
#5257).

Differential Revision: https://code.wildfiregames.com/D1597
Performance upload feature removal accepted by: Vladislav
This was SVN commit r21858.
2018-08-05 15:18:00 +00:00
81d1e7a111 Fix conversion in previous 468d963e78 / D1575.
This was SVN commit r21851.
2018-06-21 16:52:52 +00:00
468d963e78 Persist the lobby Terms Of Use and Terms Of Service checkbox if the logged in user and the accepted versions of the pages didn't change since last login, refs #5218.
This way the user is only forced to read the Terms again that changed or
if the user logged in from a different machine.
Use md5sum since it is sufficiently resistant against collisions and
doesn't freeze the window for 2 seconds like EncryptPassword / SHA256
does, refs #4399.
Use 0 instead of empty string in default.cfg, refs #3990.

Differential Revision: https://code.wildfiregames.com/D1575
Partial review by: Vladislav
This was SVN commit r21850.
2018-06-21 16:38:08 +00:00
f51f78c999 Don't print lobby buddies to mainlog.html, refs D209 / dcf12abe8c.
Differential Revision: https://code.wildfiregames.com/D1563
Comments By: Vladislav
This was SVN commit r21844.
2018-06-06 22:37:20 +00:00
8ae179aaae Support parsing config values as u32 in preparation of D1513, refs #5163.
Differential Revision: https://code.wildfiregames.com/D1566
Reviewed By: Vladislav
This was SVN commit r21840.
2018-06-06 17:55:08 +00:00
333766ef1b Test all full hashes in non-visual replaymode by default and keep skipping quick-hash by default.
The previous code only tested quick hashes every 100 turns and could not
be used to confirm replay hashes matching.
The option can become used for visual replays too.

Differential Revision: https://code.wildfiregames.com/D1538
Refs #5162
Reviewed By: temple
This was SVN commit r21829.
2018-05-29 02:14:38 +00:00
44ec2e324e Alpha 23 "lobby lag" release fix.
Caches the loaded mod versions, so that GetEngineInfo doesn't read the
zip and json files everytime and returns about 1000 times faster.
Adds two missing includes.

The lobby froze multiple times every few seconds on updateGameList().
The gamesetup page was slowed down with every stanza sent and the
load savegame selection page was slowed down per savegame selection,
proportional to the number of installed zipped mods.

Introduced by: d5807cd59f and eca956a513
Differential Revision: https://code.wildfiregames.com/D1518
Reviewed By: wraitii
Comments By: Imarok (in D1512, P121), leper (in the lobby)
This was SVN commit r21823.
2018-05-24 18:08:56 +00:00
a5d1e0068b Fix OSX not starting matches following 8fbc095a88.
That commit illegaly polled SDL events from a different thread which for
an unknown reason did not error on Windows and GNU/linux.

Refs #4822 / D1304, similarly 8fec942e8a.

Differential Revision: https://code.wildfiregames.com/D1484
Previous iteration tested on OSX and some comments with regards to
letter case by Vladislav (refs 27da92e55f, 4c73614955).

This was SVN commit r21818.
2018-05-08 10:03:46 +00:00
27da92e55f Main.cpp cleanup.
Use an enum to indicate the type of engine shutdown instead of three
bools.
State in the comments that the program is restarted within the same
process.

In preparation of introducing an IsQuitRequested function (which shall
not be named is_quit_requested as stressed by Vladislav):
Rename kill_mainloop to QuitEngine, restart_mainloop to RestartEngine,
restart_mainloop_in_atlas to StartAtlas to not break consistency.
Don't rename RestartInAtlas in JS just now.
Group declarations at the top of main.cpp.

This was SVN commit r21817.
2018-05-08 09:45:54 +00:00
4c73614955 In preparation of renaming and grouping main.cpp shutdown variables:
Declare the g_GameRestarted hack from 12f0720f31 in main.cpp, because it
is main.cpp and Game.cpp who provide it's value.
Move the comment so that the connotation becomes clear when reading
main.cpp.

Remove the extern declaration introduced to the Renderer in fb035d08e3
that became obsolete with ed7c66eb82.

This was SVN commit r21816.
2018-05-08 09:24:16 +00:00
a89bcf837b Fix the window icon that cannot be loaded in release packages, refs 27d99765bb.
Discussed with Imarok and elexis.

This was SVN commit r21812.
2018-05-01 20:29:36 +00:00
13e1702777 Add missing ScriptInterface includes to
JSInterface_L10n.cpp from d6db5a466d,
JSInterface_Renderer.cpp and JSInterface_GUITypes.cpp from 4b1297b328,
JSInterface_VisualReplay.cpp from b830233498,
JSInterface_Game.cpp from 5f8be8e0c6,
JSInterface_Simulation.cpp from 921c5515a6,
JSInterface_Debug.cpp from d6cb9c845b,
JSInterface_Main.cpp from 486aec18d4, refs #4772,
JSInterface_Mod.cpp where it was incorrectly removed in af03c72f76.

Refs D1470.
Sort includes alphabetically, add recent Coding Convention macro
comments.

This was SVN commit r21789.
2018-04-27 16:48:44 +00:00
7ecd1d2c34 Clean some forward declarations.
Remove unused (wrong copy&paste) includes from 86fcf0de8c in
JSInterface_ModIo.*, initially hinted at by leper.
Remove a forward declaration in JSInterface_Console.h that should have
become an include with 4b1297b328, because CxPrivate must be declared
before its reference too.
Remove a forward declaration in JSInterface_Mod.h from 64bfa089af that
should have been the include added in af03c72f76 which in turn omitted
to remove this forward declaration.
Remove a forward declaration in Renderer.h that became unused with
1ddd24bb8c.

Differential Revision: https://code.wildfiregames.com/D1470
Reviewed By: Itms
This was SVN commit r21788.
2018-04-27 16:06:42 +00:00
86fcf0de8c Move ModIo JS interface functions to a separate namespace, refs 833c9f108c.
Differential Revision: https://code.wildfiregames.com/D1466
Reviewed By: Itms
This was SVN commit r21778.
2018-04-24 13:12:08 +00:00
56d93afceb Adjust code comments to match a breaking change in the mod.io API.
See
317358c5d0.

This was SVN commit r21764.
2018-04-23 09:09:45 +00:00
833c9f108c mod.io support.
mod.io is a new platform for sharing mods, that 0 A.D. can make use of
in order to download mods and install them.

Based on patch by leper, numerous changes from s0600204, vladislavbelov,
Imarok, elexis, temple and myself.
Differential Revision: https://code.wildfiregames.com/D1029
This was SVN commit r21759.
2018-04-22 18:14:45 +00:00
f2cda85310 Fix compilation of ModInstaller without pch
Reviewed by: elexis
Differential Revision: https://code.wildfiregames.com/D1456
This was SVN commit r21739.
2018-04-17 22:02:10 +00:00
404e1a9a4a Add a mod installer, fixes #4027.
pyrogenesis can now take a zip file (rename it to .pyromod for direct
file association following 943a61e4ea) and install it. It then starts
the mod selector.

Patch by vladislavbelov, with contributions from Imarok, elexis and
myself.
Differential Revision: https://code.wildfiregames.com/D1142
This was SVN commit r21726.
2018-04-15 01:46:28 +00:00
5e39b717aa Fix compilation with ICU 61
Initial patch by: elexis
Reviewed By: mapkoc, elexis
Fixes: #5114
Differential Revision: https://code.wildfiregames.com/D1436
This was SVN commit r21688.
2018-04-10 18:13:32 +00:00
d0a771c712 Use the loading screen for autostart singleplayer/bot matches and replays too (not only for autostarted multiplayer matches), refs #4822.
Add an autostart-player option, so that one can start as an observer too
and watch some knockout bots.

Precise the "Needed for autostart loading option" comment from
d5bd374586 which
become increasingly incomprehensible with each a68d5dae0d, 506350d6fa,
9f796068f8 and 6c5a8269f3.

This was SVN commit r21659.
2018-04-04 18:46:36 +00:00
d6ae354158 Fix mod check of non-visual replays and allow conversion of a vector of vectors of strings via ScriptConversions
Reviewed by: elexis
Fixes #5044
Differential Revision: https://code.wildfiregames.com/D1316
This was SVN commit r21603.
2018-03-22 15:26:27 +00:00
ee9e677084 Simulation replay profiling graph overhaul.
Support multiple graphs with different scales, units, rounding and
descriptions and use it for memory allocation and number of garbage
collections.
Have the X axis in number of turns (instead of that divided by 20).
Don't have the legend hide part of the graph.
Add references to that hardcoded 20.
Move graph JS to a separate JS file.
Use JSON instead of JS.
Add legal html structure.

Comments By: Vladislav in irc yesterday
This was SVN commit r21602.
2018-03-22 13:53:04 +00:00
bb
7127186b70 Add a ceasire autostart option, silences a javascript warning on autostart games
fixes #4606

This was SVN commit r21561.
2018-03-16 00:12:58 +00:00
bb
648cd44576 Set a relicCount from autostart, so the triggerscripts actually will spawn relics
Should fix the concern in 6d54ab4c1f
Reported By: mimo
Reviewed By: elexis
Differential Revision: https://code.wildfiregames.com/D1393
This was SVN commit r21560.
2018-03-15 23:46:29 +00:00
0fd8aa2a77 Secure lobby authentication - prevent joins as a different player
Reviewed by: Dunedan, elexis, Itms
Fixes #3549
Differential Revision: https://code.wildfiregames.com/D897
This was SVN commit r21520.
2018-03-12 00:23:40 +00:00
cc67d54aeb Fix compiler warnings on VS 2015, refs #3439, refs #5069.
Patch By: Stan
Reviewed By: Itms, vladislavbelov
Differential Revision: https://code.wildfiregames.com/D1262
This was SVN commit r21480.
2018-03-10 09:58:53 +00:00
0e710d716d Fixes the Alt + Tab crash in the fullscreen mode. Refs #4181.
Patch By: Angen
Comments By: echotangoecho, Imarok, Stan
Reviewed By: vladislavbelov
Trac Tickets: #4181
Differential Revision: https://code.wildfiregames.com/D1212
This was SVN commit r21476.
2018-03-09 22:23:03 +00:00
bb
6d54ab4c1f Implement combine victory conditions
Excluding the changes to scenario and skirmisch maps
Transform gameType string to victoryCondition array in load/replaymenu
Adapt the gamesetup to use checkboxes for every victory condition and an
array for storing them
Allow multiple queries in conquestCommon
Remove conquest from regicide, wonder and capture the relic
Move the endless gamedescription from settings to gamedescription
Fixing wrong tabulation from a8a29271ce

This commit will break all scenario and skirmisch maps, their "Gametype"
string needs to be transformed in a "VictoryCondition" array as is done
in the tutorial map (counting endless as an empty array). This counts
for mods too!
Old svn replays and savegame will throw warnings/errors as they are
incompatible after this commit. So svn users will need to delete all
those.

Comments on ai and autostart games By: mimo
Comments on Atlas By: Vladislav
Reviewed By: elexis
Differential Revision: https://code.wildfiregames.com/D1240
fixes: #4014

This was SVN commit r21474.
2018-03-09 21:51:18 +00:00