mirror of
https://github.com/polserver/polserver
synced 2026-08-13 08:23:08 -04:00
* renamed include guard to be able to use both format lib versions in parallel * build Fmt lib and link it into clib * use std::string instead of format Writer for logging added variant "2" for logging with new fmt lib * use new logging variant for two logs * always add \n to flush log, lets see if the assumption holds * use new lib for tostring * replaced all INFO_PRINTS in clib * formatter for Token, BObject and BObjectImp * started with bsccript * use function instead of actual object for logging * remaining bscript, started plib * logvariant without newline added, more template magic * format support for base types, added test for format padding new version for fdump * chanhed ecompile/runecl fixed compilation with ESCRIPT_PROFILE * rewrite INFO_PRINT in plib,poltool/uoconvert/uotool * replaced remaining INFO_PRINTS, renamed macros INFO_PRINT for logging without newline, INFO_PRINTLN for newline addition. Replaced also INFO_PRINT_TRACE and renamed it to INFO_PRINTLN_TRACE * gitignore for fmt lib * cleanup vim leftovers
119 lines
3 KiB
C++
119 lines
3 KiB
C++
/** @file
|
|
*
|
|
* @par History
|
|
*/
|
|
|
|
|
|
#include "clidata.h"
|
|
#include "udatfile.h"
|
|
#include "uofile.h"
|
|
#include "ustruct.h"
|
|
|
|
namespace Pol
|
|
{
|
|
namespace 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.push_back( StaticRec( 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.push_back( StaticRec( 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.push_back( StaticRec( srec->graphic, srec->z, tile_uoflags_read( srec->graphic ),
|
|
tileheight_read( srec->graphic ) ) );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} // namespace Plib
|
|
} // namespace Pol
|