4 * This file is part of OpenTTD.
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
10 /** @file object_gui.cpp The GUI for objects. */
13 #include "map/subcoord.h"
14 #include "command_func.h"
16 #include "newgrf_object.h"
17 #include "newgrf_text.h"
18 #include "strings_func.h"
19 #include "viewport_func.h"
20 #include "tilehighlight_func.h"
21 #include "window_gui.h"
22 #include "window_func.h"
23 #include "zoom_func.h"
25 #include "widgets/object_widget.h"
27 #include "table/strings.h"
29 static ObjectClassID _selected_object_class
; ///< the currently visible object class
30 static int _selected_object_index
; ///< the index of the selected object in the current class or -1
31 static uint8 _selected_object_view
; ///< the view of the selected object
33 static const int OBJECT_MARGIN
= 4; ///< The margin (in pixels) around an object.
35 /** Draw an object preview in a widget. */
36 static inline void DrawObjectPreview (const ObjectSpec
*spec
, BlitArea
*dpi
,
37 const Rect
&r
, int shrink
, int y
, uint view
)
39 /* Set up a clipping area for the preview. */
41 int width
= r
.right
- r
.left
;
42 if (InitBlitArea (dpi
, &tmp_dpi
, r
.left
+ shrink
, r
.top
, width
- 2 * shrink
+ 1, r
.bottom
- r
.top
+ 1)) {
43 int x
= width
/ 2 - 1;
44 y
-= OBJECT_MARGIN
+ ScaleGUITrad (TILE_PIXELS
);
45 if (spec
->grf_prop
.grffile
== NULL
) {
46 extern const DrawTileSprites _objects
[];
47 const DrawTileSprites
*dts
= &_objects
[spec
->grf_prop
.local_id
];
48 DrawOrigTileSeqInGUI (&tmp_dpi
, x
, y
, dts
, PAL_NONE
);
50 DrawNewObjectTileInGUI (&tmp_dpi
, x
, y
, spec
, view
);
55 /** The window used for building objects. */
56 class BuildObjectWindow
: public Window
{
57 int line_height
; ///< The height of a single line.
58 int info_height
; ///< The height of the info box.
59 Scrollbar
*vscroll
; ///< The scrollbar.
61 /** Scroll #WID_BO_CLASS_LIST so that the selected object class is visible. */
62 void EnsureSelectedObjectClassIsVisible()
65 for (int i
= 0; i
< _selected_object_class
; i
++) {
66 if (ObjectClass::Get((ObjectClassID
) i
)->GetUISpecCount() == 0) continue;
69 this->vscroll
->ScrollTowards(pos
);
73 * Tests whether the previously selected object can be selected.
74 * @return \c true if the selected object is available, \c false otherwise.
76 bool CanRestoreSelectedObject()
78 if (_selected_object_index
== -1) return false;
80 ObjectClass
*sel_objclass
= ObjectClass::Get(_selected_object_class
);
81 if ((int)sel_objclass
->GetSpecCount() <= _selected_object_index
) return false;
83 return sel_objclass
->GetSpec(_selected_object_index
)->IsAvailable();
87 * Calculate the number of columns of the #WID_BO_SELECT_MATRIX widget.
88 * @return Number of columns in the matrix.
90 uint
GetMatrixColumnCount()
92 const NWidgetBase
*matrix
= this->GetWidget
<NWidgetBase
>(WID_BO_SELECT_MATRIX
);
93 return 1 + (matrix
->current_x
- matrix
->smallest_x
) / matrix
->resize_x
;
97 BuildObjectWindow (const WindowDesc
*desc
, WindowNumber number
) :
98 Window(desc
), line_height(0), info_height(1), vscroll(NULL
)
100 this->CreateNestedTree();
101 this->vscroll
= this->GetScrollbar(WID_BO_SCROLLBAR
);
102 this->InitNested(number
);
106 this->vscroll
->SetPosition(0);
107 this->vscroll
->SetCount(ObjectClass::GetUIClassCount());
109 NWidgetMatrix
*matrix
= this->GetWidget
<NWidgetMatrix
>(WID_BO_SELECT_MATRIX
);
110 matrix
->SetScrollbar(this->GetScrollbar(WID_BO_SELECT_SCROLL
));
112 this->SelectOtherClass(_selected_object_class
);
113 if (this->CanRestoreSelectedObject()) {
114 this->SelectOtherObject(_selected_object_index
);
116 this->SelectFirstAvailableObject(true);
118 assert(ObjectClass::Get(_selected_object_class
)->GetUISpecCount() > 0); // object GUI should be disables elsewise
119 this->EnsureSelectedObjectClassIsVisible();
120 this->GetWidget
<NWidgetMatrix
>(WID_BO_OBJECT_MATRIX
)->SetCount(4);
123 virtual void SetStringParameters(int widget
) const
126 case WID_BO_OBJECT_NAME
: {
127 const ObjectSpec
*spec
= ObjectClass::Get(_selected_object_class
)->GetSpec(_selected_object_index
);
128 SetDParam(0, spec
!= NULL
? spec
->name
: STR_EMPTY
);
132 case WID_BO_OBJECT_SIZE
: {
133 const ObjectSpec
*spec
= ObjectClass::Get(_selected_object_class
)->GetSpec(_selected_object_index
);
134 int size
= spec
== NULL
? 0 : spec
->size
;
135 SetDParam(0, GB(size
, HasBit(_selected_object_view
, 0) ? 4 : 0, 4));
136 SetDParam(1, GB(size
, HasBit(_selected_object_view
, 0) ? 0 : 4, 4));
144 virtual void UpdateWidgetSize(int widget
, Dimension
*size
, const Dimension
&padding
, Dimension
*fill
, Dimension
*resize
)
147 case WID_BO_CLASS_LIST
: {
148 for (uint i
= 0; i
< ObjectClass::GetClassCount(); i
++) {
149 ObjectClass
*objclass
= ObjectClass::Get((ObjectClassID
)i
);
150 if (objclass
->GetUISpecCount() == 0) continue;
151 size
->width
= max(size
->width
, GetStringBoundingBox(objclass
->name
).width
);
153 size
->width
+= padding
.width
;
154 this->line_height
= FONT_HEIGHT_NORMAL
+ WD_MATRIX_TOP
+ WD_MATRIX_BOTTOM
;
155 resize
->height
= this->line_height
;
156 size
->height
= 5 * this->line_height
;
160 case WID_BO_OBJECT_NAME
:
161 case WID_BO_OBJECT_SIZE
:
162 /* We do not want the window to resize when selecting objects; better clip texts */
166 case WID_BO_OBJECT_MATRIX
: {
167 /* Get the right amount of buttons based on the current spec. */
168 const ObjectSpec
*spec
= ObjectClass::Get(_selected_object_class
)->GetSpec(_selected_object_index
);
170 if (spec
->views
>= 2) size
->width
+= resize
->width
;
171 if (spec
->views
>= 4) size
->height
+= resize
->height
;
178 case WID_BO_OBJECT_SPRITE
: {
179 bool two_wide
= false; // Whether there will be two widgets next to each other in the matrix or not.
180 int height
[2] = {0, 0}; // The height for the different views; in this case views 1/2 and 4.
182 /* Get the height and view information. */
183 for (int i
= 0; i
< NUM_OBJECTS
; i
++) {
184 const ObjectSpec
*spec
= ObjectSpec::Get(i
);
185 if (!spec
->IsEverAvailable()) continue;
186 two_wide
|= spec
->views
>= 2;
187 height
[spec
->views
/ 4] = max
<int>(ObjectSpec::Get(i
)->height
, height
[spec
->views
/ 4]);
190 /* Determine the pixel heights. */
191 for (size_t i
= 0; i
< lengthof(height
); i
++) {
192 height
[i
] *= ScaleGUITrad(TILE_HEIGHT
);
193 height
[i
] += ScaleGUITrad(TILE_PIXELS
) + 2 * OBJECT_MARGIN
;
196 /* Now determine the size of the minimum widgets. When there are two columns, then
197 * we want these columns to be slightly less wide. When there are two rows, then
198 * determine the size of the widgets based on the maximum size for a single row
199 * of widgets, or just the twice the widget height of the two row ones. */
200 size
->height
= max(height
[0], height
[1] * 2 + 2);
202 size
->width
= (3 * ScaleGUITrad(TILE_PIXELS
) + 2 * OBJECT_MARGIN
) * 2 + 2;
204 size
->width
= 4 * ScaleGUITrad(TILE_PIXELS
) + 2 * OBJECT_MARGIN
;
207 /* Get the right size for the single widget based on the current spec. */
208 const ObjectSpec
*spec
= ObjectClass::Get(_selected_object_class
)->GetSpec(_selected_object_index
);
210 if (spec
->views
>= 2) size
->width
= size
->width
/ 2 - 1;
211 if (spec
->views
>= 4) size
->height
= size
->height
/ 2 - 1;
217 size
->height
= this->info_height
;
220 case WID_BO_SELECT_MATRIX
:
225 case WID_BO_SELECT_IMAGE
:
226 size
->width
= ScaleGUITrad(64) + 2;
227 size
->height
= ScaleGUITrad(58) + 2;
234 void DrawWidget (BlitArea
*dpi
, const Rect
&r
, int widget
) const OVERRIDE
236 switch (GB(widget
, 0, 16)) {
237 case WID_BO_CLASS_LIST
: {
240 for (uint i
= 0; i
< ObjectClass::GetClassCount(); i
++) {
241 ObjectClass
*objclass
= ObjectClass::Get((ObjectClassID
)i
);
242 if (objclass
->GetUISpecCount() == 0) continue;
243 if (!this->vscroll
->IsVisible(pos
++)) continue;
244 DrawString (dpi
, r
.left
+ WD_MATRIX_LEFT
, r
.right
- WD_MATRIX_RIGHT
, y
+ WD_MATRIX_TOP
, objclass
->name
,
245 ((int)i
== _selected_object_class
) ? TC_WHITE
: TC_BLACK
);
246 y
+= this->line_height
;
251 case WID_BO_OBJECT_SPRITE
: {
252 const ObjectSpec
*spec
= ObjectClass::Get(_selected_object_class
)->GetSpec(_selected_object_index
);
253 if (spec
== NULL
) break;
255 /* Height of the selection matrix.
256 * Depending on the number of views, the matrix has a 1x1, 1x2, 2x1 or 2x2 layout. To make the previews
257 * look nice in all layouts, we use the 4x4 layout (smallest previews) as starting point. For the bigger
258 * previews in the layouts with less views we add space homogeneously on all sides, so the 4x4 preview-rectangle
259 * is centered in the 2x1, 1x2 resp. 1x1 buttons. */
260 uint matrix_height
= this->GetWidget
<NWidgetMatrix
>(WID_BO_OBJECT_MATRIX
)->current_y
;
262 int y
= (r
.bottom
- r
.top
+ matrix_height
/ 2) / 2;
263 DrawObjectPreview (spec
, dpi
, r
, 0, y
, GB(widget
, 16, 16));
267 case WID_BO_SELECT_IMAGE
: {
268 ObjectClass
*objclass
= ObjectClass::Get(_selected_object_class
);
269 int obj_index
= objclass
->GetIndexFromUI(GB(widget
, 16, 16));
270 if (obj_index
< 0) break;
271 const ObjectSpec
*spec
= objclass
->GetSpec(obj_index
);
272 if (spec
== NULL
) break;
274 if (!spec
->IsAvailable()) {
275 GfxFillRect (dpi
, r
.left
+ 1, r
.top
+ 1, r
.right
- 1, r
.bottom
- 1, PC_BLACK
, FILLRECT_CHECKER
);
277 DrawObjectPreview (spec
, dpi
, r
, 1, r
.bottom
- r
.top
, 0);
282 const ObjectSpec
*spec
= ObjectClass::Get(_selected_object_class
)->GetSpec(_selected_object_index
);
283 if (spec
== NULL
) break;
285 /* Get the extra message for the GUI */
286 if (HasBit(spec
->callback_mask
, CBM_OBJ_FUND_MORE_TEXT
)) {
287 uint16 callback_res
= GetObjectCallback(CBID_OBJECT_FUND_MORE_TEXT
, 0, 0, spec
, NULL
, INVALID_TILE
, _selected_object_view
);
288 if (callback_res
!= CALLBACK_FAILED
&& callback_res
!= 0x400) {
289 if (callback_res
> 0x400) {
290 ErrorUnknownCallbackResult(spec
->grf_prop
.grffile
->grfid
, CBID_OBJECT_FUND_MORE_TEXT
, callback_res
);
292 StringID message
= GetGRFStringID(spec
->grf_prop
.grffile
->grfid
, 0xD000 + callback_res
);
293 if (message
!= STR_NULL
&& message
!= STR_UNDEFINED
) {
294 StartTextRefStackUsage(spec
->grf_prop
.grffile
, 6);
295 /* Use all the available space left from where we stand up to the
296 * end of the window. We ALSO enlarge the window if needed, so we
297 * can 'go' wild with the bottom of the window. */
298 int y
= DrawStringMultiLine (dpi
, r
.left
, r
.right
, r
.top
, UINT16_MAX
, message
, TC_ORANGE
) - r
.top
;
299 StopTextRefStackUsage();
300 if (y
> this->info_height
) {
301 BuildObjectWindow
*bow
= const_cast<BuildObjectWindow
*>(this);
302 bow
->info_height
= y
+ 2;
314 * Select the specified object class.
315 * @param object_class_index Object class index to select.
317 void SelectOtherClass(ObjectClassID object_class_index
)
319 _selected_object_class
= object_class_index
;
320 this->GetWidget
<NWidgetMatrix
>(WID_BO_SELECT_MATRIX
)->SetCount(ObjectClass::Get(_selected_object_class
)->GetUISpecCount());
324 * Select the specified object in #_selected_object_class class.
325 * @param object_index Object index to select, \c -1 means select nothing.
327 void SelectOtherObject(int object_index
)
329 _selected_object_index
= object_index
;
330 if (_selected_object_index
!= -1) {
331 const ObjectSpec
*spec
= ObjectClass::Get(_selected_object_class
)->GetSpec(_selected_object_index
);
332 _selected_object_view
= min(_selected_object_view
, spec
->views
- 1);
335 _selected_object_view
= 0;
338 if (_selected_object_index
!= -1) {
339 SetPointerMode (POINTER_TILE
, this, SPR_CURSOR_TRANSMITTER
);
342 this->UpdateButtons(_selected_object_class
, _selected_object_index
, _selected_object_view
);
345 void UpdateSelectSize()
347 if (_selected_object_index
== -1) {
348 SetTileSelectSize(1, 1);
350 const ObjectSpec
*spec
= ObjectClass::Get(_selected_object_class
)->GetSpec(_selected_object_index
);
351 int w
= GB(spec
->size
, HasBit(_selected_object_view
, 0) ? 4 : 0, 4);
352 int h
= GB(spec
->size
, HasBit(_selected_object_view
, 0) ? 0 : 4, 4);
353 SetTileSelectSize(w
, h
);
358 * Update buttons to show the selection to the user.
359 * @param sel_class The class of the selected object.
360 * @param sel_index Index of the object to select, or \c -1 .
361 * @param sel_view View of the object to select.
363 void UpdateButtons(ObjectClassID sel_class
, int sel_index
, uint sel_view
)
365 int view_number
, object_number
;
366 if (sel_index
== -1) {
367 view_number
= -1; // If no object selected, also hide the selected view.
370 view_number
= sel_view
;
371 object_number
= ObjectClass::Get(sel_class
)->GetUIFromIndex(sel_index
);
374 this->GetWidget
<NWidgetMatrix
>(WID_BO_OBJECT_MATRIX
)->SetClicked(view_number
);
375 this->GetWidget
<NWidgetMatrix
>(WID_BO_SELECT_MATRIX
)->SetClicked(object_number
);
376 this->UpdateSelectSize();
380 virtual void OnResize()
382 this->vscroll
->SetCapacityFromWidget(this, WID_BO_CLASS_LIST
);
385 virtual void OnClick(Point pt
, int widget
, int click_count
)
387 switch (GB(widget
, 0, 16)) {
388 case WID_BO_CLASS_LIST
: {
389 int num_clicked
= this->vscroll
->GetPosition() + (pt
.y
- this->nested_array
[widget
]->pos_y
) / this->line_height
;
390 if (num_clicked
>= (int)ObjectClass::GetUIClassCount()) break;
392 this->SelectOtherClass(ObjectClass::GetUIClass(num_clicked
));
393 this->SelectFirstAvailableObject(false);
397 case WID_BO_SELECT_IMAGE
: {
398 ObjectClass
*objclass
= ObjectClass::Get(_selected_object_class
);
399 int num_clicked
= objclass
->GetIndexFromUI(GB(widget
, 16, 16));
400 if (num_clicked
>= 0 && objclass
->GetSpec(num_clicked
)->IsAvailable()) this->SelectOtherObject(num_clicked
);
404 case WID_BO_OBJECT_SPRITE
:
405 if (_selected_object_index
!= -1) {
406 _selected_object_view
= GB(widget
, 16, 16);
407 this->SelectOtherObject(_selected_object_index
); // Re-select the object for a different view.
413 virtual void OnPlaceObject(Point pt
, TileIndex tile
)
415 DoCommandP(tile
, ObjectClass::Get(_selected_object_class
)->GetSpec(_selected_object_index
)->Index(),
416 _selected_object_view
, CMD_BUILD_OBJECT
);
419 virtual void OnPlaceObjectAbort()
421 this->UpdateButtons(_selected_object_class
, -1, _selected_object_view
);
425 * Select the first available object.
426 * @param change_class If true, change the class if no object in the current
427 * class is available.
429 void SelectFirstAvailableObject(bool change_class
)
431 /* First try to select an object in the selected class. */
432 ObjectClass
*sel_objclass
= ObjectClass::Get(_selected_object_class
);
433 for (uint i
= 0; i
< sel_objclass
->GetSpecCount(); i
++) {
434 const ObjectSpec
*spec
= sel_objclass
->GetSpec(i
);
435 if (spec
->IsAvailable()) {
436 this->SelectOtherObject(i
);
441 /* If that fails, select the first available object
442 * from a random class. */
443 for (ObjectClassID j
= OBJECT_CLASS_BEGIN
; j
< OBJECT_CLASS_MAX
; j
++) {
444 ObjectClass
*objclass
= ObjectClass::Get(j
);
445 for (uint i
= 0; i
< objclass
->GetSpecCount(); i
++) {
446 const ObjectSpec
*spec
= objclass
->GetSpec(i
);
447 if (spec
->IsAvailable()) {
448 this->SelectOtherClass(j
);
449 this->SelectOtherObject(i
);
455 /* If all objects are unavailable, select nothing... */
456 if (ObjectClass::Get(_selected_object_class
)->GetUISpecCount() == 0) {
457 /* ... but make sure that the class is not empty. */
458 for (ObjectClassID j
= OBJECT_CLASS_BEGIN
; j
< OBJECT_CLASS_MAX
; j
++) {
459 if (ObjectClass::Get(j
)->GetUISpecCount() > 0) {
460 this->SelectOtherClass(j
);
465 this->SelectOtherObject(-1);
469 static const NWidgetPart _nested_build_object_widgets
[] = {
470 NWidget(NWID_HORIZONTAL
),
471 NWidget(WWT_CLOSEBOX
, COLOUR_DARK_GREEN
),
472 NWidget(WWT_CAPTION
, COLOUR_DARK_GREEN
), SetDataTip(STR_OBJECT_BUILD_CAPTION
, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS
),
473 NWidget(WWT_DEFSIZEBOX
, COLOUR_DARK_GREEN
),
475 NWidget(WWT_PANEL
, COLOUR_DARK_GREEN
),
476 NWidget(NWID_HORIZONTAL
), SetPadding(2, 0, 0, 0),
477 NWidget(NWID_VERTICAL
),
478 NWidget(NWID_HORIZONTAL
), SetPadding(0, 5, 2, 5),
479 NWidget(WWT_MATRIX
, COLOUR_GREY
, WID_BO_CLASS_LIST
), SetFill(1, 0), SetMatrixDataTip(1, 0, STR_OBJECT_BUILD_CLASS_TOOLTIP
), SetScrollbar(WID_BO_SCROLLBAR
),
480 NWidget(NWID_VSCROLLBAR
, COLOUR_GREY
, WID_BO_SCROLLBAR
),
482 NWidget(NWID_HORIZONTAL
), SetPadding(0, 5, 0, 5),
483 NWidget(NWID_MATRIX
, COLOUR_DARK_GREEN
, WID_BO_OBJECT_MATRIX
), SetPIP(0, 2, 0),
484 NWidget(WWT_PANEL
, COLOUR_GREY
, WID_BO_OBJECT_SPRITE
), SetDataTip(0x0, STR_OBJECT_BUILD_PREVIEW_TOOLTIP
), EndContainer(),
487 NWidget(WWT_TEXT
, COLOUR_DARK_GREEN
, WID_BO_OBJECT_NAME
), SetDataTip(STR_ORANGE_STRING
, STR_NULL
), SetPadding(2, 5, 2, 5),
488 NWidget(WWT_TEXT
, COLOUR_DARK_GREEN
, WID_BO_OBJECT_SIZE
), SetDataTip(STR_OBJECT_BUILD_SIZE
, STR_NULL
), SetPadding(2, 5, 2, 5),
490 NWidget(WWT_PANEL
, COLOUR_DARK_GREEN
), SetScrollbar(WID_BO_SELECT_SCROLL
),
491 NWidget(NWID_HORIZONTAL
),
492 NWidget(NWID_MATRIX
, COLOUR_DARK_GREEN
, WID_BO_SELECT_MATRIX
), SetFill(0, 1), SetPIP(0, 2, 0),
493 NWidget(WWT_PANEL
, COLOUR_DARK_GREEN
, WID_BO_SELECT_IMAGE
), SetMinimalSize(66, 60), SetDataTip(0x0, STR_OBJECT_BUILD_TOOLTIP
),
494 SetFill(0, 0), SetResize(0, 0), SetScrollbar(WID_BO_SELECT_SCROLL
),
497 NWidget(NWID_VSCROLLBAR
, COLOUR_DARK_GREEN
, WID_BO_SELECT_SCROLL
),
501 NWidget(NWID_HORIZONTAL
),
502 NWidget(WWT_EMPTY
, INVALID_COLOUR
, WID_BO_INFO
), SetPadding(2, 5, 0, 5), SetFill(1, 0), SetResize(1, 0),
503 NWidget(NWID_VERTICAL
),
504 NWidget(WWT_PANEL
, COLOUR_DARK_GREEN
), SetFill(0, 1), EndContainer(),
505 NWidget(WWT_RESIZEBOX
, COLOUR_DARK_GREEN
),
511 static WindowDesc::Prefs
_build_object_prefs ("build_object");
513 static const WindowDesc
_build_object_desc(
515 WC_BUILD_OBJECT
, WC_BUILD_TOOLBAR
,
517 _nested_build_object_widgets
, lengthof(_nested_build_object_widgets
),
522 * Show our object picker.
523 * @param w The toolbar window we're associated with.
525 void ShowBuildObjectPicker()
527 /* Don't show the place object button when there are no objects to place. */
528 if (ObjectClass::GetUIClassCount() > 0) {
529 AllocateWindowDescFront
<BuildObjectWindow
>(&_build_object_desc
, 0);
533 /** Reset all data of the object GUI. */
534 void InitializeObjectGui()
536 _selected_object_class
= (ObjectClassID
)0;
540 * Get the error string to show when building an object.
541 * @param tile Tile where the object was built.
542 * @param p1 The type of object built.
544 * @param text Unused.
546 StringID
GetErrBuildObject (TileIndex tile
, uint32 p1
, uint32 p2
, const char *text
)
548 switch (GB(p1
, 0, 8)) {
550 return STR_ERROR_CAN_T_BUILD_COMPANY_HEADQUARTERS
;
552 case OBJECT_OWNED_LAND
:
553 return STR_ERROR_CAN_T_PURCHASE_THIS_LAND
;
556 return STR_ERROR_CAN_T_BUILD_OBJECT
;
561 * Command callback. Play a sound depending on the object built.
562 * @param result Result of the command.
563 * @param tile Tile where the object was built.
564 * @param p1 The type of object built.
567 void CcBuildObject(const CommandCost
&result
, TileIndex tile
, uint32 p1
, uint32 p2
)
569 switch (GB(p1
, 0, 8)) {
573 case OBJECT_OWNED_LAND
:
574 CcPlaySound_SPLAT_RAIL(result
, tile
, p1
, p2
);
578 CcTerraform(result
, tile
, p1
, p2
);