mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r4561) - NewGRF: implement most of callback 0x23: additional text in vehicle purchase windows.
This commit is contained in:
parent
a665462cc1
commit
efd0d2d2b7
|
@ -24,6 +24,10 @@ enum CallbackID {
|
||||||
CBID_VEHICLE_REFIT_CAPACITY = 0x15,
|
CBID_VEHICLE_REFIT_CAPACITY = 0x15,
|
||||||
|
|
||||||
CBID_TRAIN_ARTIC_ENGINE = 0x16,
|
CBID_TRAIN_ARTIC_ENGINE = 0x16,
|
||||||
|
|
||||||
|
/* This callback is called from vehicle purchase lists. It returns a value to be
|
||||||
|
* used as a custom string ID in the 0xD000 range. */
|
||||||
|
CBID_VEHICLE_ADDITIONAL_TEXT = 0x23,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -19,7 +19,9 @@
|
||||||
#include "vehicle_gui.h"
|
#include "vehicle_gui.h"
|
||||||
#include "viewport.h"
|
#include "viewport.h"
|
||||||
#include "train.h"
|
#include "train.h"
|
||||||
|
#include "newgrf_callbacks.h"
|
||||||
#include "newgrf_engine.h"
|
#include "newgrf_engine.h"
|
||||||
|
#include "newgrf_text.h"
|
||||||
|
|
||||||
Sorting _sorting;
|
Sorting _sorting;
|
||||||
|
|
||||||
|
@ -256,6 +258,16 @@ CargoID DrawVehicleRefitWindow(const Vehicle *v, int sel)
|
||||||
return cargo;
|
return cargo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Display additional text from NewGRF in the purchase information window */
|
||||||
|
int ShowAdditionalText(int x, int y, int w, EngineID engine)
|
||||||
|
{
|
||||||
|
uint16 callback = GetVehicleCallback(CBID_VEHICLE_ADDITIONAL_TEXT, 0, 0, engine, NULL);
|
||||||
|
if (callback == CALLBACK_FAILED) return 0;
|
||||||
|
|
||||||
|
DrawStringTruncated(x, y, GetGRFStringID(GetEngineGRFID(engine), 0xD000 + callback), 16, w);
|
||||||
|
return 10;
|
||||||
|
}
|
||||||
|
|
||||||
/************ Sorter functions *****************/
|
/************ Sorter functions *****************/
|
||||||
int CDECL GeneralOwnerSorter(const void *a, const void *b)
|
int CDECL GeneralOwnerSorter(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
|
|
|
@ -62,6 +62,7 @@ void DrawShipPurchaseInfo(int x, int y, EngineID engine_number);
|
||||||
|
|
||||||
void ChangeVehicleViewWindow(const Vehicle *from_v, const Vehicle *to_v);
|
void ChangeVehicleViewWindow(const Vehicle *from_v, const Vehicle *to_v);
|
||||||
|
|
||||||
|
int ShowAdditionalText(int x, int y, int w, EngineID engine_number);
|
||||||
|
|
||||||
|
|
||||||
#endif /* VEHICLE_GUI_H */
|
#endif /* VEHICLE_GUI_H */
|
||||||
|
|
Loading…
Reference in New Issue