1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-09-15 15:02:34 +02:00

Spool up a HttpServer thread on script start

This commit is contained in:
Timmy Sjöstedt 2015-04-19 22:38:01 +02:00
parent 31b625d391
commit efadffb03b
2 changed files with 12 additions and 0 deletions

View File

@ -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);

View File

@ -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;