mirror of https://github.com/OpenTTD/OpenTTD
(svn r20761) -Codechange: make PlaceObject() static
parent
15c2a2d555
commit
bb4538665a
|
@ -1802,6 +1802,26 @@ static bool CheckClickOnLandscape(const ViewPort *vp, int x, int y)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void PlaceObject()
|
||||||
|
{
|
||||||
|
Point pt;
|
||||||
|
Window *w;
|
||||||
|
|
||||||
|
pt = GetTileBelowCursor();
|
||||||
|
if (pt.x == -1) return;
|
||||||
|
|
||||||
|
if (_thd.place_mode == HT_POINT) {
|
||||||
|
pt.x += 8;
|
||||||
|
pt.y += 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
_tile_fract_coords.x = pt.x & TILE_UNIT_MASK;
|
||||||
|
_tile_fract_coords.y = pt.y & TILE_UNIT_MASK;
|
||||||
|
|
||||||
|
w = GetCallbackWnd();
|
||||||
|
if (w != NULL) w->OnPlaceObject(pt, TileVirtXY(pt.x, pt.y));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool HandleViewportClicked(const ViewPort *vp, int x, int y)
|
bool HandleViewportClicked(const ViewPort *vp, int x, int y)
|
||||||
{
|
{
|
||||||
|
@ -1836,26 +1856,6 @@ bool HandleViewportClicked(const ViewPort *vp, int x, int y)
|
||||||
return CheckClickOnLandscape(vp, x, y);
|
return CheckClickOnLandscape(vp, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlaceObject()
|
|
||||||
{
|
|
||||||
Point pt;
|
|
||||||
Window *w;
|
|
||||||
|
|
||||||
pt = GetTileBelowCursor();
|
|
||||||
if (pt.x == -1) return;
|
|
||||||
|
|
||||||
if (_thd.place_mode == HT_POINT) {
|
|
||||||
pt.x += 8;
|
|
||||||
pt.y += 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
_tile_fract_coords.x = pt.x & TILE_UNIT_MASK;
|
|
||||||
_tile_fract_coords.y = pt.y & TILE_UNIT_MASK;
|
|
||||||
|
|
||||||
w = GetCallbackWnd();
|
|
||||||
if (w != NULL) w->OnPlaceObject(pt, TileVirtXY(pt.x, pt.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scrolls the viewport in a window to a given location.
|
* Scrolls the viewport in a window to a given location.
|
||||||
|
|
|
@ -58,7 +58,6 @@ void StartSpriteCombine();
|
||||||
void EndSpriteCombine();
|
void EndSpriteCombine();
|
||||||
|
|
||||||
bool HandleViewportClicked(const ViewPort *vp, int x, int y);
|
bool HandleViewportClicked(const ViewPort *vp, int x, int y);
|
||||||
void PlaceObject();
|
|
||||||
void SetRedErrorSquare(TileIndex tile);
|
void SetRedErrorSquare(TileIndex tile);
|
||||||
void SetTileSelectSize(int w, int h);
|
void SetTileSelectSize(int w, int h);
|
||||||
void SetTileSelectBigSize(int ox, int oy, int sx, int sy);
|
void SetTileSelectBigSize(int ox, int oy, int sx, int sy);
|
||||||
|
|
Loading…
Reference in New Issue