forked from mirror/OpenTTD
(svn r8661) -Fix: [depot windows] Enlarge the blocks in the depot window if a sprite is too big to fit (ships and aircraft only)
-Codechange: depot windows default now makes a 1x1 matrix and resize the window by block size*number of blocks This will make less vehicle type specific code and easier to read resizing based on sprite sizes
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include "newgrf_text.h"
|
||||
#include "newgrf_sound.h"
|
||||
#include "date.h"
|
||||
#include "spritecache.h"
|
||||
|
||||
// this maps the terminal to its corresponding state and block flag
|
||||
// currently set for 10 terms, 4 helipads
|
||||
@@ -165,6 +166,31 @@ void DrawAircraftEngine(int x, int y, EngineID engine, SpriteID pal)
|
||||
}
|
||||
}
|
||||
|
||||
/** Get the size of the sprite of an aircraft sprite heading west (used for lists)
|
||||
* @param engine The engine to get the sprite from
|
||||
* @param &width The width of the sprite
|
||||
* @param &height The height of the sprite
|
||||
*/
|
||||
void GetAircraftSpriteSize(EngineID engine, uint &width, uint &height)
|
||||
{
|
||||
const AircraftVehicleInfo* avi = AircraftVehInfo(engine);
|
||||
int spritenum = avi->image_index;
|
||||
SpriteID sprite = (6 + _aircraft_sprite[spritenum]);
|
||||
|
||||
if (is_custom_sprite(spritenum)) {
|
||||
sprite = GetCustomVehicleIcon(engine, DIR_W);
|
||||
if (sprite == 0) {
|
||||
spritenum = orig_aircraft_vehicle_info[engine - AIRCRAFT_ENGINES_INDEX].image_index;
|
||||
sprite = (6 + _aircraft_sprite[spritenum]);
|
||||
}
|
||||
}
|
||||
|
||||
const Sprite *spr = GetSprite(sprite);
|
||||
|
||||
width = spr->width ;
|
||||
height = spr->height;
|
||||
}
|
||||
|
||||
static int32 EstimateAircraftCost(const AircraftVehicleInfo *avi)
|
||||
{
|
||||
return avi->base_cost * (_price.aircraft_base >> 3) >> 5;
|
||||
|
Reference in New Issue
Block a user