From 09d64ff79dfb8dd52355fe269a582fe75b2615e0 Mon Sep 17 00:00:00 2001 From: frosch Date: Fri, 22 May 2009 19:47:26 +0000 Subject: (svn r16386) -Codechange: Move ShowAdditionalText() to build_vehicle_gui and make it static. --- src/build_vehicle_gui.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/build_vehicle_gui.cpp') diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index 955f5f3ad..72cfb0a29 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -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" @@ -590,6 +591,27 @@ static int DrawAircraftPurchaseInfo(int left, int right, int y, EngineID engine_ return y; } +/** + * 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 -- cgit v1.2.3-54-g00ecf