mirror of
https://github.com/polserver/polserver
synced 2026-08-13 08:23:08 -04:00
* python script to generate cpp file with BareDistro content poltool cmd to generate the files * updated baredistro, fixed compilation * fix warning, ignore autogenerated file in stylechecker * test for pol? uoconvert got a new argument outdir for the cfg file output single thread decay has now a upper limit of sleeptime fixed that the exit_code can only get worse basic files for core testing in testsuite added a not really nice way to set it up via ctest integrated in CI with upload of log output * testenv * update poltool filegeneration to c++17 * first real tests * first npc test * equip a backpack and test a bit aos props * fixed early returns
53 lines
1.3 KiB
C++
53 lines
1.3 KiB
C++
#include "testenv.h"
|
|
|
|
#include "../clib/logfacility.h"
|
|
#include "baredistro.h"
|
|
#include "testfiles.h"
|
|
|
|
#include "pol_global_config.h"
|
|
|
|
#include <fstream>
|
|
#include <utility>
|
|
|
|
namespace Pol
|
|
{
|
|
namespace PolTool
|
|
{
|
|
TestEnv::TestEnv( fs::path basedir, bool hsa, int maxtiles, int width, int height )
|
|
: _basedir( std::move( basedir ) ),
|
|
_hsa( hsa ),
|
|
_maxtiles( maxtiles ),
|
|
_width( width ),
|
|
_height( height )
|
|
{
|
|
if ( _basedir.empty() )
|
|
_basedir = ".";
|
|
}
|
|
void TestEnv::generate()
|
|
{
|
|
if ( _basedir != "." && !fs::exists( _basedir ) )
|
|
fs::create_directories( _basedir );
|
|
|
|
fs::path clientdir = _basedir / "client";
|
|
FileGenerator g( clientdir, _hsa, _maxtiles, _width, _height );
|
|
g.generateTiledata();
|
|
g.generateMap();
|
|
g.generateStatics();
|
|
g.generateMultis();
|
|
|
|
BareDistro distro( _basedir, _hsa, _maxtiles, _width, _height );
|
|
distro.generate();
|
|
|
|
fs::path datadir = _basedir / "data";
|
|
if ( !fs::exists( datadir ) )
|
|
fs::create_directories( datadir );
|
|
std::ofstream afile( datadir / "accounts.txt", std::ofstream::out );
|
|
afile.close();
|
|
std::ofstream pfile( datadir / "pol.txt", std::ofstream::out );
|
|
pfile << "System\n{\n\tCoreVersion " << POL_VERSION << "\n}";
|
|
pfile.close();
|
|
std::ofstream bfile( _basedir / "config" / "boats.cfg", std::ofstream::out );
|
|
bfile.close();
|
|
}
|
|
} // namespace PolTool
|
|
} // namespace Pol
|