Changeset - r15073:02cc9885c126
[Not reviewed]
master
0 8 0
rubidium - 15 years ago 2010-04-24 13:39:11
rubidium@openttd.org
(svn r19709) -Feature: NewGRF debugging/inspecting of (primarily) enabled callbacks and values of variables
8 files changed with 57 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/industry_cmd.cpp
Show inline comments
 
@@ -26,6 +26,7 @@
 
#include "newgrf.h"
 
#include "newgrf_cargo.h"
 
#include "newgrf_commons.h"
 
#include "newgrf_debug.h"
 
#include "newgrf_industries.h"
 
#include "newgrf_industrytiles.h"
 
#include "autoslope.h"
 
@@ -141,6 +142,8 @@ Industry::~Industry()
 
	TILE_AREA_LOOP(tile_cur, this->location) {
 
		if (IsTileType(tile_cur, MP_INDUSTRY)) {
 
			if (GetIndustryIndex(tile_cur) == this->index) {
 
				DeleteNewGRFInspectWindow(GSF_INDUSTRYTILES, tile_cur);
 

	
 
				/* MakeWaterKeepingClass() can also handle 'land' */
 
				MakeWaterKeepingClass(tile_cur, OWNER_NONE);
 

	
 
@@ -173,6 +176,7 @@ Industry::~Industry()
 

	
 
	DeleteIndustryNews(this->index);
 
	DeleteWindowById(WC_INDUSTRY_VIEW, this->index);
 
	DeleteNewGRFInspectWindow(GSF_INDUSTRIES, this->index);
 

	
 
	DeleteSubsidyWith(ST_INDUSTRY, this->index);
 
	CargoPacket::InvalidateAllFrom(ST_INDUSTRY, this->index);
src/industry_gui.cpp
Show inline comments
 
@@ -23,6 +23,7 @@
 
#include "newgrf.h"
 
#include "newgrf_industries.h"
 
#include "newgrf_text.h"
 
#include "newgrf_debug.h"
 
#include "strings_func.h"
 
#include "company_func.h"
 
#include "tilehighlight_func.h"
 
@@ -834,6 +835,16 @@ public:
 
		UpdateIndustryProduction(i);
 
		this->SetDirty();
 
	}
 

	
 
	virtual bool IsNewGRFInspectable() const
 
	{
 
		return ::IsNewGRFInspectable(GSF_INDUSTRIES, this->window_number);
 
	}
 

	
 
	virtual void ShowNewGRFInspectWindow() const
 
	{
 
		::ShowNewGRFInspectWindow(GSF_INDUSTRIES, this->window_number);
 
	}
 
};
 

	
 
static void UpdateIndustryProduction(Industry *i)
 
@@ -850,6 +861,7 @@ static const NWidgetPart _nested_industr
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_CREAM),
 
		NWidget(WWT_CAPTION, COLOUR_CREAM, IVW_CAPTION), SetDataTip(STR_INDUSTRY_VIEW_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
		NWidget(WWT_DEBUGBOX, COLOUR_CREAM),
 
		NWidget(WWT_SHADEBOX, COLOUR_CREAM),
 
		NWidget(WWT_STICKYBOX, COLOUR_CREAM),
 
	EndContainer(),
src/misc_gui.cpp
Show inline comments
 
@@ -35,6 +35,7 @@
 
#include "querystring_gui.h"
 
#include "console_func.h"
 
#include "core/geometry_func.hpp"
 
#include "newgrf_debug.h"
 

	
 
#include "table/strings.h"
 

	
 
@@ -65,6 +66,7 @@ static const NWidgetPart _nested_land_in
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_GREY),
 
		NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_LAND_AREA_INFORMATION_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
		NWidget(WWT_DEBUGBOX, COLOUR_GREY),
 
	EndContainer(),
 
	NWidget(WWT_PANEL, COLOUR_GREY, LIW_BACKGROUND), EndContainer(),
 
};
 
@@ -87,6 +89,7 @@ class LandInfoWindow : public Window {
 

	
 
public:
 
	char landinfo_data[LAND_INFO_LINE_END][LAND_INFO_LINE_BUFF_SIZE];
 
	TileIndex tile;
 

	
 
	virtual void OnPaint()
 
	{
 
@@ -135,7 +138,7 @@ public:
 
		}
 
	}
 

	
 
	LandInfoWindow(TileIndex tile) : Window() {
 
	LandInfoWindow(TileIndex tile) : Window(), tile(tile) {
 
		Town *t = ClosestTownFromTile(tile, _settings_game.economy.dist_local_authority);
 

	
 
		/* Because build_date is not set yet in every TileDesc, we make sure it is empty */
 
@@ -315,6 +318,16 @@ public:
 
		DEBUG(misc, LANDINFOD_LEVEL, "m7           = %#x", _me[tile].m7);
 
#undef LANDINFOD_LEVEL
 
	}
 

	
 
	virtual bool IsNewGRFInspectable() const
 
	{
 
		return ::IsNewGRFInspectable(GetGrfSpecFeature(this->tile), this->tile);
 
	}
 

	
 
	virtual void ShowNewGRFInspectWindow() const
 
	{
 
		::ShowNewGRFInspectWindow(GetGrfSpecFeature(this->tile), this->tile);
 
	}
 
};
 

	
 
static void Place_LandInfo(TileIndex tile)
src/rail_cmd.cpp
Show inline comments
 
@@ -19,6 +19,7 @@
 
#include "pathfinder/yapf/yapf_cache.h"
 
#include "newgrf_engine.h"
 
#include "landscape_type.h"
 
#include "newgrf_debug.h"
 
#include "newgrf_railtype.h"
 
#include "newgrf_commons.h"
 
#include "train.h"
 
@@ -537,6 +538,7 @@ CommandCost CmdRemoveSingleRail(TileInde
 
				}
 
				owner = GetTileOwner(tile);
 
				MakeRoadNormal(tile, GetCrossingRoadBits(tile), GetRoadTypes(tile), GetTownIndex(tile), GetRoadOwner(tile, ROADTYPE_ROAD), GetRoadOwner(tile, ROADTYPE_TRAM));
 
				DeleteNewGRFInspectWindow(GSF_RAILTYPES, tile);
 
			}
 
			break;
 
		}
 
@@ -579,6 +581,7 @@ CommandCost CmdRemoveSingleRail(TileInde
 
					} else {
 
						DoClearSquare(tile);
 
					}
 
					DeleteNewGRFInspectWindow(GSF_RAILTYPES, tile);
 
				} else {
 
					SetTrackBits(tile, present);
 
					SetTrackReservation(tile, GetRailReservationTrackBits(tile) & present);
src/station_cmd.cpp
Show inline comments
 
@@ -22,6 +22,7 @@
 
#include "roadveh.h"
 
#include "industry.h"
 
#include "newgrf_cargo.h"
 
#include "newgrf_debug.h"
 
#include "newgrf_station.h"
 
#include "pathfinder/yapf/yapf_cache.h"
 
#include "road_internal.h" /* For drawing catenary/checking road removal */
 
@@ -1412,6 +1413,7 @@ CommandCost RemoveFromRailBaseStation(Ti
 
			}
 

	
 
			DoClearSquare(tile);
 
			DeleteNewGRFInspectWindow(GSF_STATIONS, tile);
 
			if (keep_rail) MakeRailNormal(tile, owner, TrackToTrackBits(track), rt);
 

	
 
			st->rect.AfterRemoveTile(st, tile);
 
@@ -1557,6 +1559,7 @@ CommandCost RemoveRailStation(T *st, DoC
 
				if (v != NULL) FreeTrainTrackReservation(v);
 
			}
 
			DoClearSquare(tile);
 
			DeleteNewGRFInspectWindow(GSF_STATIONS, tile);
 
			AddTrackToSignalBuffer(tile, track, owner);
 
			YapfNotifyTrackLayoutChange(tile, track);
 
			if (v != NULL) TryPathReserve(v, true);
 
@@ -2264,6 +2267,7 @@ static CommandCost RemoveAirport(TileInd
 
		if (flags & DC_EXEC) {
 
			DeleteAnimatedTile(tile_cur);
 
			DoClearSquare(tile_cur);
 
			DeleteNewGRFInspectWindow(GSF_AIRPORTTILES, tile_cur);
 
		}
 
	}
 

	
 
@@ -2295,6 +2299,7 @@ static CommandCost RemoveAirport(TileInd
 
		st->UpdateVirtCoord();
 
		st->RecomputeIndustriesNear();
 
		DeleteStationIfEmpty(st);
 
		DeleteNewGRFInspectWindow(GSF_AIRPORTS, st->index);
 
	}
 

	
 
	return cost;
src/town_cmd.cpp
Show inline comments
 
@@ -24,7 +24,7 @@
 
#include "unmovable_map.h"
 
#include "variables.h"
 
#include "genworld.h"
 
#include "newgrf.h"
 
#include "newgrf_debug.h"
 
#include "newgrf_house.h"
 
#include "newgrf_commons.h"
 
#include "newgrf_text.h"
 
@@ -98,6 +98,7 @@ Town::~Town()
 
	}
 

	
 
	DeleteSubsidyWith(ST_TOWN, this->index);
 
	DeleteNewGRFInspectWindow(GSF_FAKE_TOWNS, this->index);
 
	CargoPacket::InvalidateAllFrom(ST_TOWN, this->index);
 
	MarkWholeScreenDirty();
 
}
 
@@ -2210,6 +2211,8 @@ static void DoClearTownHouseHelper(TileI
 
	DecreaseBuildingCount(t, house);
 
	DoClearSquare(tile);
 
	DeleteAnimatedTile(tile);
 

	
 
	DeleteNewGRFInspectWindow(GSF_HOUSES, tile);
 
}
 

	
 
/**
src/vehicle.cpp
Show inline comments
 
@@ -24,6 +24,7 @@
 
#include "vehicle_gui.h"
 
#include "train.h"
 
#include "aircraft.h"
 
#include "newgrf_debug.h"
 
#include "newgrf_engine.h"
 
#include "newgrf_sound.h"
 
#include "newgrf_station.h"
 
@@ -681,6 +682,7 @@ Vehicle::~Vehicle()
 

	
 
	UpdateVehiclePosHash(this, INVALID_COORD, 0);
 
	DeleteVehicleNews(this->index, INVALID_STRING_ID);
 
	DeleteNewGRFInspectWindow(GetGrfSpecFeature(this->type), this->index);
 
}
 

	
 
/** Adds a vehicle to the list of vehicles, that visited a depot this tick
src/vehicle_gui.cpp
Show inline comments
 
@@ -20,6 +20,7 @@
 
#include "viewport_func.h"
 
#include "newgrf_engine.h"
 
#include "newgrf_text.h"
 
#include "newgrf_debug.h"
 
#include "waypoint_base.h"
 
#include "roadveh.h"
 
#include "train.h"
 
@@ -41,6 +42,7 @@
 
#include "company_base.h"
 
#include "engine_base.h"
 
#include "engine_func.h"
 
#include "newgrf.h"
 

	
 
#include "table/sprites.h"
 
#include "table/strings.h"
 
@@ -1763,6 +1765,7 @@ static const NWidgetPart _nested_vehicle
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_GREY),
 
		NWidget(WWT_CAPTION, COLOUR_GREY, VVW_WIDGET_CAPTION), SetDataTip(STR_VEHICLE_VIEW_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
		NWidget(WWT_DEBUGBOX, COLOUR_GREY),
 
		NWidget(WWT_SHADEBOX, COLOUR_GREY),
 
		NWidget(WWT_STICKYBOX, COLOUR_GREY),
 
	EndContainer(),
 
@@ -2195,6 +2198,16 @@ public:
 
			}
 
		}
 
	}
 

	
 
	virtual bool IsNewGRFInspectable() const
 
	{
 
		return ::IsNewGRFInspectable(GetGrfSpecFeature(Vehicle::Get(this->window_number)->type), this->window_number);
 
	}
 

	
 
	virtual void ShowNewGRFInspectWindow() const
 
	{
 
		::ShowNewGRFInspectWindow(GetGrfSpecFeature(Vehicle::Get(this->window_number)->type), this->window_number);
 
	}
 
};
 

	
 

	
0 comments (0 inline, 0 general)