Changeset - r11975:8dac5adcb5ba
[Not reviewed]
master
0 3 0
frosch - 15 years ago 2009-05-22 19:47:26
frosch@openttd.org
(svn r16386) -Codechange: Move ShowAdditionalText() to build_vehicle_gui and make it static.
3 files changed with 22 insertions and 15 deletions:
0 comments (0 inline, 0 general)
src/build_vehicle_gui.cpp
Show inline comments
 
@@ -12,6 +12,7 @@
 
#include "company_func.h"
 
#include "vehicle_gui.h"
 
#include "newgrf_engine.h"
 
#include "newgrf_text.h"
 
#include "group.h"
 
#include "strings_func.h"
 
#include "window_func.h"
 
@@ -591,6 +592,27 @@ static int DrawAircraftPurchaseInfo(int 
 
}
 

	
 
/**
 
 * Display additional text from NewGRF in the purchase information window
 
 * @param left   Left border of text bounding box
 
 * @param right  Right border of text bounding box
 
 * @param y      Top border of text bounding box
 
 * @param engine Engine to query the additional purchase information for
 
 * @return       Bottom border of text bounding box
 
 */
 
static uint ShowAdditionalText(int left, int right, int y, EngineID engine)
 
{
 
	uint16 callback = GetVehicleCallback(CBID_VEHICLE_ADDITIONAL_TEXT, 0, 0, engine, NULL);
 
	if (callback == CALLBACK_FAILED) return y;
 

	
 
	/* STR_BLACK_STRING is used to start the string with {BLACK} */
 
	SetDParam(0, GetGRFStringID(GetEngineGRFID(engine), 0xD000 + callback));
 
	PrepareTextRefStackUsage(0);
 
	uint result = DrawStringMultiLine(left, right, y, INT32_MAX, STR_BLACK_STRING);
 
	StopTextRefStackUsage();
 
	return result;
 
}
 

	
 
/**
 
 * Draw the purchase info details of a vehicle at a given location.
 
 * @param left,right,y location where to draw the info
 
 * @param engine_number the engine of which to draw the info of
src/vehicle_gui.cpp
Show inline comments
 
@@ -459,20 +459,6 @@ void ShowVehicleRefitWindow(const Vehicl
 
	w->parent = parent;
 
}
 

	
 
/** Display additional text from NewGRF in the purchase information window */
 
uint ShowAdditionalText(int left, int right, int y, EngineID engine)
 
{
 
	uint16 callback = GetVehicleCallback(CBID_VEHICLE_ADDITIONAL_TEXT, 0, 0, engine, NULL);
 
	if (callback == CALLBACK_FAILED) return y;
 

	
 
	/* STR_BLACK_STRING is used to start the string with {BLACK} */
 
	SetDParam(0, GetGRFStringID(GetEngineGRFID(engine), 0xD000 + callback));
 
	PrepareTextRefStackUsage(0);
 
	uint result = DrawStringMultiLine(left, right, y, INT32_MAX, STR_BLACK_STRING);
 
	StopTextRefStackUsage();
 
	return result;
 
}
 

	
 
/** Display list of cargo types of the engine, for the purchase information window */
 
uint ShowRefitOptionsList(int left, int right, int y, EngineID engine)
 
{
src/vehicle_gui.h
Show inline comments
 
@@ -60,7 +60,6 @@ void DrawAircraftImage(const Vehicle *v,
 

	
 
void ShowBuildVehicleWindow(TileIndex tile, VehicleType type);
 

	
 
uint ShowAdditionalText(int left, int right, int y, EngineID engine);
 
uint ShowRefitOptionsList(int left, int right, int y, EngineID engine);
 
StringID GetCargoSubtypeText(const Vehicle *v);
 

	
0 comments (0 inline, 0 general)