1
0
forked from 0ad/0ad
Commit Graph

21940 Commits

Author SHA1 Message Date
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
abb124a36f Fix cpuid call with -fPIC on i386 architectures.
GCC < 5 used to reserve the ebx register for PIC (position-independent
code) metadata. This meant that we needed to save the state of ebx
before calling cpuid (fixed in #2675)
However, the original patch from 03eaf9b461 did not force a particular
register to store this value in. Following the GCC 5 upgrade, GCC
stopped reserving ebx, and that register silently got used instead. The
code became non-sensical, and our ASM __cpuidex started returning random
garbage in edx.

Since we now only support GCC7 and above, the PIC-specific branch is no
longer necessary and is removed.

Fixes #6028. The assertion was a result of random data in ebx.
Refs #2675 / reverts 6334ee3f8b and reverts 03eaf9b461.

Patch by: nwtour
Comments by: vladislavbelov
Differential Revision: https://code.wildfiregames.com/D3575
This was SVN commit r25405.
2021-05-09 12:41:45 +00:00
1e1af6e2df Separate campaign replays in replay page & fix for i18n
The 'map name' dropdown filter did not work in localised interfaces.

Patch by: nwtour
Differential Revision: https://code.wildfiregames.com/D3883
This was SVN commit r25404.
2021-05-09 08:39:38 +00:00
14324b8918 Fix auto-complete chat entries for Biome names in GameSetup
The line altered here was returning an Array of Objects. This array
would
eventually passed to code that expected it to be an Array of Strings.
This was
causing an error to thrown that could be replicated by going to the
Multiplayer
GameSetup, entering text (e.g. "Winter", "Dry", "lol") into the chat
field, and
pressing `Tab` to trigger the auto-complete.

This line now returns an Array containing the user-facing names of the
Biomes
available to the selected map (if it has them), which is what this
method was
returning prior to dc18d94030.


Related: dc18d94030, dc18d94030

This was SVN commit r25403.
2021-05-08 20:45:20 +00:00
0dbf417171 Fix 8b08f4ae7a - CGUIColor setting
Reported by: langbart
Fixes #6173

Differential Revision: https://code.wildfiregames.com/D3937
This was SVN commit r25401.
2021-05-07 11:34:20 +00:00
f008edea73 Fx low resource supply tricking AI.
Strength was floored, resulting in possibility for `0`, which was not
handled gracefully by the map.
Since the strength is multiplied by something that can be non-integer in
the map, the floor is not needed.

Differential revision: https://code.wildfiregames.com/D3884
Comments by: @Angen, @smiley
This was SVN commit r25400.
2021-05-07 09:07:20 +00:00
a18d97b047 Let team bonuses also apply to own player.
Requested in D3810 (and other places).
It was weird that e.g. the Romans gave their allies a training bonus but
lacked that themselves.

Differential revision: https://code.wildfiregames.com/D3899
Reviewed by: @ValihrAnt
Comment by: @darkcity
Idea approved by: @wraitii
This was SVN commit r25399.
2021-05-07 08:48:51 +00:00
2dfc8681d2 Fix returning resources by formation members.
Noticed by @mysticjim.
Introduced in 21645f5c1c.

Differential revision: https://code.wildfiregames.com/D3931
Differential revision: D3838
Fixes: #6170
Reviewed by: @wraitii
This was SVN commit r25397.
2021-05-07 07:05:57 +00:00
d2d0c6b347 Some small fixes for the AutoQueue feature.
51ab4315ff
Fix using the hotkey on entities that don't have a Production Queue.
Fix showing the icon on entities that don't produce entities.

Differential revision: https://code.wildfiregames.com/D3932
Fixes: #6172
Comment by: @wraitii
Tested by: @Langbart
This was SVN commit r25396.
2021-05-07 07:01:39 +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
e0800bc092 Allow toggling repairability.
Useful for trigger maps.

Differential Revision: https://code.wildfiregames.com/D3901
This was SVN commit r25393.
2021-05-06 14:25:33 +00:00
8b08f4ae7a Change GUI settings to explicitly be member variables.
Completes work starting in D2313 / a33fd55e81:
- Make C++ mistakes where values can be changed without messages being
sent easier to notice / harder to do.
- Make the IGUISetting interface more flexible, allowing custom settings
implementing their own logic. This is used to clean up hotkey code
introduced in 33af6da5e1.

Side effects:
- FromJSVal_Vector clears the vector being passed in. I have some vague
memory of not doing that in D24 / 2bae30c454 as an optimisation, but it
seems more like a footgun to me.
- Most usage of SetSettingFromString is replaced by direct method calls,
as we can generally cast to the proper GUI object type. Where we can't,
it is kept as a poor's man virtual dispatch.
- It moves a few member variables elsewhere, e.g. TextOwner now gets its
own member variable settings.

Differential Revision: https://code.wildfiregames.com/D3892
This was SVN commit r25392.
2021-05-06 08:22:37 +00:00
4db5467717 Fix mistake in 100159548c
I last-minuted a "X = X * Y" into a "X *= Y" but that turns out to map
to "X = Y * X" with our matrix overloads.

Reported by: langbart
This was SVN commit r25391.
2021-05-06 07:42:49 +00:00
c2167ffc7e Differentiate a bit the spart and athen rams.
- Use Athenian Shields
- Reduce Duplication
- Add default material

Patch by: @wowgetoffyourcellphone & @Stan`
This was SVN commit r25390.
2021-05-06 07:17:09 +00:00
100159548c Fix bounding boxes after f73fa05542
Skinning calculations must happen in bone-space.

Fixes f73fa05542

Reported by: langbart
Fixes #6168

Differential Revision: https://code.wildfiregames.com/D3927
This was SVN commit r25387.
2021-05-05 16:20:33 +00:00
781afea4b1 More broken implicit conversions.
Differential Revision: https://code.wildfiregames.com/D3928
This was SVN commit r25386.
2021-05-05 15:39:44 +00:00
8724b86915 Fix macOS boost compilation
Bintray has moved. Also upgrade to 1_76 while at it.

Differential Revision: https://code.wildfiregames.com/D3925
This was SVN commit r25383.
2021-05-05 08:25:01 +00:00
51ab4315ff Enable production entities to autoqueue.
This adds a new command button that enables training of units
automatically.
Use:
- Enable auto-queue.
- Train an entity.

This adds a new item to the queue whenever the previous item starts,
such that good micro is more resource-efficient.

Patch by: @azayrahmad
Differential revision: https://code.wildfiregames.com/D3865
Comments by: @Langbart, @nani, @Stan, @wraitii
This was SVN commit r25381.
2021-05-05 06:12:31 +00:00
fe3ff1b0ff Map browser fixes and improvements
- 'Random' map is filtered correctly
 - When in 'fallback to all' mode, selecting something works (#6165).
 - Fix hotkeys being broken (fixes map browser following 0406c4dfde)
 - Clear filters when reopening the map browser (seems natural).

Based on a patch by: nani
Refs #6045.
Fixes #6165.

Differential Revision: https://code.wildfiregames.com/D3833
This was SVN commit r25379.
2021-05-04 16:40:16 +00:00
2e08fd38ea GUI cleanup: XML & child handling.
- We only need an XMBFile, not a CXeromyces to parse GUI
objects/scripts/... This makes the interface more consistent with other
usage, notably ParamNode.
- Rename IGUIObject::AddChild to RegisterChild and flesh out the
interface a little.

Differential Revision: https://code.wildfiregames.com/D3908
This was SVN commit r25378.
2021-05-04 15:17:50 +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
a1010b83d3 Enable specifying the trigger action independently of the trigger name.
Trigger functions/actions were tied to the trigger 'identifier'. This is
inconvenient if several triggers should call the same function, e.g. for
range triggers.

By setting an 'action' in the trigger data, one can now specify the
function to call independently of the trigger name.

For clarity, the 'action' parameter in RegisterTrigger is changed to
'name'. By default, the action still matches the trigger name for
compatibility and convenience.

Differential Revision: https://code.wildfiregames.com/D3903
This was SVN commit r25374.
2021-05-04 12:33:45 +00:00
c0157d613d Simplify trigger event naming scheme.
Reduces confusion and string manipulation.

Refs #52.

Differential Revision: https://code.wildfiregames.com/D3913
This was SVN commit r25373.
2021-05-04 09:46:38 +00:00
79118e6716 Remove castshadow from decals.
This was SVN commit r25372.
2021-05-04 09:21:32 +00:00
6663b27fa2 Disable shadows for blood. Since they are decals it doesn't seem to make much difference.
This was SVN commit r25371.
2021-05-04 09:06:13 +00:00
2efe255bbd Fix error when hosting lobby game.
Revealed by 0406c4dfde. The fix also avoids sending a redundant
lobbyregistration message.

Reported by: langbart
Differential Revision: https://code.wildfiregames.com/D3923
This was SVN commit r25369.
2021-05-04 08:58:22 +00:00
738b200dda Let entity react on target death directly.
Don't let entities waste a repeat time when they've killed their target.
Done by storing a list of attackers in cmpResistance (since that cmp is
obligatory anyway).

Differential revision: https://code.wildfiregames.com/D2129
Comments by: @Angen, @wraitii
This was SVN commit r25368.
2021-05-04 05:18:11 +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
5287dd768d Add some missing credits.
@mysticjim and @Sundiata manage the community, but were not named in
those credits yet.
@Langbart does a lot of valuable work (amongst which is writing patches)
and was not credited at their first patch (my fault).

Differential revision: https://code.wildfiregames.com/D3880
This was SVN commit r25364.
2021-05-03 14:03:43 +00:00
48cb9a2d6f Allow triggers to spawn turreted entities.
After 21e866fcf0.

Differential revision: https://code.wildfiregames.com/D3872
Comments by: @Angen
This was SVN commit r25363.
2021-05-03 08:54:54 +00:00
bb49fbe793 Further reduce usage of TERRAIN_TILE_SIZE in non-terrain components
TERRAIN_TILE_SIZE is now only used in relevant places in the simulation.
This also makes it mostly possible to use CFixed in constexpr contexts.

Refs #5566

Differential Revision: https://code.wildfiregames.com/D3078
This was SVN commit r25360.
2021-05-02 17:40:00 +00:00
6d10a35d97 Fix some warnings.
- 25332f9b86 added 'override' to a method in ShaderProgram.cpp. This
adds it to the rest.
- BinarySerializer.cpp had custom JS includes, because putting those in
ScriptExtraHeaders failed. The cause is that gloox leaves "#define
lookup" up. This has been reported upstream, and fixed here.
- VS17 complains about an uninitialised variable, though the usage is
safe.

Differential Revision: https://code.wildfiregames.com/D3916
This was SVN commit r25359.
2021-05-02 15:45:40 +00:00
3801a4dd47 Allow implicit JS boolean -> string conversions.
`false` becomes `"false"`, `true` becomes `"true"`.

Differential Revision: https://code.wildfiregames.com/D3917
This was SVN commit r25358.
2021-05-02 15:43:59 +00:00
e53628ab56 Remove debug code left in d9748173c7
Reported by: Freagarach
This was SVN commit r25357.
2021-05-02 07:08:40 +00:00
Angen
0ad3dba097 Do not transfer xp twice on Promotion
ChangeEntityTemplate used by Promotion is transfering xp from old unit
to new one, but also Promotion component itself does the same thing.
Introduced in cc1ea7cca0

Differential revision: D3915
This was SVN commit r25356.
2021-05-01 17:40:26 +00:00
2fcab79e15 Moves terrain independent code for viewport bounds calculations to camera.
This was SVN commit r25355.
2021-05-01 16:59:42 +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
d9748173c7 Generalize icon-specific tooltips to a tag, streamline code.
We can currently specify a custom tooltip for an icon. This extends that
to a generic tag `[tooltip='something']...[/tooltip]` for any particular
piece of text, and removes the iconTooltip hardcoding by instead using a
virtual `GetTooltipText` call since all IGUIObject descendants have a
tooltip. This is both cleaner & more efficient.
Removes the ability to set a custom tooltip style (that doesn't seem
particularly useful), it'll reuse the style of the CText itself.

Differential Revision: https://code.wildfiregames.com/D3895
This was SVN commit r25353.
2021-05-01 12:38:05 +00:00
9107d6d8c7 Fixes unused CCamera argument in debug rendering in SilhouetteRenderer.
This was SVN commit r25352.
2021-05-01 12:13:48 +00:00
8633a28b00 TriggerPoint - default required component is '0'.
Differential Revision: https://code.wildfiregames.com/D3902
This was SVN commit r25351.
2021-05-01 09:02:30 +00:00
19b01dc710 Migrate DEFINE_INTERFACE_METHOD_* to the ScriptFunction wrappers.
The main benefits are more convenient code in the component interfaces
TU and no limit on the # of arguments that can be passed.

Differential Revision: https://code.wildfiregames.com/D3910
This was SVN commit r25350.
2021-05-01 08:01:30 +00:00
c62ad8fefa Implement FromJSVal<IObject*> safely
By making all GUI proxy objects share the same class, we can easily
confirm if a given JS object is one, and from there convert to the
appropriate types.

Differential Revision: https://code.wildfiregames.com/D3907
This was SVN commit r25347.
2021-04-30 13:20:43 +00:00
3579097d95 Count resource gatherers also when returning their resources.
Followup on 1e0a6f66f0.
This gives a better image of the amount of units which are gathering.
By decision, entities are _not_ accounted from when the player tasks
them to return their resources.

Refs. #643
Differential revision: https://code.wildfiregames.com/D3226
Comments by: @wraitii
This was SVN commit r25345.
2021-04-30 06:24:13 +00:00
835c081ca4 Fix large slowdown in rendering on some configurations.
Usage of GL_VERTEX_ARRAY client state apparently prevented OpenGL from
using hardware acceleration on my computer (Macos 10.14 with an Intel
GPU).
It is unclear how many people would be affected by this issue, but on my
end it makes GLSL performance competitive with ARB again.

Reviewed By: vladislavbelov
Differential Revision: https://code.wildfiregames.com/D3900
This was SVN commit r25343.
2021-04-29 07:38:40 +00:00
2ce4c2e7d5 Unify pierce resistance of defensive structures.
Defensive buildings now have 25H/35P/3C resistance.

Patch by: Nescio
Differential Revision: https://code.wildfiregames.com/D3757
This was SVN commit r25342.
2021-04-29 07:35:27 +00:00
f0b2c31533 Buff stone throwers: increased range and HP.
Patch by: borg-
Differential Revision: https://code.wildfiregames.com/D3781
This was SVN commit r25341.
2021-04-29 07:32:49 +00:00