mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-25 11:52:40 +01:00
Spool up a HttpServer thread on script start
This commit is contained in:
parent
31b625d391
commit
efadffb03b
@ -4,6 +4,7 @@
|
||||
#include "DrawUI.hpp"
|
||||
#include "ingamestate.hpp"
|
||||
#include "menustate.hpp"
|
||||
#include "debug/HttpServer.hpp"
|
||||
|
||||
#include <engine/GameObject.hpp>
|
||||
#include <engine/GameState.hpp>
|
||||
@ -153,6 +154,13 @@ void RWGame::startScript(const std::string& name)
|
||||
SCMFile* f = engine->data->loadSCM(name);
|
||||
if( f ) {
|
||||
if( script ) delete script;
|
||||
|
||||
if ( ! httpserver) {
|
||||
httpserver_thread = new std::thread([&](){
|
||||
httpserver = new HttpServer(this, engine);
|
||||
httpserver->run();
|
||||
});
|
||||
}
|
||||
|
||||
SCMOpcodes* opcodes = new SCMOpcodes;
|
||||
opcodes->modules.push_back(new VMModule);
|
||||
|
@ -10,6 +10,8 @@
|
||||
|
||||
#include <SFML/Graphics.hpp>
|
||||
|
||||
class HttpServer;
|
||||
|
||||
class RWGame
|
||||
{
|
||||
Logger log;
|
||||
@ -18,6 +20,8 @@ class RWGame
|
||||
// must be allocated after Logger setup.
|
||||
GameRenderer* renderer;
|
||||
ScriptMachine* script;
|
||||
HttpServer* httpserver = nullptr;
|
||||
std::thread* httpserver_thread = nullptr;
|
||||
sf::RenderWindow window;
|
||||
sf::Clock clock;
|
||||
bool inFocus;
|
||||
|
Loading…
Reference in New Issue
Block a user