(svn r18410) -Codechange: Move GetCargoSprite() to CargoSpec::GetCargoIcon().

This commit is contained in:
alberth
2009-12-05 16:00:58 +00:00
parent 9bbf2ca405
commit 466a0841a9
3 changed files with 20 additions and 21 deletions

View File

@@ -12,6 +12,7 @@
#include "stdafx.h"
#include "cargotype.h"
#include "core/bitmath_func.hpp"
#include "newgrf_cargo.h"
#include "table/sprites.h"
#include "table/strings.h"
@@ -89,3 +90,19 @@ CargoID GetCargoIDByBitnum(uint8 bitnum)
return CT_INVALID;
}
/** Get sprite for showing cargo of this type.
* @return Sprite number to use.
*/
SpriteID CargoSpec::GetCargoIcon() const
{
SpriteID sprite = this->sprite;
if (sprite == 0xFFFF) {
/* A value of 0xFFFF indicates we should draw a custom icon */
sprite = GetCustomCargoSprite(this);
}
if (sprite == 0) sprite = SPR_CARGO_GOODS;
return sprite;
}