mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-24 23:19:09 +00:00
(svn r7313) -Codechange: Calling invalidate data on a window will surely warrant a redraw, so call
that after the WE_INVALIDATE_DATA event and remove (some of) the superflouous calls.
This commit is contained in:
@@ -402,7 +402,6 @@ int32 CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||||||
GetPlayer(_current_player)->num_engines[p1]++;
|
GetPlayer(_current_player)->num_engines[p1]++;
|
||||||
|
|
||||||
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
||||||
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
|
|
||||||
RebuildVehicleLists();
|
RebuildVehicleLists();
|
||||||
InvalidateWindow(WC_COMPANY, v->owner);
|
InvalidateWindow(WC_COMPANY, v->owner);
|
||||||
if (IsLocalPlayer())
|
if (IsLocalPlayer())
|
||||||
@@ -1435,7 +1434,6 @@ static void AircraftLeaveHangar(Vehicle *v)
|
|||||||
VehicleServiceInDepot(v);
|
VehicleServiceInDepot(v);
|
||||||
SetAircraftPosition(v, v->x_pos, v->y_pos, v->z_pos);
|
SetAircraftPosition(v, v->x_pos, v->y_pos, v->z_pos);
|
||||||
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
||||||
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
|
|
||||||
InvalidateWindowClasses(WC_AIRCRAFT_LIST);
|
InvalidateWindowClasses(WC_AIRCRAFT_LIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -428,7 +428,6 @@ static void NewAircraftWndProc(Window *w, WindowEvent *e)
|
|||||||
switch (e->event) {
|
switch (e->event) {
|
||||||
case WE_INVALIDATE_DATA:
|
case WE_INVALIDATE_DATA:
|
||||||
GenerateBuildList(w);
|
GenerateBuildList(w);
|
||||||
SetWindowDirty(w);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WE_DESTROY:
|
case WE_DESTROY:
|
||||||
|
@@ -2010,11 +2010,10 @@ static uint32 VehicleEnter_Track(Vehicle *v, TileIndex tile, int x, int y)
|
|||||||
v->u.rail.track = 0x80,
|
v->u.rail.track = 0x80,
|
||||||
v->vehstatus |= VS_HIDDEN; /* hide it */
|
v->vehstatus |= VS_HIDDEN; /* hide it */
|
||||||
v->direction = ReverseDir(v->direction);
|
v->direction = ReverseDir(v->direction);
|
||||||
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
if (v->next == NULL) VehicleEnterDepot(v);
|
||||||
if (v->next == NULL)
|
|
||||||
VehicleEnterDepot(v);
|
|
||||||
v->tile = tile;
|
v->tile = tile;
|
||||||
InvalidateWindow(WC_VEHICLE_DEPOT, tile);
|
|
||||||
|
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
} else if (fract_coord_leave == fract_coord) {
|
} else if (fract_coord_leave == fract_coord) {
|
||||||
|
@@ -195,7 +195,6 @@ int32 CmdBuildRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||||||
GetPlayer(_current_player)->num_engines[p1]++;
|
GetPlayer(_current_player)->num_engines[p1]++;
|
||||||
|
|
||||||
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
||||||
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
|
|
||||||
RebuildVehicleLists();
|
RebuildVehicleLists();
|
||||||
InvalidateWindow(WC_COMPANY, v->owner);
|
InvalidateWindow(WC_COMPANY, v->owner);
|
||||||
if (IsLocalPlayer())
|
if (IsLocalPlayer())
|
||||||
@@ -1307,7 +1306,6 @@ static void RoadVehController(Vehicle *v)
|
|||||||
SetRoadVehPosition(v,x,y);
|
SetRoadVehPosition(v,x,y);
|
||||||
|
|
||||||
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
||||||
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -455,10 +455,6 @@ void CcBuildRoadVeh(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
|||||||
static void NewRoadVehWndProc(Window *w, WindowEvent *e)
|
static void NewRoadVehWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch (e->event) {
|
switch (e->event) {
|
||||||
case WE_INVALIDATE_DATA:
|
|
||||||
SetWindowDirty(w);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WE_PAINT:
|
case WE_PAINT:
|
||||||
DrawNewRoadVehWindow(w);
|
DrawNewRoadVehWindow(w);
|
||||||
break;
|
break;
|
||||||
|
@@ -884,7 +884,6 @@ int32 CmdBuildShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||||||
GetPlayer(_current_player)->num_engines[p1]++;
|
GetPlayer(_current_player)->num_engines[p1]++;
|
||||||
|
|
||||||
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
||||||
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
|
|
||||||
RebuildVehicleLists();
|
RebuildVehicleLists();
|
||||||
InvalidateWindow(WC_COMPANY, v->owner);
|
InvalidateWindow(WC_COMPANY, v->owner);
|
||||||
if (IsLocalPlayer())
|
if (IsLocalPlayer())
|
||||||
|
@@ -242,10 +242,6 @@ void CcCloneShip(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
|||||||
static void NewShipWndProc(Window *w, WindowEvent *e)
|
static void NewShipWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch (e->event) {
|
switch (e->event) {
|
||||||
case WE_INVALIDATE_DATA:
|
|
||||||
SetWindowDirty(w);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
EngineID selected_id;
|
EngineID selected_id;
|
||||||
EngineID eid;
|
EngineID eid;
|
||||||
|
@@ -851,7 +851,6 @@ int32 CmdBuildRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||||||
|
|
||||||
GetPlayer(_current_player)->num_engines[p1]++;
|
GetPlayer(_current_player)->num_engines[p1]++;
|
||||||
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
||||||
InvalidateWindow(WC_VEHICLE_DEPOT, tile);
|
|
||||||
RebuildVehicleLists();
|
RebuildVehicleLists();
|
||||||
InvalidateWindow(WC_COMPANY, v->owner);
|
InvalidateWindow(WC_COMPANY, v->owner);
|
||||||
if (IsLocalPlayer()) {
|
if (IsLocalPlayer()) {
|
||||||
@@ -1682,7 +1681,6 @@ static void ReverseTrainDirection(Vehicle *v)
|
|||||||
|
|
||||||
if (IsTileDepotType(v->tile, TRANSPORT_RAIL)) {
|
if (IsTileDepotType(v->tile, TRANSPORT_RAIL)) {
|
||||||
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
||||||
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if we were approaching a rail/road-crossing */
|
/* Check if we were approaching a rail/road-crossing */
|
||||||
@@ -1716,7 +1714,6 @@ static void ReverseTrainDirection(Vehicle *v)
|
|||||||
|
|
||||||
if (IsTileDepotType(v->tile, TRANSPORT_RAIL)) {
|
if (IsTileDepotType(v->tile, TRANSPORT_RAIL)) {
|
||||||
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
||||||
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CLRBIT(v->u.rail.flags, VRF_REVERSING);
|
CLRBIT(v->u.rail.flags, VRF_REVERSING);
|
||||||
@@ -2213,7 +2210,6 @@ static bool CheckTrainStayInDepot(Vehicle *v)
|
|||||||
UpdateSignalsOnSegment(v->tile, DirToDiagDir(v->direction));
|
UpdateSignalsOnSegment(v->tile, DirToDiagDir(v->direction));
|
||||||
UpdateTrainAcceleration(v);
|
UpdateTrainAcceleration(v);
|
||||||
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
||||||
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -473,7 +473,6 @@ static void NewRailVehicleWndProc(Window *w, WindowEvent *e)
|
|||||||
|
|
||||||
case WE_INVALIDATE_DATA:
|
case WE_INVALIDATE_DATA:
|
||||||
GenerateBuildList(w);
|
GenerateBuildList(w);
|
||||||
SetWindowDirty(w);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WE_DESTROY:
|
case WE_DESTROY:
|
||||||
|
1
window.c
1
window.c
@@ -1767,6 +1767,7 @@ void InvalidateWindowClasses(WindowClass cls)
|
|||||||
void InvalidateThisWindowData(Window *w)
|
void InvalidateThisWindowData(Window *w)
|
||||||
{
|
{
|
||||||
CallWindowEventNP(w, WE_INVALIDATE_DATA);
|
CallWindowEventNP(w, WE_INVALIDATE_DATA);
|
||||||
|
SetWindowDirty(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InvalidateWindowData(WindowClass cls, WindowNumber number)
|
void InvalidateWindowData(WindowClass cls, WindowNumber number)
|
||||||
|
Reference in New Issue
Block a user