mirror of
https://github.com/polserver/polserver
synced 2026-08-13 08:23:08 -04:00
* trigger tidy * Automated clang-tidy change: readability-else-after-return * compile test * rerun * Automated clang-tidy change: readability-else-after-return * trigger.. * Automated clang-tidy change: readability-else-after-return * manually removed a few * Automated clang-tidy change: readability-else-after-return * removed duplicate code * fix remaining warnings * fixed scope --------- Co-authored-by: Clang Tidy <clang-tidy@users.noreply.github.com>
83 lines
1.5 KiB
C++
83 lines
1.5 KiB
C++
/** @file
|
|
*
|
|
* @par History
|
|
* - 2009/12/02 Turley: added config.max_tile_id - Tomi
|
|
*/
|
|
|
|
// TODO: consider joining this file with landtile.cpp, tiles.cpp and clidata.h and renaming it all
|
|
// to something consistent.
|
|
// TODO: encapsulate the tile[] vector here
|
|
|
|
#include <string>
|
|
|
|
#include "../clib/rawtypes.h"
|
|
#include "mapcell.h"
|
|
#include "systemstate.h"
|
|
#include "tiles.h"
|
|
|
|
|
|
namespace Pol::Plib
|
|
{
|
|
unsigned char tilelayer( unsigned short tilenum )
|
|
{
|
|
if ( tilenum <= systemstate.config.max_tile_id )
|
|
{
|
|
return systemstate.tile[tilenum].layer;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
char tileheight( unsigned short tilenum )
|
|
{
|
|
if ( tilenum <= systemstate.config.max_tile_id )
|
|
{
|
|
char height = systemstate.tile[tilenum].height;
|
|
if ( systemstate.tile[tilenum].flags & FLAG::GRADUAL )
|
|
height /= 2;
|
|
return height;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
u32 tile_flags( unsigned short tilenum )
|
|
{
|
|
if ( tilenum <= systemstate.config.max_tile_id )
|
|
{
|
|
return systemstate.tile[tilenum].flags;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
u32 tile_uoflags( unsigned short tilenum )
|
|
{
|
|
if ( tilenum <= systemstate.config.max_tile_id )
|
|
{
|
|
return systemstate.tile[tilenum].uoflags;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
std::string tile_desc( unsigned short tilenum )
|
|
{
|
|
if ( tilenum <= systemstate.config.max_tile_id )
|
|
{
|
|
return systemstate.tile[tilenum].desc;
|
|
}
|
|
// a multi, probably
|
|
return "multi";
|
|
}
|
|
|
|
unsigned short tileweight( unsigned short tilenum )
|
|
{
|
|
if ( tilenum <= systemstate.config.max_tile_id )
|
|
{
|
|
return systemstate.tile[tilenum].weight;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
} // namespace Pol::Plib
|