update keyboard shortcuts
This commit is contained in:
@@ -130,3 +130,20 @@ void BuildButtonGrid::handleEvent(std::shared_ptr<const DemolishModeChangedEvent
|
||||
{
|
||||
m_demolishButton->setChecked(event->active);
|
||||
}
|
||||
|
||||
void BuildButtonGrid::handleEvent(std::shared_ptr<const BuildHotkeyPressedEvent> event)
|
||||
{
|
||||
for (std::size_t i = 0; i < m_types.size(); ++i)
|
||||
{
|
||||
if (m_types[i] == event->type)
|
||||
{
|
||||
// Equivalent to clicking the build button: a disabled (unaffordable)
|
||||
// button cannot be clicked, so the hotkey is likewise inert.
|
||||
if (m_buttons[i]->isEnabled())
|
||||
{
|
||||
onBuildButton(static_cast<int>(i));
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user