1
0
Fork 0

(svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.

release/0.6
rubidium 2007-11-15 18:21:59 +00:00
parent 7faec2f54d
commit 59a6e40ed2
3 changed files with 18 additions and 17 deletions

View File

@ -2294,7 +2294,7 @@ void UpdateTileSelection()
} }
/** highlighting tiles while only going over them with the mouse */ /** 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_method = method;
_thd.select_proc = process; _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 y Y coordinate of end of selection
* @param method modifies the way tiles are selected. Possible * @param method modifies the way tiles are selected. Possible
* methods are VPM_* in viewport.h */ * 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; int sx, sy;
HighLightStyle style; HighLightStyle style;

View File

@ -73,20 +73,17 @@ 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);
void VpStartPlaceSizing(TileIndex tile, byte method, byte process);
void VpSetPresizeRange(uint from, uint to);
void VpSetPlaceSizingLimit(int limit);
Vehicle *CheckMouseOverVehicle(); Vehicle *CheckMouseOverVehicle();
enum { /** Viewport place method (type of highlighted area and placed objects) */
VPM_X_OR_Y = 0, enum ViewportPlaceMethod {
VPM_FIX_X = 1, VPM_X_OR_Y = 0, ///< drag in X or Y direction
VPM_FIX_Y = 2, VPM_FIX_X = 1, ///< drag only in X axis
VPM_RAILDIRS = 3, VPM_FIX_Y = 2, ///< drag only in Y axis
VPM_X_AND_Y = 4, VPM_RAILDIRS = 3, ///< all rail directions
VPM_X_AND_Y_LIMITED = 5, VPM_X_AND_Y = 4, ///< area of land in X and Y directions
VPM_SIGNALDIRS = 6 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) */ /* viewport highlight mode (for highlighting tiles below cursor) */
@ -99,7 +96,10 @@ enum {
VHM_RAIL = 5, ///< rail pieces 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 */ /* highlighting draw styles */
typedef byte HighLightStyle; typedef byte HighLightStyle;
@ -148,7 +148,7 @@ struct TileHighlightData {
WindowClass window_class; WindowClass window_class;
WindowNumber window_number; WindowNumber window_number;
byte select_method; ViewportPlaceMethod select_method;
byte select_proc; byte select_proc;
TileIndex redsq; TileIndex redsq;

View File

@ -12,6 +12,7 @@
#include "road.h" #include "road.h"
#include "airport.h" #include "airport.h"
#include "vehicle.h" #include "vehicle.h"
#include "viewport.h"
struct WindowEvent; struct WindowEvent;
@ -140,7 +141,7 @@ struct WindowEvent {
Point pt; Point pt;
TileIndex tile; TileIndex tile;
TileIndex starttile; TileIndex starttile;
byte select_method; ViewportPlaceMethod select_method;
byte select_proc; byte select_proc;
} place; } place;