mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-29 22:45:34 +00:00
Merge pull request #76 from TES3MP/tes3mp-minimap
Show dedicated players on minimap
This commit is contained in:
commit
81dfd21d9a
9 changed files with 377 additions and 6 deletions
|
@ -96,7 +96,7 @@ add_openmw_dir (mwbase
|
|||
inputmanager windowmanager statemanager
|
||||
)
|
||||
|
||||
add_openmw_dir (mwmp DedicatedPlayer LocalPlayer Networking Main GUIChat GUILogin GUIController)
|
||||
add_openmw_dir (mwmp DedicatedPlayer LocalPlayer Networking Main GUIChat GUILogin GUIController PlayerMarkerCollection)
|
||||
|
||||
# Main executable
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <components/esm/esmwriter.hpp>
|
||||
#include <components/settings/settings.hpp>
|
||||
#include <components/myguiplatform/myguitexture.hpp>
|
||||
#include <apps/openmw/mwmp/Main.hpp>
|
||||
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
@ -176,11 +177,13 @@ namespace MWGui
|
|||
, mNeedDoorMarkersUpdate(false)
|
||||
{
|
||||
mCustomMarkers.eventMarkersChanged += MyGUI::newDelegate(this, &LocalMapBase::updateCustomMarkers);
|
||||
mwmp::Main::get().getGUIController()->mPlayerMarkers.eventMarkersChanged += MyGUI::newDelegate(this, &LocalMapBase::updatePlayerMarkers);
|
||||
}
|
||||
|
||||
LocalMapBase::~LocalMapBase()
|
||||
{
|
||||
mCustomMarkers.eventMarkersChanged -= MyGUI::newDelegate(this, &LocalMapBase::updateCustomMarkers);
|
||||
mwmp::Main::get().getGUIController()->mPlayerMarkers.eventMarkersChanged -= MyGUI::newDelegate(this, &LocalMapBase::updatePlayerMarkers);
|
||||
}
|
||||
|
||||
void LocalMapBase::init(MyGUI::ScrollView* widget, MyGUI::ImageBox* compass, int mapWidgetSize, int cellDistance)
|
||||
|
@ -356,6 +359,18 @@ namespace MWGui
|
|||
redraw();
|
||||
}
|
||||
|
||||
void LocalMapBase::updatePlayerMarkers()
|
||||
{
|
||||
mwmp::Main::get().getGUIController()->updatePlayersMarkers(this);
|
||||
}
|
||||
|
||||
void MapWindow::updatePlayerMarkers()
|
||||
{
|
||||
LocalMapBase::updatePlayerMarkers();
|
||||
|
||||
mwmp::Main::get().getGUIController()->updateGlobalMapMarkerTooltips(this);
|
||||
}
|
||||
|
||||
void LocalMapBase::setActiveCell(const int x, const int y, bool interior)
|
||||
{
|
||||
if (x==mCurX && y==mCurY && mInterior==interior && !mChanged)
|
||||
|
|
|
@ -11,6 +11,11 @@
|
|||
|
||||
#include <components/esm/custommarkerstate.hpp>
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class GUIController;
|
||||
}
|
||||
|
||||
namespace MWRender
|
||||
{
|
||||
class GlobalMap;
|
||||
|
@ -65,6 +70,7 @@ namespace MWGui
|
|||
|
||||
class LocalMapBase
|
||||
{
|
||||
friend class mwmp::GUIController;
|
||||
public:
|
||||
LocalMapBase(CustomMarkerCollection& markers, MWRender::LocalMap* localMapRender, bool fogOfWarEnabled = true);
|
||||
virtual ~LocalMapBase();
|
||||
|
@ -133,8 +139,10 @@ namespace MWGui
|
|||
std::vector<MyGUI::Widget*> mDoorMarkerWidgets;
|
||||
std::vector<MyGUI::Widget*> mMagicMarkerWidgets;
|
||||
std::vector<MyGUI::Widget*> mCustomMarkerWidgets;
|
||||
std::vector<MyGUI::Widget*> mPlayerMarkerWidgets;
|
||||
|
||||
virtual void updateCustomMarkers();
|
||||
virtual void updatePlayerMarkers();
|
||||
|
||||
void applyFogOfWar();
|
||||
|
||||
|
@ -192,6 +200,7 @@ namespace MWGui
|
|||
|
||||
class MapWindow : public MWGui::WindowPinnableBase, public LocalMapBase, public NoDrop
|
||||
{
|
||||
friend class mwmp::GUIController;
|
||||
public:
|
||||
MapWindow(CustomMarkerCollection& customMarkers, DragAndDrop* drag, MWRender::LocalMap* localMapRender);
|
||||
virtual ~MapWindow();
|
||||
|
@ -217,6 +226,7 @@ namespace MWGui
|
|||
void onFrame(float dt);
|
||||
|
||||
virtual void updateCustomMarkers();
|
||||
virtual void updatePlayerMarkers();
|
||||
|
||||
/// Clear all savegame-specific data
|
||||
void clear();
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "../mwmechanics/mechanicsmanagerimp.hpp"
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/action.hpp"
|
||||
#include "Main.hpp"
|
||||
#include <apps/openmw/mwworld/inventorystore.hpp>
|
||||
#include <boost/algorithm/clamp.hpp>
|
||||
#include <components/openmw-mp/Log.hpp>
|
||||
|
@ -107,6 +108,10 @@ void Players::CreatePlayer(RakNet::RakNetGUID id)
|
|||
dedicPlayer->state = 2;
|
||||
|
||||
world->enable(players[id]->ptr);
|
||||
|
||||
ESM::CustomMarker mEditingMarker = Main::get().getGUIController()->CreateMarker(id);
|
||||
dedicPlayer->marker = mEditingMarker;
|
||||
dedicPlayer->markerEnabled = true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -211,6 +216,8 @@ void DedicatedPlayer::Move(float dt)
|
|||
|
||||
void Players::Update(float dt)
|
||||
{
|
||||
static float timer = 0;
|
||||
timer += dt;
|
||||
for (std::map <RakNet::RakNetGUID, DedicatedPlayer *>::iterator it = players.begin(); it != players.end(); it++)
|
||||
{
|
||||
DedicatedPlayer *pl = it->second;
|
||||
|
@ -251,7 +258,12 @@ void Players::Update(float dt)
|
|||
ptrNpcStats->setBaseDisposition(255);
|
||||
pl->Move(dt);
|
||||
pl->UpdateDrawState();
|
||||
|
||||
if (timer >= 0.2) // call every 200 msec
|
||||
pl->updateMarker();
|
||||
}
|
||||
if (timer >= 0.2)
|
||||
timer = 0;
|
||||
}
|
||||
|
||||
void DedicatedPlayer::UpdatePtr(MWWorld::Ptr newPtr)
|
||||
|
@ -450,3 +462,35 @@ void DedicatedPlayer::updateCell()
|
|||
ptr.getBase()->canChangeCell = true;
|
||||
UpdatePtr(world->moveObject(ptr, cellStore, pos.pos[0], pos.pos[1], pos.pos[2]));
|
||||
}
|
||||
|
||||
|
||||
void DedicatedPlayer::updateMarker()
|
||||
{
|
||||
if (!markerEnabled)
|
||||
return;
|
||||
GUIController *gui = Main::get().getGUIController();
|
||||
if (gui->mPlayerMarkers.isExists(marker))
|
||||
{
|
||||
gui->mPlayerMarkers.deleteMarker(marker);
|
||||
marker = gui->CreateMarker(guid);
|
||||
gui->mPlayerMarkers.addMarker(marker);
|
||||
}
|
||||
else
|
||||
gui->mPlayerMarkers.addMarker(marker, true);
|
||||
}
|
||||
|
||||
void DedicatedPlayer::removeMarker()
|
||||
{
|
||||
if (!markerEnabled)
|
||||
return;
|
||||
markerEnabled = false;
|
||||
Main::get().getGUIController()->mPlayerMarkers.deleteMarker(marker);
|
||||
}
|
||||
|
||||
void DedicatedPlayer::enableMarker(bool enable)
|
||||
{
|
||||
if (enable)
|
||||
updateMarker();
|
||||
else
|
||||
removeMarker();
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <RakNetTypes.h>
|
||||
|
||||
#include <components/openmw-mp/Base/BasePlayer.hpp>
|
||||
#include <components/esm/custommarkerstate.hpp>
|
||||
|
||||
|
||||
namespace mwmp
|
||||
|
@ -46,6 +47,9 @@ namespace mwmp
|
|||
|
||||
void updateCell();
|
||||
|
||||
void updateMarker();
|
||||
void removeMarker();
|
||||
void enableMarker(bool enable);
|
||||
private:
|
||||
DedicatedPlayer(RakNet::RakNetGUID guid);
|
||||
virtual ~DedicatedPlayer();
|
||||
|
@ -55,6 +59,9 @@ namespace mwmp
|
|||
MWWorld::ManualRef* reference;
|
||||
|
||||
MWWorld::Ptr ptr;
|
||||
|
||||
ESM::CustomMarker marker;
|
||||
bool markerEnabled;
|
||||
};
|
||||
}
|
||||
#endif //OPENMW_PLAYER_HPP
|
||||
|
|
|
@ -4,14 +4,30 @@
|
|||
|
||||
#include <SDL_system.h>
|
||||
#include <MyGUI_InputManager.h>
|
||||
#include <apps/openmw/mwbase/environment.hpp>
|
||||
#include <apps/openmw/mwbase/windowmanager.hpp>
|
||||
#include <apps/openmw/mwbase/inputmanager.hpp>
|
||||
#include <apps/openmw/mwbase/environment.hpp>
|
||||
#include <apps/openmw/mwworld/worldimp.hpp>
|
||||
#include <apps/openmw/mwworld/player.hpp>
|
||||
#include <apps/openmw/mwworld/cellstore.hpp>
|
||||
#include <components/openmw-mp/Base/BasePlayer.hpp>
|
||||
#include <MyGUI_ScrollView.h>
|
||||
#include <MyGUI_ImageBox.h>
|
||||
#include <MyGUI_RenderManager.h>
|
||||
#include <MyGUI_Gui.h>
|
||||
#include <MyGUI_LanguageManager.h>
|
||||
#include <MyGUI_InputManager.h>
|
||||
#include <MyGUI_RotatingSkin.h>
|
||||
#include <MyGUI_FactoryManager.h>
|
||||
#include <apps/openmw/mwgui/mapwindow.hpp>
|
||||
#include <MyGUI_TextIterator.h>
|
||||
#include <components/openmw-mp/Log.hpp>
|
||||
|
||||
|
||||
#include "GUIController.hpp"
|
||||
#include "Main.hpp"
|
||||
#include "PlayerMarkerCollection.hpp"
|
||||
#include "DedicatedPlayer.hpp"
|
||||
|
||||
|
||||
mwmp::GUIController::GUIController(): mInputBox(0)
|
||||
|
@ -29,6 +45,7 @@ mwmp::GUIController::~GUIController()
|
|||
|
||||
void mwmp::GUIController::cleanup()
|
||||
{
|
||||
mPlayerMarkers.clear();
|
||||
if (mChat != nullptr)
|
||||
delete mChat;
|
||||
mChat = nullptr;
|
||||
|
@ -128,11 +145,7 @@ bool mwmp::GUIController::pressedKey(int key)
|
|||
}
|
||||
else if (key == keySay)
|
||||
{
|
||||
//MyGUI::Widget *oldFocus = MyGUI::InputManager::getInstance().getKeyFocusWidget();
|
||||
mChat->PressedSay();
|
||||
/*MyGUI::Widget *newFocus = MyGUI::InputManager::getInstance().getKeyFocusWidget();
|
||||
printf("mwmp::GUIController::pressedKey. oldFocus: %s.\n", oldFocus ? oldFocus->getName().c_str() : "nil");
|
||||
printf("mwmp::GUIController::pressedKey.newFocus: %s.\n", newFocus ? newFocus->getName().c_str() : "nil");*/
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -175,4 +188,143 @@ void mwmp::GUIController::WM_UpdateVisible(MWGui::GuiMode mode)
|
|||
}
|
||||
}
|
||||
|
||||
class MarkerWidget: public MyGUI::Widget
|
||||
{
|
||||
MYGUI_RTTI_DERIVED(MarkerWidget)
|
||||
|
||||
public:
|
||||
void setNormalColour(const MyGUI::Colour& colour)
|
||||
{
|
||||
mNormalColour = colour;
|
||||
setColour(colour);
|
||||
}
|
||||
|
||||
void setHoverColour(const MyGUI::Colour& colour)
|
||||
{
|
||||
mHoverColour = colour;
|
||||
}
|
||||
|
||||
private:
|
||||
MyGUI::Colour mNormalColour;
|
||||
MyGUI::Colour mHoverColour;
|
||||
|
||||
void onMouseLostFocus(MyGUI::Widget* _new)
|
||||
{
|
||||
setColour(mNormalColour);
|
||||
}
|
||||
|
||||
void onMouseSetFocus(MyGUI::Widget* _old)
|
||||
{
|
||||
setColour(mHoverColour);
|
||||
}
|
||||
};
|
||||
|
||||
ESM::CustomMarker mwmp::GUIController::CreateMarker(const RakNet::RakNetGUID &guid)
|
||||
{
|
||||
DedicatedPlayer *player = Players::GetPlayer(guid);
|
||||
ESM::CustomMarker mEditingMarker;
|
||||
if (!player)
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "Unknown player guid: %lu", guid.g);
|
||||
return mEditingMarker;
|
||||
}
|
||||
|
||||
mEditingMarker.mNote = player->Npc()->mName;
|
||||
|
||||
const ESM::Cell *ptrCell = player->GetCell();
|
||||
|
||||
mEditingMarker.mCell = player->GetCell()->mCellId;
|
||||
|
||||
mEditingMarker.mWorldX = player->Position()->pos[0];
|
||||
mEditingMarker.mWorldY = player->Position()->pos[1];
|
||||
|
||||
mEditingMarker.mCell.mPaged = ptrCell->isExterior();
|
||||
if (!ptrCell->isExterior())
|
||||
mEditingMarker.mCell.mWorldspace = ptrCell->mName;
|
||||
else
|
||||
mEditingMarker.mCell.mWorldspace = ESM::CellId::sDefaultWorldspace;
|
||||
return mEditingMarker;
|
||||
}
|
||||
|
||||
|
||||
void mwmp::GUIController::updatePlayersMarkers(MWGui::LocalMapBase *localMapBase)
|
||||
{
|
||||
std::vector<MyGUI::Widget*>::iterator it = localMapBase->mPlayerMarkerWidgets.begin();
|
||||
for (; it != localMapBase->mPlayerMarkerWidgets.end(); ++it)
|
||||
MyGUI::Gui::getInstance().destroyWidget(*it);
|
||||
localMapBase->mPlayerMarkerWidgets.clear();
|
||||
|
||||
for (int dX = -localMapBase->mCellDistance; dX <= localMapBase->mCellDistance; ++dX)
|
||||
{
|
||||
for (int dY =-localMapBase->mCellDistance; dY <= localMapBase->mCellDistance; ++dY)
|
||||
{
|
||||
ESM::CellId cellId;
|
||||
cellId.mPaged = !localMapBase->mInterior;
|
||||
cellId.mWorldspace = (localMapBase->mInterior ? localMapBase->mPrefix : ESM::CellId::sDefaultWorldspace);
|
||||
cellId.mIndex.mX = localMapBase->mCurX+dX;
|
||||
cellId.mIndex.mY = localMapBase->mCurY+dY;
|
||||
|
||||
PlayerMarkerCollection::RangeType markers = mPlayerMarkers.getMarkers(cellId);
|
||||
for (PlayerMarkerCollection::ContainerType::const_iterator it = markers.first; it != markers.second; ++it)
|
||||
{
|
||||
const ESM::CustomMarker &marker = it->second;
|
||||
|
||||
MWGui::LocalMapBase::MarkerUserData markerPos (localMapBase->mLocalMapRender);
|
||||
MyGUI::IntPoint widgetPos = localMapBase->getMarkerPosition(marker.mWorldX, marker.mWorldY, markerPos);
|
||||
|
||||
MyGUI::IntCoord widgetCoord(widgetPos.left - 8, widgetPos.top - 8, 16, 16);
|
||||
MarkerWidget* markerWidget = localMapBase->mLocalMap->createWidget<MarkerWidget>("CustomMarkerButton",
|
||||
widgetCoord, MyGUI::Align::Default);
|
||||
|
||||
markerWidget->setDepth(0); // Local_MarkerAboveFogLayer
|
||||
markerWidget->setUserString("ToolTipType", "Layout");
|
||||
markerWidget->setUserString("ToolTipLayout", "TextToolTipOneLine");
|
||||
markerWidget->setUserString("Caption_TextOneLine", MyGUI::TextIterator::toTagsString(marker.mNote));
|
||||
markerWidget->setNormalColour(MyGUI::Colour(0.6f, 0.6f, 0.6f));
|
||||
markerWidget->setHoverColour(MyGUI::Colour(1.0f, 1.0f, 1.0f));
|
||||
markerWidget->setUserData(marker);
|
||||
markerWidget->setNeedMouseFocus(true);
|
||||
//localMapBase->customMarkerCreated(markerWidget);
|
||||
localMapBase->mPlayerMarkerWidgets.push_back(markerWidget);
|
||||
}
|
||||
}
|
||||
}
|
||||
localMapBase->redraw();
|
||||
}
|
||||
|
||||
void mwmp::GUIController::setGlobalMapMarkerTooltip(MWGui::MapWindow *mapWindow, MyGUI::Widget *markerWidget, int x, int y)
|
||||
{
|
||||
ESM::CellId cellId;
|
||||
cellId.mIndex.mX = x;
|
||||
cellId.mIndex.mY = y;
|
||||
cellId.mWorldspace = ESM::CellId::sDefaultWorldspace;
|
||||
cellId.mPaged = true;
|
||||
PlayerMarkerCollection::RangeType markers = mPlayerMarkers.getMarkers(cellId);
|
||||
std::vector<std::string> destNotes;
|
||||
for (PlayerMarkerCollection::ContainerType::const_iterator it = markers.first; it != markers.second; ++it)
|
||||
destNotes.push_back(it->second.mNote);
|
||||
|
||||
if (!destNotes.empty())
|
||||
{
|
||||
MWGui::LocalMapBase::MarkerUserData data (NULL);
|
||||
data.notes = destNotes;
|
||||
data.caption = markerWidget->getUserString("Caption_TextOneLine");
|
||||
|
||||
markerWidget->setUserData(data);
|
||||
markerWidget->setUserString("ToolTipType", "MapMarker");
|
||||
}
|
||||
else
|
||||
markerWidget->setUserString("ToolTipType", "Layout");
|
||||
}
|
||||
|
||||
void mwmp::GUIController::updateGlobalMapMarkerTooltips(MWGui::MapWindow *mapWindow)
|
||||
{
|
||||
std::map<std::pair<int, int>, MyGUI::Widget*>::iterator widgetIt = mapWindow->mGlobalMapMarkers.begin();
|
||||
for (; widgetIt != mapWindow->mGlobalMapMarkers.end(); ++widgetIt)
|
||||
{
|
||||
int x = widgetIt->first.first;
|
||||
int y = widgetIt->first.second;
|
||||
MyGUI::Widget* markerWidget = widgetIt->second;
|
||||
setGlobalMapMarkerTooltip(mapWindow, markerWidget, x, y);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,13 @@
|
|||
#include <apps/openmw/mwgui/mode.hpp>
|
||||
#include <components/openmw-mp/Base/BasePlayer.hpp>
|
||||
#include "GUIChat.hpp"
|
||||
#include "PlayerMarkerCollection.hpp"
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
class LocalMapBase;
|
||||
class MapWindow;
|
||||
}
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
|
@ -36,6 +43,15 @@ namespace mwmp
|
|||
void update(float dt);
|
||||
|
||||
void WM_UpdateVisible(MWGui::GuiMode mode);
|
||||
|
||||
void updatePlayersMarkers(MWGui::LocalMapBase *localMapBase);
|
||||
void updateGlobalMapMarkerTooltips(MWGui::MapWindow *pWindow);
|
||||
|
||||
ESM::CustomMarker CreateMarker(const RakNet::RakNetGUID &guid);
|
||||
PlayerMarkerCollection mPlayerMarkers;
|
||||
private:
|
||||
void setGlobalMapMarkerTooltip(MWGui::MapWindow *mapWindow ,MyGUI::Widget* markerWidget, int x, int y);
|
||||
|
||||
private:
|
||||
GUIChat *mChat;
|
||||
int keySay;
|
||||
|
|
79
apps/openmw/mwmp/PlayerMarkerCollection.cpp
Normal file
79
apps/openmw/mwmp/PlayerMarkerCollection.cpp
Normal file
|
@ -0,0 +1,79 @@
|
|||
//
|
||||
// Created by koncord on 30.09.16.
|
||||
//
|
||||
|
||||
#include <stdexcept>
|
||||
#include "PlayerMarkerCollection.hpp"
|
||||
|
||||
|
||||
using namespace mwmp;
|
||||
|
||||
void PlayerMarkerCollection::addMarker(const ESM::CustomMarker &marker, bool triggerEvent)
|
||||
{
|
||||
mMarkers.insert(std::make_pair(marker.mCell, marker));
|
||||
if (triggerEvent)
|
||||
eventMarkersChanged();
|
||||
}
|
||||
|
||||
void PlayerMarkerCollection::deleteMarker(const ESM::CustomMarker &marker)
|
||||
{
|
||||
std::pair<ContainerType::iterator, ContainerType::iterator> range = mMarkers.equal_range(marker.mCell);
|
||||
|
||||
for (ContainerType::iterator it = range.first; it != range.second; ++it)
|
||||
{
|
||||
if (it->second == marker)
|
||||
{
|
||||
mMarkers.erase(it);
|
||||
eventMarkersChanged();
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw std::runtime_error("can't find marker to delete");
|
||||
}
|
||||
|
||||
void PlayerMarkerCollection::updateMarker(const ESM::CustomMarker &marker, const std::string &newNote)
|
||||
{
|
||||
std::pair<ContainerType::iterator, ContainerType::iterator> range = mMarkers.equal_range(marker.mCell);
|
||||
|
||||
for (ContainerType::iterator it = range.first; it != range.second; ++it)
|
||||
{
|
||||
if (it->second == marker)
|
||||
{
|
||||
it->second.mNote = newNote;
|
||||
eventMarkersChanged();
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw std::runtime_error("can't find marker to update");
|
||||
}
|
||||
|
||||
void PlayerMarkerCollection::clear()
|
||||
{
|
||||
mMarkers.clear();
|
||||
eventMarkersChanged();
|
||||
}
|
||||
|
||||
PlayerMarkerCollection::ContainerType::const_iterator PlayerMarkerCollection::begin() const
|
||||
{
|
||||
return mMarkers.begin();
|
||||
}
|
||||
|
||||
PlayerMarkerCollection::ContainerType::const_iterator PlayerMarkerCollection::end() const
|
||||
{
|
||||
return mMarkers.end();
|
||||
}
|
||||
|
||||
PlayerMarkerCollection::RangeType PlayerMarkerCollection::getMarkers(const ESM::CellId &cellId) const
|
||||
{
|
||||
return mMarkers.equal_range(cellId);
|
||||
}
|
||||
|
||||
size_t PlayerMarkerCollection::size() const
|
||||
{
|
||||
return mMarkers.size();
|
||||
}
|
||||
|
||||
bool PlayerMarkerCollection::isExists(const ESM::CustomMarker &marker)
|
||||
{
|
||||
return mMarkers.find(marker.mCell) != mMarkers.end();
|
||||
}
|
48
apps/openmw/mwmp/PlayerMarkerCollection.hpp
Normal file
48
apps/openmw/mwmp/PlayerMarkerCollection.hpp
Normal file
|
@ -0,0 +1,48 @@
|
|||
//
|
||||
// Created by koncord on 30.09.16.
|
||||
//
|
||||
|
||||
// Copied from MWGui::CustomMarkerCollection
|
||||
|
||||
#ifndef OPENMW_PLAYERMARKERCOLLECTION_HPP
|
||||
#define OPENMW_PLAYERMARKERCOLLECTION_HPP
|
||||
|
||||
#include <components/esm/cellid.hpp>
|
||||
#include <components/esm/custommarkerstate.hpp>
|
||||
#include <map>
|
||||
#include <MyGUI_Common.h>
|
||||
#include <MyGUI_Colour.h>
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class PlayerMarkerCollection
|
||||
{
|
||||
public:
|
||||
|
||||
void addMarker(const ESM::CustomMarker &marker, bool triggerEvent = true);
|
||||
void deleteMarker(const ESM::CustomMarker &marker);
|
||||
void updateMarker(const ESM::CustomMarker &marker, const std::string &newNote);
|
||||
|
||||
void clear();
|
||||
|
||||
size_t size() const;
|
||||
|
||||
typedef std::multimap <ESM::CellId, ESM::CustomMarker> ContainerType;
|
||||
|
||||
typedef std::pair <ContainerType::const_iterator, ContainerType::const_iterator> RangeType;
|
||||
|
||||
ContainerType::const_iterator begin() const;
|
||||
ContainerType::const_iterator end() const;
|
||||
|
||||
RangeType getMarkers(const ESM::CellId &cellId) const;
|
||||
|
||||
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
|
||||
EventHandle_Void eventMarkersChanged;
|
||||
|
||||
bool isExists(const ESM::CustomMarker &marker);
|
||||
private:
|
||||
ContainerType mMarkers;
|
||||
};
|
||||
}
|
||||
|
||||
#endif //OPENMW_PLAYERMARKERCOLLECTION_HPP
|
Loading…
Reference in a new issue