mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
General code refactoring/improvements in server, treegen and connection
This commit is contained in:
parent
24f2c38093
commit
bc4ab8b99e
34 changed files with 330 additions and 439 deletions
|
@ -20,17 +20,29 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#pragma once
|
||||
|
||||
#include "server.h"
|
||||
#include "server/mods.h"
|
||||
#include "scripting_server.h"
|
||||
|
||||
class MockServer : public Server
|
||||
{
|
||||
public:
|
||||
/* Set path_world to a real existing folder if you plan to initialize scripting! */
|
||||
/* Set `path_world` to a real existing folder if you plan to initialize scripting! */
|
||||
MockServer(const std::string &path_world = "fakepath") :
|
||||
Server(path_world, SubgameSpec("fakespec", "fakespec"), true,
|
||||
Address(), true, nullptr
|
||||
)
|
||||
{}
|
||||
|
||||
/*
|
||||
* Use this in unit tests to create scripting.
|
||||
* Note that you still need to call script->loadBuiltin() and don't forget
|
||||
* a try-catch for `ModError`.
|
||||
*/
|
||||
void createScripting() {
|
||||
m_script = std::make_unique<ServerScripting>(this);
|
||||
m_modmgr = std::make_unique<ServerModManager>(nullptr);
|
||||
}
|
||||
|
||||
void start() = delete;
|
||||
void stop() = delete;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue