MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / toolCancel

Function toolCancel

src/OpenLoco/src/Ui/ToolManager.cpp:86–111  ·  view source on GitHub ↗

0x004CE3D6

Source from the content-addressed store, hash-verified

84
85 // 0x004CE3D6
86 void toolCancel()
87 {
88 if (Input::hasFlag(Input::Flags::toolActive))
89 {
90 Input::resetFlag(Input::Flags::toolActive);
91
92 World::mapInvalidateSelectionRect();
93 World::mapInvalidateMapSelectionFreeFormTiles();
94
95 resetMapSelectionFlag(MapSelectionFlags::enable | MapSelectionFlags::enableConstruct | MapSelectionFlags::enableConstructionArrow | MapSelectionFlags::unk_03 | MapSelectionFlags::unk_04);
96
97 if (ToolManager::getToolWidgetIndex() >= 0)
98 {
99 // Invalidate tool widget
100 Ui::WindowManager::invalidateWidget(ToolManager::getToolWindowType(), ToolManager::getToolWindowNumber(), ToolManager::getToolWidgetIndex());
101
102 // Abort tool event
103 Window* w = Ui::WindowManager::find(ToolManager::getToolWindowType(), ToolManager::getToolWindowNumber());
104 if (w != nullptr)
105 {
106 // TODO: Handle widget ids properly for tools.
107 w->callToolAbort(ToolManager::getToolWidgetIndex(), WidgetId::none);
108 }
109 }
110 }
111 }
112
113 void toolCancel(Ui::WindowType type, Ui::WindowNumber_t number)
114 {

Callers 6

toolSetFunction · 0.70
closeConstructionWindowsFunction · 0.70
loadGameFunction · 0.50
confirmSaveGameFunction · 0.50
processMouseToolFunction · 0.50
cancelConstructionModeFunction · 0.50

Calls 12

resetMapSelectionFlagFunction · 0.85
getToolWidgetIndexFunction · 0.85
invalidateWidgetFunction · 0.85
getToolWindowTypeFunction · 0.85
getToolWindowNumberFunction · 0.85
findFunction · 0.85
isToolActiveFunction · 0.85
callToolAbortMethod · 0.80
hasFlagFunction · 0.50
resetFlagFunction · 0.50

Tested by

no test coverage detected