summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-11-15 18:21:59 +0000
committerrubidium <rubidium@openttd.org>2007-11-15 18:21:59 +0000
commit59a6e40ed215319b6fe1feace41b7f745e28364a (patch)
tree9da03edcf303a22c3c11c18e658865c79e06599b /src
parent7faec2f54d3dc0ffb7dc14f9d151284de511a248 (diff)
downloadopenttd-59a6e40ed215319b6fe1feace41b7f745e28364a.tar.xz
(svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
Diffstat (limited to 'src')
-rw-r--r--src/viewport.cpp4
-rw-r--r--src/viewport.h28
-rw-r--r--src/window.h3
3 files changed, 18 insertions, 17 deletions
diff --git a/src/viewport.cpp b/src/viewport.cpp
index fa816b6fb..c8247acf2 100644
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -2294,7 +2294,7 @@ void UpdateTileSelection()
}
/** highlighting tiles while only going over them with the mouse */
-void VpStartPlaceSizing(TileIndex tile, byte method, byte process)
+void VpStartPlaceSizing(TileIndex tile, ViewportPlaceMethod method, byte process)
{
_thd.select_method = method;
_thd.select_proc = process;
@@ -2631,7 +2631,7 @@ static void CalcRaildirsDrawstyle(TileHighlightData *thd, int x, int y, int meth
* @param y Y coordinate of end of selection
* @param method modifies the way tiles are selected. Possible
* methods are VPM_* in viewport.h */
-void VpSelectTilesWithMethod(int x, int y, int method)
+void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method)
{
int sx, sy;
HighLightStyle style;
diff --git a/src/viewport.h b/src/viewport.h
index 2f4e83d62..ebc0e27d1 100644
--- a/src/viewport.h
+++ b/src/viewport.h
@@ -73,20 +73,17 @@ void SetRedErrorSquare(TileIndex tile);
void SetTileSelectSize(int w, int h);
void SetTileSelectBigSize(int ox, int oy, int sx, int sy);
-void VpStartPlaceSizing(TileIndex tile, byte method, byte process);
-void VpSetPresizeRange(uint from, uint to);
-void VpSetPlaceSizingLimit(int limit);
-
Vehicle *CheckMouseOverVehicle();
-enum {
- VPM_X_OR_Y = 0,
- VPM_FIX_X = 1,
- VPM_FIX_Y = 2,
- VPM_RAILDIRS = 3,
- VPM_X_AND_Y = 4,
- VPM_X_AND_Y_LIMITED = 5,
- VPM_SIGNALDIRS = 6
+/** Viewport place method (type of highlighted area and placed objects) */
+enum ViewportPlaceMethod {
+ VPM_X_OR_Y = 0, ///< drag in X or Y direction
+ VPM_FIX_X = 1, ///< drag only in X axis
+ VPM_FIX_Y = 2, ///< drag only in Y axis
+ VPM_RAILDIRS = 3, ///< all rail directions
+ VPM_X_AND_Y = 4, ///< area of land in X and Y directions
+ VPM_X_AND_Y_LIMITED = 5, ///< area of land of limited size
+ VPM_SIGNALDIRS = 6, ///< similiar to VMP_RAILDIRS, but with different cursor
};
/* viewport highlight mode (for highlighting tiles below cursor) */
@@ -99,7 +96,10 @@ enum {
VHM_RAIL = 5, ///< rail pieces
};
-void VpSelectTilesWithMethod(int x, int y, int method);
+void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method);
+void VpStartPlaceSizing(TileIndex tile, ViewportPlaceMethod method, byte process);
+void VpSetPresizeRange(uint from, uint to);
+void VpSetPlaceSizingLimit(int limit);
/* highlighting draw styles */
typedef byte HighLightStyle;
@@ -148,7 +148,7 @@ struct TileHighlightData {
WindowClass window_class;
WindowNumber window_number;
- byte select_method;
+ ViewportPlaceMethod select_method;
byte select_proc;
TileIndex redsq;
diff --git a/src/window.h b/src/window.h
index 9f498eb6d..7dcb1fc6d 100644
--- a/src/window.h
+++ b/src/window.h
@@ -12,6 +12,7 @@
#include "road.h"
#include "airport.h"
#include "vehicle.h"
+#include "viewport.h"
struct WindowEvent;
@@ -140,7 +141,7 @@ struct WindowEvent {
Point pt;
TileIndex tile;
TileIndex starttile;
- byte select_method;
+ ViewportPlaceMethod select_method;
byte select_proc;
} place;