MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / OnPlaceObject

Method OnPlaceObject

src/object_gui.cpp:332–341  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

330 }
331
332 void OnPlaceObject([[maybe_unused]] Point pt, TileIndex tile) override
333 {
334 const ObjectSpec *spec = ObjectClass::Get(_object_gui.sel_class)->GetSpec(_object_gui.sel_type);
335
336 if (spec->size == OBJECT_SIZE_1X1) {
337 VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_BUILD_OBJECT);
338 } else {
339 Command<CMD_BUILD_OBJECT>::Post(STR_ERROR_CAN_T_BUILD_OBJECT, CcPlaySound_CONSTRUCTION_OTHER, tile, spec->Index(), _object_gui.sel_view);
340 }
341 }
342
343 void OnPlaceDrag(ViewportPlaceMethod select_method, [[maybe_unused]] ViewportDragDropSelectionProcess select_proc, [[maybe_unused]] Point pt) override
344 {

Callers

nothing calls this directly

Calls 3

VpStartPlaceSizingFunction · 0.85
GetSpecMethod · 0.45
IndexMethod · 0.45

Tested by

no test coverage detected