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

Function scrollMouseDown

src/OpenLoco/src/Ui/Windows/CompanyFaceSelection.cpp:172–207  ·  view source on GitHub ↗

0x00435314

Source from the content-addressed store, hash-verified

170
171 // 0x00435314
172 static void scrollMouseDown(Window& self, [[maybe_unused]] const int16_t x, const int16_t y, [[maybe_unused]] const uint8_t scroll_index)
173 {
174 const auto objRow = getObjectFromSelection(y);
175
176 if (objRow.index == ObjectManager::kNullObjectIndex)
177 {
178 return;
179 }
180 self.invalidate();
181
182 auto mousePos = Input::getMouseLocation();
183 Audio::playSound(Audio::SoundId::clickDown, Audio::ChannelId::ui, mousePos.x);
184
185 if (_callingWindowType == WindowType::company)
186 {
187 GameCommands::setErrorTitle(StringIds::cant_select_face);
188
189 GameCommands::ChangeCompanyFaceArgs args{};
190 args.companyId = self.owner;
191 args.objHeader = objRow.object._header;
192
193 const auto result = GameCommands::doCommand(args, GameCommands::Flags::apply) != GameCommands::kFailure;
194 if (result)
195 {
196 WindowManager::close(&self);
197 }
198 }
199 else if (_callingWindowType == WindowType::options)
200 {
201 auto& config = Config::get();
202 config.preferredOwnerFace = objRow.object._header;
203 Config::write();
204
205 WindowManager::close(&self);
206 }
207 }
208
209 // 0x004352C7
210 static void scrollMouseOver(Window& self, [[maybe_unused]] const int16_t x, const int16_t y, [[maybe_unused]] const uint8_t scroll_index)

Callers

nothing calls this directly

Calls 9

getMouseLocationFunction · 0.85
playSoundFunction · 0.85
setErrorTitleFunction · 0.85
writeFunction · 0.85
getObjectFromSelectionFunction · 0.70
closeFunction · 0.70
doCommandFunction · 0.50
getFunction · 0.50
invalidateMethod · 0.45

Tested by

no test coverage detected