1
0
Fork 0

(svn r2420) - Codechange: magic number elminitation of cursorsprites.

release/0.4.5
Darkvater 2005-06-06 13:47:06 +00:00
parent 71c2a573e1
commit 5fed47964e
17 changed files with 73 additions and 70 deletions

View File

@ -40,7 +40,7 @@ static void PlaceAir_DemolishArea(uint tile)
static void BuildAirClick_Airport(Window *w) static void BuildAirClick_Airport(Window *w)
{ {
if (HandlePlacePushButton(w, 3, 0xAA4, 1, PlaceAirport)) ShowBuildAirportPicker(); if (HandlePlacePushButton(w, 3, SPR_CURSOR_AIRPORT, 1, PlaceAirport)) ShowBuildAirportPicker();
} }
static void BuildAirClick_Demolish(Window *w) static void BuildAirClick_Demolish(Window *w)

View File

@ -63,12 +63,12 @@ static void PlaceDocks_BuildLock(uint tile)
static void BuildDocksClick_Canal(Window *w) static void BuildDocksClick_Canal(Window *w)
{ {
HandlePlacePushButton(w, 3, SPR_OPENTTD_BASE + 11, 1, PlaceDocks_BuildCanal); HandlePlacePushButton(w, 3, SPR_CURSOR_CANAL, 1, PlaceDocks_BuildCanal);
} }
static void BuildDocksClick_Lock(Window *w) static void BuildDocksClick_Lock(Window *w)
{ {
HandlePlacePushButton(w, 4, SPR_OPENTTD_BASE + 64, 1, PlaceDocks_BuildLock); HandlePlacePushButton(w, 4, SPR_CURSOR_LOCK, 1, PlaceDocks_BuildLock);
} }
static void BuildDocksClick_Demolish(Window *w) static void BuildDocksClick_Demolish(Window *w)
@ -78,18 +78,18 @@ static void BuildDocksClick_Demolish(Window *w)
static void BuildDocksClick_Depot(Window *w) static void BuildDocksClick_Depot(Window *w)
{ {
if (HandlePlacePushButton(w, 7, 0x2D1, 1, PlaceDocks_Depot)) ShowBuildDocksDepotPicker(); if (HandlePlacePushButton(w, 7, SPR_CURSOR_SHIP_DEPOT, 1, PlaceDocks_Depot)) ShowBuildDocksDepotPicker();
} }
static void BuildDocksClick_Dock(Window *w) static void BuildDocksClick_Dock(Window *w)
{ {
if (HandlePlacePushButton(w, 8, 0xE54, 3, PlaceDocks_Dock)) ShowBuildDockStationPicker(); if (HandlePlacePushButton(w, 8, SPR_CURSOR_DOCK, 3, PlaceDocks_Dock)) ShowBuildDockStationPicker();
} }
static void BuildDocksClick_Buoy(Window *w) static void BuildDocksClick_Buoy(Window *w)
{ {
HandlePlacePushButton(w, 9, 0x2BE, 1, PlaceDocks_Buoy); HandlePlacePushButton(w, 9, SPR_CURSOR_BOUY, 1, PlaceDocks_Buoy);
} }
static void BuildDocksClick_Landscaping(Window *w) static void BuildDocksClick_Landscaping(Window *w)

View File

@ -177,8 +177,8 @@ void InvalidateWindowClasses(byte cls);
void DeleteWindowById(WindowClass cls, WindowNumber number); void DeleteWindowById(WindowClass cls, WindowNumber number);
void DeleteWindowByClass(WindowClass cls); void DeleteWindowByClass(WindowClass cls);
void SetObjectToPlaceWnd(int icon, byte mode, Window *w); void SetObjectToPlaceWnd(CursorID icon, byte mode, Window *w);
void SetObjectToPlace(int icon, byte mode, WindowClass window_class, WindowNumber window_num); void SetObjectToPlace(CursorID icon, byte mode, WindowClass window_class, WindowNumber window_num);
void ResetObjectToPlace(void); void ResetObjectToPlace(void);

16
gfx.c
View File

@ -1913,7 +1913,7 @@ bool FillDrawPixelInfo(DrawPixelInfo *n, DrawPixelInfo *o, int left, int top, in
return true; return true;
} }
static void SetCursorSprite(uint cursor) static void SetCursorSprite(CursorID cursor)
{ {
CursorVars *cv = &_cursor; CursorVars *cv = &_cursor;
const Sprite *p; const Sprite *p;
@ -1934,12 +1934,12 @@ static void SetCursorSprite(uint cursor)
static void SwitchAnimatedCursor(void) static void SwitchAnimatedCursor(void)
{ {
CursorVars *cv = &_cursor; CursorVars *cv = &_cursor;
const uint16 *cur; const CursorID *cur = cv->animate_cur;
uint sprite; CursorID sprite;
// ANIM_CURSOR_END is 0xFFFF in table/animcursors.h
if (cur == NULL || *cur == 0xFFFF) cur = cv->animate_list;
cur = cv->animate_cur;
if (cur == NULL || *cur == 0xFFFF)
cur = cv->animate_list;
sprite = cur[0]; sprite = cur[0];
cv->animate_timeout = cur[1]; cv->animate_timeout = cur[1];
cv->animate_cur = cur + 2; cv->animate_cur = cur + 2;
@ -1954,7 +1954,7 @@ void CursorTick(void)
SwitchAnimatedCursor(); SwitchAnimatedCursor();
} }
void SetMouseCursor(uint cursor) void SetMouseCursor(CursorID cursor)
{ {
// Turn off animation // Turn off animation
_cursor.animate_timeout = 0; _cursor.animate_timeout = 0;
@ -1962,7 +1962,7 @@ void SetMouseCursor(uint cursor)
SetCursorSprite(cursor); SetCursorSprite(cursor);
} }
void SetAnimatedMouseCursor(const uint16 *table) void SetAnimatedMouseCursor(const CursorID *table)
{ {
_cursor.animate_list = table; _cursor.animate_list = table;
_cursor.animate_cur = NULL; _cursor.animate_cur = NULL;

6
gfx.h
View File

@ -20,10 +20,10 @@ struct DrawPixelInfo {
typedef struct CursorVars { typedef struct CursorVars {
Point pos, size, offs, delta; Point pos, size, offs, delta;
Point draw_pos, draw_size; Point draw_pos, draw_size;
uint32 sprite; CursorID sprite;
int wheel; // mouse wheel movement int wheel; // mouse wheel movement
const uint16 *animate_list, *animate_cur; const CursorID *animate_list, *animate_cur;
uint animate_timeout; uint animate_timeout;
bool visible; bool visible;
@ -60,7 +60,7 @@ bool FillDrawPixelInfo(DrawPixelInfo *n, DrawPixelInfo *o, int left, int top, in
void DrawOverlappedWindowForAll(int left, int top, int right, int bottom); void DrawOverlappedWindowForAll(int left, int top, int right, int bottom);
void SetMouseCursor(uint cursor); void SetMouseCursor(uint cursor);
void SetAnimatedMouseCursor(const uint16 *table); void SetAnimatedMouseCursor(const CursorID *table);
void CursorTick(void); void CursorTick(void);
void DrawMouseCursor(void); void DrawMouseCursor(void);
void ScreenSizeChanged(void); void ScreenSizeChanged(void);

View File

@ -3,6 +3,7 @@
#include "debug.h" #include "debug.h"
#include "strings.h" #include "strings.h"
#include "table/strings.h" #include "table/strings.h"
#include "table/sprites.h"
#include "map.h" #include "map.h"
#include "gui.h" #include "gui.h"
#include "window.h" #include "window.h"
@ -35,7 +36,7 @@ static void BuildIndustryWndProc(Window *w, WindowEvent *e)
case WE_CLICK: { case WE_CLICK: {
int wid = e->click.widget; int wid = e->click.widget;
if (wid >= 3) { if (wid >= 3) {
if (HandlePlacePushButton(w, wid, 0xFF1, 1, NULL)) if (HandlePlacePushButton(w, wid, SPR_CURSOR_INDUSTRY, 1, NULL))
WP(w,def_d).data_1 = wid - 3; WP(w,def_d).data_1 = wid - 3;
} }
} break; } break;

View File

@ -122,7 +122,7 @@ void HandleOnEditText(WindowEvent *e)
* @return true if the button is clicked, false if it's unclicked * @return true if the button is clicked, false if it's unclicked
*/ */
bool HandlePlacePushButton(Window *w, int widget, uint32 cursor, int mode, PlaceProc *placeproc) bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, int mode, PlaceProc *placeproc)
{ {
uint32 mask = 1 << widget; uint32 mask = 1 << widget;
@ -406,10 +406,10 @@ void ShowRenameWaypointWindow(Waypoint *wp)
static void SelectSignTool(void) static void SelectSignTool(void)
{ {
if (_cursor.sprite == 0x2D2) if (_cursor.sprite == SPR_CURSOR_SIGN)
ResetObjectToPlace(); ResetObjectToPlace();
else { else {
SetObjectToPlace(0x2D2, 1, 1, 0); SetObjectToPlace(SPR_CURSOR_SIGN, 1, 1, 0);
_place_proc = PlaceProc_Sign; _place_proc = PlaceProc_Sign;
} }
} }
@ -1713,7 +1713,7 @@ static void ScenEditIndustryWndProc(Window *w, WindowEvent *e)
} }
if ((button=e->click.widget) >= 4) { if ((button=e->click.widget) >= 4) {
if (HandlePlacePushButton(w, button, 0xFF1, 1, NULL)) if (HandlePlacePushButton(w, button, SPR_CURSOR_INDUSTRY, 1, NULL))
_industry_type_to_place = _industry_type_list[_opt.landscape][button - 4]; _industry_type_to_place = _industry_type_list[_opt.landscape][button - 4];
} }
break; break;

5
misc.c
View File

@ -3,6 +3,7 @@
#include "string.h" #include "string.h"
#include "strings.h" // XXX GetParam* #include "strings.h" // XXX GetParam*
#include "table/strings.h" #include "table/strings.h"
#include "table/sprites.h"
#include "map.h" #include "map.h"
#include "vehicle.h" #include "vehicle.h"
#include "gfx.h" #include "gfx.h"
@ -208,7 +209,7 @@ void InitializeGame(uint log_x, uint log_y)
AddTypeToEngines(); // make sure all engines have a type AddTypeToEngines(); // make sure all engines have a type
SetObjectToPlace(1, 0, 0, 0); SetObjectToPlace(SPR_CURSOR_ZZZ, 0, 0, 0);
_pause = 0; _pause = 0;
_fast_forward = 0; _fast_forward = 0;
@ -270,7 +271,7 @@ void GenerateWorld(int mode, uint log_x, uint log_y)
_generating_world = true; _generating_world = true;
InitializeGame(log_x, log_y); InitializeGame(log_x, log_y);
SetObjectToPlace(1, 0, 0, 0); SetObjectToPlace(SPR_CURSOR_ZZZ, 0, 0, 0);
// Must start economy early because of the costs. // Must start economy early because of the costs.
StartupEconomy(); StartupEconomy();

View File

@ -161,11 +161,11 @@ static void Place_LandInfo(uint tile)
void PlaceLandBlockInfo(void) void PlaceLandBlockInfo(void)
{ {
if (_cursor.sprite == 0x2CF) { if (_cursor.sprite == SPR_CURSOR_QUERY) {
ResetObjectToPlace(); ResetObjectToPlace();
} else { } else {
_place_proc = Place_LandInfo; _place_proc = Place_LandInfo;
SetObjectToPlace(0x2CF, 1, 1, 0); SetObjectToPlace(SPR_CURSOR_QUERY, 1, 1, 0);
} }
} }
@ -317,12 +317,12 @@ static void BuildTreesWndProc(Window *w, WindowEvent *e)
if ( (uint)(wid-3) >= (uint)WP(w,tree_d).count) if ( (uint)(wid-3) >= (uint)WP(w,tree_d).count)
return; return;
if (HandlePlacePushButton(w, wid, 0x7DA, 1, NULL)) if (HandlePlacePushButton(w, wid, SPR_CURSOR_TREE, 1, NULL))
_tree_to_plant = WP(w,tree_d).base + wid - 3; _tree_to_plant = WP(w,tree_d).base + wid - 3;
break; break;
case 15: // tree of random type. case 15: // tree of random type.
if (HandlePlacePushButton(w, 15, 0x7DA, 1, NULL)) if (HandlePlacePushButton(w, 15, SPR_CURSOR_TREE, 1, NULL))
_tree_to_plant = -1; _tree_to_plant = -1;
break; break;
@ -1389,7 +1389,7 @@ void ShowSaveLoadDialog(int mode)
{ {
Window *w; Window *w;
SetObjectToPlace(1, 0, 0, 0); SetObjectToPlace(SPR_CURSOR_ZZZ, 0, 0, 0);
DeleteWindowById(WC_QUERY_STRING, 0); DeleteWindowById(WC_QUERY_STRING, 0);
DeleteWindowById(WC_SAVELOAD, 0); DeleteWindowById(WC_SAVELOAD, 0);

View File

@ -71,6 +71,7 @@ typedef byte CargoID;
typedef uint16 StringID; typedef uint16 StringID;
typedef uint16 SpriteID; typedef uint16 SpriteID;
typedef uint32 PalSpriteID; typedef uint32 PalSpriteID;
typedef uint32 CursorID;
typedef uint32 WindowNumber; typedef uint32 WindowNumber;
typedef byte WindowClass; typedef byte WindowClass;

View File

@ -593,7 +593,7 @@ static void PlayerCompanyWndProc(Window *w, WindowEvent *e)
if (tile == 0) { if (tile == 0) {
if ((byte)w->window_number != _local_player) if ((byte)w->window_number != _local_player)
return; return;
SetObjectToPlaceWnd(0x2D0, 1, w); SetObjectToPlaceWnd(SPR_CURSOR_HQ, 1, w);
SetTileSelectSize(2, 2); SetTileSelectSize(2, 2);
} else { } else {
ScrollMainWindowToTile(tile); ScrollMainWindowToTile(tile);
@ -601,7 +601,7 @@ static void PlayerCompanyWndProc(Window *w, WindowEvent *e)
} break; } break;
case 8: /* relocate HQ */ case 8: /* relocate HQ */
SetObjectToPlaceWnd(0x2D0, 1, w); SetObjectToPlaceWnd(SPR_CURSOR_HQ, 1, w);
SetTileSelectSize(2, 2); SetTileSelectSize(2, 2);
break; break;
case 9: /* buy 25% */ case 9: /* buy 25% */

View File

@ -214,27 +214,27 @@ static void PlaceRail_AutoSignals(uint tile)
static void BuildRailClick_N(Window *w) static void BuildRailClick_N(Window *w)
{ {
HandlePlacePushButton(w, 4, _cur_railtype*4 + 0x4EF, 1, PlaceRail_N); HandlePlacePushButton(w, 4, _cur_railtype*4 + SPR_CURSOR_NS_TRACK, 1, PlaceRail_N);
} }
static void BuildRailClick_NE(Window *w) static void BuildRailClick_NE(Window *w)
{ {
HandlePlacePushButton(w, 5, _cur_railtype*4 + 0x4F0, 1, PlaceRail_NE); HandlePlacePushButton(w, 5, _cur_railtype*4 + SPR_CURSOR_SWNE_TRACK, 1, PlaceRail_NE);
} }
static void BuildRailClick_E(Window *w) static void BuildRailClick_E(Window *w)
{ {
HandlePlacePushButton(w, 6, _cur_railtype*4 + 0x4F1, 1, PlaceRail_E); HandlePlacePushButton(w, 6, _cur_railtype*4 + SPR_CURSOR_EW_TRACK, 1, PlaceRail_E);
} }
static void BuildRailClick_NW(Window *w) static void BuildRailClick_NW(Window *w)
{ {
HandlePlacePushButton(w, 7, _cur_railtype*4 + 0x4F2, 1, PlaceRail_NW); HandlePlacePushButton(w, 7, _cur_railtype*4 + SPR_CURSOR_NWSE_TRACK, 1, PlaceRail_NW);
} }
static void BuildRailClick_AutoRail(Window *w) static void BuildRailClick_AutoRail(Window *w)
{ {
HandlePlacePushButton(w, 8, _cur_railtype + SPR_CURSOR_AUTORAIL, VHM_RAIL, PlaceRail_AutoRail); HandlePlacePushButton(w, 8, SPR_CURSOR_AUTORAIL + _cur_railtype, VHM_RAIL, PlaceRail_AutoRail);
} }
static void BuildRailClick_Demolish(Window *w) static void BuildRailClick_Demolish(Window *w)
@ -242,10 +242,10 @@ static void BuildRailClick_Demolish(Window *w)
HandlePlacePushButton(w, 9, ANIMCURSOR_DEMOLISH, 1, PlaceProc_DemolishArea); HandlePlacePushButton(w, 9, ANIMCURSOR_DEMOLISH, 1, PlaceProc_DemolishArea);
} }
static const SpriteID _depot_cursors[] = { static const CursorID _depot_cursors[] = {
0x510, SPR_CURSOR_RAIL_DEPOT,
SPR_OPENTTD_BASE + 14, SPR_CURSOR_MONO_DEPOT,
SPR_OPENTTD_BASE + 15, SPR_CURSOR_MAGLEV_DEPOT,
}; };
static void BuildRailClick_Depot(Window *w) static void BuildRailClick_Depot(Window *w)
@ -256,14 +256,14 @@ static void BuildRailClick_Depot(Window *w)
static void BuildRailClick_Waypoint(Window *w) static void BuildRailClick_Waypoint(Window *w)
{ {
_waypoint_count = GetCustomStationsCount(STAT_CLASS_WAYP); _waypoint_count = GetCustomStationsCount(STAT_CLASS_WAYP);
if (HandlePlacePushButton(w, 11, SPR_OPENTTD_BASE + 7, 1, PlaceRail_Waypoint) if (HandlePlacePushButton(w, 11, SPR_CURSOR_WAYPOINT, 1, PlaceRail_Waypoint)
&& _waypoint_count > 0) && _waypoint_count > 0)
ShowBuildWaypointPicker(); ShowBuildWaypointPicker();
} }
static void BuildRailClick_Station(Window *w) static void BuildRailClick_Station(Window *w)
{ {
if (HandlePlacePushButton(w, 12, 0x514, 1, PlaceRail_Station)) ShowStationBuilder(); if (HandlePlacePushButton(w, 12, SPR_CURSOR_RAIL_STATION, 1, PlaceRail_Station)) ShowStationBuilder();
} }
static void BuildRailClick_AutoSignals(Window *w) static void BuildRailClick_AutoSignals(Window *w)
@ -273,12 +273,12 @@ static void BuildRailClick_AutoSignals(Window *w)
static void BuildRailClick_Bridge(Window *w) static void BuildRailClick_Bridge(Window *w)
{ {
HandlePlacePushButton(w, 14, 0xA21, 1, PlaceRail_Bridge); HandlePlacePushButton(w, 14, SPR_CURSOR_BRIDGE, 1, PlaceRail_Bridge);
} }
static void BuildRailClick_Tunnel(Window *w) static void BuildRailClick_Tunnel(Window *w)
{ {
HandlePlacePushButton(w, 15, 0x982 + _cur_railtype, 3, PlaceRail_Tunnel); HandlePlacePushButton(w, 15, SPR_CURSOR_TUNNEL_RAIL + _cur_railtype, 3, PlaceRail_Tunnel);
} }
static void BuildRailClick_Remove(Window *w) static void BuildRailClick_Remove(Window *w)
@ -304,7 +304,7 @@ static void BuildRailClick_Remove(Window *w)
static void BuildRailClick_Convert(Window *w) static void BuildRailClick_Convert(Window *w)
{ {
HandlePlacePushButton(w, 17, (SPR_OPENTTD_BASE + 26) + _cur_railtype * 2, 1, PlaceRail_ConvertRail); HandlePlacePushButton(w, 17, SPR_CURSOR_CONVERT_RAIL + _cur_railtype * 2, 1, PlaceRail_ConvertRail);
} }
static void BuildRailClick_Landscaping(Window *w) static void BuildRailClick_Landscaping(Window *w)

View File

@ -108,13 +108,13 @@ typedef void OnButtonClick(Window *w);
static void BuildRoadClick_NE(Window *w) static void BuildRoadClick_NE(Window *w)
{ {
_build_road_flag = 0; _build_road_flag = 0;
HandlePlacePushButton(w, 3, 0x51F, 1, PlaceRoad_NE); HandlePlacePushButton(w, 3, SPR_CURSOR_ROAD_NESW, 1, PlaceRoad_NE);
} }
static void BuildRoadClick_NW(Window *w) static void BuildRoadClick_NW(Window *w)
{ {
_build_road_flag = 0; _build_road_flag = 0;
HandlePlacePushButton(w, 4, 0x520, 1, PlaceRoad_NW); HandlePlacePushButton(w, 4, SPR_CURSOR_ROAD_NWSE, 1, PlaceRoad_NW);
} }
@ -126,31 +126,31 @@ static void BuildRoadClick_Demolish(Window *w)
static void BuildRoadClick_Depot(Window *w) static void BuildRoadClick_Depot(Window *w)
{ {
if (_game_mode == GM_EDITOR) return; if (_game_mode == GM_EDITOR) return;
if (HandlePlacePushButton(w, 6, 0x511, 1, PlaceRoad_Depot)) ShowRoadDepotPicker(); if (HandlePlacePushButton(w, 6, SPR_CURSOR_ROAD_DEPOT, 1, PlaceRoad_Depot)) ShowRoadDepotPicker();
} }
static void BuildRoadClick_BusStation(Window *w) static void BuildRoadClick_BusStation(Window *w)
{ {
if (_game_mode == GM_EDITOR) return; if (_game_mode == GM_EDITOR) return;
if (HandlePlacePushButton(w, 7, 0xAA5, 1, PlaceRoad_BusStation)) ShowBusStationPicker(); if (HandlePlacePushButton(w, 7, SPR_CURSOR_BUS_STATION, 1, PlaceRoad_BusStation)) ShowBusStationPicker();
} }
static void BuildRoadClick_TruckStation(Window *w) static void BuildRoadClick_TruckStation(Window *w)
{ {
if (_game_mode == GM_EDITOR) return; if (_game_mode == GM_EDITOR) return;
if (HandlePlacePushButton(w, 8, 0xAA6, 1, PlaceRoad_TruckStation)) ShowTruckStationPicker(); if (HandlePlacePushButton(w, 8, SPR_CURSOR_TRUCK_STATION, 1, PlaceRoad_TruckStation)) ShowTruckStationPicker();
} }
static void BuildRoadClick_Bridge(Window *w) static void BuildRoadClick_Bridge(Window *w)
{ {
_build_road_flag = 0; _build_road_flag = 0;
HandlePlacePushButton(w, 9, 0xA21, 1, PlaceRoad_Bridge); HandlePlacePushButton(w, 9, SPR_CURSOR_BRIDGE, 1, PlaceRoad_Bridge);
} }
static void BuildRoadClick_Tunnel(Window *w) static void BuildRoadClick_Tunnel(Window *w)
{ {
_build_road_flag = 0; _build_road_flag = 0;
HandlePlacePushButton(w, 10, 0x981, 3, PlaceRoad_Tunnel); HandlePlacePushButton(w, 10, SPR_CURSOR_ROAD_TUNNEL, 3, PlaceRoad_Tunnel);
} }
static void BuildRoadClick_Remove(Window *w) static void BuildRoadClick_Remove(Window *w)

View File

@ -837,7 +837,7 @@ typedef struct ThreadedSave {
uint count; uint count;
bool ff_state; bool ff_state;
bool saveinprogress; bool saveinprogress;
uint32 cursor; CursorID cursor;
} ThreadedSave; } ThreadedSave;
/* A maximum size of of 128K * 500 = 64.000KB savegames */ /* A maximum size of of 128K * 500 = 64.000KB savegames */

View File

@ -1,7 +1,7 @@
#define ANIM_CURSOR_LINE(a,b) a,b, #define ANIM_CURSOR_LINE(a,b) a,b,
#define ANIM_CURSOR_END() 0xFFFF #define ANIM_CURSOR_END() 0xFFFF
static const uint16 _demolish_animcursor[] = { static const CursorID _demolish_animcursor[] = {
ANIM_CURSOR_LINE(0x2C0, 29) ANIM_CURSOR_LINE(0x2C0, 29)
ANIM_CURSOR_LINE(0x2C1, 29) ANIM_CURSOR_LINE(0x2C1, 29)
ANIM_CURSOR_LINE(0x2C2, 29) ANIM_CURSOR_LINE(0x2C2, 29)
@ -9,34 +9,34 @@ static const uint16 _demolish_animcursor[] = {
ANIM_CURSOR_END() ANIM_CURSOR_END()
}; };
static const uint16 _lower_land_animcursor[] = { static const CursorID _lower_land_animcursor[] = {
ANIM_CURSOR_LINE(0x2BB, 29) ANIM_CURSOR_LINE(0x2BB, 29)
ANIM_CURSOR_LINE(0x2BC, 29) ANIM_CURSOR_LINE(0x2BC, 29)
ANIM_CURSOR_LINE(0x2BD, 98) ANIM_CURSOR_LINE(0x2BD, 98)
ANIM_CURSOR_END() ANIM_CURSOR_END()
}; };
static const uint16 _raise_land_animcursor[] = { static const CursorID _raise_land_animcursor[] = {
ANIM_CURSOR_LINE(0x2B8, 29) ANIM_CURSOR_LINE(0x2B8, 29)
ANIM_CURSOR_LINE(0x2B9, 29) ANIM_CURSOR_LINE(0x2B9, 29)
ANIM_CURSOR_LINE(0x2BA, 98) ANIM_CURSOR_LINE(0x2BA, 98)
ANIM_CURSOR_END() ANIM_CURSOR_END()
}; };
static const uint16 _pick_station_animcursor[] = { static const CursorID _pick_station_animcursor[] = {
ANIM_CURSOR_LINE(0x2CC, 29) ANIM_CURSOR_LINE(0x2CC, 29)
ANIM_CURSOR_LINE(0x2CD, 29) ANIM_CURSOR_LINE(0x2CD, 29)
ANIM_CURSOR_LINE(0x2CE, 98) ANIM_CURSOR_LINE(0x2CE, 98)
ANIM_CURSOR_END() ANIM_CURSOR_END()
}; };
static const uint16 _build_signals_animcursor[] = { static const CursorID _build_signals_animcursor[] = {
ANIM_CURSOR_LINE(0x50C, 148) ANIM_CURSOR_LINE(0x50C, 148)
ANIM_CURSOR_LINE(0x50D, 148) ANIM_CURSOR_LINE(0x50D, 148)
ANIM_CURSOR_END() ANIM_CURSOR_END()
}; };
static const uint16 * const _animcursors[] = { static const CursorID * const _animcursors[] = {
_demolish_animcursor, _demolish_animcursor,
_lower_land_animcursor, _lower_land_animcursor,
_raise_land_animcursor, _raise_land_animcursor,

View File

@ -135,27 +135,27 @@ static void TerraformClick_Raise(Window *w)
static void TerraformClick_Level(Window *w) static void TerraformClick_Level(Window *w)
{ {
HandlePlacePushButton(w, 6, SPR_OPENTTD_BASE+69, 2, PlaceProc_LevelLand); HandlePlacePushButton(w, 6, ANIMCURSOR_LOWERLAND, 2, PlaceProc_LevelLand);
} }
static void TerraformClick_Dynamite(Window *w) static void TerraformClick_Dynamite(Window *w)
{ {
HandlePlacePushButton(w, 7, SPR_IMG_DYNAMITE+1 , 1, PlaceProc_DemolishArea); HandlePlacePushButton(w, 7, ANIMCURSOR_DEMOLISH , 1, PlaceProc_DemolishArea);
} }
static void TerraformClick_BuyLand(Window *w) static void TerraformClick_BuyLand(Window *w)
{ {
HandlePlacePushButton(w, 8, 4792, 1, PlaceProc_BuyLand); HandlePlacePushButton(w, 8, SPR_CURSOR_BUY_LAND, 1, PlaceProc_BuyLand);
} }
static void TerraformClick_Trees(Window *w) static void TerraformClick_Trees(Window *w)
{ {
if (HandlePlacePushButton(w, 9, 0, 1, PlaceProc_PlantTree)) ShowBuildTreesToolbar(); if (HandlePlacePushButton(w, 9, SPR_CURSOR_MOUSE, 1, PlaceProc_PlantTree)) ShowBuildTreesToolbar();
} }
static void TerraformClick_PlaceSign(Window *w) static void TerraformClick_PlaceSign(Window *w)
{ {
HandlePlacePushButton(w, 10, 722, 1, PlaceProc_Sign); HandlePlacePushButton(w, 10, SPR_CURSOR_SIGN, 1, PlaceProc_Sign);
} }
static OnButtonClick * const _terraform_button_proc[] = { static OnButtonClick * const _terraform_button_proc[] = {

View File

@ -2176,14 +2176,14 @@ bool VpHandlePlaceSizingDrag(void)
return false; return false;
} }
void SetObjectToPlaceWnd(int icon, byte mode, Window *w) void SetObjectToPlaceWnd(CursorID icon, byte mode, Window *w)
{ {
SetObjectToPlace(icon,mode,w->window_class, w->window_number); SetObjectToPlace(icon, mode, w->window_class, w->window_number);
} }
#include "table/animcursors.h" #include "table/animcursors.h"
void SetObjectToPlace(int icon, byte mode, WindowClass window_class, WindowNumber window_num) void SetObjectToPlace(CursorID icon, byte mode, WindowClass window_class, WindowNumber window_num)
{ {
Window *w; Window *w;
@ -2221,5 +2221,5 @@ void SetObjectToPlace(int icon, byte mode, WindowClass window_class, WindowNumbe
void ResetObjectToPlace(void) void ResetObjectToPlace(void)
{ {
SetObjectToPlace(0,0,0,0); SetObjectToPlace(SPR_CURSOR_MOUSE, 0, 0, 0);
} }