polserver/pol-core/plib/uofile07.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

117 lines
2.9 KiB
C++

/** @file
*
* @par History
*/
#include "clidata.h"
#include "udatfile.h"
#include "uofile.h"
#include "ustruct.h"
namespace Pol::Plib
{
extern bool static_debug_on;
// I'd put these in an anonymous namespace, but the debugger can't see 'em...at least not easily.
void readstatics( StaticList& vec, unsigned short x, unsigned short y )
{
std::vector<USTRUCT_STATIC> srecarr;
int nrec;
readstaticblock( &srecarr, &nrec, x, y );
if ( nrec )
{
unsigned short x_offset, y_offset;
x_offset = x & 0x7;
y_offset = y & 0x7;
for ( int i = 0; i < nrec; ++i )
{
USTRUCT_STATIC* srec = &srecarr[i];
#if ENABLE_POLTEST_OUTPUT
if ( static_debug_on )
{
INFO_PRINTLN( "static: {} {} {} {}", int( srec->x_offset ), int( srec->y_offset ),
int( srec->z ), srec->graphic );
}
#endif
if ( ( srec->x_offset == x_offset ) && ( srec->y_offset == y_offset ) &&
( tile_uoflags_read( srec->graphic ) & USTRUCT_TILE::FLAG_WALKBLOCK ) )
{
vec.emplace_back( srec->graphic, srec->z, tile_uoflags_read( srec->graphic ),
tileheight_read( srec->graphic ) );
}
}
}
}
void readstatics( StaticList& vec, unsigned short x, unsigned short y, unsigned int flags )
{
std::vector<USTRUCT_STATIC> srecarr;
int nrec;
readstaticblock( &srecarr, &nrec, x, y );
if ( nrec )
{
unsigned short x_offset, y_offset;
x_offset = x & 0x7;
y_offset = y & 0x7;
for ( int i = 0; i < nrec; ++i )
{
USTRUCT_STATIC* srec = &srecarr[i];
#if ENABLE_POLTEST_OUTPUT
if ( static_debug_on )
{
INFO_PRINTLN( "static: {} {} {} {:#x}", int( srec->x_offset ), int( srec->y_offset ),
int( srec->z ), srec->graphic );
}
#endif
if ( ( srec->x_offset == x_offset ) && ( srec->y_offset == y_offset ) &&
( tile_uoflags_read( srec->graphic ) & flags ) )
{
vec.emplace_back( srec->graphic, srec->z, tile_uoflags_read( srec->graphic ),
tileheight_read( srec->graphic ) );
}
}
}
}
void readallstatics( StaticList& vec, unsigned short x, unsigned short y )
{
std::vector<USTRUCT_STATIC> srecarr;
int nrec;
readstaticblock( &srecarr, &nrec, x, y );
if ( nrec )
{
unsigned short x_offset, y_offset;
x_offset = x & 0x7;
y_offset = y & 0x7;
for ( int i = 0; i < nrec; ++i )
{
USTRUCT_STATIC* srec = &srecarr[i];
#if ENABLE_POLTEST_OUTPUT
if ( static_debug_on )
{
INFO_PRINTLN( "static: {} {} {} {:#x}", int( srec->x_offset ), int( srec->y_offset ),
int( srec->z ), srec->graphic );
}
#endif
if ( ( srec->x_offset == x_offset ) && ( srec->y_offset == y_offset ) )
{
vec.emplace_back( srec->graphic, srec->z, tile_uoflags_read( srec->graphic ),
tileheight_read( srec->graphic ) );
}
}
}
}
} // namespace Pol::Plib