added --debug option and finally cleaned up the merge mess

pull/7/head
Marc Zinnschlag 15 years ago
parent 417df63302
commit c7f76f51fb

@ -11,8 +11,6 @@
#include "world.hpp" #include "world.hpp"
#include "mwrender/sky.hpp"
class ProcessCommandsHook : public Ogre::FrameListener class ProcessCommandsHook : public Ogre::FrameListener
{ {
public: public:
@ -27,12 +25,18 @@ protected:
}; };
OMW::Engine::Engine() : mWorld(NULL) OMW::Engine::Engine() : mWorld(NULL), mDebug (false)
{ {
mspCommandServer.reset( mspCommandServer.reset(
new OMW::CommandServer::Server(&mCommandQueue, kCommandServerPort)); new OMW::CommandServer::Server(&mCommandQueue, kCommandServerPort));
} }
OMW::Engine::~Engine()
{
// mspCommandServer->stop();
delete mWorld;
}
// Load all BSA files in data directory. // Load all BSA files in data directory.
void OMW::Engine::loadBSA() void OMW::Engine::loadBSA()
@ -89,13 +93,11 @@ void OMW::Engine::addMaster (const std::string& master)
} }
} }
// Enables sky rendering void OMW::Engine::enableDebugMode()
//
void OMW::Engine::enableSky (bool bEnable)
{ {
mEnableSky = bEnable; mDebug = true;
} }
void OMW::Engine::processCommands() void OMW::Engine::processCommands()
{ {
Command cmd; Command cmd;
@ -144,7 +146,7 @@ void OMW::Engine::go()
std::cout << "Setting up input system\n"; std::cout << "Setting up input system\n";
// Sets up the input system // Sets up the input system
MWInput::MWInputManager input(mOgre, mWorld->getPlayerPos()); MWInput::MWInputManager input(mOgre, mWorld->getPlayerPos(), mDebug);
// Launch the console server // Launch the console server
std::cout << "Starting command server on port " << kCommandServerPort << std::endl; std::cout << "Starting command server on port " << kCommandServerPort << std::endl;
@ -159,10 +161,4 @@ void OMW::Engine::go()
std::cout << "\nThat's all for now!\n"; std::cout << "\nThat's all for now!\n";
} }
OMW::Engine::~Engine()
{
// mspCommandServer->stop();
delete mWorld;
delete mpSkyManager;
}

@ -11,12 +11,6 @@
#include "components/commandserver/server.hpp" #include "components/commandserver/server.hpp"
#include "components/commandserver/command.hpp" #include "components/commandserver/command.hpp"
namespace MWRender
{
class SkyManager;
}
namespace OMW namespace OMW
{ {
class World; class World;
@ -32,9 +26,7 @@ namespace OMW
std::string mCellName; std::string mCellName;
std::string mMaster; std::string mMaster;
World *mWorld; World *mWorld;
bool mDebug;
bool mEnableSky;
MWRender::SkyManager* mpSkyManager;
TsDeque<OMW::Command> mCommandQueue; TsDeque<OMW::Command> mCommandQueue;
std::auto_ptr<OMW::CommandServer::Server> mspCommandServer; std::auto_ptr<OMW::CommandServer::Server> mspCommandServer;
@ -67,8 +59,9 @@ namespace OMW
/// - Currently OpenMW only supports one master at the same time. /// - Currently OpenMW only supports one master at the same time.
void addMaster (const std::string& master); void addMaster (const std::string& master);
/// Enables rendering of the sky (off by default). /// Enable debug mode:
void enableSky (bool bEnable); /// - non-exclusive input
void enableDebugMode();
/// Process pending commands /// Process pending commands
void processCommands(); void processCommands();

@ -29,6 +29,7 @@ bool parseOptions (int argc, char**argv, OMW::Engine& engine)
"set initial cell (only interior cells supported at the moment") "set initial cell (only interior cells supported at the moment")
("master", bpo::value<std::string>()->default_value ("Morrowind"), ("master", bpo::value<std::string>()->default_value ("Morrowind"),
"master file") "master file")
( "debug", "debug mode" )
; ;
bpo::variables_map variables; bpo::variables_map variables;
@ -50,6 +51,9 @@ bool parseOptions (int argc, char**argv, OMW::Engine& engine)
engine.setDataDir (variables["data"].as<std::string>()); engine.setDataDir (variables["data"].as<std::string>());
engine.setCell (variables["start"].as<std::string>()); engine.setCell (variables["start"].as<std::string>());
engine.addMaster (variables["master"].as<std::string>()); engine.addMaster (variables["master"].as<std::string>());
if (variables.count ("debug"))
engine.enableDebugMode();
return true; return true;
} }

@ -58,10 +58,10 @@ namespace MWInput
public: public:
MWInputManager(Render::OgreRenderer &_ogre, MWInputManager(Render::OgreRenderer &_ogre,
MWRender::PlayerPos &_player) MWRender::PlayerPos &_player, bool debug)
: disp(A_LAST), : disp(A_LAST),
ogre(_ogre), ogre(_ogre),
input(_ogre), input(_ogre, debug),
poller(input), poller(input),
listener(_ogre, input, disp), listener(_ogre, input, disp),
player(_player), player(_player),

@ -16,7 +16,7 @@ using namespace OIS;
using namespace std; using namespace std;
OISManager::OISManager(Render::OgreRenderer &rend) OISManager::OISManager(Render::OgreRenderer &rend, bool debug)
{ {
RenderWindow *window = rend.getWindow(); RenderWindow *window = rend.getWindow();
assert(window); assert(window);
@ -32,7 +32,7 @@ OISManager::OISManager(Render::OgreRenderer &rend)
// Non-exclusive mouse and keyboard input in debug mode. Debug mode // Non-exclusive mouse and keyboard input in debug mode. Debug mode
// isn't implemented yet though. // isn't implemented yet though.
if(true) if(debug)
{ {
#if defined OIS_WIN32_PLATFORM #if defined OIS_WIN32_PLATFORM
pl.insert(std::make_pair(std::string("w32_mouse"), pl.insert(std::make_pair(std::string("w32_mouse"),

@ -12,7 +12,7 @@ namespace Input
OIS::Mouse *mouse; OIS::Mouse *mouse;
OIS::Keyboard *keyboard; OIS::Keyboard *keyboard;
OISManager(Render::OgreRenderer &rend); OISManager(Render::OgreRenderer &rend, bool debug);
~OISManager(); ~OISManager();
}; };
} }

Loading…
Cancel
Save