Units can be stuck in gather states when the target ought to be
collectable from, but it's actually unreachable.
A new FINDINGNEWTARGET intermediate state for GATHER will try and find a
new, different target to collect from. This should generally improve the
behaviour (perfect reachability checks would be required to completely
fix it).
Use this also when the target is knowably unreachable / uncollectible.
Fixes#5529
Differential Revision: https://code.wildfiregames.com/D2120
This was SVN commit r22816.
In some rare cases, units could be stuck in the special state of 3
failed path computations, making them always compute long paths instead
of trying short paths again. This can happen when they compute a long
path successfully, but the unit cannot actually move as it gets
obstructed right away.
Make sure this state is never kept for more than one turn to fix this
problem.
Refs #5569 (probable fix but kept open for further investigating).
Differential Revision: https://code.wildfiregames.com/D2239
This was SVN commit r22815.
Iterating over attack effects incorrectly returned instead of continuing
when the target did not have a receiver.
Polar Sea triggers used Attack instead of Attacking.
Reported By: Freagarach
Differential Revision: https://code.wildfiregames.com/D2235
This was SVN commit r22814.
Modifiers affecting the player entity itself were not applying
correctly.
The reason was that the cache was not correctly reset.
Adds a regression test.
Reported By: Minohaka
Tested By: Minohaka
Refs #5572 (probably fixed but kept open for verifiation).
Differential Revision: https://code.wildfiregames.com/D2236
This was SVN commit r22813.
Mechanical was a union of Siege and Ship and not very used.
The '_mechanical' part of template names was removed in d3a73f0611.
Replace its usage with Ship and/or Siege where relevant.
Reviewed By: wraitii
Patch By: Nescio
Differential Revision: https://code.wildfiregames.com/D2201
This was SVN commit r22810.
Usage of these classes was inconsistent, and CitizenSoldier is a
non-visible class so should not be used in data files.
Reviewed By: wraitii
Patch By: Nescio
Differential Revision: https://code.wildfiregames.com/D2200
This was SVN commit r22809.
The objective of 3362c591f5 to have only one global for multiple AIs is
still achieved by not changing the resulting object structure.
The advantage of not using the pattern is to have less parental scopes,
i.e. more localization and separation of concerns.
This resembles the successful simulation script component system.
The stated benefits of the Augmentation pattern were never used, because
there are (luckily) no such private variables or globals passed as
arguments.
Fixes an ESLint warning about using PETRA before it is defined, refs
#5524, D1993.
Fixes the missing level of indentation if indentation should represent
scoping proportionally.
Remove superfluous, thus misleading name PetraBot in PETRA.PetraBot
assignment.
Differential Revision: https://code.wildfiregames.com/D2103
Patch By: Krinkle
Related comments by: Yves, wraitii, Philip, leper on #0ad-dev on
December 2013, see #2322
Source was:
http://www.adequatelygood.com/JavaScript-Module-Pattern-In-Depth.html
This was SVN commit r22803.
Remove PSERROR codes from SetSetting (let std::map throw an out_of_range
if a caller wants to Set a setting that doesn't exist without having
checked with SettingExists, equal to GetSetting from 92b6cdfeab).
That also simplifies std::function SetSettingWrap construct from
0a7d0ecdde to void IGUIObject::SettingChanged.
Don't trigger debug_warn or exceptions in GUITooltip::ShowTooltip if the
XML author specified wrong tooltip input, and dodge another
dynamic_cast.
Rename existing IGUIObject::SetSetting to
IGUIObject::SetSettingFromString and comment that it is purposed for
parsing XML files.
Remove SetSetting default value, so that authors are made aware
explicitly of the need to decide the function broadcasting a message,
refs d87057b1c0, 719f2d7967, ...
Change const bool& SkipMessage to const bool SendMessage, so that a
positive value relates to a positive action.
Clean AddSettings whitespace and integer types.
Differential Revision: https://code.wildfiregames.com/D2231
Tested on: gcc 9.1.0, clang 8.0.1, Jenkins
Comments By: Philip on IRC on 2010-07-24 on GUIUtil being ugly, in case
that one counts
This was SVN commit r22796.
Unify the two IGUIObject::LoadStyle functions and remove CGUI argument
that is always identical to the member.
Differential Revision: https://code.wildfiregames.com/D2232
Tested on: gcc 9.1.0., clang 8.0.1, Jenkins
This was SVN commit r22792.
659a9ea57a introduced the call rightfully in ShowTooltip since
CTooltip::SetupText() depends on the just changed _mousepos setting.
But then 0382cdd9b1 moved that _mousepos SetSetting call, resulting in
the message becoming redundant; and it inserted the second redundant
message in HideTooltip.
These were the only redundant SGUIMessage HandleMessage calls.
This was SVN commit r22790.
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.
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.
The warning seems to be a false positive and happens with clang but not
gcc.
Differential Revision: https://code.wildfiregames.com/D2223
Reviewed By: Vladislav
This was SVN commit r22777.
Remove duplicated actors from carthaginian civ folder due to redundance
of having twice the same infantry in two folders.
carthaginians/infantry_slinger_e.xml > iberians/infantry_slinger_e.xml
carthaginians/infantry_swordsman_e.xml > gauls/infantry_swordsman_e.xml
Also include a fix for an unsync frame of the idle_ready_shieldsmall.dae
animation.
This was SVN commit r22775.
createDefault returns a new pointer to be deleted, getGMT returned a
pointer to an icu variable not to be deleted.
Differential Revision: https://code.wildfiregames.com/D2220
Reviewed By: Vladislav
This was SVN commit r22773.
The old name was unnecessary long, but also potentially misleading:
stoas are Greek, but not necessary royal, and there are no other stoas
in game. Just “stoa” is clearer, more correct, and more consistent with
other `template_structure_*.xml` names.
Patch By: Nescio
Reviewed By: wraitii
Differential Revision: https://code.wildfiregames.com/D2036
This was SVN commit r22770.
e16c4c4800 expects player-wide modifications to invalidate entity
caches.
However, this requires the entity to have an owner when calling
ApplyModifiers.
ResourceGatherer caches its gather rates at Init, when entities do now
yet have their correct owner, and thus this fails.
Since OnOwnershipChanged also caches gather rates however, this call is
redundant (and needlessly slow) so it can just be deleted.
Differential Revision: https://code.wildfiregames.com/D2217
This was SVN commit r22768.
The ModifiersManager system component provides an interface to add and
remove modifiers, and get modified stats.
The goal is to merge all the different stat-modifying systems 0 A.D. has
implemented over the years.
This commit makes technologies and auras use ModifiersManager. Some
cheats and AI bonuses also have a similar stat-modifying effect that
have not yet been updated.
Further, this system component makes it possible for e.g. triggers to
easily add modifiers, enabling the writing of Castle Blood Automatic,
RPG or Tower Defense maps without the need for mods or hacks.
The 'Modifier' name was preferred over 'Modification' as it is shorter
and more readable, along with the logic that 'modifiers' store
'modifications' and this stores modifiers. Renaming of other functions
and classes has been left for future work for now.
Internally, this uses a JS data structure. If performance issues arise
with it in the future, this data structure or the whole component could
be moved to C++.
The performance has been tested to be about as fast as the current
implementations (and specifically much faster for global auras with no
icons). Testing showed that sending value modification messages was by
far the slowest part.
Comments by: leper, Stan, elexis
Differential Revision: https://code.wildfiregames.com/D274
This was SVN commit r22767.
Avoids one or two dozen unoptimizable string copies and two CPos copies,
mostly in SetupText.
The reference return allows to mark values as const where the previous
one prevented that.
This also reveals unused variables where the previous code hid them.
Thus use unused variable "buffer_zone" in the otherwise unused (since
b1422137e5, refs 0f807c643a) CCheckBox::SetupText() from b5f6d19332 and
use the unused variable "scrollbar" in CInput GUIM_MOUSE_PRESS_LEFT from
4113aa0a36.
Refs unintentionally copied DrawCall cache due to GetSetting copying in
c19f3608a5, fixed in 8f4f8e240f.
Differential Revision: https://code.wildfiregames.com/D2215
This was SVN commit r22765.
The class didn't leak the m_Wrapped gloox Jingle for this program since
it's not set to owned, and it's not set to owned because gloox deletes
it.
It would have leaked if some other app would have used glooxwrapper with
owned = true, if gloox has a situation for that.
Differential Revision: https://code.wildfiregames.com/D2090
This was SVN commit r22764.
Use references instead of copies for obtaining the font in SetupText().
Differential Revision: https://code.wildfiregames.com/D2214
This was SVN commit r22761.
carthaginians/elephantry_c_r.xml
ptolemies/elephantry_c_r.xml
Also add new variants for the ptolemaic cavalry.
ptolemies/cavalry_spearman_e_r.xml
ptolemies/hero_cavalry_swordsman_ptolemy_IV_r.xml
This was SVN commit r22760.
Stops copying the CStrW each time a sound is played by using the
reference GetSetting variant.
Differential Revision: https://code.wildfiregames.com/D2209
This was SVN commit r22756.