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.
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.
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.
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.
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.
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.
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.
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.
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.
C++ should not hardcode JS implementation details or strings.
SendEventToAll or CallFunctionVoid are more common and versatile
alternatives.
This was SVN commit r21935.
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.
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.
JSInterface_L10n.cpp from d6db5a466d,
JSInterface_Renderer.cpp and JSInterface_GUITypes.cpp from 4b1297b328,
JSInterface_VisualReplay.cpp from b830233498,
JSInterface_Game.cpp from 5f8be8e0c6,
JSInterface_Simulation.cpp from 921c5515a6,
JSInterface_Debug.cpp from d6cb9c845b,
JSInterface_Main.cpp from 486aec18d4, refs #4772,
JSInterface_Mod.cpp where it was incorrectly removed in af03c72f76.
Refs D1470.
Sort includes alphabetically, add recent Coding Convention macro
comments.
This was SVN commit r21789.
Patch By: fpre / ffffffff
Fixes#4987, refs #4254
This allows the replay menu and lobby to focus the selected element if,
but only if it is expected by the user.
Replaces 3f5648767d which scrolled the selected player into view every
single time a new playerlist was received by the lobby server.
This was SVN commit r20958.
The abs caused a compiler error in that environment, because wchar_t is
unsigned on armhf, subtracting signed from unsigned results in unsigned
and std::abs does not define an unsigned variant.
Differential Revision: https://code.wildfiregames.com/D1122
Patch By: Peter Michael Green
Uploaded By: Ludovic
This was SVN commit r20869.
This way globalscripts/ can use the same code in all contexts, all paths
are absolute and only one function name is needed.
Remove ReadCivJSONFile which is redundant with this function as well.
Restrict read access of rmgen/ to rmgen/ and simulation/, refs
4275a8a33c, 89055ef858.
Refs #4868
Differential Revision: https://code.wildfiregames.com/D1085
Reviewed By: wraitii
Partial agreement with leper
This was SVN commit r20576.
Revert the introduction of the exact copies of FileExists ReadJSONFile
functions in MapGenerator.cpp introduced by 871ed04521.
Include JSInterface_VFS.cpp from MapGenerator.cpp to remove that code
while gaining the other missing VFS file loading functions in rmgen/.
Split RegisterScriptFunctions of JSInterface_VFS.cpp from eb4e66aab3
into RegisterReadOnlyScriptFunctions and RegisterWriteScriptFunctions to
prevent unintentional write access.
This was SVN commit r20507.
Note that this does not fix the warnings in AtlasObjectXML, someone
interested
in fixing those should check whether using ICU would be a nicer
solution.
Reviewed By: echotangoecho
Differential Revision: https://code.wildfiregames.com/D740
This was SVN commit r20095.
Patch By: Vladislav
Refs #4225, D763
Also use SDL_Keycode instead of int, remove an outdated history lookup
comment and some other unneeded comments.
This was SVN commit r20074.
Remove unused SGUIBaseSettings and GUI comment.
Fix indentation of a macro, refs D794.
Differential Revision: https://code.wildfiregames.com/D838
Review by: leper.
Itms came up with the same patch for the SpiderMonkey 45 update
independently.
This was SVN commit r20062.
Do not send a wasteful rating request if the same player is selected
again when someone joined the lobby, when changing the sorting order or
when clicking on the same user again
by moving the player-selection change test from updatePlayerList to
onPlayerListSelection.
That test should have been done here in 8f4daa9dd0 already and fixes
#3840 well enough.
This change also fixes an unintentional behavior of the code, where the
game the currently selected player is playing in would be selected if
someone else joined the lobby, even if a different game was selected
manually.
Furthermore it allows simplification of the code of 655ce95468 by
removing selectGameFromPlayername which did almost the same as
selectGameFromPlayername.
To still select the game the current player is playing in if the
selected player didn't change, subscribe to the (new) event that is
called when clicking on an item.
Differential Revision: https://code.wildfiregames.com/D688
Reviewed By: ffffffff (fpre)
This was SVN commit r19841.
Use OsPath instead of CStr and CStrW where possible,
wstring_from_utf8(OsPath.string8()) to pass printable strings to the
JSAPI,
OsString when opening a filestream and
off_t instead of int for filesizes.
Fixes#4320
Differential Revision: https://code.wildfiregames.com/D518
Reviewed By: Imarok
Tested By: Imarok on Windows, wraitii on OSX
Special thanks to Philip for advice and the lib/path.h fix in
47cc447322.
This was SVN commit r19824.
Still throw that error if the function exists but could not be called
with JS_CallFunction.
Differential Revision: https://code.wildfiregames.com/D620
This was SVN commit r19769.
Allows lobby players to host games without having to configure their
router.
Differential Revision: https://code.wildfiregames.com/D364Fixes#2305
Patch By: fcxSanya.
StunClient based on code by SuperTuxKart, relicensed with approval of
the according authors hilnius, hiker, Auria, deveee, Flakebi, leper,
konstin and KroArtem.
Added rfc5245 (ejabberd) support, a GUI option, refactoring and segfault
fixes by myself.
Tested By: user1, Sandarac, Sestroretsk1714, Vladislav, Grugnas,
javiergodas
Partially Reviewed By: leper, Philip, echotangoecho
This was SVN commit r19703.
Two of our printf calls are not compatible with python-format and will
be ignored until Dennis supports the corresponding formats. Also removed
meaningless enclosing characters that were wrongly considered HTML.
Reviewed By: leper
Differential Revision: https://code.wildfiregames.com/D214
This was SVN commit r19669.
Some invalid cursor positions were not checked, resulting in a crash in
Debug mode. This was revealed by e1e4ef0370, refs #4401.
Reviewed By: echotangoecho, Itms
Differential Revision: https://code.wildfiregames.com/D484
This was SVN commit r19579.
Add a test for the GetNonGaiaEntities function of the RangeManager
broken by that commit that was fixed by f3e4e619bc.
Don't call one script function from another, but directly call into the
Selection helper like the others.
Don't make a loop around that RangeManager function for all players but
call the function once for all players.
The pointless virtual keywords were removed by 8827db201a.
Differential Revision: https://code.wildfiregames.com/D166
Reviewed By: leper
This was SVN commit r19344.
Use the maximum height of all cells of the current row.
Lobby games with empty servernames are not rendered weirdly anymore.
Patch By: Vladislav
Fixes#4402
This was SVN commit r19306.