Commit Graph

21826 Commits

Author SHA1 Message Date
63224865d5 Fix selection height for the apple, banana, date, fig, olive and palm trees. Use the biggest variation as reference. Forgotten in https://code.wildfiregames.com/24043 (Height was 10 initially)
Reported by: @nani
Fixes: #6075

This was SVN commit r25259.
2021-04-14 16:55:44 +00:00
43a780504a Delete "Compact RelaxNG" / .rnc files
(Follows 76acc4e146 where I deleted actor.rnc)

This deletes the .rnc validation files, upgrading the .rng files to
being the source of truth.

- The engine uses, via LibXML2, .rng files to validate XML schemas, to
the .rnc files are redundant.
- The RelaxNG "Compact" format is a DSL for the RelaxNG XML format. Its
syntax is unique, unlike .rng files which are XML.
- Some errors are likely - I'm not sure anyone has converted the compact
files in years.
- The tool to generate .rng from .rnc files is trang
(https://github.com/relaxng/jing-trang), which runs on the JVM and is
quite annoying to install compared to "your usual text editor".
- The JS components use the full .rng format in XML, so editing this
format is already familiar to most people that mod the game.

The .rnc files were added in 2c9939ac74 along the .rng files.

Refs #413, #245

Differential Revision: https://code.wildfiregames.com/D3824
This was SVN commit r25258.
2021-04-14 07:39:36 +00:00
fde66f5134 Fix 4 small gamesetup issues
- Random lanscape option now works properly.
- Non-host clients now see the game attributes correctly in the loading
screen, including in particular the map name.
- AI bots are again translated.
- 'Cheat' setting is persisted correctly in MP gamesetup.

Reported by: myself, Freagarach, nwtour
Differential Revision: https://code.wildfiregames.com/D3841
This was SVN commit r25257.
2021-04-14 07:30:26 +00:00
0308c2390a Rework the pathfinder path computation setup for threading.
Essentially reverts D1918 / d592bf9cb6.
Instead of copying path requests to workers, setup the result vector,
then setup an index, and compute 'in-place'.
To send messages, the result vectors are read in order. This makes the
order trivially constant no matter how many workers there are, and the
architecture overall makes it much easier to efficiently paralellise.

Tested by: Langbart, Stan
Differential Revision: https://code.wildfiregames.com/D3849
This was SVN commit r25256.
2021-04-14 07:23:47 +00:00
990265d974 Fixes warnings after minimap changes in b7db124cb5.
This was SVN commit r25254.
2021-04-13 23:16:46 +00:00
c8b2c09bc3 Fix --without-pch build. fc60d80af1 was missing an include.
Reported by: @vladislavbelov
This was SVN commit r25253.
2021-04-13 17:28:01 +00:00
1508031f09 Scale down turret icons so that they don't overflow.
Reported by: @nwtour
This was SVN commit r25252.
2021-04-13 17:15:34 +00:00
e36c8c3763 Destroy components in reverse order of construction.
Components have some initialisation-order dependency. They could also
have destroy-order dependency, and from a RAII-like point of view, it
makes sense to do this.

Differential Revision: https://code.wildfiregames.com/D3843
This was SVN commit r25251.
2021-04-13 13:47:59 +00:00
0a59489824 Use unique_ptr for secondary sim data.
Differential Revision: https://code.wildfiregames.com/D3842
This was SVN commit r25250.
2021-04-13 13:46:45 +00:00
67fe65e85b Fix mismatching range checks in finding a new target when gathering.
While gathering resources entities may be tasked to gather near a
position. The range check for that is 10 m. However, the relaxed range
check for the walking state is this.DefaultRelaxedMaxRange, which is 12
meter, currently. Meaning it would lead to a slow infinite loop.

Differential revision: D3839
Comments by: @wraitii
Tested by: @gameboy
(https://wildfiregames.com/forum/topic/38131-tutorial-bug/)

This was SVN commit r25249.
2021-04-13 06:48:13 +00:00
1b844606aa Implement mul_round in checkrefs.
Missed in 19f600cfa2. In use since 2078abdcc4.

This was SVN commit r25247.
2021-04-12 16:33:54 +00:00
5df6e688e2 Revert 189d00d811 - infinite loop in UnitAI when slaughtering.
Reverting to get some time to investigate.

Reported by: langbart
This was SVN commit r25246.
2021-04-12 16:16:57 +00:00
2078abdcc4 Fix issue with 37790e099c
Cost cannot be non-integer, and rounding issues happened.

Reported by: gameboy
This was SVN commit r25245.
2021-04-12 14:07:59 +00:00
6d5b710877 Fix undefined values in barter tooltip.
Patch by: nwtour
Reviewed By: wraitii
Differential Revision: https://code.wildfiregames.com/D3829
This was SVN commit r25244.
2021-04-12 13:51:02 +00:00
21645f5c1c Minor fixes after Gathering refactoring.
- `initPos` was used wrong.
- There were two `CanGather` functions in `cmpResourceGatherer`.
- Reduced some duplication in the ReturnResource order.

Differential revision: D3838.
This was SVN commit r25243.
2021-04-12 12:50:17 +00:00
189d00d811 Fix entities being able to attack allied structures in rare cases.
Caused by not checking the attack type while performing an attack.

Closes: #5511
Differential revision: D3840
References #3484

This was SVN commit r25242.
2021-04-12 12:41:35 +00:00
b7db124cb5 Crops minimap view bounds to map size.
Differential Revision: https://code.wildfiregames.com/D3837
This was SVN commit r25241.
2021-04-12 12:39:07 +00:00
e17cd7754e Split hotkeys of turrets.
Following 21e866fcf0.
Also support leaving a turret by using a hotkey.
Currently the hotkeys are by default bound to the same ones as
garrisoning.

Differential revision: D3773
Icons by: @wowgetoffyourcellphone and @Stan.
This was SVN commit r25240.
2021-04-12 12:31:29 +00:00
d0a0ed0b1c Mixins: deduplicate Athen-specific data.
Puts the athen-specific data in the mixin `civ/athen`. Deduplicates.

Differential Revision: https://code.wildfiregames.com/D3831
This was SVN commit r25239.
2021-04-12 11:30:38 +00:00
37790e099c Mixins: Remove the special mercenary technology, apply template changes directly.
Reviewed By: Freagarach
Differential Revision: https://code.wildfiregames.com/D3832
This was SVN commit r25238.
2021-04-12 11:28:18 +00:00
318a5d7a2b Improve Caratacos' portrait.
Patch by: @m7600
Refs: d8709f84f3

This was SVN commit r25237.
2021-04-12 09:13:34 +00:00
3097a7c302 Attack using cmpAttack instead of UnitAI.
Keep responsibilities separated, allow easier modding of attacking
behaviour.
Ideally the BuildingAI attacking routine would be merged in here as
well, but not done for now.

Part of #5810
Differential revision: D3816
Comments by: @smiley, @Stan
This was SVN commit r25235.
2021-04-12 06:51:39 +00:00
ea86790e4e Profile the Transform helper.
Differential revision: D3825
Comments by: @Stan, @wraitii
This was SVN commit r25234.
2021-04-12 06:23:30 +00:00
8acc3b049f Combine attack times in a single node.
Reduces duplication, allows all attack types to cause splash damage.
While at it, makes delay and minimal range optional (for obvious
defaults are available).

Split from D368, so basically a patch by @bb.

Note that it may seem like one can arbitrarily name an attack now, but
that is not true.

Differential revision: D2002
Comments by: @bb, @Nescio, @Stan, @wraitii
This was SVN commit r25233.
2021-04-12 06:17:13 +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
e7159c01fb Fix 3759fc8a98
3759fc8a98 broke decals and particle emitters, as I misplaced the if
block.

Reported by: langbart
This was SVN commit r25230.
2021-04-11 19:04:56 +00:00
8eb4871c9b Draws GUI elements by Z order.
Tested By: wraitii
Differential Revision: https://code.wildfiregames.com/D3780
This was SVN commit r25229.
2021-04-11 11:27:53 +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
fc60d80af1 Simplify GUI Proxy implementation & customisation.
This finishes 7c04ea0211 and 1b67a079fb.
GUI Proxy objects are now easier to specialize, code duplication is
reduced, code is made safer.
In details:
- the proxy private is always the IGUIObject* pointer
- the private data is accessed through a safer wrapper
- CreateJSObject returns an opaque type to allow easier extension &
prevent errors.
- The implementation of CreateJSObject is moved near the GUI Proxy
template instantiation, and both are wrapped in a convenient macro (this
makes it so that if you use the macro, you can't forget to overload the
method, and vice-versa).
- The common IGUIObject JS interface no longer needs to be repeated.
- All specialisations are again put in the same file, for improved
compile-time & clarity, given there are so few lines now.
- While at it, implement toSource which makes it possible to `uneval`
components (does the same as toString though).


Differential Revision: https://code.wildfiregames.com/D3826
This was SVN commit r25225.
2021-04-09 18:01:47 +00:00
3759fc8a98 Allow empty actor files.
This allows empty actor files -> they map to a dummy object that renders
nothing.
The use case is automatically hiding objects at lower quality levels &
LOD settings.

Differential Revision: https://code.wildfiregames.com/D3819
This was SVN commit r25224.
2021-04-09 15:45:31 +00:00
d73a3f59ad Allow arbitrary compositions in TemplateLoader template names.
- Allows compositing any two templates in TemplateLoader, and not just
filters: 'A|B|C' is now valid for any template A, B and C.
- Allows parents to be composited paths 'A|B|C'. In such a schema, if A
or B themselves specify a parent, the actual composition becomes
A|pA|B|pB|C and so on.

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

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

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

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

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

Tested by: langbart
Differential Revision: https://code.wildfiregames.com/D3827
This was SVN commit r25222.
2021-04-09 15:34:51 +00:00
14d24e03f2 Fix promoting entities going back to default stance.
Introduced in 93d22ef16b.
Brings back the less intrusive bug of transforming while garrisoned of
turreted and unloading results in the default stance. That needs to be
fixed again.

Differential revision: D3822
This was SVN commit r25221.
2021-04-09 08:46:39 +00:00
f7f82ecf25 Use explicit functions for passing on a builders list.
Instead of relying on the assumption that an entity which transforms
only has one of the two (and the same) before and after.
Fixes 5b3bdf3647.

Differential revision: D3821
Comment by: @Stan
This was SVN commit r25220.
2021-04-09 08:42:43 +00:00
1af9a4702d Fix MSVC warning.
Introduced in 592453c62f.

Differential Revision: https://code.wildfiregames.com/D3815
This was SVN commit r25219.
2021-04-09 08:13:14 +00:00
b1c1cb1657 Fix pickup error.
Introduced by forgetting to change a line in fd1d7d5d83.

This was SVN commit r25217.
2021-04-09 07:08:33 +00:00
8f04d2ee90 Move function to perform trade to substate.
Don't pretend it to be a callable function, while it is certainly part
of the FSM.
(Also makes it easier for us to implement a duration for the trading in
the future, might we ever want to.)

Differential revision: D3813
Comment from: @Angen
Closes: #6135

This was SVN commit r25216.
2021-04-09 06:29:49 +00:00
7ba4b1ffc8 Split dropping resources from approaching in UnitAI.
Allows for non-moving entities to drop resources. (When someone checks
those cases in the order.)
(Also makes it easier for us to implement a duration for the dropping in
the future, might we ever want to.)

Differential revision: D3817
This was SVN commit r25215.
2021-04-09 06:25:47 +00:00
6023a273df Fix phasing requirements of tutorial.
Introduced in 2ef3fd7a77.
Fixed by switching the order of task of the barracks and outpost.

Patch by: @nwtour
Differential revision: D3820
This was SVN commit r25214.
2021-04-09 06:02:22 +00:00
294d102a6f Queue techs at structure with the lowest queue length.
Instead of queueing all techs at the lowest ID.

Patch by: @n1xc0d3r
Differential revision: D3798
Tested by: @Langbart
This was SVN commit r25213.
2021-04-09 05:55:05 +00:00
f5a0ab81b6 Fix missing return in 3c4a341906.
Caused entities to walk to the edge of the map when their dropsite was
destroyed.

This was SVN commit r25211.
2021-04-08 10:34:48 +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
e3695abe59 Build using Builder instead of UnitAI.
Moves the building logic from UnitAI to Builder.
Makes it easier for modders to change building behaviour, e.g. letting
structures build.

Differential revision: D3812
Comment by: @Angen
This was SVN commit r25208.
2021-04-08 05:50:18 +00:00
f2d5603422 Heal using Heal instead of UnitAI.
Moves the healing logic from UnitAI to Heal.
Makes it easier for modders to change healing behaviour, e.g. letting
structures heal (instead of using an aura).

Differential revision: D2680
Comments by: @Stan, @wraitii
This was SVN commit r25207.
2021-04-08 05:40:49 +00:00
3c4a341906 Gather using ResourceGatherer instead of UnitAI.
Moves the gathering logic from UnitAI to ResourceGatherer.
Makes it easier for modders to change gathering behaviour, e.g. letting
structures gather.
Refs. #4293 by optimising a bit.

Differential revision: D2662
Comments by: @bb, @Stan, @wraitii
This was SVN commit r25206.
2021-04-08 05:31:34 +00:00
48d6b84c62 Fix initial animation sync.
UpdateAnimationID → PickAnimationID

Reviewed by: @wraitii
Differential Revision: https://code.wildfiregames.com/D3747
This was SVN commit r25205.
2021-04-07 08:35:02 +00:00
a7d777d69b Don't store origin market in this.goods in cmpTrader.
It was introduced in 9b98585275 but made obselete in 98b4fe6d00.

Differential revision: D3809
This was SVN commit r25204.
2021-04-07 07:04:57 +00:00
9ee4ccd8ec Split commit from build in cmpFoundation.
Useful if e.g. a modder wants to commit a structure before building it.

Differential revision: D3806
This was SVN commit r25203.
2021-04-07 07:02:12 +00:00
ac7db9850b Move trader gain to cmpMarket.
Deletes the helper, since we need at least one market anyway.

Differential revision: D3808
Closes: #5890

This was SVN commit r25202.
2021-04-07 06:58:36 +00:00