Various Windows fixes to CMake, compile errors, and a few warnings. Also made the command server optional and disabled by default since it is not currently working correctly on Linux.

pull/7/head
athile 14 years ago
parent a61b2c39f0
commit 5fe4313b95

@ -178,7 +178,8 @@ set(OPENMW_LIBS_HEADER)
# Platform specific
if (WIN32)
set(PLATFORM_INCLUDE_DIR "platform")
set(PLATFORM_INCLUDE_DIR "platform")
add_definitions(-DBOOST_ALL_NO_LIB)
else (WIN32)
set(PLATFORM_INCLUDE_DIR "")
endif (WIN32)
@ -186,10 +187,11 @@ endif (WIN32)
# Dependencies
find_package(OGRE REQUIRED)
find_package(Boost REQUIRED COMPONENTS system filesystem program_options)
find_package(Boost REQUIRED COMPONENTS system filesystem program_options thread)
find_package(OIS REQUIRED)
include_directories("."
${OGRE_INCLUDE_DIR} ${OIS_INCLUDE_DIR} ${Boost_INCLUDE_DIR}
${OGRE_INCLUDE_DIR} ${OGRE_INCLUDE_DIR}/Ogre
${OIS_INCLUDE_DIR} ${Boost_INCLUDE_DIR}
${PLATFORM_INCLUDE_DIR}
${CMAKE_HOME_DIRECTORY}/extern/caelum/include)
link_directories(${Boost_LIBRARY_DIRS} ${OGRE_LIB_DIR})

@ -1,5 +1,3 @@
project(clientconsole)
find_package(Boost REQUIRED COMPONENTS system)
link_directories(${Boost_LIBRARY_DIRS})
add_executable(clientconsole client.cpp)
target_link_libraries(clientconsole ${Boost_LIBRARIES})

@ -64,15 +64,15 @@ void OMW::Engine::processCommands()
OMW::Engine::Engine()
: mDebug (false), mVerboseScripts (false), mNewGame (false), mScriptManager (0),
mScriptContext (0)
{
mspCommandServer.reset(
new OMW::CommandServer::Server(&mCommandQueue, kCommandServerPort));
mScriptContext (0), mEnableCommandServer (false)
{
}
OMW::Engine::~Engine()
{
// mspCommandServer->stop();
if (mspCommandServer.get())
mspCommandServer->stop();
delete mEnvironment.mWorld;
delete mEnvironment.mSoundManager;
delete mEnvironment.mGlobalScripts;
@ -140,6 +140,11 @@ void OMW::Engine::enableDebugMode()
{
mDebug = true;
}
void OMW::Engine::enableCommandServer()
{
mEnableCommandServer = true;
}
void OMW::Engine::enableVerboseScripts()
{
@ -201,8 +206,14 @@ void OMW::Engine::go()
MWInput::MWInputManager input(mOgre, mEnvironment.mWorld->getPlayerPos(), mDebug);
// Launch the console server
std::cout << "Starting command server on port " << kCommandServerPort << std::endl;
mspCommandServer->start();
if (mEnableCommandServer)
{
std::cout << "Starting command server on port " << kCommandServerPort << std::endl;
mspCommandServer.reset(new OMW::CommandServer::Server(&mCommandQueue, kCommandServerPort));
mspCommandServer->start();
}
else
std::cout << "Command server disabled" << std::endl;
std::cout << "\nStart! Press Q/ESC or close window to exit.\n";

@ -52,6 +52,7 @@ namespace OMW
bool mNewGame;
TsDeque<OMW::Command> mCommandQueue;
bool mEnableCommandServer;
std::auto_ptr<OMW::CommandServer::Server> mspCommandServer;
MWWorld::Environment mEnvironment;
@ -98,6 +99,10 @@ namespace OMW
/// - non-exclusive input
void enableDebugMode();
/// Enable the command server so external apps can send commands to the console.
/// Must be set before go().
void enableCommandServer();
/// Enable verbose script output
void enableVerboseScripts();

@ -32,6 +32,7 @@ bool parseOptions (int argc, char**argv, OMW::Engine& engine)
( "debug", "debug mode" )
( "script-verbose", "verbose script output" )
( "new-game", "activate char gen/new game mechanics" )
( "enable-command-server", "turn on the command server" )
;
bpo::variables_map variables;
@ -62,6 +63,9 @@ bool parseOptions (int argc, char**argv, OMW::Engine& engine)
if (variables.count ("new-game"))
engine.setNewGame();
if (variables.count("enable-command-server"))
engine.enableCommandServer();
return true;
}

@ -110,7 +110,7 @@ namespace MWScript
void InterpreterContext::setGlobalLong (const std::string& name, int value)
{
// a global long is internally a float.
float value2 = value;
float value2 = float(value);
mEnvironment.mWorld->getGlobalVariable (name) =
*reinterpret_cast<Interpreter::Type_Data *> (&value2);

@ -16,8 +16,9 @@ namespace MWWorld
class World;
///< Collection of script-accessable sub-systems
struct Environment
class Environment
{
public:
Environment() : mWorld (0), mSoundManager (0), mGlobalScripts (0) {}
World *mWorld;

@ -99,8 +99,9 @@ namespace MWWorld
iter->second->show();
// Optionally enable the sky
// if (mEnableSky)
// mpSkyManager = MWRender::SkyManager::create(renderer.getWindow(), mScene.getCamera());
///\todo FIXME
if (false)
mSkyManager = MWRender::SkyManager::create(renderer.getWindow(), mScene.getCamera());
}

@ -9,8 +9,9 @@ namespace ESM {
* Script definitions
*/
struct Script
class Script
{
public:
struct SCHDstruct
{
/* Script name.

@ -87,7 +87,7 @@ namespace ESMS
CellRefList<Ingredient, D> ingreds;
CellRefList<CreatureLevList, D> creatureLists;
CellRefList<ItemLevList, D> itemLists;
CellRefList<Light, D> lights;
CellRefList<ESM::Light, D> lights;
CellRefList<Tool, D> lockpicks;
CellRefList<Misc, D> miscItems;
CellRefList<NPC, D> npcs;

@ -1,7 +1,14 @@
project(Caelum)
IF(MSVC)
add_definitions("-D_SCL_SECURE_NO_WARNINGS /wd4305 /wd4244" )
ENDIF(MSVC)
ADD_DEFINITIONS(-DCAELUM_LIB)
INCLUDE_DIRECTORIES( ${CMAKE_HOME_DIRECTORY}/extern/caelum/include )
INCLUDE_DIRECTORIES(
${CMAKE_HOME_DIRECTORY}/extern/caelum/include
${OGRE_INCLUDE_DIR}/Ogre
)
file(GLOB_RECURSE CAELUM_SRC src/*)
file(GLOB_RECURSE CAELUM_HDR include/*)

Loading…
Cancel
Save