polserver/pol-core/pol/landtile.cpp
turleypol 21577d8e5b
Clang Tidy concat namespaces (#855)
* tidy

* Automated clang-tidy change: modernize-concat-nested-namespaces

* compile test

* fix namespace

---------

Co-authored-by: Clang Tidy <clang-tidy@users.noreply.github.com>
2026-01-17 10:30:21 +01:00

53 lines
1.3 KiB
C++

/** @file
*
* @par History
* - 2005/07/05 Shinigami: added Warning if no landtile was loaded
*/
#include "landtile.h"
#include <stddef.h>
#include "../clib/cfgelem.h"
#include "../clib/logfacility.h"
#include "../clib/passert.h"
#include "../plib/clidata.h"
#include "../plib/mapfunc.h"
#include "../plib/pkg.h"
#include "globals/uvars.h"
namespace Pol::Core
{
void load_landtile_entry( const Plib::Package* /*pkg*/, Clib::ConfigElem& elem )
{
unsigned short graphic = static_cast<unsigned short>( strtoul( elem.rest(), nullptr, 0 ) );
passert_always( graphic < Plib::LANDTILE_COUNT );
gamestate.landtiles[graphic].uoflags = elem.remove_ulong( "UoFlags" );
gamestate.landtiles[graphic].flags = Plib::readflags( elem );
gamestate.landtiles_loaded = true;
}
void load_landtile_cfg()
{
load_all_cfgs( "landtiles.cfg", "landtile", load_landtile_entry );
if ( !gamestate.landtiles_loaded )
ERROR_PRINTLN( "Warning: No landtiles loaded. Please check landtiles.cfg" );
}
unsigned int landtile_uoflags( unsigned short landtile )
{
passert_always( landtile < Plib::LANDTILE_COUNT );
return gamestate.landtiles[landtile].uoflags;
}
unsigned int landtile_flags( unsigned short landtile )
{
passert_always( landtile < Plib::LANDTILE_COUNT );
return gamestate.landtiles[landtile].flags;
}
} // namespace Pol::Core