mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-28 12:51:34 +00:00
Display the updated batch size immediately when using the batch-train/barter hotkey, instead of waiting for the next turn. Patch by elexis. Fixes #3194
This was SVN commit r19028.
This commit is contained in:
@@ -62,6 +62,16 @@
|
|||||||
<action on="Press">backToWork();</action>
|
<action on="Press">backToWork();</action>
|
||||||
</object>
|
</object>
|
||||||
|
|
||||||
|
<object hotkey="session.batchtrain">
|
||||||
|
<action on="Press">updateSelectionDetails();</action>
|
||||||
|
<action on="Release">updateSelectionDetails();</action>
|
||||||
|
</object>
|
||||||
|
|
||||||
|
<object hotkey="session.massbarter">
|
||||||
|
<action on="Press">updateSelectionDetails();</action>
|
||||||
|
<action on="Release">updateSelectionDetails();</action>
|
||||||
|
</object>
|
||||||
|
|
||||||
<!-- Find idle warrior - TODO: Potentially move this to own UI button? -->
|
<!-- Find idle warrior - TODO: Potentially move this to own UI button? -->
|
||||||
<object hotkey="selection.idlewarrior">
|
<object hotkey="selection.idlewarrior">
|
||||||
<action on="Press">findIdleUnit(g_MilitaryTypes);</action>
|
<action on="Press">findIdleUnit(g_MilitaryTypes);</action>
|
||||||
|
|||||||
+13
-2
@@ -67,13 +67,24 @@ InReaction CGUI::HandleEvent(const SDL_Event_* ev)
|
|||||||
{
|
{
|
||||||
InReaction ret = IN_PASS;
|
InReaction ret = IN_PASS;
|
||||||
|
|
||||||
if (ev->ev.type == SDL_HOTKEYDOWN)
|
if (ev->ev.type == SDL_HOTKEYDOWN || ev->ev.type == SDL_HOTKEYUP)
|
||||||
{
|
{
|
||||||
const char* hotkey = static_cast<const char*>(ev->ev.user.data1);
|
const char* hotkey = static_cast<const char*>(ev->ev.user.data1);
|
||||||
|
|
||||||
std::map<CStr, std::vector<IGUIObject*> >::iterator it = m_HotkeyObjects.find(hotkey);
|
std::map<CStr, std::vector<IGUIObject*> >::iterator it = m_HotkeyObjects.find(hotkey);
|
||||||
if (it != m_HotkeyObjects.end())
|
if (it != m_HotkeyObjects.end())
|
||||||
for (IGUIObject* const& obj : it->second)
|
for (IGUIObject* const& obj : it->second)
|
||||||
obj->SendEvent(GUIM_PRESSED, "press");
|
{
|
||||||
|
// Update hotkey status before sending the event,
|
||||||
|
// else the status will be outdated when processing the GUI event.
|
||||||
|
HotkeyInputHandler(ev);
|
||||||
|
ret = IN_HANDLED;
|
||||||
|
|
||||||
|
if (ev->ev.type == SDL_HOTKEYDOWN)
|
||||||
|
obj->SendEvent(GUIM_PRESSED, "press");
|
||||||
|
else
|
||||||
|
obj->SendEvent(GUIM_RELEASED, "release");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (ev->ev.type == SDL_MOUSEMOTION)
|
else if (ev->ev.type == SDL_MOUSEMOTION)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 2015 Wildfire Games.
|
/* Copyright (C) 2016 Wildfire Games.
|
||||||
* This file is part of 0 A.D.
|
* This file is part of 0 A.D.
|
||||||
*
|
*
|
||||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||||
@@ -72,6 +72,7 @@ enum EGUIMessageType
|
|||||||
GUIM_MOUSE_WHEEL_DOWN,
|
GUIM_MOUSE_WHEEL_DOWN,
|
||||||
GUIM_SETTINGS_UPDATED, // SGUIMessage.m_Value = name of setting
|
GUIM_SETTINGS_UPDATED, // SGUIMessage.m_Value = name of setting
|
||||||
GUIM_PRESSED,
|
GUIM_PRESSED,
|
||||||
|
GUIM_RELEASED,
|
||||||
GUIM_DOUBLE_PRESSED,
|
GUIM_DOUBLE_PRESSED,
|
||||||
GUIM_MOUSE_MOTION,
|
GUIM_MOUSE_MOTION,
|
||||||
GUIM_LOAD, // Called when an object is added to the GUI.
|
GUIM_LOAD, // Called when an object is added to the GUI.
|
||||||
|
|||||||
Reference in New Issue
Block a user