2017-06-20 02:28:45 +00:00
|
|
|
#ifndef OPENMW_PROCESSORGAMESETTINGS_HPP
|
|
|
|
#define OPENMW_PROCESSORGAMESETTINGS_HPP
|
|
|
|
|
2017-08-23 01:58:07 +00:00
|
|
|
#include "apps/openmw/mwbase/environment.hpp"
|
2018-02-14 03:53:44 +00:00
|
|
|
#include "apps/openmw/mwworld/worldimp.hpp"
|
2017-08-23 01:58:07 +00:00
|
|
|
#include "apps/openmw/mwgui/windowmanagerimp.hpp"
|
|
|
|
|
2017-06-20 02:28:45 +00:00
|
|
|
#include "../PlayerProcessor.hpp"
|
|
|
|
|
|
|
|
namespace mwmp
|
|
|
|
{
|
|
|
|
class ProcessorGameSettings : public PlayerProcessor
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ProcessorGameSettings()
|
|
|
|
{
|
|
|
|
BPP_INIT(ID_GAME_SETTINGS)
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void Do(PlayerPacket &packet, BasePlayer *player)
|
|
|
|
{
|
2018-03-11 02:50:59 +00:00
|
|
|
static const int initialLogLevel = Log::GetLevel();
|
|
|
|
|
2017-08-23 01:58:07 +00:00
|
|
|
if (isLocal())
|
|
|
|
{
|
2018-03-11 02:50:59 +00:00
|
|
|
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_GAME_SETTINGS");
|
|
|
|
|
2017-08-23 01:58:07 +00:00
|
|
|
if (MWBase::Environment::get().getWindowManager()->isGuiMode())
|
|
|
|
{
|
|
|
|
if (MWBase::Environment::get().getWindowManager()->getMode() == MWGui::GM_Console && !player->consoleAllowed)
|
|
|
|
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
2017-11-30 10:18:15 +00:00
|
|
|
else if (MWBase::Environment::get().getWindowManager()->getMode() == MWGui::GM_Rest &&
|
2017-12-25 01:26:28 +00:00
|
|
|
(!player->bedRestAllowed || !player->wildernessRestAllowed || !player->waitAllowed))
|
2017-11-27 05:39:02 +00:00
|
|
|
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
2017-08-23 01:58:07 +00:00
|
|
|
}
|
2018-02-14 03:53:44 +00:00
|
|
|
|
2018-03-11 02:50:59 +00:00
|
|
|
if (player->enforcedLogLevel > -1)
|
|
|
|
{
|
|
|
|
LOG_APPEND(Log::LOG_INFO, "- server is enforcing log level %i", player->enforcedLogLevel);
|
|
|
|
Log::SetLevel(player->enforcedLogLevel);
|
|
|
|
}
|
|
|
|
else if (initialLogLevel != Log::GetLevel())
|
|
|
|
{
|
|
|
|
LOG_APPEND(Log::LOG_INFO, "- log level has been reset to initial value %i", initialLogLevel);
|
|
|
|
Log::SetLevel(initialLogLevel);
|
|
|
|
}
|
|
|
|
|
2018-02-14 03:53:44 +00:00
|
|
|
MWBase::Environment::get().getWorld()->setPhysicsFramerate(player->physicsFramerate);
|
2017-08-23 01:58:07 +00:00
|
|
|
}
|
2017-06-20 02:28:45 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif //OPENMW_PROCESSORGAMESETTINGS_HPP
|