1
0
forked from 0ad/0ad
Commit Graph

20013 Commits

Author SHA1 Message Date
30dcd696eb Improve gathering behaviour when a target is not reachable
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.
2019-09-01 07:35:32 +00:00
9e41ff39fc Unit Motion - make sure units don't get stuck in the special long-path computation step.
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.
2019-09-01 07:31:21 +00:00
2c229a986d Further fixes for Generalized Attack D2092/16b452cf91
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.
2019-09-01 07:28:50 +00:00
dd86d599f5 Fix modifiers affecting player entity following ModifiersManager component in e16c4c4800
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.
2019-09-01 07:16:02 +00:00
Alexandermb
a8afe55b02 Following 4c2b3b6fda Mesh wasn't committed.
This was SVN commit r22812.
2019-08-31 19:40:35 +00:00
Alexandermb
4c2b3b6fda Rome Infantry Spearman helmet (Apulo Corinthian)
Update of Apulo-Corinthian Type helmets replacing the ones i've did
before with a better quality ones.

Thread:
https://wildfiregames.com/forum/index.php?/topic/24494-task-roma-helmets/&do=getNewComment

This was SVN commit r22811.
2019-08-31 19:38:03 +00:00
055935fa0e Remove Mechanical class in favour or using Siege and Ship.
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.
2019-08-31 12:44:48 +00:00
74ac1111b6 Change CitizenSoldier class to Citizen and/or Soldier in auras and technologies.
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.
2019-08-31 12:41:43 +00:00
381bdcbade Fix cc1ea7cca0 error in Promotion when promoting an entity that died on the same turn.
Add a regression test for this case.

Reported By: elexis
Differential Revision: https://code.wildfiregames.com/D2227
This was SVN commit r22808.
2019-08-31 12:38:38 +00:00
395fae107b Fix missing PushGuiPage callback replacement in session/ openManual() in 86c151ebaa, refs D1684.
This was SVN commit r22807.
2019-08-31 11:00:26 +00:00
7943d82bfe Cypresses, maritime pines, emergent teak variant, grasses ptolemaic tower, walls and temple commit, ptolemaic texture split
This was SVN commit r22804.
2019-08-30 00:19:16 +00:00
b59198524f Remove PETRA Module and Augmentation pattern from 3362c591f5, refs #2322, and in Petra since 97afd25171.
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.
2019-08-29 18:12:53 +00:00
bc9116cdfb Use the @wowgetoffyourcellphone's Uffington Horse as the Briton Wonder committed in @Enrique's special commit 83680b0dee. As such the building is no longer garrisonable, and no longer gives a population bonus.
Discussed with: @wowgetoffyourcellphone
Thread 1:
https://wildfiregames.com/forum/index.php?/topic/20986-civ-britons/&tab=comments#comment-318536
Thread 2:
https://wildfiregames.com/forum/index.php?/topic/17495-task-wonder-britons-stonehenge-and-white-horse/page/6/&tab=comments#comment-298890

This was SVN commit r22802.
2019-08-29 15:55:12 +00:00
9c6039e4fe Solemnly delete class GUI and rename GUIUtil.h to CGUISetting.h.
Finishes GUIutil rewrite and fixes #5575.

Differential Revision: https://code.wildfiregames.com/D2233
Test on: clang 8.0.1, Jenkins

This was SVN commit r22801.
2019-08-29 09:07:29 +00:00
0c3a610acc Delete invalid ModmodScrollbar style use and style property from 64bfa089af and 833c9f108c, identified by the LOGWARNING from be963ec9b7, reported by nani.
This was SVN commit r22800.
2019-08-29 07:56:26 +00:00
Alexandermb
18c90ce449 Fix female axe position while gathering wood.
Reported by @wowgetoffyourcelphone

This was SVN commit r22798.
2019-08-28 17:51:49 +00:00
fac98e7afb Move other/wallset_palisade to structures/wallset_palisade, refs #4770, D1002, D1798.
Differential Revision: https://code.wildfiregames.com/D1881
Patch By: Nescio
While at it, fix ESLint overshadowing warning in survival triggers from
804fd4be61, unnoticed in b8fbfe2d20 and 18e7d8a518 but noticed by
Jenkins.

This was SVN commit r22797.
2019-08-28 12:06:59 +00:00
1a49ccb294 Move static GUI<>::SetSetting operating on IGUIObject to a member IGUIObject::SetSetting.
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.
2019-08-28 11:21:11 +00:00
Alexandermb
36e2c1caf8 Remove now unused rome_helmet_attic.xml due to better version (both done by myself)
This was SVN commit r22794.
2019-08-27 23:31:10 +00:00
wackyserious
a5679ddcd4 Texture Update: Seleucid Pikeman and Cataphract
Thread:
https://wildfiregames.com/forum/index.php?/topic/26907-task-compounded-linothorax-unit-texture/&tab=comments#comment-383735

General Discussion:
https://wildfiregames.com/forum/index.php?/topic/22184-task-greek-unit-texture-general-thread/page/9/#comments

Reviewed by: Lordgood, Alexandermb and wowgetoffyourcellphone
This was SVN commit r22793.
2019-08-27 21:21:07 +00:00
be963ec9b7 Delete 27 invalid style settings and add LOGWARNING to inform future authors.
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.
2019-08-27 16:03:24 +00:00
0a6b650189 Delete SGUIMessage GUIM_SETTINGS_UPDATED broadcasts redundant with the broadcast initiated from SetSetting from e21ebb37f5.
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.
2019-08-26 23:39:16 +00:00
92b6cdfeab Move static GUI<>::GetSetting operating on IGUIObject member to a IGUIObject member function, grouping it with SettingExists and AddSetting.
Differential Revision: https://code.wildfiregames.com/D2230
Tested on: gcc 9.1.0, Jenkins

This was SVN commit r22789.
2019-08-26 12:25:07 +00:00
85d01b839c Fix attack/armor techs not applying after 16b452cf91, and fix auras/techs affecting capture rate.
Reported By: Nescio
Patch By: Freagarach
Differential Revision: https://code.wildfiregames.com/D2224
This was SVN commit r22786.
2019-08-25 18:03:32 +00:00
719f2d7967 Remove default CGame constructor values to make the code less error-prone, use CRenderer::IsInitialised() to test if the CGame should be rendered to remove indirection/proxies, making the code easier to read.
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.
2019-08-25 11:02:55 +00:00
336c423e8e standardized structure aura descriptions
Patch By: Nescio
Differential Revision: D1806
This was SVN commit r22784.
2019-08-25 09:20:43 +00:00
27a190578f correct descriptions and tooltips of siege technologies
Patch By: Nescio
Differential Revision: D2186
This was SVN commit r22783.
2019-08-25 09:19:01 +00:00
37a2149cb4 update fortress tooltips
Patch By: Nescio
Differential Revision: D2189
This was SVN commit r22782.
2019-08-25 09:17:58 +00:00
0dbc66a391 update workshop tooltip
Patch By: Nescio
Differential Revision: D2190
This was SVN commit r22781.
2019-08-25 09:16:53 +00:00
5f6e2c789c remove incorrect book numbers from Plutarch Moralia
Patch By: Nescio
Differential Revision: D2191
This was SVN commit r22780.
2019-08-25 09:15:23 +00:00
4919a6185e Remove unused GUIUtil functions, unused GUI includes and some tails in GUIUtil.
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.
2019-08-25 08:57:36 +00:00
b197df5ee6 Fix valgrind conditional jump depending on uninitialised value warning in CGUIManager::HandleEvent from 7c2e9027c2.
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.
2019-08-24 22:25:26 +00:00
Alexandermb
9977ddaeff Replace samnite_swordsman.xml actor properly following 31c128b282
reported by: @Freagarach and @Nescio
This was SVN commit r22776.
2019-08-24 19:30:12 +00:00
Alexandermb
31c128b282 Carthaginian mercenaries duplication removal.
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.
2019-08-24 18:54:26 +00:00
Alexandermb
51f1436ee2 Add syntagma formation variant for every civ pikeman infantry.
Also add phalanx to hoplite cape.

This was SVN commit r22774.
2019-08-24 18:07:59 +00:00
55efe4a735 Fix L10n::FormatMillisecondsIntoDateString memory leak following c92e74138a, refs a74fcdcb35, #3350, #4418, #2938.
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.
2019-08-24 17:33:29 +00:00
62dd922bc0 pthread -> std::thread (5/7) - Replace sdl semaphore with condition variable
This removes a dependency on the SDL_Thread header.

Differential Revision: https://code.wildfiregames.com/D1921
This was SVN commit r22772.
2019-08-24 11:26:58 +00:00
b429d0ce03 Quote all book names in quotes.txt
Differential Revision: D2178
This was SVN commit r22771.
2019-08-24 09:24:13 +00:00
97ee3211d4 Common template name change: hellenic_royal_stoa → stoa
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.
2019-08-24 09:00:46 +00:00
9280b57e79 Make damage bonuses, attack preferred classes and garrisonHolder ejectable classes use MatchesClassList.
MatchesClassList supports additional functionalities (and, not and or).

Reviewed By: wraitii
Patch By: Freagarach
Differential Revision: https://code.wildfiregames.com/D2115
This was SVN commit r22769.
2019-08-24 08:52:15 +00:00
47581ea900 Fix resourceGatherer value modifications following e16c4c4800
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.
2019-08-24 08:20:30 +00:00
e16c4c4800 Add a system component to handle stat modifiers, make technologies and auras use this common interface.
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.
2019-08-24 07:37:07 +00:00
040624acff Replace copy-assigning GUI<T>::GetSetting from c2a71e41bf with the reference returning GetSetting from 3dfa23cd25.
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.
2019-08-23 14:43:10 +00:00
4d77bd6542 Fix unused glooxwrapper variable following 61261d14fc, refs #2305, #5294, #5550.
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.
2019-08-23 12:04:20 +00:00
e02afa279c Remove hardcoded C++ fallback font from 70d84beab2 and according TODO from 924b0bf1b4 that was fixed in 6af0d7cfd3 by having the default style specify the default font.
Use references instead of copies for obtaining the font in SetupText().

Differential Revision: https://code.wildfiregames.com/D2214
This was SVN commit r22761.
2019-08-23 03:28:04 +00:00
Alexandermb
fcd15d0ad5 Update elephantry_r of the following factions:
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.
2019-08-23 03:07:22 +00:00
Alexandermb
1f6b4702ee Fix the warning of fishermans unrecognized skeleton.
Thread:
https://wildfiregames.com/forum/index.php?/topic/26866-could-not-load-animation/&tab=comments#comment-383334

The issue was a variant "base" file using two of the old armature death
animations.

Also clean the repository from having the old actors with the old meshes
in the meshes/structural folder.

Issue reported by @gameboy

This was SVN commit r22759.
2019-08-23 02:50:55 +00:00
8609041ddf Fix missing actual boolean check in the commit removing the odd way to check for a boolean in 77b81d8761.
Reported By: Vladislav
Reviewed By: Vladislav
This was SVN commit r22758.
2019-08-23 00:42:00 +00:00
f4990cf967 Mark some GUI functions as const, including the boolean ones from d4d5187c9d.
Rename MouseOver to IsMouseOver.

Reported By: Vladislav
This was SVN commit r22757.
2019-08-22 23:51:10 +00:00
0e26503cc6 Introduce IGUIObject::PlaySound to unify 19 copies of the UI sound play following 9565c60a14, refs #948.
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.
2019-08-22 22:34:12 +00:00