1
0
forked from 0ad/0ad
Commit Graph

21988 Commits

Author SHA1 Message Date
04549a081d Rework Mod into a class.
`Mod` currently modifies 4 global arrays, including some that are
'public'.

The logic flow is easier to understand if this becomes a real class with
const-correctness and public/private methods.

Differential Revision: https://code.wildfiregames.com/D3981
This was SVN commit r25469.
2021-05-20 08:32:11 +00:00
13c1b55f42 Fix UnitAI states in PetraAI.
Sometimes PetraAI relies on UnitAI state of an entity, but those were
not changed after modifying UnitAI.
Introduced in ea96e81098 and 3579097d95.

Differential revision: https://code.wildfiregames.com/D3976
This was SVN commit r25468.
2021-05-20 08:31:30 +00:00
453fe486de Triggers: prevent event names from conflicting with added methods
Refs c0157d613d / D3913 which removed the 'actions' suffix. The reason
for this suffix was probably avoiding this type of conflict, but this
new solution does a better job.

Fixes (at least) Survival of the Fittest, which used an
OnOnwershipChanged trigger.

Differential Revision: https://code.wildfiregames.com/D3979
This was SVN commit r25467.
2021-05-20 08:26:04 +00:00
575cd6c953 Removes unused uniforms and attributes from water shader.
This was SVN commit r25466.
2021-05-19 21:51:36 +00:00
88549e77e1 Require 'Resistance' in CanAttack
This was already effectively the case, so this change increases
coherence.

Accepted By: Freagarach
Differential Revision: https://code.wildfiregames.com/D3980
This was SVN commit r25465.
2021-05-19 12:36:22 +00:00
1619be9902 Differentiate movement speeds of ranged cavalry
Ranged cavalry goes from a base 0.89 walkspeed multiplier to:
- 0.8 for crossbowmen
- 0.85 for archers
- 0.9 for javelineers

The intention is to nerf archers slightly.

Patch By: Nescio
Accepted By: ValihrAnt, chrstgtr
Differential Revision: https://code.wildfiregames.com/D3758
This was SVN commit r25464.
2021-05-19 08:21:05 +00:00
5d1d2d27d7 Outposts have vision without garrisoning again.
Reverts D2986 / f9f7b4d49f.

Outposts have 90 base vision, increasing to 120 with the 'Carrier
pigeon' technology.
Outposts no longer decay in neutral territory, thus not needing
garrisoning. To compensate, they decay 10x faster in enemy territory.

Differential Revision: https://code.wildfiregames.com/D3898
This was SVN commit r25463.
2021-05-19 08:13:35 +00:00
9093e7bbe2 TreasureCollecter -> TreasureCollector.
Noticed by @Stan on ea96e81098.

Differential revision: https://code.wildfiregames.com/D3949
This was SVN commit r25461.
2021-05-18 16:51:44 +00:00
4195205904 Use a set for the selection internals.
Avoids recreating an object and frequent casting.
Allows some optimisations.
Simplifies some calls.

Differential revision: https://code.wildfiregames.com/D3934
Comment by: @Stan
This was SVN commit r25460.
2021-05-18 15:56:47 +00:00
7bfcd9f78b Additional entropy when hashing match passwords.
The purpose of our client-side hashing for lobby game passwords is to
prevent malicious hosts from getting valuable passwords from clients
(e.g. accidentally typing their lobby password instead of the game, or
even their email password, etc).
However, the hashing was deterministic (and rather simple), making it
possible to compute rainbow tables and recover user passwords anyways.

By adding more variation, including some that cannot so easily be
controlled by the host (the client name), this becomes impractical. The
password hashing function used is rather fast, but given the base low
probability of mistypes, this seems fine.

Differential Revision: https://code.wildfiregames.com/D3459
This was SVN commit r25459.
2021-05-18 14:47:36 +00:00
40f9372d29 Allow decaying only in enemy territory.
Reviewed By: Freagarach
Differential Revision: https://code.wildfiregames.com/D3969
This was SVN commit r25458.
2021-05-18 12:43:01 +00:00
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
3939e0f035 Fix autostart without default difficulty.
If a default difficulty is given by the map, use that. Else use the
default of the game.

Patch by: @JCWasmx86
Differential revision: https://code.wildfiregames.com/D3951
This was SVN commit r25455.
2021-05-17 15:59:05 +00:00
4f2e730d3c CodingConventions: Prefer using const on immutable values.
Using `const` for values that should not be changed is considered a good
practice (https://eslint.org/docs/rules/prefer-const).

Forum poll:
https://wildfiregames.com/forum/topic/38347-codingconventions-use-const-instead-of-let-for-immutable-values-in-functions/
Differential revision: https://code.wildfiregames.com/D3950
Comments by: @bb, @Stan, @wraitii
This was SVN commit r25454.
2021-05-17 15:50:16 +00:00
895e4e6aa6 StunClient code cleanup: use enet functions, endianness
Instead of using platform-specific sockets, use enet_socket* functions
(which ends up doing the same).
Clean up some confusing APIs, removing the distinction between finding
the public IP for the host/join.

Fix endianness support & use simpler code.

Refs D364 / 61261d14fc (and some subsequent fixing diffs).

Differential Revision: https://code.wildfiregames.com/D3970
This was SVN commit r25453.
2021-05-17 15:14:10 +00:00
f1467d10fd Make pathfinder debug rendering thread-safe.
Also cleans up the jump point cache const-correctness.

Differential Revision: https://code.wildfiregames.com/D3966
This was SVN commit r25452.
2021-05-17 09:38:24 +00:00
8b6d4233eb Disables by default Intel Mesa workaround to save video memory.
Tested By: Langbart
Differential Revision: https://code.wildfiregames.com/DD3967
This was SVN commit r25449.
2021-05-16 19:08:28 +00:00
2034136560 Implement a workaround for routers without NAT loopback.
This allows joining a lobby game hosted on the same network (behind the
same NAT gateway).
This is relatively primitive to keep things simple: if the server and
the client have the same public IP, it is assumed that they are on the
same network and the client instead requests the local IP.

Differential Revision: https://code.wildfiregames.com/D3944
This was SVN commit r25448.
2021-05-16 15:34:38 +00:00
a19dc1717f Don't include ComponentManager.h in ScriptComponent
ScriptComponent does not use ComponentManager, and its derived classes
(most ICMP*.cpp files) do not either. Therefore, we can skip a lot of
transitive inclusions and speed up recompiling by not including it
there.

Differential Revision: https://code.wildfiregames.com/D3962
This was SVN commit r25447.
2021-05-16 15:12:39 +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
3ebff376cc Adds view bounds test for an ortho camera and removes commented code after 44f8d2c6f5.
This was SVN commit r25441.
2021-05-15 13:47:48 +00:00
44f8d2c6f5 Fixes a bounding box projection to an incorrect camera causes the red water bug.
Tested By: Langbart
Differential Revision: https://code.wildfiregames.com/D3905
This was SVN commit r25440.
2021-05-15 13:33:36 +00:00
6b0802836a Fix duplicating promoting entities in XP trickling structures.
The entity received a value modif. message while promoting, triggering a
second promotion.

Differential revision: https://code.wildfiregames.com/D3918
Fixes: #6162
Comments by: @Angen, @Stan
This was SVN commit r25439.
2021-05-15 05:40:13 +00:00
66c75068bc Fix broken non pot texture by @m7600
Reported by: @nwtour
Fixes: #6177 and 318a5d7a2b

This was SVN commit r25437.
2021-05-14 18:06:00 +00:00
79e294ec06 Make fruit (berries and some fruit trees)'s obstructions smaller.
Patch by: @nani
Liked by: @ffffffff
Tested by: me and @Langbart
Differential Revision: https://code.wildfiregames.com/D3957
This was SVN commit r25436.
2021-05-14 15:13:55 +00:00
cf5c815879 Fix 4f972bc623
Shouldn't make last-minute changes without recompiling...

This was SVN commit r25435.
2021-05-14 11:12:07 +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
f368e1a69e Remove unused m_rng member from ScriptInterface.
The one in ScriptInterface_Impl is actually used.
Introduced in e9e05f4efc and from what I can tell never actually used.

Differential Revision: https://code.wildfiregames.com/D3960
This was SVN commit r25433.
2021-05-14 09:27:12 +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
cb263b9f26 Add a decal to the berry bushes to make them more visible and make the fruits bigger
Suggestions by: @m7600, @wraitii, @JCWasmx86
Reported by: @Yekaterina
Thread:
https://wildfiregames.com/forum/topic/39973-a25-feedbacks-from-testing/

This was SVN commit r25429.
2021-05-13 11:19:37 +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
d798a2ec0e Fix crash in Atlas.
Fixes 6fbf036ae4

Reported by: Stan
Differential Revision: https://code.wildfiregames.com/D3954
This was SVN commit r25425.
2021-05-12 19:25:09 +00:00
dd19cc3444 Major improvements to the lobby bots XpartaMuPP and EcheLOn.
Reviewers: elexis, Dunedan

Fixes: #5914

Differential Revision: https://code.wildfiregames.com/D2630
This was SVN commit r25424.
2021-05-12 15:40:50 +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
bb
412e870c55 Add defeat condition on civil centre loss
Somewhat obsoleting 171afdc7a6.

Reviewed By: Freagarach
Comments By: Stan, Nescio and wowgetoffyourcellphone
Differential Revision: D3530
This was SVN commit r25422.
2021-05-12 13:34:50 +00:00
441c122331 Fix collecting treasures near position.
Also refactors the order a bit to be more equal to other orders.
Removes the `autocontinue` because it was not useful (since that is more
about doing other tasks than the one ordered).
Follows ea96e81098 97addf2aa7.

Differential revision: https://code.wildfiregames.com/D3942
Tested by: @Langbart
Fixes: #6175

This was SVN commit r25421.
2021-05-11 07:41:40 +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
ad62707eef Ensure rated game and cheat won't be enabled at the same time.
Reported by: Freagarach
Differential Revision: https://code.wildfiregames.com/D3943
This was SVN commit r25418.
2021-05-10 07:49:30 +00:00
5fbdbaa3bc Fix 3af1fc64d2 - incorrect texture path on Windows.
sizeof(const char*) returns the pointer size and not the string size,
and 'texture:' happend to be 8 characters long, which is the same as a
64-bit pointer but not a 32-bit pointer.

Reported by: Stan
Differential Revision: https://code.wildfiregames.com/D3947
This was SVN commit r25415.
2021-05-09 17:29:50 +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
8f8996e338 Allow registering custom data for triggers
This allows easier handling of e.g. range triggers calling into the same
function.

The original trigger data is also forwarded for convenience.

Differential Revision: https://code.wildfiregames.com/D3904
This was SVN commit r25413.
2021-05-09 16:55:36 +00:00
f653541e2c Fix warnings in 3af1fc64d2
Differential Revision: https://code.wildfiregames.com/D3946
This was SVN commit r25412.
2021-05-09 16:24:13 +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
Angen
933b331c1b Hide icon for matches without password
This should help with better visual experience.
Icon introduced in c2155e31c0.

Differential revision: D3939
Fixes: #6153

This was SVN commit r25409.
2021-05-09 13:47:03 +00:00
3af1fc64d2 Allow GUI elements to define custom mouse event mask shapes.
This allows GUI elements to use a texture as their "mouse event mask",
making it possible to have arbitrarily-shaped GUI elements with regards
to mouse interactions.

Used for the minimap idle worker button as a proof-of-concept.

Differential Revision: https://code.wildfiregames.com/D3814
This was SVN commit r25408.
2021-05-09 13:08:07 +00:00
e94faf7827 Don't hardcode the "0ad" resource into lobby XMPP & hosting
XMPP JID has a concept of 'resources', which can be used to
differentiate multiple clients of the same account.

We currently hardcode this 'resource' to '0ad' in two places:
- The 0 A.D. client always uses '0ad'
- The network code expects a host resource to be '0ad' when connecting.

As noted in 0fd8aa2a77#31215, it is less effort to store the JI
D directly. This patch does that. It also makes 0 A.D. use a different
resource each time.
Note that resources ought not contain particular information, as the
XMPP server is free to
 clobber it. I keep '0ad-' here for debug purposes.

This allows:
- multiple 0 A.D. instances to log on the lobby at the same time (not
massively useful, but good for debugging sometimes)
- hosting a game with a custom resource, which will potentially make it
easier to have dedi
cated servers on one account.

Note that hosting multiple games on one account is currently not
supported and will have weird behaviour on the lobbybots side. They
should be upgraded independently of this.

Refs #3556

Differential Revision: https://code.wildfiregames.com/D3500
This was SVN commit r25407.
2021-05-09 12:51:32 +00:00
88810524b3 Make it explicit that technology specific names expect an object.
Simple strings would trigger errors.

Patch by: nwtour
Differential Revision: https://code.wildfiregames.com/D3921
This was SVN commit r25406.
2021-05-09 12:46:58 +00:00