forked from teamnwah/openmw-tes3coop
Merge pull request #308 from TES3MP/master while resolving conflicts
# Conflicts: # apps/openmw-mp/main.cpp
This commit is contained in:
commit
4845599bda
24 changed files with 163 additions and 111 deletions
|
@ -692,32 +692,23 @@ namespace CSMWorld
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \todo QColor is a GUI class and should not be in model. Need to think of an alternative
|
|
||||||
/// solution.
|
|
||||||
template<typename ESXRecordT>
|
template<typename ESXRecordT>
|
||||||
struct MapColourColumn : public Column<ESXRecordT>
|
struct MapColourColumn : public Column<ESXRecordT>
|
||||||
{
|
{
|
||||||
/// \todo Replace Display_Integer with something that displays the colour value more directly.
|
|
||||||
MapColourColumn()
|
MapColourColumn()
|
||||||
: Column<ESXRecordT> (Columns::ColumnId_MapColour, ColumnBase::Display_Colour)
|
: Column<ESXRecordT> (Columns::ColumnId_MapColour, ColumnBase::Display_Colour)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual QVariant get (const Record<ESXRecordT>& record) const
|
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||||
{
|
{
|
||||||
int colour = record.get().mMapColor;
|
return record.get().mMapColor;
|
||||||
|
|
||||||
return QColor (colour & 0xff, (colour>>8) & 0xff, (colour>>16) & 0xff);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
|
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
|
||||||
{
|
{
|
||||||
ESXRecordT record2 = record.get();
|
ESXRecordT copy = record.get();
|
||||||
|
copy.mMapColor = data.toInt();
|
||||||
QColor colour = data.value<QColor>();
|
record.setModified (copy);
|
||||||
|
|
||||||
record2.mMapColor = (colour.blue() << 16) | (colour.green() << 8) | colour.red();
|
|
||||||
|
|
||||||
record.setModified (record2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool isEditable() const
|
virtual bool isEditable() const
|
||||||
|
|
|
@ -15,12 +15,15 @@ void CSVWorld::ColorDelegate::paint(QPainter *painter,
|
||||||
const QStyleOptionViewItem &option,
|
const QStyleOptionViewItem &option,
|
||||||
const QModelIndex &index) const
|
const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
|
int colorInt = index.data().toInt();
|
||||||
|
QColor color(colorInt & 0xff, (colorInt >> 8) & 0xff, (colorInt >> 16) & 0xff);
|
||||||
|
|
||||||
QRect coloredRect(option.rect.x() + qRound(option.rect.width() / 4.0),
|
QRect coloredRect(option.rect.x() + qRound(option.rect.width() / 4.0),
|
||||||
option.rect.y() + qRound(option.rect.height() / 4.0),
|
option.rect.y() + qRound(option.rect.height() / 4.0),
|
||||||
option.rect.width() / 2,
|
option.rect.width() / 2,
|
||||||
option.rect.height() / 2);
|
option.rect.height() / 2);
|
||||||
painter->save();
|
painter->save();
|
||||||
painter->fillRect(coloredRect, index.data().value<QColor>());
|
painter->fillRect(coloredRect, color);
|
||||||
painter->setPen(Qt::black);
|
painter->setPen(Qt::black);
|
||||||
painter->drawRect(coloredRect);
|
painter->drawRect(coloredRect);
|
||||||
painter->restore();
|
painter->restore();
|
||||||
|
|
|
@ -1,26 +1,28 @@
|
||||||
#include <RakPeerInterface.h>
|
#include <iostream>
|
||||||
|
|
||||||
|
#include <boost/filesystem/fstream.hpp>
|
||||||
|
#include <boost/iostreams/concepts.hpp>
|
||||||
|
#include <boost/iostreams/stream_buffer.hpp>
|
||||||
|
|
||||||
|
#include <components/files/configurationmanager.hpp>
|
||||||
|
#include <components/files/escape.hpp>
|
||||||
|
#include <components/settings/settings.hpp>
|
||||||
|
#include <components/version/version.hpp>
|
||||||
|
|
||||||
|
#include <components/openmw-mp/Log.hpp>
|
||||||
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||||
|
#include <components/openmw-mp/Version.hpp>
|
||||||
|
|
||||||
#include <BitStream.h>
|
#include <BitStream.h>
|
||||||
|
#include <MessageIdentifiers.h>
|
||||||
|
#include <RakPeer.h>
|
||||||
|
#include <RakPeerInterface.h>
|
||||||
|
|
||||||
#include "Player.hpp"
|
#include "Player.hpp"
|
||||||
#include "Networking.hpp"
|
#include "Networking.hpp"
|
||||||
#include "MasterClient.hpp"
|
#include "MasterClient.hpp"
|
||||||
#include <RakPeer.h>
|
|
||||||
#include <MessageIdentifiers.h>
|
|
||||||
#include <components/openmw-mp/Log.hpp>
|
|
||||||
#include <components/openmw-mp/NetworkMessages.hpp>
|
|
||||||
#include <iostream>
|
|
||||||
#include <components/files/configurationmanager.hpp>
|
|
||||||
#include <components/settings/settings.hpp>
|
|
||||||
#include <boost/iostreams/concepts.hpp>
|
|
||||||
#include <boost/iostreams/stream_buffer.hpp>
|
|
||||||
#include <boost/filesystem/fstream.hpp>
|
|
||||||
#include <components/openmw-mp/Version.hpp>
|
|
||||||
#include "Utils.hpp"
|
#include "Utils.hpp"
|
||||||
|
|
||||||
#include "MasterClient.hpp"
|
|
||||||
|
|
||||||
#include <components/version/version.hpp>
|
|
||||||
#include <components/files/escape.hpp>
|
|
||||||
|
|
||||||
#ifdef ENABLE_BREAKPAD
|
#ifdef ENABLE_BREAKPAD
|
||||||
#include <handler/exception_handler.h>
|
#include <handler/exception_handler.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -28,41 +30,6 @@
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace mwmp;
|
using namespace mwmp;
|
||||||
|
|
||||||
void printVersion(string version, Version::Version ver, int protocol)
|
|
||||||
{
|
|
||||||
cout << "TES3:MP dedicated server " << version;
|
|
||||||
cout << " (";
|
|
||||||
#if defined(_WIN32)
|
|
||||||
cout << "Windows";
|
|
||||||
#elif defined(__linux)
|
|
||||||
cout << "Linux";
|
|
||||||
#elif defined(__APPLE__)
|
|
||||||
cout << "OS X";
|
|
||||||
#else
|
|
||||||
cout << "Unknown OS";
|
|
||||||
#endif
|
|
||||||
cout << " ";
|
|
||||||
#if defined(__x86_64__) || defined(_M_X64)
|
|
||||||
cout << "64-bit";
|
|
||||||
#elif defined(__i386__) || defined(_M_I86)
|
|
||||||
cout << "32-bit";
|
|
||||||
#elif defined(__ARM_ARCH)
|
|
||||||
cout << "ARMv" << __ARM_ARCH << " ";
|
|
||||||
#ifdef __aarch64__
|
|
||||||
cout << "64-bit";
|
|
||||||
#else
|
|
||||||
cout << "32-bit";
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
cout << "Unknown architecture";
|
|
||||||
#endif
|
|
||||||
cout << ")" << endl;
|
|
||||||
cout << "Protocol version: " << protocol << endl;
|
|
||||||
cout << "Commit hash: " << ver.mCommitHash.substr(0, 10) << endl;
|
|
||||||
|
|
||||||
cout << "------------------------------------------------------------" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef ENABLE_BREAKPAD
|
#ifdef ENABLE_BREAKPAD
|
||||||
google_breakpad::ExceptionHandler *pHandler = 0;
|
google_breakpad::ExceptionHandler *pHandler = 0;
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
|
@ -229,8 +196,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
vector<string> plugins (Utils::split(mgr.getString("plugins", "Plugins"), ','));
|
vector<string> plugins (Utils::split(mgr.getString("plugins", "Plugins"), ','));
|
||||||
|
|
||||||
|
Utils::printVersion("TES3MP dedicated server", TES3MP_VERSION, version.mCommitHash, TES3MP_PROTO_VERSION);
|
||||||
printVersion(TES3MP_VERSION, version, TES3MP_PROTO_VERSION);
|
|
||||||
|
|
||||||
int code;
|
int code;
|
||||||
|
|
||||||
|
|
|
@ -49,9 +49,11 @@ extern int is_debugger_attached(void);
|
||||||
/*
|
/*
|
||||||
Start of tes3mp addition
|
Start of tes3mp addition
|
||||||
|
|
||||||
Include the header of the logger added for multiplayer
|
Include additional headers for multiplayer purposes
|
||||||
*/
|
*/
|
||||||
#include <components/openmw-mp/Log.hpp>
|
#include <components/openmw-mp/Log.hpp>
|
||||||
|
#include <components/openmw-mp/Utils.hpp>
|
||||||
|
#include <components/openmw-mp/Version.hpp>
|
||||||
/*
|
/*
|
||||||
End of tes3mp addition
|
End of tes3mp addition
|
||||||
*/
|
*/
|
||||||
|
@ -207,7 +209,26 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat
|
||||||
cfgMgr.readConfiguration(variables, desc);
|
cfgMgr.readConfiguration(variables, desc);
|
||||||
|
|
||||||
Version::Version v = Version::getOpenmwVersion(variables["resources"].as<Files::EscapeHashString>().toStdString());
|
Version::Version v = Version::getOpenmwVersion(variables["resources"].as<Files::EscapeHashString>().toStdString());
|
||||||
std::cout << v.describe() << std::endl;
|
|
||||||
|
/*
|
||||||
|
Start of tes3mp addition
|
||||||
|
|
||||||
|
Print the multiplayer version first
|
||||||
|
*/
|
||||||
|
Utils::printVersion("TES3MP client", TES3MP_VERSION, v.mCommitHash, TES3MP_PROTO_VERSION);
|
||||||
|
/*
|
||||||
|
End of tes3mp addition
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Start of tes3mp change (minor)
|
||||||
|
|
||||||
|
Because there is no need to print the commit hash again, only print OpenMW's version
|
||||||
|
*/
|
||||||
|
std::cout << "OpenMW version " << v.mVersion << std::endl;
|
||||||
|
/*
|
||||||
|
End of tes3mp change (minor)
|
||||||
|
*/
|
||||||
|
|
||||||
engine.setGrabMouse(!variables["no-grab"].as<bool>());
|
engine.setGrabMouse(!variables["no-grab"].as<bool>());
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ namespace MWBase
|
||||||
|
|
||||||
Declare this method here so it can be used from outside of MWDialogue::DialogueManager
|
Declare this method here so it can be used from outside of MWDialogue::DialogueManager
|
||||||
*/
|
*/
|
||||||
virtual void updateTopics() = 0;
|
virtual void updateActorKnownTopics() = 0;
|
||||||
/*
|
/*
|
||||||
End of tes3mp addition
|
End of tes3mp addition
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -226,7 +226,7 @@ namespace MWGui
|
||||||
|
|
||||||
Mark this container as open for multiplayer logic purposes
|
Mark this container as open for multiplayer logic purposes
|
||||||
*/
|
*/
|
||||||
mwmp::Main::get().getCellController()->openContainer(container, loot);
|
mwmp::Main::get().getCellController()->openContainer(container);
|
||||||
/*
|
/*
|
||||||
End of tes3mp addition
|
End of tes3mp addition
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -191,8 +191,7 @@ namespace MWGui
|
||||||
else if (type == "ItemPtr")
|
else if (type == "ItemPtr")
|
||||||
{
|
{
|
||||||
mFocusObject = *focus->getUserData<MWWorld::Ptr>();
|
mFocusObject = *focus->getUserData<MWWorld::Ptr>();
|
||||||
bool isAllowedToUse = checkOwned();
|
tooltipSize = getToolTipViaPtr(mFocusObject.getRefData().getCount(), false, checkOwned());
|
||||||
tooltipSize = getToolTipViaPtr(mFocusObject.getRefData().getCount(), false, !isAllowedToUse);
|
|
||||||
}
|
}
|
||||||
else if (type == "ItemModelIndex")
|
else if (type == "ItemModelIndex")
|
||||||
{
|
{
|
||||||
|
|
|
@ -1775,9 +1775,10 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
if (!mCurrentModals.empty())
|
if (!mCurrentModals.empty())
|
||||||
{
|
{
|
||||||
if (!mCurrentModals.back()->exit())
|
WindowModal* window = mCurrentModals.back();
|
||||||
|
if (!window->exit())
|
||||||
return;
|
return;
|
||||||
mCurrentModals.back()->setVisible(false);
|
window->setVisible(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,11 +87,7 @@ void adjustBoundItem (const std::string& item, bool bound, const MWWorld::Ptr& a
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
actor.getClass().getInventoryStore(actor).remove(item, 1, actor, true);
|
||||||
MWWorld::Ptr itemPtr = actor.getClass().getInventoryStore(actor).search(item);
|
|
||||||
if (!itemPtr.isEmpty())
|
|
||||||
actor.getClass().getInventoryStore(actor).remove(itemPtr, 1, actor, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class CheckActorCommanded : public MWMechanics::EffectSourceVisitor
|
class CheckActorCommanded : public MWMechanics::EffectSourceVisitor
|
||||||
|
|
|
@ -338,14 +338,14 @@ bool CellController::isSameCell(const ESM::Cell& cell, const ESM::Cell& otherCel
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CellController::openContainer(const MWWorld::Ptr &container, bool loot)
|
void CellController::openContainer(const MWWorld::Ptr &container)
|
||||||
{
|
{
|
||||||
// Record this as the player's current open container
|
// Record this as the player's current open container
|
||||||
Main::get().getLocalPlayer()->storeCurrentContainer(container, loot);
|
Main::get().getLocalPlayer()->storeCurrentContainer(container);
|
||||||
|
|
||||||
const auto &cellRef = container.getCellRef();
|
const auto &cellRef = container.getCellRef();
|
||||||
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Container \"%s\" (%d) is opened. Loot: %s",
|
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Container \"%s\" (%d) is opened",
|
||||||
cellRef.getRefId().c_str(), cellRef.getRefNum().mIndex, loot ? "true" : "false");
|
cellRef.getRefId().c_str(), cellRef.getRefNum().mIndex);
|
||||||
|
|
||||||
for (const auto &ptr : container.getClass().getContainerStore(container))
|
for (const auto &ptr : container.getClass().getContainerStore(container))
|
||||||
{
|
{
|
||||||
|
|
|
@ -59,7 +59,7 @@ namespace mwmp
|
||||||
|
|
||||||
bool isSameCell(const ESM::Cell& cell, const ESM::Cell& otherCell);
|
bool isSameCell(const ESM::Cell& cell, const ESM::Cell& otherCell);
|
||||||
|
|
||||||
void openContainer(const MWWorld::Ptr& container, bool loot);
|
void openContainer(const MWWorld::Ptr& container);
|
||||||
void closeContainer(const MWWorld::Ptr& container);
|
void closeContainer(const MWWorld::Ptr& container);
|
||||||
|
|
||||||
int getCellSize() const;
|
int getCellSize() const;
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace mwmp
|
||||||
delay = 3; // 3 sec.
|
delay = 3; // 3 sec.
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIChat::open()
|
void GUIChat::onOpen()
|
||||||
{
|
{
|
||||||
// Give keyboard focus to the combo box whenever the console is
|
// Give keyboard focus to the combo box whenever the console is
|
||||||
// turned on
|
// turned on
|
||||||
|
@ -54,7 +54,7 @@ namespace mwmp
|
||||||
windowState = CHAT_ENABLED;
|
windowState = CHAT_ENABLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIChat::close()
|
void GUIChat::onClose()
|
||||||
{
|
{
|
||||||
// Apparently, hidden widgets can retain key focus
|
// Apparently, hidden widgets can retain key focus
|
||||||
// Remove for MyGUI 3.2.2
|
// Remove for MyGUI 3.2.2
|
||||||
|
@ -62,9 +62,10 @@ namespace mwmp
|
||||||
SetEditState(0);
|
SetEditState(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIChat::exit()
|
bool GUIChat::exit()
|
||||||
{
|
{
|
||||||
//WindowBase::exit();
|
//WindowBase::exit();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIChat::acceptCommand(MyGUI::EditBox *_sender)
|
void GUIChat::acceptCommand(MyGUI::EditBox *_sender)
|
||||||
|
|
|
@ -43,11 +43,10 @@ namespace mwmp
|
||||||
|
|
||||||
void Update(float dt);
|
void Update(float dt);
|
||||||
|
|
||||||
|
virtual void onOpen();
|
||||||
|
virtual void onClose();
|
||||||
|
|
||||||
virtual void open();
|
virtual bool exit();
|
||||||
virtual void close();
|
|
||||||
|
|
||||||
virtual void exit();
|
|
||||||
|
|
||||||
void setFont(const std::string &fntName);
|
void setFont(const std::string &fntName);
|
||||||
|
|
||||||
|
|
|
@ -55,13 +55,18 @@ namespace mwmp
|
||||||
setText("TextNote", note);
|
setText("TextNote", note);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextInputDialog::open()
|
void TextInputDialog::onOpen()
|
||||||
{
|
{
|
||||||
WindowModal::open();
|
WindowModal::onOpen();
|
||||||
// Make sure the edit box has focus
|
// Make sure the edit box has focus
|
||||||
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mTextEdit);
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mTextEdit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TextInputDialog::exit()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// widget controls
|
// widget controls
|
||||||
|
|
||||||
void TextInputDialog::onOkClicked(MyGUI::Widget *_sender)
|
void TextInputDialog::onOkClicked(MyGUI::Widget *_sender)
|
||||||
|
|
|
@ -29,7 +29,8 @@ namespace mwmp
|
||||||
|
|
||||||
void setEditPassword(bool value);
|
void setEditPassword(bool value);
|
||||||
|
|
||||||
virtual void open();
|
virtual void onOpen();
|
||||||
|
virtual bool exit();
|
||||||
|
|
||||||
/** Event : Dialog finished, OK button clicked.\n
|
/** Event : Dialog finished, OK button clicked.\n
|
||||||
signature : void method()\n
|
signature : void method()\n
|
||||||
|
|
|
@ -158,12 +158,13 @@ void mwmp::GUIController::showInputBox(const BasePlayer::GUIMessageBox &guiMessa
|
||||||
|
|
||||||
mInputBox->eventDone += MyGUI::newDelegate(this, &GUIController::onInputBoxDone);
|
mInputBox->eventDone += MyGUI::newDelegate(this, &GUIController::onInputBoxDone);
|
||||||
|
|
||||||
|
mInputBox->setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mwmp::GUIController::onInputBoxDone(MWGui::WindowBase *parWindow)
|
void mwmp::GUIController::onInputBoxDone(MWGui::WindowBase *parWindow)
|
||||||
{
|
{
|
||||||
//MWBase::WindowManager *windowManager = MWBase::Environment::get().getWindowManager();
|
//MWBase::WindowManager *windowManager = MWBase::Environment::get().getWindowManager();
|
||||||
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "GUIController::OnInputBoxDone: %s.",mInputBox->getTextInput().c_str());
|
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "GUIController::onInputBoxDone: %s.",mInputBox->getTextInput().c_str());
|
||||||
|
|
||||||
Main::get().getLocalPlayer()->guiMessageBox.data = mInputBox->getTextInput();
|
Main::get().getLocalPlayer()->guiMessageBox.data = mInputBox->getTextInput();
|
||||||
Main::get().getNetworking()->getPlayerPacket(ID_GUI_MESSAGEBOX)->setPlayer(Main::get().getLocalPlayer());
|
Main::get().getNetworking()->getPlayerPacket(ID_GUI_MESSAGEBOX)->setPlayer(Main::get().getLocalPlayer());
|
||||||
|
|
|
@ -719,7 +719,7 @@ void LocalPlayer::addTopics()
|
||||||
env.getDialogueManager()->addTopic(topicId);
|
env.getDialogueManager()->addTopic(topicId);
|
||||||
|
|
||||||
if (env.getWindowManager()->containsMode(MWGui::GM_Dialogue))
|
if (env.getWindowManager()->containsMode(MWGui::GM_Dialogue))
|
||||||
env.getDialogueManager()->updateTopics();
|
env.getDialogueManager()->updateActorKnownTopics();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1369,10 +1369,9 @@ void LocalPlayer::storeCellState(ESM::Cell cell, int stateType)
|
||||||
cellStateChanges.cellStates.push_back(cellState);
|
cellStateChanges.cellStates.push_back(cellState);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalPlayer::storeCurrentContainer(const MWWorld::Ptr &container, bool loot)
|
void LocalPlayer::storeCurrentContainer(const MWWorld::Ptr &container)
|
||||||
{
|
{
|
||||||
currentContainer.refId = container.getCellRef().getRefId();
|
currentContainer.refId = container.getCellRef().getRefId();
|
||||||
currentContainer.refNumIndex = container.getCellRef().getRefNum().mIndex;
|
currentContainer.refNumIndex = container.getCellRef().getRefNum().mIndex;
|
||||||
currentContainer.mpNum = container.getCellRef().getMpNum();
|
currentContainer.mpNum = container.getCellRef().getMpNum();
|
||||||
currentContainer.loot = loot;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ namespace mwmp
|
||||||
void clearCurrentContainer();
|
void clearCurrentContainer();
|
||||||
|
|
||||||
void storeCellState(ESM::Cell cell, int stateType);
|
void storeCellState(ESM::Cell cell, int stateType);
|
||||||
void storeCurrentContainer(const MWWorld::Ptr& container, bool loot);
|
void storeCurrentContainer(const MWWorld::Ptr& container);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Networking *getNetworking();
|
Networking *getNetworking();
|
||||||
|
|
|
@ -142,7 +142,7 @@ void WorldEvent::editContainers(MWWorld::CellStore* cellStore)
|
||||||
currentContainer->mpNum == ptrFound.getCellRef().getMpNum())
|
currentContainer->mpNum == ptrFound.getCellRef().getMpNum())
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(MWGui::GM_Container);
|
MWBase::Environment::get().getWindowManager()->removeGuiMode(MWGui::GM_Container);
|
||||||
MWBase::Environment::get().getWindowManager()->openContainer(ptrFound, currentContainer->loot);
|
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Container, ptrFound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -678,11 +678,30 @@ MWWorld::ContainerStoreIterator MWWorld::InventoryStore::getSelectedEnchantItem(
|
||||||
return mSelectedEnchantItem;
|
return mSelectedEnchantItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int MWWorld::InventoryStore::remove(const std::string& itemId, int count, const Ptr& actor)
|
||||||
|
{
|
||||||
|
return remove(itemId, count, actor, false);
|
||||||
|
}
|
||||||
|
|
||||||
int MWWorld::InventoryStore::remove(const Ptr& item, int count, const Ptr& actor)
|
int MWWorld::InventoryStore::remove(const Ptr& item, int count, const Ptr& actor)
|
||||||
{
|
{
|
||||||
return remove(item, count, actor, false);
|
return remove(item, count, actor, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int MWWorld::InventoryStore::remove(const std::string& itemId, int count, const Ptr& actor, bool equipReplacement)
|
||||||
|
{
|
||||||
|
int toRemove = count;
|
||||||
|
|
||||||
|
for (ContainerStoreIterator iter(begin()); iter != end() && toRemove > 0; ++iter)
|
||||||
|
if (Misc::StringUtils::ciEqual(iter->getCellRef().getRefId(), itemId))
|
||||||
|
toRemove -= remove(*iter, toRemove, actor, equipReplacement);
|
||||||
|
|
||||||
|
flagAsModified();
|
||||||
|
|
||||||
|
// number of removed items
|
||||||
|
return count - toRemove;
|
||||||
|
}
|
||||||
|
|
||||||
int MWWorld::InventoryStore::remove(const Ptr& item, int count, const Ptr& actor, bool equipReplacement)
|
int MWWorld::InventoryStore::remove(const Ptr& item, int count, const Ptr& actor, bool equipReplacement)
|
||||||
{
|
{
|
||||||
int retCount = ContainerStore::remove(item, count, actor);
|
int retCount = ContainerStore::remove(item, count, actor);
|
||||||
|
|
|
@ -177,6 +177,9 @@ namespace MWWorld
|
||||||
virtual bool stacks (const ConstPtr& ptr1, const ConstPtr& ptr2) const;
|
virtual bool stacks (const ConstPtr& ptr1, const ConstPtr& ptr2) const;
|
||||||
///< @return true if the two specified objects can stack with each other
|
///< @return true if the two specified objects can stack with each other
|
||||||
|
|
||||||
|
virtual int remove(const std::string& itemId, int count, const Ptr& actor);
|
||||||
|
virtual int remove(const std::string& itemId, int count, const Ptr& actor, bool equipReplacement);
|
||||||
|
|
||||||
virtual int remove(const Ptr& item, int count, const Ptr& actor);
|
virtual int remove(const Ptr& item, int count, const Ptr& actor);
|
||||||
virtual int remove(const Ptr& item, int count, const Ptr& actor, bool equipReplacement);
|
virtual int remove(const Ptr& item, int count, const Ptr& actor, bool equipReplacement);
|
||||||
///< Remove \a count item(s) designated by \a item from this inventory.
|
///< Remove \a count item(s) designated by \a item from this inventory.
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <boost/crc.hpp>
|
#include <boost/crc.hpp>
|
||||||
#include <boost/filesystem/fstream.hpp>
|
#include <boost/filesystem/fstream.hpp>
|
||||||
|
@ -149,6 +150,41 @@ unsigned int ::Utils::crc32Checksum(const std::string &file)
|
||||||
return crc32.checksum();
|
return crc32.checksum();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Utils::printVersion(std::string appName, std::string version, std::string commitHash, int protocol)
|
||||||
|
{
|
||||||
|
cout << appName << " " << version;
|
||||||
|
cout << " (";
|
||||||
|
#if defined(_WIN32)
|
||||||
|
cout << "Windows";
|
||||||
|
#elif defined(__linux)
|
||||||
|
cout << "Linux";
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
cout << "OS X";
|
||||||
|
#else
|
||||||
|
cout << "Unknown OS";
|
||||||
|
#endif
|
||||||
|
cout << " ";
|
||||||
|
#if defined(__x86_64__) || defined(_M_X64)
|
||||||
|
cout << "64-bit";
|
||||||
|
#elif defined(__i386__) || defined(_M_I86)
|
||||||
|
cout << "32-bit";
|
||||||
|
#elif defined(__ARM_ARCH)
|
||||||
|
cout << "ARMv" << __ARM_ARCH << " ";
|
||||||
|
#ifdef __aarch64__
|
||||||
|
cout << "64-bit";
|
||||||
|
#else
|
||||||
|
cout << "32-bit";
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
cout << "Unknown architecture";
|
||||||
|
#endif
|
||||||
|
cout << ")" << endl;
|
||||||
|
cout << "Protocol version: " << protocol << endl;
|
||||||
|
cout << "Commit hash: " << commitHash.substr(0, 10) << endl;
|
||||||
|
|
||||||
|
cout << "------------------------------------------------------------" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
void Utils::printWithWidth(ostringstream &sstr, string str, size_t width)
|
void Utils::printWithWidth(ostringstream &sstr, string str, size_t width)
|
||||||
{
|
{
|
||||||
sstr << left << setw(width) << setfill(' ') << str;
|
sstr << left << setw(width) << setfill(' ') << str;
|
||||||
|
|
|
@ -36,6 +36,7 @@ namespace Utils
|
||||||
|
|
||||||
unsigned int crc32Checksum(const std::string &file);
|
unsigned int crc32Checksum(const std::string &file);
|
||||||
|
|
||||||
|
void printVersion(std::string appName, std::string version, std::string commitHash, int protocol);
|
||||||
|
|
||||||
void printWithWidth(std::ostringstream &sstr, std::string str, size_t width);
|
void printWithWidth(std::ostringstream &sstr, std::string str, size_t width);
|
||||||
std::string intToHexStr(unsigned val);
|
std::string intToHexStr(unsigned val);
|
||||||
|
|
|
@ -24,10 +24,20 @@
|
||||||
</Widget>
|
</Widget>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
<Widget type="AutoSizedEditBox" skin="HeaderText" position="6 96 300 0" name="TextNote" align="Left Top">
|
<Widget type="VBox" skin="">
|
||||||
<Property key="TextAlign" value="Center"/>
|
<Property key="AutoResize" value="true"/>
|
||||||
<Property key="MultiLine" value="true"/>
|
<Property key="Padding" value="10"/>
|
||||||
<Property key="WordWrap" value="true"/>
|
<Property key="Spacing" value="12"/>
|
||||||
|
|
||||||
|
<Widget type="Widget">
|
||||||
|
<UserString key="VStretch" value="true"/>
|
||||||
|
</Widget>
|
||||||
|
|
||||||
|
<Widget type="AutoSizedEditBox" skin="HeaderText" position="6 96 300 0" name="TextNote" align="Left Top">
|
||||||
|
<Property key="TextAlign" value="Center"/>
|
||||||
|
<Property key="MultiLine" value="true"/>
|
||||||
|
<Property key="WordWrap" value="true"/>
|
||||||
|
</Widget>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
Loading…
Reference in a new issue