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 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.
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.
Unifies the four copies of the function while making it more versatile.
Supersede the hardcoded GUIRR enum and CheckIfRestricted function with a
flexible member function pointer.
Replace the custom IGUIObject iterator with a casually iterable
GetChildren getter, so that it is more obvious what it iterates on.
Implement TODO from e21ebb37f5, i.e. RecurseObject not iterating over
the base object.
Differential Revision: https://code.wildfiregames.com/D2204
Tested on: gcc 9.1.0, clang 8.0.1, VS2015
This was SVN commit r22744.
Remove the remaining of such checks after d3e56f0f57 removed 21 of them
already.
2c47fbd66a initialized the pointer at construction time rather than at
random conditional events later.
Differential Revision: https://code.wildfiregames.com/D2205
Comments By: Vladislav, wraitii
Tested on: gcc 9.1.0, clang 8.0.1
This was SVN commit r22741.
This property is defined as a boolean for every IGUIObject.
If GUIObjects were empowered to make up their own hidden property, then
they should also be empowered to use custom boolean hidden properties
that don't trigger ResetStates.
This was SVN commit r22695.
Avoid color copies for rendering Draw calls in
GUIRenderer::UpdateDrawCallCache, CButton::Draw, CChart::DrawAxes,
CDropDown::Draw, CList::DrawList, COList::DrawList, refs #1984,
8f4f8e240f, 3028551b91, a905fbbc98.
Avoid color copies during XML loading in CGUI::Xeromyces_ReadImage,
CGUI::Xeromyces_ReadEffects, COList::HandleAdditionalChildren.
Add CGUI::HasPreDefinedColor and mark m_PreDefinedColors,
CGUI::GetPreDefinedColor, IGUIButtonBehavior::ChooseColor() as const for
consistency with the other "databases", refs 3028551b91.
Mark CGUIColor as NONCOPYABLE to add compiler errors if there is an
unexplicit copy, refs 3028551b91.
Explicit ugly copy in CGUI::Xeromyces_ReadColor and
CGUIColor::ParseString.
Deregister copying <CGUIColor>GetSetting functions, refs 8f4f8e240f.
Uses the const ref GetSetting from 3dfa23cd25.
This was SVN commit r22694.
- Removed bashisms
- Removed the call to SVN update which is usually done beforehand in CI
- Removed the git alternative which is never used
- Fixed the call to poediff which seems to fail with latest poediff
Tested on Jenkins since the revamp.
Reviewed By: Gallaecio
Differential Revision: https://code.wildfiregames.com/D2078
This was SVN commit r22690.
Makes GUI text construction 30x faster for empty strings, otherwise less
than 1% faster.
Split the constructor into smaller helper functions to reduce nesting
and improve readability.
Change m_GeneratedTexts from pointer to reference, so that one doesn't
have to keep track to delete it correctly in several places, without
having to resort to copy or move assignments but constructing in place.
Mark CGUIText as NONCOPYABLE and MOVABLE which is already implicitly the
case due to the CGUISpriteInstance members, refs 0a7d0ecdde/D2133,
D2163/3028551b91.
Differential Revision: https://code.wildfiregames.com/D2168
Prepared by the GUIText.h file split in 838889ab12 / D2167.
Comments By: Vladislav
Tested on: gcc 9, clang 8, VS2015, Jenkins
Inlining tested using: clang -Rpass=inline and gcc -Winline
This was SVN commit r22679.
Fixes an occurring leak indicated by the reported clang unused variable
compiler warning, refs #5294, #5550,
by adding the missing glooxwrapper::Jingle::Session::Session destructor
.
Fix two leaks that would have occurred if the according code had been
used:
Delete unused glooxwrapper::Jingle::ICEUDP::ICEUDP instead of adding the
missing destructor.
Delete unused glooxwrapper::Jingle::Content::Content instead of adding
the missing destructor.
Explain why glooxwrapper::Client::registerStanzaExtension doesn't leak
the new StanzaExtensionWrapper.
Explain why glooxwrapper::Jingle::Session::sessionInitiate doesn't leak
the new gloox::Jingle::Content, nor the new gloox::Jingle::ICEUDP.
Explain why glooxwrapper::SessionManager::registerPlugins doesn't leak
the new gloox::Jingle::Content and new gloox::Jingle::ICEUDP.
Explain why glooxwrapper::SessionManager::createSession doesn't leak the
gloox::Jingle::Session.
I will not leak memory in the glooxwrapper.
I will not leak memory in the glooxwrapper.
I will not leak memory in the glooxwrapper.
Use references in the StunClient and glooxwrapper to anticipate any
confusion as to whose obligation it is to delete variables when they are
passed around across several files.
Use static_cast and reinterpret_cast instead of C-style casts in the
StunClient.
Differential Revision: https://code.wildfiregames.com/D2094
Refs D2093 for the reported leaks.
Reviewed By: Josh
Comments By: fcxSanya, Vladislav for D2094, and echotangoecho, leper in
61261d14fc
This was SVN commit r22678.
Allows coding the GUI without global functions which break
prototype-oriented coding, refs #5322, fixing the concern in 4b1297b328.
Supports stacked message boxes and removes the according workaround.
Change structree / civinfo switch-dialog code from 760a47335d to perform
the callback for page that actually registered the callback.
Ensure the parent that the callbackhandler is always called if the page
is closed.
Merge PopGuiPage and PopGuiPageCB following that choice, incidentally
leaving cleaner code.
Differential Revision: https://code.wildfiregames.com/D1684
Comments by: Yves, Vladislav, wraitii, leper
This was SVN commit r22676.
std::thread crashes when destroyed without being joined or detached.
Joining would wait on the UPnP thread, which can take upwards of 10
seconds, so detach instead.
Reviewed By: elexis
Differential Revision: https://code.wildfiregames.com/D2181
This was SVN commit r22674.
Silences a GCC 9 warning and the logic was faulty.
Reported by: elexis
Differential Revision: https://code.wildfiregames.com/D2180
This was SVN commit r22670.
This reworks wind-speed computation to not use a blurred-heightmap
approach but rather a slightly more wind simulation approach. It fixes
issues near the edges of some maps.
Differential Revision: https://code.wildfiregames.com/D1721
This was SVN commit r22668.
This removes pthread mutexes/threads from:
- vfs
- the resource handler manager
- timer
- the network server.
This allows removing it from our general posix include header.
Differential Revision: https://code.wildfiregames.com/D1920
This was SVN commit r22666.
It is wrong because the predefined colors should be loaded from the GUI
page that requests to have the color parsed, which may be different from
the topmost page.
Similar to FindObjectByName removed in f9b529f2fb.
Achieve this by implementing the CGUISetting<CGUIColor>::FromJSVal
specialization, moved from ScriptInterface::FromJSVal<CGUIColor>,
instead of adding a CGUI pointer to CGUIColor.
Mark ScriptInterface::FromJSVal<GUIColor> and inherited
CColor::ParseString explicitly as deleted, so that people get a compile
error if they forget to check for predefined colors when parsing a
color.
Refs #5387, D1746 > D1684 > this > f9b529f2fb, 9be8a560a9, 415939b59b,
2c47fbd66a, 85a622b13a.
Differential Revision: https://code.wildfiregames.com/D2108
Tested on: clang 8, VS2015
This was SVN commit r22663.
Optimise MakeGoalReachable using global regions, by leveraging the fact
that we can easily know which goal regions we can reach. Particularly
for point-goals, it becomes almost instant.
This does not change hashes.
Differential Revision: https://code.wildfiregames.com/D1835
This was SVN commit r22653.
MapGenerator, TextureConverter, and some other files used pthread.
Differential Revision: https://code.wildfiregames.com/D1917
This was SVN commit r22649.
A call to SelectAnimation("idle") was left over.
Reported by: elexis
Fixes#5552
Differential Revision: https://code.wildfiregames.com/D2169
This was SVN commit r22648.
In eab4f9fdde the `gender`-tag was replaced with `phenotype`. the
checkrefs script however was not updated and complained.
b637fdbae9 introduced a map that checkrefs did not validate.
Based on a patch by: Freagarach
Differential Revision: https://code.wildfiregames.com/D2141
This was SVN commit r22647.
Improves separation of concerns and makes the code less error prone,
since the IGUIObject classes can't break CGUI private members without
CGUIs help anymore.
This is achieved by making CGUI GetFocusedObject, UpdateObjects public,
by introducing public CGUI GetBaseObject, GetMousePos, GetMouseButtons,
HasStyle, GetStyle getters,
and by removing the pointless IGUIObject GetMousePos proxy.
Delete GetGUI() checks that are either always or never true following
2c47fbd66a.
Use const references instead of copies for some mouse positions.
Differential Revision: https://code.wildfiregames.com/D2166
This was SVN commit r22641.
That is CChartData, CGUIList, CGUISeries, COListColumn, GUITooltip,
SGUIMessage, SSpriteCall, STextCall, SFeedback, IGUISetting,
CGUISetting, GUI, IGUIObject, IGUIScrollBar.
Drop copying GetSetting and SetSetting template functions for CGUIList,
CGUISeries, CClientArea, CGUIString.
Stop copying COListColumn.
Drop copying GUI<CClientArea>::GetSetting call in
IGUIObject::UpdateCachedSize() and four copying
GUI<CGUIString>::GetSetting calls in SetupText() functions.
Delete unused GUIRenderer IGLState class from 849f50a500 obsolete since
1f5b8f1c9a.
Differential Revision: https://code.wildfiregames.com/D2164
This was SVN commit r22638.
Introduce MOVABLE idiom indicating that a class can use move semantics.
Make values of CGUI struct maps holding XML data const to ensure at the
root that the data is not modified.
Use NONCOPYABLE and MOVABLE for SGUIIcon and SGUIStyle to enforce the
non-copy policy on the compiler level (until someone changes the GUI
design to make modifications needed).
As indicated by that:
Replace copy operations by in place move operations for these CGUI
struct maps in the CGUI Xeromyces XML loading functions.
Replace copy operations by const references for CSize and SGUIIcon in
CGUIString::GenerateTextCall and CGUI::GenerateText.
This avoids copying of non primitive members, such as the strings and
containers of strings.
Further related cleanup to be kept separated for auditability.
Differential Revision: https://code.wildfiregames.com/D2163
Few comments on IRC by: wraitii, Itms
Tested on: gcc 9, Jenkins, partially VS2015
Refs #1984,
NONCOPYABLE CGUISpriteInstances: 0a7d0ecdde, 8f4f8e240f, c19f3608a5
NONCOPYABLE Image, Sprite: fb8032043b
NONCOPYABLE GUI page: 94c57085e9
NONCOPYABLE GUIManager: 7c2e9027c2
NONCOPYABLE macro: 16ccae10cd
This was SVN commit r22637.
This breaked a SM assertion, which was only caught in debug mode. It
could have led to subtle bugs during the compilation of JS scripts.
Still set the flag to its default value, because SM devs wanted to
change the default in the future.
This was SVN commit r22629.
This removes the trigger for an unidentified VS2015 bug revealed by the
IGUIObject::AddSetting / CGUISetting constructor in 85a622b13a
(unset GUIObject color settings didn't hold the color assigned in the
inherited default constructor, so hovered button text appeared black
instead of white on Windows).
The code in the two commits seems correct, but VS2015 doesn't seem to
implement it correctly (and claims to support C++17) while clang and gcc
behave as intended.
Fix whitespace.
Reported By: gameboy, Angen
Refs
https://wildfiregames.com/forum/index.php?/topic/26694-strange-font-color/
This was SVN commit r22617.
This moves the renderer options into their own class to:@
- allow one to only include the rendering options, not the whole
renderer header, when one wants access to rendering options.
- centralise rendering changes and their side-effects.
- clean up code.
Tested by: historic_bruno, Freagarach
Commented by: historic_bruno
Differential Revision: https://code.wildfiregames.com/D1929
This was SVN commit r22610.
Use the "pretend correct path" behaviour for short goals too. This is a
fix for #5545, since the position check now works correctly without
needing to add a tricky check for path-vs-path distance.
Simplify HandleObstructedMove to use ComputePathToGoal more. This means
we occasionally compute a long path when stuck, which fixes two cases of
stuck units reported in #5547.
Move some common calls into functions for convenience.
Make sure the short-path-waypoint-range-relaxing introduced in
32e8ed51aa doesn't happen for the last waypoint, which caused units to
occasionally never get in range of the last waypoint.
Clear short path waypoints when computing a long path.
This won't fix all instances of unit dancing, but it should improve most
of them.
Fixes#5545, Fixes#5547
Differential Revision: https://code.wildfiregames.com/D2135
This was SVN commit r22609.
Use std::thread and thread_local instead of pthread specific calls.
Differential Revision: https://code.wildfiregames.com/D1916
This was SVN commit r22608.
The function was located in the wrong file, because it is not logically
related to IGUIObject settings.
The separate file allows the various users to include it without
including the GUIRenderer.
This was SVN commit r22605.
This means the type information is available for all methods operating
with the setting type, which is easier for the authors, allows for
compile-time checks and optimizations.
Remove the enum that was used to indirectly obtain the setting type at
runtime.
Revises SGUISetting and enum from e326ebae46 (5122b0f906),
std::function from 82f1d2718b.
Differential Revision: https://code.wildfiregames.com/D2145
Tested on: gcc, clang, VS2015, Jenkins
This was SVN commit r22604.
Revise 53b335f5ae in CInput::UpdateBufferPositionSetting to use the
SkipMessage argument from 4113aa0a36 to prevent the infinite loop
instead of hijacking the pointer.
This was SVN commit r22603.
Retract IGUIObject override keyword from that commit, because clang
recommends to use it for either every or no overriding class member
(which then should be done consistently for all classes inheriting
IGUIObject, refs D2144).
This was SVN commit r22602.
JSI_IGUIObject should not contain functions that work only for some GUI
Object types, refs #5442.
Deduplicate the shuffled copy of CText::SetupText.
Avoid the 80 times slower dynamic_cast mandated by the virtual class
inheritance by adding an ugly overridable pointer to the base class
pointing at this derived classes, as bargained with Vladislav and
proposed by wraitii in D1781 id=8426.
This may be improved by refactoring the IGUIObject and JSInterface
classes to use templates and / or eliminating its virtual inheritance.
Implement and use FromJSVal / ToJSVal CSize specialization.
Remove the JS::CallArgsFromVp call.
Differential Revision: https://code.wildfiregames.com/D2136
Comments By: wraitii, Vladislav
This was SVN commit r22596.
Remove the comment from 53bcba3368 that allures the reader to believe
there is a memory leak which is not and has not been the case, refs
D1700.
Remove the useless JSAutoRequest from GetJSObject if the object was
constructed already (performance improvement), following cx assignment
in 4b1297b328, following JSAutoRequest addition in e9e05f4efc (that also
had removed other useles JSAutoRequest calls but not this one).
Don't change JS::PersistentRooted to JS::Heap until SpiderMonkey is
updated, refs D1700.
Provide access to GUI, ScriptHandlers and JSObject for inheriting
classes.
This was SVN commit r22593.
Reported by Jenkins, but not gcc, clang, VS2015.
Take the opportunity following 2c47fbd66a to make the CGUI pointer held
by IGUIObject constant (the address, not the value).
Differential Revision: https://code.wildfiregames.com/D2139
This was SVN commit r22589.
Call JS_AddExtraGCRootsTracer and JS_RemoveExtraGCRootsTracer depending
on JS::Heap use instead of on CGUI page link setup.
GUIObjects should be able to access the GUI page independent of the
scripting (for example to obtain PredefinedColors, refs D2108).
Refs: D2108, c02a7e1a7b
Comments By: wraitii
This was SVN commit r22587.
A random phenotype can be chosen by giving multiple tokens to the
template.
This allows giving different looks to the same template.
Comments By: stan, vladislav, elexis
Patch By: Freagarach
Reviewed By: wraitii
Differential Revision: https://code.wildfiregames.com/D1955
This was SVN commit r22586.
Make CGUISpriteInstance non-copyable to further harden Philips
protection from 8f4f8e240f against unintentional copies of its DrawCall
cache such as in c19f3608a5.
Remove its copy constructor from 849f50a500, make it movable, and until
it becomes otherwise necessary, force move assignment when sprites are
assigned.
Improves the fixes of the compiler warnings about deprecated implicit
copy constructors in 8a32b0b3d4 by avoiding the copies instead of
copying explicitly.
Add ToJSVal, FromJSVal for CGUISprinteInstance to make
JSI_IGUIObject::getProperty and setProperty more consistent.
Rename Sprite operator= to SetName to reduce ambiguity.
Pass CRect by reference in CGUISpriteInstance::Draw.
Differential Revision: https://code.wildfiregames.com/D2133
Comments By: wraitii
This was SVN commit r22570.
BeginPathing renamed to ComputePathToGoal, as that is what this function
does.
IsMoving renamed to IsMoveRequested, as the function returns true when
the unit has a move request going on, not when it is actually moving
across the map, which was misleading.
UpdateMovementState's implementation moved closer to where it is used.
PathIsShort and WAYPOINT_ADVANCE_MAX are currently unused, thus deleted.
Differential Revision: https://code.wildfiregames.com/D2067
This was SVN commit r22568.
This helps with #3144 and units not going idle when ordered to clump
together.
By rejecting paths that would not take the unit closer to the goal than
it is, we can avoid the case where a unit at A finds a short path to B,
goes there, gets stuck, finds a new short path to A, etc. ad infinitum.
It doesn't completely fix the problem since two units moving might still
occasionally become stuck against one another, but it makes it rarer
(unit pushing would probably finish solving this).
This assumes that being as close as possible to the goal is the best
behaviour when trying to move somewhere, even when it is unreachable.
Refs #3144
Differential Revision: https://code.wildfiregames.com/D2075
This was SVN commit r22566.
Delete GetSetting/SetSetting variants that operate on a GUI page other
than the one that the setting is defined in; introduced in c2a71e41bf,
obsolete since f0d9806b3f.
Delete CInternalCGUIAccessorBase::GetObjectPointer as these variants
were the only caller for that.
Delete CInternalCGUIAccessorBase::HandleMessage from a08cbd2f74 as it's
an unnecessary proxy.
Delete CInternalCGUIAccessorBase::QueryResetting from 953f72a91c by
making ResetStates public, equal to UpdateCachedSize from 90bbd48a14
(public required for VS2015 but not gcc 9).
Move ResetStates to implementation file.
Tested on: gcc 9, VS2015
This was SVN commit r22563.
JS_ReportError was passed a CStr, which it doesn't support.
Reviewed By: elexis
Differential Revision: https://code.wildfiregames.com/D2131
This was SVN commit r22561.
The type differs from the Color type, because contrary to Color, it can
be created from a color predefined in the GUI page (such as "yellow").
Move this predefined color check to the new class instead of hardcoding
it in FromJSVal / ToJSVal, GUIUtil, JSInterface_IGUIObject and to
straighten the latter.
Delete fov_wedge_color from Minimap, unused since introduction in
5275dc862b.
This was SVN commit r22558.
Move EAlign and EVAlign JS<->C++ conversions to FromJSVal and ToJSVal
for consistency.
Remove alternative / british spelling "centre".
Use i32 instead of int since at least and at most 32 bits are intended
there, refs 1e07787e76.
This was SVN commit r22556.
Following 3a839517ce, SparseGrid::Reset() replaces the value of m_Data
(a C-style dynamically sized array) with a new value-initialised array,
by using the new operator. Previous code simply did a memset.
This means that when m_Data was not null, it leaked memory as the
previous array was not deleted.
SparseGrid::Reset is called when destroying the sparse grid, and a
SparseGrid is used by the long pathfinder when computing JPS paths. As
that is called rather often, it resulted in a relatively serious memory
leak that could make very long games use several GB of memory.
This fixes the leak by using placement new, which re-uses the memory,
effectively doing the same as the previously existing memset.
Profiling by historic_bruno and elexis showed that performance from
value-initialising with placement new was at worst similar to memset,
and testing shows this was compiled in a memset call in several cases
anyways.
Reviewed By: elexis
Fixes#5522
Differential Revision: https://code.wildfiregames.com/D2121
This was SVN commit r22545.
- ca9109be75 moved SwapBuffers inside Render - this makes Atlas call it
twice in a row which might behave oddly (did not seem to though) and
anyways was wasteful.
- ca9109be75 moved IdleTask from the sound manager outside of Render.
This means atlas never called IdleTask, and this broke sounds after a
few seconds.
Reviewed By: Angen
Differential Revision: https://code.wildfiregames.com/D2029
This was SVN commit r22544.
Consistently warn instead of using implicit conversion when not passing
a boolean, for consistency and callers being more cautious with passed
values.
This was SVN commit r22538.
* JSI_GUIColor::construct and JSI_IGUIObject::setProperty hunk are
duplicates of FromJSVal, getProperty of ToJSVal, following 7c2e9027c2.
* The constructor, it's fallback magenta and toString have never been
used by JS.
* A JS color class providing some methods (such as found in color.js,
refs #5387, and the unused toString redundant with rgbToGuiColor, see
also eee8217b45) is more inviting to changes and maintenance if defined
in JS and can still be instantiated in C++, like the Vector2D (see also
65b02395b3).
* PredefinedColors (such as "red" or "green") can be obtained from the
prototype without defining the class in C++.
* Minimize ugliness by removing macrosity, refs 8ceb41212d.
Rename alpha to a in guiToRgbColor from eee8217b45 for consistency with
the C++ conversions (opaqueness had been skipped in the only callers of
this JS function yet).
Delete unused GUISTDTYPE Mouse in header forgotton in 8734efca94.
This was SVN commit r22534.
This fixes a regression introduced by 055c848c1a: when an entity is
ordered to move to a target within short path distance (or direct path
distance), it no longer computed at least one long path, which meant it
could be stuck forever if the target was not actually reachable (such as
behind a wall).
To fix this, compute a long path after 3 failed computations, which
should result in a delay of 1-3 turns. The previous code did this after
1 failed try - the decision to make it 3 is mostly based on the idea
that in most cases, being stuck means we ran into units, not that we
were ordered somewhere close. Should there be complaints, it could be
lowered to 2 or 1.
This fixes a second issue, reported in #4473: units sometimes get stuck,
particularly when trying to garrison a turret from 'inside' the walls.
The issue is that the turret is not accessible via the inside as its
obstruction + garrison range is blocked by the surrounding walls.
However, as introduced by 6e05a00929, TryGoingStraightToTargetEntity
ignores all entities with the obstruction group of the target (the
reason for this being that otherwise it would never succeed, since the
line towards the target would likely go through the target).
For walls and formations, this means ignoring possibly too many
entities, and in the case of #4473, ignoring wall pieces. The unit thus
mistakenly thought it could direct-path to the turret, and got stuck.
To fix this, we can ignore specifically the targeted entity's
obstruction tag. This can be considered a fix to 6e05a00929.
temple accepted an earlier version of this patch (specifically elexis'
version).
Fixes#4473
Based on a patch by: elexis
Differential Revision: https://code.wildfiregames.com/D1424
This was SVN commit r22533.
The constructor is invalid, because one cannot create or obtain and pass
an IGUIObject C++ class instance pointer via JS, only triggering a crash
when doing something with it.
If there was a use case, the GUIObject should be created with a
GUIObject type specific constructor.
Remove obsolete getProperty comments.
From D1699, refs #5369 and wraitiis equivalent:
Differential Revision: https://code.wildfiregames.com/D1933
This was SVN commit r22530.
As reported by #5521, Ordering units to walk to a point in a forest can
lag terribly, as units will end up computing long short paths in the
forest, which can result in `ComputeShortPath` calls that individually
take upwards of 80ms.
This can be alleviated by allowing units to stop a bit earlier. A23
handled this in UnitMotion directly, but it's better to handle this in
UnitAI to avoid surprises and to make it customisable on a per-state
level.
This diff further speeds up using the short pathfinder by starting with
a smaller search range, limiting the max-range more and moving the range
slightly towards the goal.
This also refactors UM sending messages to UnitAI so that we may in the
future push more information (in particular, the entity_id that a unit
was obstructed by could be interesting for COMBAT).
This doesn't fix the possibility of lag, but it reduces its occurrence
to levels that should be similar to A23 and thus acceptable enough.
Tested By: Freagarach
Fixes#5521
Differential Revision: https://code.wildfiregames.com/D2105
This was SVN commit r22526.
Removes a few non-behavioral workarounds for older versions.
Refs #5502, #2891.
Accepted By: asterix
Comments by: vladislavbelov
Differential Revision: https://code.wildfiregames.com/D2076
This was SVN commit r22508.
Units right now try going to their next long waypoint using the
short-range pathfinder. This works, but it tends to leads to units
clumping together when shuttling for example.
By switching to short paths earlier, and by scrapping the long waypoints
when doing so, we can make movement more natural until we have unit
pushing.
Some cleanup in how the short-path domain range gets handled, and
increase the max-range by one tile to improve rare cases.
Differential Revision: https://code.wildfiregames.com/D2095
This was SVN commit r22507.
Port the script to Python 3, fix some bigs in it, and remove whitespace
from the output.
Reviewed By: bb
Differential Revision: https://code.wildfiregames.com/D1810
This was SVN commit r22499.
As reported by @bb in #5512, catapults and other big-range units might
not approach targets correctly when trying to get in range.
To be sure that we will be in range of a square obstruction approximated
as a circle, we need to consider the inscribed circle and not the
circumscribed circle.
Reported by: bb
Fixes#5512
Differential Revision: https://code.wildfiregames.com/D2086
This was SVN commit r22495.
5c642611c4 introduces undefined behaviour: for vertices that are part of
non-AA squares, the value of "quadOutward" is undefined. This fixes that
by again setting it to QUADRANT_ALL by default, as it was pre
5c642611c4. This led to OOS.
Reviewed By: elexis
Fixes#5508
Differential Revision: https://code.wildfiregames.com/D2082
This was SVN commit r22483.
Add two missing error reports.
Move sanity check prior to the first variable use.
Differential Revision: https://code.wildfiregames.com/D1817
Patch By: Angen
This was SVN commit r22476.
Three changes:
- Assume a certain incertain based on distance to the target, to avoid
recompute paths every turn when the target is far way and moving.
- Handle cases where the target is unreachable to the long-range
pathfinder and we would be recomputing every turn.
- If we went straight, assume we don't need to recompute a path.
These together make moving entities recompute paths far less often,
speeding up the game.
Differential Revision: https://code.wildfiregames.com/D2066
This was SVN commit r22474.
Compute the outward quadrants once and for all instead of setting them
dynamically, because there is no reason why we should always arrive from
the same quadrant as the first time we see a vertex.
Don't consider quadrants for the start-vertex, because of the edge
expansion (which can put us in illegal quadrants)
These result in (much) better paths, the tradeoff being that we now look
at some more vertices.
Fixes#5476
Differential Revision: https://code.wildfiregames.com/D1908
This was SVN commit r22473.
Since m_ExpectedPathTicket.m_Type is uninitialised before being used,
serialisation could fail with an out of bouds error. This fixes it by
giving it an (arbitrary) default value.
Reported by: gameboy
Confirmed and debugged by: Angen
Reviewed By: Angen
Differential Revision: https://code.wildfiregames.com/D2074
This was SVN commit r22470.
Contrary to wxWidgets documentation, wxMenuEvent::GetMenu() can return
NULL when the system menu is accessed on wxMSW, see
https://trac.wxwidgets.org/ticket/18443.
This was SVN commit r22467.
This adds back the "domain" edges to the short/vertex pathfinder.
Without these edges, units could use points far away from the path
search that they inaccurately thought were reachable, leading to some
pathing oddities in rare cases.
Reviewed By: temple
Differential Revision: https://code.wildfiregames.com/D443
This was SVN commit r22465.
Reorder code flow, handle long paths and short paths in a more explicit
manner, and only fail after a certain number of failed path computations
to avoid going idle too easily.
Make sure WALKING orders in UnitAI stop when the move fails to avoid
units being stuck.
Differential Revision: https://code.wildfiregames.com/D1907
This was SVN commit r22464.
As reported by @Freagarach on #5496, there can be broken behaviour as
UnitMotion::PathResult may call RequestLongPath with an uninitialised
path goal when ComputeGoal fails.
To fix this, check the return value everywhere and react accordingly in
case of failure.
Fixes#5496
Differential Revision: https://code.wildfiregames.com/D2063
This was SVN commit r22458.
m_PathState kept 3 pieces of information that can be deduced using other
variables:
- whether the entity was following a path. This can be better deduced
by checking if the entity has short/long waypoints.
- whether a path is currently being requested. This can be better
deduced by checking the value of m_ExpectedPathTicket
- whether the requested path is long or short. This can be stored
directly alonside the path request ticket number, making it more obvious
why it exists.
With these changes, m_PathState can be removed.
Differential Revision: https://code.wildfiregames.com/D1903
This was SVN commit r22456.
It is generally better to use the movement request data as that is our
actual target and goals are just a representation of that at any given
time. Where a PathGoal is required, compute this lazily.
This allow failing easily in MoveToX() functions if the goal cannot be
computed.
Differential Revision: https://code.wildfiregames.com/D1902
This was SVN commit r22452.
Introduced by 70e22e2923. PositionChanged messages sent between
MT_Destroy handling in CmpObstruction and the actual destruction of the
component could re-recreate an obstruction, which would then live
forever in the obstruction manager.
This prevents that by de-activating the obstruction when it is
destroyed, so that further PositionChanged messages do nothing.
Differential Revision: https://code.wildfiregames.com/D2060
This was SVN commit r22451.
MoveToPoint and MoveToTarget both compute a goal from a move request.
They can be combined to reduce duplication and streamline the code.
Differential Revision: https://code.wildfiregames.com/D1984
This was SVN commit r22450.
HandleObstructedMove contains logic to drop long waypoints, should they
be occupied by units (because that can get the pathfinder stuck, since
the long-range pathfinder can find a path, but not the vertex one).
However PathResult already drops waypoints this way, so this code can be
removed for simplification.
Differential Revision: https://code.wildfiregames.com/D1981
This was SVN commit r22448.
This fixes a number of issues with formations:
- Gives the controller an obstruction. This fixes the bug where units in
formations can't gather from a tree.
- Stop special-casing formation members in PathResult. This fixes
formation members being stuck in-place when they run in an obstruction.
- Makes sure units stay in Formation.IDle when they are idle so that
D1337/D1901 can work correctly in the IDLE state.
- Warn if animals enter this state.
- Make sure that formation members that end up in INDIVIDUAL.IDLE go
back to FORMATION.IDLE for sanity and for better housekeeping (refs
#3144 - fixed completely upstream).
Differential Revision: https://code.wildfiregames.com/D2048
This was SVN commit r22447.
Use UpdateMovementState to inform the visual actor of the unit's speed,
which cill update the movement animation accordingly.
The removes the need for UnitAI to handle movement animation using the
special "move" state.
Differential Revision: https://code.wildfiregames.com/D1901
This was SVN commit r22446.
The animation overrides are a little awkward. Instead, use animation
variants, which allow defining different animations (and props and such)
easily for different units in a formation.
This lets us clean up the special C++ code to override the walk
animations.
It continues the work started by 8446b92f1b.
Original Patch By: temple
Differential Revision: https://code.wildfiregames.com/D1337
This was SVN commit r22442.
Following D1899/98f609df1d, we have logic that can handle calling
MoveSucceeded() even if we don't go through the special STATE_STOPPING
state, and following D1898/8ac104b07a we no longer need STATE_STOPPING
for animation sync either.
m_State can therefore be entirely removed as it is redundant with other
information.
Differential Revision: https://code.wildfiregames.com/D1900
This was SVN commit r22441.
After the recent UM changes, units sometimes chase/flee forever as they
can never actually get in range.
This is because moving to the current target's position is not enough
when the target is moving.
By accounting for the target movement's in ComputeTargetPosition, the
behaviour is much improved.
Differential Revision: https://code.wildfiregames.com/D1987
This was SVN commit r22431.
This new version compares the final waypoint with the target's
obtruction shape and uses reachability checks to know if we will be in
range or not.
Differential Revision: https://code.wildfiregames.com/D1983
This was SVN commit r22430.
This is a partial revert of 4fda917f46, which skipped the
"MoveToTargetAttackingRange" in APPROACHING. I (incorrectly) assumed
that the original order was still perfectly fine, but in fact the
attacker's max range may have changed as that depends on the relative
elevation between attack and target - and so the original order might
never get us in range!
This was introduced originally in 8c74df2acd.
Add a comment to clarify this.
Further, this makes sure UnitMotion still is aware that it has a target
even if it is in range from the beginning, as that could lead
to stuckiness (and did when chasing sometimes). This was done in D1984
anyways.
Fixes#5478.
Differential Revision: https://code.wildfiregames.com/D2035
This was SVN commit r22429.
This makes it possible to merge the TryGoingStraightTo family of
function.
This means it is now called even for point goals and decreases the
likelihood of stuck units (as we take over from the long-range
pathfinder which brings units to navcell centers, which may not be in
the goal).
Differential Revision: https://code.wildfiregames.com/D1982
This was SVN commit r22426.
D981/c219ee54b2 changed IsInXChecks to use edge-to-edge distance instead
of centre-to-edge, which broke UnitMotion's min-range movement, which
assumed distance to the center.
Since units are represented as squares, the diagonal point may be closer
to the target than the "real" clearance by a factor √2, so the delta
between minimum range and maximum range should be at least `(√2 - 1) *
clearance` to be safe in all situations (this is generally not a problem
for regular units which have a clearance of 0.8, but could be one for
catapults or elephants).
Differential Revision: https://code.wildfiregames.com/D1969
This was SVN commit r22422.
Previously, unitMotion had no code that checked particularly if the
target was still in the world.
When the target moved out of the world, unitMotion would follow the path
to its last known position, then send a "MoveSucceeded" message once
there.
Following 98f609df1d, this message was no longer sent. Thus unit would
follow their path to its last waypoint and stay there, unable to carry
on or finish the order. UnitMotion now explcitly sends a "MoveFailed"
message.
This still changes behaviour from A23, requiring further revisions to
UnitAI (see D1992 for one such case).
Minohaka tested an earlier version of this change (which incorporated
D1992) and accepted it.
Differential Revision: https://code.wildfiregames.com/D1979
This was SVN commit r22415.
Due to an issue in 4a15cc3b9f, animals incorrectly tried going towards
the roaming point instead of away from it.
With that fixed, MovementUpdate still did not trigger as the min and max
range were the same.
Use -1 as max range (= infinite) instead since we want to move
arbitrarily away.
Having an infinite max range was broken in c219ee54b2, this
re-implements that.
Further, other calls with equal min and max range have been changed
likewise.
This does not entirely fix whales, which run in other problems because
of their large roaming range.
Differential Revision: https://code.wildfiregames.com/D1980
This was SVN commit r22413.
Use the default naming for both libraries (libvorbis instead of vorbis),
and use our default suffix for debug versions of the libs.
This was SVN commit r22406.
It was introduced in d295dacb9b as a way to control behavior of shaders.
Its usage in shaders was completely removed in 05008d190e (before that
in b7888aea52).
Reviewed By: elexis
Tested By: Stan
Differential Revision: https://code.wildfiregames.com/D2011
This was SVN commit r22403.
cppformat tests failed on MacOS - the global locale was not set and
defaulted to something unexcpeted.
It is now fixed to US notation.
Patch By: Krinkle
Reviewed By: wraitii
Differential Revision: https://code.wildfiregames.com/D1978
This was SVN commit r22378.
UnitMotion will now send hints that a move may be completed if:
- it is a formation member and the formation member has stopped moving.
- it isn't and it is in range from its target.
Differential Revision: https://code.wildfiregames.com/D1899
This was SVN commit r22366.
Units in 0 A.D. exhibited a "gliding" behaviour at the end of a
movement, e.g. they switched to the Idle animation and still moved a
little bit.
The reason for this behaviour is that entities check if they reached
their destination after moving. Other components (unitAI mostly) will
then possibly change animations and such, resulting in a movement over
the turn while the entity is possibly now in another animation state
than "move".
Instead, what should be done is checking if the entity has arrived
before moving, so if UnitAI calls StopMoving, then entity won't move at
all on the same turn, and the gliding effect vanishes.
The STATE_STOPPING state is made un-necessary by this change, since this
off-by-one mistake was the reason for its existence. It can be removed
(see downstream).
Differential Revision: https://code.wildfiregames.com/D1898
This was SVN commit r22365.
Move() is generally 4 parts:
- Moving
- Updating our state
- Handling obstructed moves
- Checking if we are at destination.
These can all be put in their own functions, clarifying logic and making
it harder to make mistakes.
Differential Revision: https://code.wildfiregames.com/D1897
This was SVN commit r22364.
In preparation for D1897, this logic isn't related to the "movement"
part of Move(), and can be called earlier.
Differential Revision: https://code.wildfiregames.com/D1896
This was SVN commit r22363.
The obstruction manager keeps a flag of moving units. This should be
updated in the same location as the entity's current speed, since they
have similar properties.
Differential Revision: https://code.wildfiregames.com/D1895
This was SVN commit r22362.
VisualActor refers to unit motion's `m_CurSpeed` to know what animation
to display in the special walk mode. However that variable was
inconsistently updated. By making sure we reach that codepath in one
place, we remove opportunities for issues.
This should fix most existing instances of moonwalking, another upstream
diff will fix the rest.
Differential Revision: https://code.wildfiregames.com/D1894
This was SVN commit r22361.
FacePointAfterMoving intends for the unit to face the destination once a
move is done. Since 4fda917f46, stopping is the responsibility of UnitAI
(through a call to StopMoving()). Thus we should move that code in that
function, as this ensures we don't forget to do it and removes
duplications.
Differential Revision: https://code.wildfiregames.com/D1889
This was SVN commit r22355.
The variable is not necessary since having a target is equivalent,
removing it thus reduces redundant state.
Differential Revision: https://code.wildfiregames.com/D1888
This was SVN commit r22354.
These variables together held the state for the target of UnitMotion, as
set by the MoveTo[X] family of functions.
Wrapping them in a struct reduces the chances that one will accidentally
forget to reset part of the state and makes it explicit in-code that
these are grouped together.
Calling StopMoving() resets this target, which wasn't before and left
the component in an incoherent state.
Differential Revision: https://code.wildfiregames.com/D1887
This was SVN commit r22352.
UnitAI is now solely in charge of moving and stopping, making UnitMotion
behaviour easier to predict, which will ultimately help with unitAI
development. It might temporarily make units more resilient than before
however.
UnitMotion also tells UnitAI that it's arrived with "MoveCompleted"
messages, but these actually could be wrong - unitAI could decide that
we didn't want to stop after all - so change the name for something less
misleading.
Differential Revision: https://code.wildfiregames.com/D1886
This was SVN commit r22351.
"MoveStarted" messages were sent by UnitMotion when the unit started
moving (sort of) or failed to do so. This was used by formations and
guarding but was not really necessary as this can be done in "enter" or
in a timer.
Differential Revision: https://code.wildfiregames.com/D1885
This was SVN commit r22350.
These functions were placed in UnitMotion, which had nothing to do with
range checks and made them available only to moving entities for no
particular reason.
This patch also adds support for square-square range checks and
shape-shape distance checks.
Modified from a patch by bb on top of work from wraitii.
Differential Revision: https://code.wildfiregames.com/D981
This was SVN commit r22345.
ThreadUtil shipped a scope lock and a mutex implementation, which can be
removed since we now have these in the standard library.
This lets us clean up this header which get included everywhere (through
profiler includes).
Tested By: Angen and Stan
Differential Revision: https://code.wildfiregames.com/D1915
This was SVN commit r22344.
0c20afdfda had two issues:
- some of the unitAI code did not return true when switching states in
the "enter" phase
- missed a return false in unitMotion.cpp
This fixes the issue noticed by @bb.
Differential Revision: https://code.wildfiregames.com/D1947
This was SVN commit r22339.
- Move the * and & to the correct side,
- Add .0 and 0.f to clearly mark the types
- Pass pointers instead of arrays
- Add a newline after forward declaration
- Add spaces between operators
- Use c++ cast
Reviewed by: @vladislavbelov
Differential Revision: https://code.wildfiregames.com/D1934
This was SVN commit r22323.
Move checks for rendering a frame in Render() to avoid missing calls to
this functions, which can crash on certain systems.
Move the sound manager's idle task out of Render().
Move the buffer swapping in Render() since we do not need to swap
buffers unless we are rendering.
Patch By: Angen
Reviewed By: wraitii
Differential Revision: https://code.wildfiregames.com/D1495
This was SVN commit r22314.
This also moves the actual "moving" code to states instead of orders,
making states more self-contained and removing the change of errors when
cleaning up a state.
Differential Revision: https://code.wildfiregames.com/D1865
This was SVN commit r22313.
Having Async in the name was not really informative and made it awkward
to reuse for non-async code.
Reviewed By: Kuba386
Differential Revision: https://code.wildfiregames.com/D1854
This was SVN commit r22305.
Expect a 10-25% build time improvement.
Original Patch By: Angen
Reviewed By: Angen
References #5038
Differential Revision: https://code.wildfiregames.com/D1333
This was SVN commit r22303.
Destroying INVALID_ENTITY is valid and should do nothing.
The current code will send MT_Destroy messages when doing this, which is
un-necessary work and feels kind of broken to me.
Early-exit instead.
Reviewed By: Itms
Differential Revision: https://code.wildfiregames.com/D1736
This was SVN commit r22300.
It improves readability of the code when a function that seems like it
does a simple check actually only does a simple check and the caller is
the one changing state.
Differential Revision: https://code.wildfiregames.com/D1884
This was SVN commit r22299.
This improves refractions around entities close to the surface, such as
fishes, by handling depth better and by clipping the water plane a
little lower.
This uses the skybox for reflections when refractions are enabled but
reflections are disabled, making it possible to play with reflections
disabled without having super-ugly water (arguably a performance
improvement).
Differential Revision: https://code.wildfiregames.com/D359
This was SVN commit r22297.
Speed up edge update by being clever, only updating dirty tiles instead
of everything (effectively doing to "TODO be clever" here).
This is a substantial speed improvement when an update is necessary.
Differential Revision: https://code.wildfiregames.com/D1834
This was SVN commit r22279.
Following 809f297707, this decouples the hierarchical pathfinder and the
long pathfinder. The long pathfinder was the class owning the
hierarchical pathfinder, which didn't particularly make sense and
resulted in some interface awkwardness.
At the moment, the long pathfinder still needs to hierarchical
pathfinder to compute paths (to make sure they are reachable).
Differential Revision: https://code.wildfiregames.com/D1867
This was SVN commit r22278.
This:
- cleans up a code duplication and clarifies the intent.
- reorders things around for clarity
- improves variable names.
Commented By: elexis
Differential Revision: https://code.wildfiregames.com/D1840
This was SVN commit r22277.
The vertex pathfinder was implemented directly in CCmpPathfinder,
instead of being a separate helper like the hierarchical pathfinder or
the long pathfinder.
This moves it to its own helper VertexPathfinder, which gets us ready
for D14 and pathfinder threading. Some struct definitions need to be
moved around.
Differential Revision: https://code.wildfiregames.com/D1855
This was SVN commit r22253.
Because of the limited precision of our fixed-point numbers, the
timeLeft calculation could sometimes return results above the actual
time left, resulting in units moving a few fixed::epsilons farther than
they should be, which makes them switch to the running animation. This
was rather unstable however, so there was a constant 'flickering'
between walking and running.
If we divide last instead of first in the operation, the errors get
gobbled up by the division and we no longer have this issue.
Reported by: wowgetoffyourcellphone
Differential Revision: https://code.wildfiregames.com/D1856
This was SVN commit r22249.
Motive behind the change: calls to Profile() currently crash unless they
are triggered from the main thread, but it's somewhat difficult to know
that from the code. It makes more sense to silently ignore those
particularly so we can easily have the same code be threaded or not.
This also removes a few profiling calls that don't make much sense.
Differential Revision: https://code.wildfiregames.com/D1853
This was SVN commit r22248.
Debug variables are kept mutable as one otherwise has to use a complex
system and this is really not worth it.
Reviewed By: vladislavbelov
Differential Revision: https://code.wildfiregames.com/D1491
This was SVN commit r22219.
FindPassableRegions intends to return all passable regions in a chunk,
but did not as it used the number of regions in that chunk. In fact,
regions can have individual IDs higher than the number of regions (as
shown by the test), therefore FindPassableRegions might miss some.
This only affected the JPS pathfinder, when starting on an impassable
cell, which called FindNearestPassableNavcell with then possibly
returned a sub-optimal navcell. This is a limited impact but upcoming
patches will rely on that function more.
Fixed using a vector to store IDs, which also makes for-range loops
usable.
Differential Revision: https://code.wildfiregames.com/D1832
This was SVN commit r22218.
Includes some style normalization.
Refs 60cfd2d16c.
Patch By: Stan
Reviewed By: vladislavbelov, Itms
Differential Revision: https://code.wildfiregames.com/D1845
This was SVN commit r22216.
Use at() over find() as it makes the code neater and the performance
impact is negligible.
This forces an algorithm change in FindReachableRegions as the key
accessed is not guaranteed to exist.
Differential Revision: https://code.wildfiregames.com/D1830
This was SVN commit r22210.
These variously test some simple MakeGoalReachable and
FindNearestNavcell calls, as well as checking edges and regions when
updating the map.
Differential Revision: https://code.wildfiregames.com/D1833
This was SVN commit r22205.
f0d9806b3f added a problem: Engine.GetGuiObjectByName is unaware of the
caller GUI page.
So GUI pages in the background that still run the onTick and other event
code tried to look on the topmost GUI page, rather than their own GUI
page.
9674c3c0fe added a workaround that has to be copied to any place that
can call JS code.
If developers don't know about the reason for this workaround and add a
new place that can call JS code (#5369), they won't be able to implement
anything.
This removes this workaround by passing the pointer to the correct GUI
page as callback data.
Patch By: elexis
Reviewed By: wraitii
Refs #5369
Trac Tickets: #5369
Differential Revision: https://code.wildfiregames.com/D1701
This was SVN commit r22200.
This changes running speed into a running multiplier (of walk speed).
The advantage is that it simplifies code since you can setup a default
run multiplier at the template level and it'll work for all subsequent
templates, and technologies cannot forget to change it. It makes
specialised unit templates easier to maintain, too.
Formations have a 100 run multiplier which effectively sets their
maximal walking speed at 100
Reviewed By: bb, O2 JS Simulation
Differential Revision: https://code.wildfiregames.com/D438
This was SVN commit r22197.
The variable was introduced in 492e49da38 without being used, neither
did it become used in a later commit. To me it seems that it is a
left-over from a copy paste, as the ".left" functions do use the
variable.
Notice 74c420f658 did cleanup around these lines, but did not remove
this variable
Patch By: Angen
Differential Revision: https://code.wildfiregames.com/D1813
This was SVN commit r22166.
C4458 in AtlasObjectImpl.cpp line 292 and in AtlasUI/Object.cpp:547
C4456 in MapDialog.cpp:173 and in ScenarioEditor.cpp:742
Reviewed by: @Angen
Accepted by: @Itms
Comments by: @vladislavbelov
Differential Revision: https://code.wildfiregames.com/D1741
This was SVN commit r22161.
the variable was removed in 12e2428495. A usage was removed in
9376609ee8.
And since then the usage is useless because we use infinity sky model.
This was SVN commit r22154.
Usage:
let size = Engine.GetGUIObjectByName({gui_object_name}).GetTextSize()
Returns a JS object containing the height and width of the primary text
field within
the object, taking into account new lines, text wrapping, and font
changes.
Unless the object doesn't contain text, in which case the method will
return undefined.
Commented on by: vladislavbelov
Additional code by: elexis
Reviewed By: wraitii
Differential Revision: https://code.wildfiregames.com/D844
This was SVN commit r22134.
the skybox at the current camera location, so that the skybox appears
indefinitely far away. Refs #3458.
Reviewed By: wraitii
Tested By: elexis, Stan
Differential Revision: https://code.wildfiregames.com/D1683
This was SVN commit r22039.
This generally makes this code cleaner and easier to maintain, while
also being more modern and fully tested.
Looked at by: leper
Differential Revision: https://code.wildfiregames.com/D8
This was SVN commit r22029.
By rendering sides even when they are back-facing, the water shader is
on top of a mesh instead of emptiness and this solves an old
"edge-of-map" graphical issue.
Taken out from D359 with vlad's agreement. See screenshots there for
more information on the exact issue.
This was SVN commit r22007.
The water manager computations for "fancy water effects" have always
been quite slow. I've updated one of the functions to be much faster,
and the other doesn't need to be called (apparently, since I removed
coastal foam, which tbh I don't remember doing).
This should all be redone entirely to be honest, as it's generally
terrible, but in the short-term™ this makes this function almost usable
in real-time.
Differential Revision: https://code.wildfiregames.com/D78
This was SVN commit r22006.
This allows using arbitrary 'mul' values with Integer types, instead of
having to switch them to Decimal types.
The ParamNode is not aware of validation (thus types) so a better
solution is incredibly non-trivial.
Differential Revision: https://code.wildfiregames.com/D268
This was SVN commit r22003.
Revelead by the A23 crash when hosting a game in the lobby. We have a
debug_break() call that calls "kill" with SIGTRAP, which generally
doesn't get handled correctly in release versions, particularly on OSX.
Differential Revision: https://code.wildfiregames.com/D1499
This was SVN commit r21998.
C++ should not hardcode JS implementation details or strings.
SendEventToAll or CallFunctionVoid are more common and versatile
alternatives.
This was SVN commit r21935.
Yields a more transparent directory structure, in particular when adding
the third bot or systemd service files.
Refs: #3022, D1659, D1661.
Comments by: user1, Dunedan
This was SVN commit r21926.
Describe Wildfire Games undocumented, but relevant or even required
configuration settings.
Add chapter on ejabberd connectivity: TLS encryption (1beb96cb20, refs
#4705), STUN (61261d14fc / D364), IPv6.
Elaborate use policy configuration, add nickname restrictions from
23d8bc11a5.
Brief Terms and Conditions notification (81883806ec, 54e5ad2ae9).
Recommend to run bots without administrative access (but explain the
alternative too for fans of the setting).
Explain how to configure and test 0 A.D. with new lobbies and how to
distribute the settings.
Differential Revision: https://code.wildfiregames.com/D1659Fixes#4671
Reviewed By: user1
Comments By: Dunedan
This was SVN commit r21925.
This prevents a lobby player banned by the host from rejoining after
getting a new IP address and changing the rating part of the nickname,
refs #5320, #3241 / 32da740f14, #3549 / 0fd8aa2a77 / D897.
Differential Revision: https://code.wildfiregames.com/D1655
Reproduced By: Hannibal_Barca
This was SVN commit r21918.
in particular Philips server not responding to SSL which became a
requirement by the client following 209bab0255 or following GDPR 32.1.a,
refs #5257 while the new backend is not ready yet.
Mark file emptied in 209bab0255 as deleted.
Add scrolling to the UserReporter window, so that the timeout error
strings that became visible following the bugfixes in b496168d0a and
c898c19735 and don't overlap with the buttons.
This was SVN commit r21900.
Require SSL for the UserReporter clientside.
Differential Revision: https://code.wildfiregames.com/D1598
Includes contributions by bb and Itms
This was SVN commit r21898.
Display a generic error message using curl_easy_strerror if the detailed
error description is unavailable.
Differential Revision: https://code.wildfiregames.com/D1625
This was SVN commit r21892.
Displays if the server is down instead of a misleading unrelated later
error message.
Differential Revision: https://code.wildfiregames.com/D1608
This was SVN commit r21891.
Add link to feedback.wildfiregames.com, which demonstrates users how
their data is going to be used.
Add link buttons to the Terms dialog (refs #4583), so that users are
informed of the terms prior to becoming subject to them.
Don't link the DMCA / copyright terms of mod.io now since I found no UI
with support for 3 buttons that doesn't appear unsatisfyingly ugly.
Adds 3 button captions and 1 tooltip string.
Differential Revision: https://code.wildfiregames.com/D1627
A Comment and a relatable patch in D1601 by smiley / (-_-).
This was SVN commit r21890.
This is due to too many oversteppings of the lobby Terms of Use
following JS mods that implemented an UI for players to join lobby games
with arbitrary nicknames or 'replace' / impersonate other players in
lobby games.
Agreed with: user1, Dunedan
Code proofread by: Vladislav
Minor discussions with: Imarok, Hannibal_Barca, smiley, fpre, bb, nani
refs
https://wildfiregames.com/forum/index.php?/topic/24722-improving-mod-security/
This was SVN commit r21877.
These are config options because developers should be able to test a
local lobby server quickly without going through the hassle to create a
valid or invalid certificate or modify and compile the client.
To protect from malicious JS mods reducing these security config
options, these options as well as the hostname would have to be
protected from JS access.
The user might still connect to other lobbies through a hypothetical UI
if there were a non-modifiable GUI confirmation dialog prior to the
connection.
Proofreading and feature design discussion by Vladislav and Dunedan on
irc on 2018-08-19 and 2018-08-23.
This was SVN commit r21875.
This way it stands out more as a separate feature that can be more
easily exchanged, extended, maintained or conditionally removed from the
build and leaves more transparent includes, refs #5257.
Add missing string includes following 7c2e9027c2 and d6cb9c845b.
Remove unused Profile include following 38d6f81d71 and d6cb9c845b.
Remove unused CLogger include, add missing debug include following
d6cb9c845b.
Remove unused CConsole include following 9f0484e5ce / D1073.
Remove unused ProfilerViewer include following 2af94c5898.
This was SVN commit r21866.
Removes the call to the sprintf_s function from test_MD5.h in 17718981cf
and JSInterface_Main.cpp in 468d963e78.
As reported by Vladislav that function might not null-terminate strings
on untested/newer platforms, but the caller requires it here.
The sprintf_s calls in other places have the same problem.
Differential Revision: https://code.wildfiregames.com/D1591
Accepted By: Vladislav
This was SVN commit r21863.
Add TextureExists to avoid needless redundant hardcoding of the
filenames.
Remove mapBiome.Preview from gamedescription.js, obsolete following
8cde469501.
Differential Revision: https://code.wildfiregames.com/D1583
Accepted By: Vladislav
This was SVN commit r21859.
User-submitted text upload was removed in 2779512c6e in preference of
the bugtracker.
Remove leftover mainmenu.js function that this commit should have
removed.
Profiler data upload was disabled in b9e46f386b because the data amount
was too large and because the two timing snapshots are inconclusive
without further data.
The hereby removed exposed JS functions could have been exploited by JS
mods to upload 0ad userdata to arbitrary places.
The performance data upload feature can be redesigned, implemented
without JS exposure, with a more transparent privacy policy (refs
#5257).
Differential Revision: https://code.wildfiregames.com/D1597
Performance upload feature removal accepted by: Vladislav
This was SVN commit r21858.
This works in autostartmode because that sets every client to an
observer and still relies on enabled cheats to have players assign
themselves.
This was SVN commit r21854.
This way the user is only forced to read the Terms again that changed or
if the user logged in from a different machine.
Use md5sum since it is sufficiently resistant against collisions and
doesn't freeze the window for 2 seconds like EncryptPassword / SHA256
does, refs #4399.
Use 0 instead of empty string in default.cfg, refs #3990.
Differential Revision: https://code.wildfiregames.com/D1575
Partial review by: Vladislav
This was SVN commit r21850.
The NetClient runs in the main thread, so any part of the loading screen
consuming several seconds makes that client timeout.
This is a workaround because threading the NetClient would have prevent
these timeouts, refs #3700.
Coutnerintuitively, since enet timeout tolerance is proportional to the
latency, the better the connection of the player, the more likely it was
to drop on gamestart.
This problem became very frequent in Alpha 23, at least due to the Aura
bugfix 583b6ec625, AIInterface being particularly slow and that not
having been disabled yet in the loading screen resulting in additional
10 second freezes during the loading screen, even on empty maps, refs
#5200, 8e168f85e6.
Differential Revision: https://code.wildfiregames.com/D1513
Based on patch by: causative
This was SVN commit r21842.
For good practice, mention all members in the affected member
initializer list:
Add booelan m_IsLocalClient and u32 m_HostID to the member initializer
list (to not have them undefined, even though they are not read from
until they are set).
Add the strings m_GUID and m_UserName for completeness (even though the
default constructor is already called for strings).
Use nullptr instead of NULL for pointers.
Comments By: Vladislav
This was SVN commit r21841.
Fix comments claiming to ensure reliability when in reality there is
only a small likelihood of the message being received.
Broken by fa85527baf / refs #2420 which was a preparation for a3e1c68b9a
/ refs #2373, which hence didn't actually work and was circumvented by
9b136a45fc without clarification.
Might have caused #3643.
Differential Revision: https://code.wildfiregames.com/D1557
Reviewed By: Imarok
This was SVN commit r21837.
Prevents changes to the gamesettings after the game was started, so as
to use the correct map seed when generating the random map terrain for
rejoiners.
D1558 will prevent the UI bug #5206 and FSM error from doubleclicking on
StartGame.
Differential Revision: https://code.wildfiregames.com/D1562
Tested and accepted by: temple
This was SVN commit r21836.
This allows the host to distinguish clients that are just slower than
everyone else with the loading screen from clients who have most likely
disconnected or crashed already and may be considered to be kicked.
This is especially important for D1513, because that increases the
timeout tolerance to a minute or longer.
Fixes#5193
Differential Revision: https://code.wildfiregames.com/D1546
Reviewed By: causative
This was SVN commit r21832.
Saves time to reproduce the binary simstate or provides data that may be
otherwise irreproducible, refs #5162.
Differential Revision: https://code.wildfiregames.com/D1544
Reviewed By: temple
This was SVN commit r21830.
The previous code only tested quick hashes every 100 turns and could not
be used to confirm replay hashes matching.
The option can become used for visual replays too.
Differential Revision: https://code.wildfiregames.com/D1538
Refs #5162
Reviewed By: temple
This was SVN commit r21829.
Caches the loaded mod versions, so that GetEngineInfo doesn't read the
zip and json files everytime and returns about 1000 times faster.
Adds two missing includes.
The lobby froze multiple times every few seconds on updateGameList().
The gamesetup page was slowed down with every stanza sent and the
load savegame selection page was slowed down per savegame selection,
proportional to the number of installed zipped mods.
Introduced by: d5807cd59f and eca956a513
Differential Revision: https://code.wildfiregames.com/D1518
Reviewed By: wraitii
Comments By: Imarok (in D1512, P121), leper (in the lobby)
This was SVN commit r21823.
That commit illegaly polled SDL events from a different thread which for
an unknown reason did not error on Windows and GNU/linux.
Refs #4822 / D1304, similarly 8fec942e8a.
Differential Revision: https://code.wildfiregames.com/D1484
Previous iteration tested on OSX and some comments with regards to
letter case by Vladislav (refs 27da92e55f, 4c73614955).
This was SVN commit r21818.
Use an enum to indicate the type of engine shutdown instead of three
bools.
State in the comments that the program is restarted within the same
process.
In preparation of introducing an IsQuitRequested function (which shall
not be named is_quit_requested as stressed by Vladislav):
Rename kill_mainloop to QuitEngine, restart_mainloop to RestartEngine,
restart_mainloop_in_atlas to StartAtlas to not break consistency.
Don't rename RestartInAtlas in JS just now.
Group declarations at the top of main.cpp.
This was SVN commit r21817.
Declare the g_GameRestarted hack from 12f0720f31 in main.cpp, because it
is main.cpp and Game.cpp who provide it's value.
Move the comment so that the connotation becomes clear when reading
main.cpp.
Remove the extern declaration introduced to the Renderer in fb035d08e3
that became obsolete with ed7c66eb82.
This was SVN commit r21816.