1
0
forked from 0ad/0ad
Commit Graph

21594 Commits

Author SHA1 Message Date
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
869076ebc5 Replace double division with multiplication/division
As noted by Vladislavbelov in d8ea401a95.
(Likely leads to identical assembly with optimisation & current values)

This was SVN commit r24982.
2021-03-02 18:27:06 +00:00
2838873c0a Fixes & improvements to FunctionWrapper
- HandleValue needed to explicitly pass UndefinedHandleValue for
'default' arguments.
- Allow passing ScriptInterface as first argument.
- Statically check that a getter is provided for object methods instead
of crashing at runtime
- A few stylistic improvements

Differential Revision: https://code.wildfiregames.com/D3625
This was SVN commit r24981.
2021-03-02 16:55:22 +00:00
d8ea401a95 Decouple LOS resolution from terrain resolution
Introduce a LOS_TILE_SIZE, to replace usage of TERRITORY_TILE_SIZE in
the LOS code.
This makes it possible to change the resolution of LOS/Terrain without
affecting the other component.

Additional refactoring:
- LosTile has been renamed LosRegion (it's more comparable to the
hierarchical pathfinder regions/spatial subdivisions)
- LosState explicitly refers to "los vertices" instead of terrain
vertices.

Refs #5566

Differential Revision: https://code.wildfiregames.com/D3076
This was SVN commit r24980.
2021-03-02 16:44:40 +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
b7ff2107ea Partial revert of d038b3c4f2 / REJECT_ORDER with FinishOrder()
Fixes d038b3c4f2, by partially reverting it.

If the new order is rejected, PushOrder() will call FinishOrder. If
there are no more orders on the queue, this calls SetNextState("idle"),
with the intention os switching the unit to IDLE. However, this only
works from within an FSM call, and thus does nothing if a new command
gets rejected.

The problem is that this.order/this.orderQueue is already replaced by
the point the order is rejected when called via ReplaceOrder. Ideally,
this would not happen (but doing so isn't trivial).

The current code avoids having 2 different ways to reject an order, thus
isn't a complete revert of d038b3c4f2. It triggers an IDLE re-entry that
wasn't there before if the unit is IDLE when it receives the rejected
order, which at the moment basically never happens.

Refs #5771 (reopened)

Reported by: gameboy
Comments by: Freagarach, Angen
Differential Revision: https://code.wildfiregames.com/D3618
This was SVN commit r24978.
2021-03-02 15:18:39 +00:00
e18001e897 Let entities garrison using cmpGarrisonable.
Followup to f4c9305eee.
Moves the logic for garrisoning from cmpGarrisonHolder to the entity
that is being garrisoned.
Also fixes
https://wildfiregames.com/forum/topic/36863-teleportation-feature-in-a24/?do=findComment&comment=418441
while at it (setting garrisoned before transferring orders on
transform).

Differential revision: D3280
Refs: #5906
Comments by: @Stan, @wraitii
This was SVN commit r24977.
2021-03-02 15:06:16 +00:00
a64536b45f Fix MSVC unknown pragma warning
Follows f3aedf88a6.

Reported by: Stan
Reviewed By: Stan
Differential Revision: https://code.wildfiregames.com/D3623
This was SVN commit r24976.
2021-03-02 15:00:33 +00:00
5e5ea5cba5 Fix replayprofile/ graphing tool for Profiler1
All modern browsers block ajax request to local file.
This changes extract.pl to generate a single HTML file with data
embedded.
This is now the default behaviour, --to-json to export, --from-json to
load exported.

Patch by: nwtour
Reviewed By: wraitii
Differential Revision: https://code.wildfiregames.com/D3621
This was SVN commit r24975.
2021-03-02 08:35:39 +00:00
23aa59e3d4 Let domestic animals flee when attacked.
Since slaughter kills animals in one strike since 3d61c227f3, domestic
animals can now be set to flee when attacked by anything else than
slaughter, like area damage or stray missiles.

Original patch by: @elexis
Differential revision: D193
Comments by: @mimo, @wraitii
This was SVN commit r24973.
2021-03-02 06:18:56 +00:00
f020a145f1 Fix Iberian starting walls on Skirmish maps.
Typo caused by b57abe806c, pointed out by @Sundiata in
https://wildfiregames.com/forum/topic/36706-why-alpha-24-is-not-nice/page/4/?tab=comments#comment-418337.

Patch by: @Nescio
Differential revision: D3616
This was SVN commit r24972.
2021-03-02 06:14:23 +00:00
bcd292d6c9 Make forge smoke only visible when the forge is researching.
Add missing particle sparks.

Thread:
https://wildfiregames.com/forum/topic/27329-visual-feedback-for-researching

This was SVN commit r24971.
2021-03-02 00:01:00 +00:00
ac72fb4486 Fix compilation of Atlas on UNICODE BUILDS
Patch by: @madpilot
Tested by: nwtour
Differential Revision: https://code.wildfiregames.com/D1593
This was SVN commit r24970.
2021-03-01 23:32:23 +00:00
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
9ed3b88d25 Guarantees no memset for allocation of DynamicArena::Block
Differential Revision: https://code.wildfiregames.com/D3609
This was SVN commit r24968.
2021-03-01 20:35:30 +00:00
502b229655 Check for missing auras in GUI Interface
Improve the explicitedness of the following error.

Reviewed By: Freagarach
Differential Revision: https://code.wildfiregames.com/D3614
This was SVN commit r24967.
2021-03-01 17:54:46 +00:00
6dc0ffd86f Add a 'debug' catalog & PEP8 the long string file
- Adds a function to generate a 'debug' catalog. This prepends 'X_X '
to strings, to make it obvious in-game which are translated and which
aren't, while still remaining usable.
 - cleans up the code and formats to PEP8 properly (except for line
lengths).

Differential Revision: https://code.wildfiregames.com/D3617
This was SVN commit r24966.
2021-03-01 16:37:33 +00:00
d6e0a9963d Remove corral aura which was not supposed to be committed in c888844b3a.
Spotted by: @wraitii
This was SVN commit r24964.
2021-02-28 21:00:05 +00:00
c888844b3a Decay/Regenerate option for resources.
Allows entities to change their resource amount over time, possibly with
some constraint.

This is a not-so-bare minimum, but can certainly be improved and/or
extended later.

Part of: #1973
Original patch by: @smiley
Redone by: @Stan
Standing on the shoulders of giants: @Freagarach
(Revisions: 59; Inlines: 209)
Differential revision: D1718
Comments by: @Angen, @elexis, @Imarok, @Langbart, @nani, @Nescio,
@smiley, @Stan, @wraitii

This was SVN commit r24963.
2021-02-28 20:14:53 +00:00
df18102e96 Add an 'Evaluate' RL endpoint, intended for dynamic game balancing
This adds a new endpoint to the RL interface for evaluating custom
JavaScript. When combined with the ability to create arbitrary
modifiers, this provides the required functionality for exploring
quantitative game balancing.

Patch By: irishninja
Fixes #5981

Differential Revision: https://code.wildfiregames.com/D3479
This was SVN commit r24962.
2021-02-28 12:16:32 +00:00
2e2ef6f3fe Increase safety of UnitAI formation code
- PushOrderFront could lead to an infinite loop if walking fails.
- Move units in formation before issuing the move order (or the
formation may not exist).

Differential Revision: https://code.wildfiregames.com/D3411
This was SVN commit r24961.
2021-02-28 10:11:30 +00:00
0e6cf11d86 Resupport more garrisoned slots per entity.
Basically removed in 3521c8f51e, now brought back :) (But split from the
population space.)

Differential revision: D2056
Comments by: @Angen, @Nescio, @Stan, @wraitii
This was SVN commit r24960.
2021-02-28 10:02:03 +00:00
41a5650a62 Allow garrisoned entities to upgrade.
Since its introduction in b2f4b0f494 garrisoned entities were not
allowed to upgrade (b2f4b0f494#inline-4821) but that is not needed (at
least since 4fadd75ace).

Changing templates to anything not being able to garrison will still
fail (#5906) but that can also be done with this code.

Differential revision: D3251
Comment by: @bb
This was SVN commit r24958.
2021-02-28 06:47:36 +00:00
f4c9305eee Move some functionality from GarrisonHolder to Garrisonable.
Take some responsibility from GarrisonHolder to where it belongs
(Garrisonable).

Differential revision: D3223
Comments by: @Stan, @wraitii
This was SVN commit r24957.
2021-02-28 06:37:05 +00:00
d038b3c4f2 Properly discard orders.
Instead of manually calling FinishOrder(). Also, `{ "discardOrder": true
}` is changed to a const `false`.

Differential revision: D3283
Fixes: #5771
Comments by: @Angen, @Stan, @wraitii
This was SVN commit r24956.
2021-02-28 06:29:53 +00:00
e5ee028313 Only cancel (un)packing when in the correct state.
Differential revision: D3285
This was SVN commit r24955.
2021-02-28 05:51:55 +00:00
c33d1192bc Only stop moving when state requests that.
In our current UnitAI implementation, the states are responsible for
whether we are moving or not. If a request to stop moving is made from
outside the state that initiated the moving order that is (mostly)
wrong. This fixes that.

Differential revision: D3289
Comment by: @wraitii
This was SVN commit r24954.
2021-02-28 05:40:08 +00:00
e7158ae6b1 Unify UnitAI and AnimalAI.
18b317bc19 (#563) introduced an ANIMAL-state from a separate
AnimalAI-component (introduced in e19146cf25).
This patch merges that separate state and brings the ROAMING and FEEDING
(renamed to LINGERING) under the INDIVIDUAL.IDLE-state.

This enables e.g. city-building mods to have human units that linger and
roam or animals that behave like humans.

The specific values for animals might need tweaking after this.

Differential revision: D2646
Fixes: #1832, #5593
Comments by: @Angen, @Langbart, @Nescio, @Stan, @wraitii
Refs.: #3919

This was SVN commit r24953.
2021-02-27 20:13:40 +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
32c3f4fb90 Early return in PreprocessorWrapper in case of failed include resolve.
This was SVN commit r24951.
2021-02-27 17:21:02 +00:00
2ce0c2b988 Remove unneeded check in JSInterface_GameView.cpp
Differential Revision: https://code.wildfiregames.com/D3608
This was SVN commit r24950.
2021-02-27 16:52:51 +00:00
bdda96a2e7 Prevent using privileged ports on *nix from the GUI
Ports 1-1023 are privileged and shouldn't be accepted by the GUI.

Patch by: DynamoFox
Differential Revision: https://code.wildfiregames.com/D3574
This was SVN commit r24949.
2021-02-27 16:40:42 +00:00
20b1d98a84 Fix compilation following 52fcee9c91
52fcee9c91 broke compilation because spawnedRadius is not an integer.

This was SVN commit r24948.
2021-02-27 11:12:21 +00:00
e839fc29c7 Fix i18n for common map trigger scripts.
Patch by: nwtour
Differential Revision: https://code.wildfiregames.com/D3570
This was SVN commit r24947.
2021-02-27 10:34:11 +00:00
c3f74494b4 Fix GUI hotkey/map/reference strings not being translated.
Fixes ae9ea5b859, a4852c4c01, bbd808349f

Differential Revision: https://code.wildfiregames.com/D3535
This was SVN commit r24946.
2021-02-27 10:27:26 +00:00
52fcee9c91 Fix division by 0 error in PickSpawnPoint
The spawn code should not assume that obstructions will never be
0-sized.

Reported by: Zack
Fixes #6039

Differential Revision: https://code.wildfiregames.com/D3583
This was SVN commit r24945.
2021-02-27 10:21:04 +00:00
c6f50b253f Fix *nix tarballs to extract in a subfolder.
Also incorporate retry improvements by Stan

Reported by: madPilot
Differential Revision: https://code.wildfiregames.com/D3585
This was SVN commit r24944.
2021-02-27 10:19:31 +00:00
0363ff112e Fix water wind speed computation
Fixes 2a485c5e3b

(the calculation resulted in mismatched wind speed & wave orientation)

Differential Revision: https://code.wildfiregames.com/D3551
This was SVN commit r24943.
2021-02-27 10:08:00 +00:00
f902b23255 Add Bellaz89 to the programming credits
For contributions to d07f271d60 notably.

Differential Revision: https://code.wildfiregames.com/D3591
This was SVN commit r24942.
2021-02-27 09:33:26 +00:00
4eadb3eb9d The SetCameraTarget script function should not change the orientation
Reviewed by: Freagarach
Differential Revision: https://code.wildfiregames.com/D3569
This was SVN commit r24940.
2021-02-27 09:01:20 +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
99712c3581 Fix No-PCH build.
ParticleManager uses <list> which has recently become unincluded.

Differential Revision: https://code.wildfiregames.com/D3589
This was SVN commit r24936.
2021-02-21 10:04:39 +00:00
ada0229f81 Fix garrison error with formations already in range.
The formation is set to an empty state upon disbanding which does not
have a `MEMBER`-substate.
Caused by c57a4d90a1.

Fixes: #6052
Differential revision: D3588
Reviewed by: @wraitii
This was SVN commit r24935.
2021-02-21 09:18:05 +00:00
03ed891029 Do not generate render data in case CDecal calculated wrong coordinates.
Tested By: OptimusShepard, Stan
Differential Revision: https://code.wildfiregames.com/D3578
This was SVN commit r24932.
2021-02-18 21:09:41 +00:00
e8fb314996 Fix error when unsetting a hotkey.
Fixes f222dd2d3e.

Reported by: nwtour
Based on a patch by: nwtour
Differential Revision: https://code.wildfiregames.com/D3579
This was SVN commit r24931.
2021-02-18 09:01:36 +00:00
f380ec627d i18n issues: Spanish manual & gamesetup tips text.
There were errors in the spanish manual, and clipping issue in the
gamesetup tips text.

Refs #6024 (partly fixed)
Fixes #6027

Differential Revision: https://code.wildfiregames.com/D3573
This was SVN commit r24930.
2021-02-16 10:59:15 +00:00
6a3246fe93 Fix variant loading order
file="" properties were not overriden by other things defined in the
actor, which lead to weird edge cases, such as frequency="0" variants
being loaded because their names="" ended up matching their parent's
name=""

Also remove the name because  it doesn't serve a purpose

Accepted by: @wraitii
Differential Revision: https://code.wildfiregames.com/D3572
This was SVN commit r24929.
2021-02-16 10:51:23 +00:00
110402eae0 Update credits again. I failed to notice not all languages were included.
- Remove not included languages from the installer.
- Add credits for other languages, even if they are not included.
Differential Revision:  https://code.wildfiregames.com/D3568
This was SVN commit r24927.
2021-02-14 14:00:30 +00:00
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
9a5d1f3503 Remove useless code in mausoleum.xml
This was SVN commit r24921.
2021-02-13 23:57:29 +00:00