polserver/pol-core/plib/polfile2.cpp
turleypol bce1154d7a
ClangTidy readability-else-after-return (#857)
* 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>
2026-01-18 09:35:52 +01:00

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