1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-15 18:57:08 +00:00

Move TestGameDef to test.h header

This makes the test gamedef available to all test modules. I removed an
unused include from test.h and included some stuff we use in test.h,
since I had to modify the include list anyway for the change.
This commit is contained in:
Josiah VanderZee 2025-03-29 09:51:53 -05:00
parent cf03296222
commit 45a5c96395
No known key found for this signature in database
GPG key ID: C7BB8573A4ABC4B9
2 changed files with 31 additions and 25 deletions

View file

@ -32,25 +32,6 @@ content_t t_CONTENT_BRICK;
//// TestGameDef
////
class TestGameDef : public DummyGameDef {
public:
TestGameDef();
~TestGameDef() = default;
void defineSomeNodes();
bool joinModChannel(const std::string &channel);
bool leaveModChannel(const std::string &channel);
bool sendModChannelMessage(const std::string &channel, const std::string &message);
ModChannel *getModChannel(const std::string &channel)
{
return m_modchannel_mgr->getModChannel(channel);
}
private:
std::unique_ptr<ModChannelMgr> m_modchannel_mgr;
};
TestGameDef::TestGameDef() :
DummyGameDef(),

View file

@ -4,15 +4,21 @@
#pragma once
#include <functional>
#include <exception>
#include <sstream>
#include <vector>
#include "dummygamedef.h"
#include "irrlichttypes_bloated.h"
#include "porting.h"
#include "filesys.h"
#include "mapnode.h"
#include "modchannels.h"
#include "porting.h"
#include <cstdio>
#include <functional>
#include <iostream>
#include <memory>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
class TestFailedException { // dont derive from std::exception to avoid accidental catch
public:
@ -105,6 +111,25 @@ public:
}
};
class TestGameDef : public DummyGameDef {
public:
TestGameDef();
~TestGameDef() = default;
void defineSomeNodes();
bool joinModChannel(const std::string &channel);
bool leaveModChannel(const std::string &channel);
bool sendModChannelMessage(const std::string &channel, const std::string &message);
ModChannel *getModChannel(const std::string &channel)
{
return m_modchannel_mgr->getModChannel(channel);
}
private:
std::unique_ptr<ModChannelMgr> m_modchannel_mgr;
};
// A few item and node definitions for those tests that need them
extern content_t t_CONTENT_STONE;
extern content_t t_CONTENT_GRASS;