diff --git a/apps/openmw/mwgui/mapwindow.cpp b/apps/openmw/mwgui/mapwindow.cpp index b3e6c5404..c11535676 100644 --- a/apps/openmw/mwgui/mapwindow.cpp +++ b/apps/openmw/mwgui/mapwindow.cpp @@ -11,14 +11,22 @@ #include #include +/* + Start of tes3mp addition + + Include additional headers for multiplayer purposes +*/ +#include "../mwmp/Main.hpp" +#include "../mwmp/GUIController.hpp" +/* + End of tes3mp addition +*/ + #include #include #include #include -#include "../mwmp/Main.hpp" -#include "../mwmp/GUIController.hpp" - #include "../mwbase/windowmanager.hpp" #include "../mwbase/world.hpp" #include "../mwbase/environment.hpp" @@ -179,13 +187,31 @@ namespace MWGui , mNeedDoorMarkersUpdate(false) { mCustomMarkers.eventMarkersChanged += MyGUI::newDelegate(this, &LocalMapBase::updateCustomMarkers); + + /* + Start of tes3mp addition + + Add a MyGUI delegate for updating player markers + */ mwmp::Main::get().getGUIController()->mPlayerMarkers.eventMarkersChanged += MyGUI::newDelegate(this, &LocalMapBase::updatePlayerMarkers); + /* + End of tes3mp addition + */ } LocalMapBase::~LocalMapBase() { mCustomMarkers.eventMarkersChanged -= MyGUI::newDelegate(this, &LocalMapBase::updateCustomMarkers); + + /* + Start of tes3mp addition + + Remove a MyGUI delegate for updating player markers + */ mwmp::Main::get().getGUIController()->mPlayerMarkers.eventMarkersChanged -= MyGUI::newDelegate(this, &LocalMapBase::updatePlayerMarkers); + /* + End of tes3mp addition + */ } void LocalMapBase::init(MyGUI::ScrollView* widget, MyGUI::ImageBox* compass, int mapWidgetSize, int cellDistance) @@ -361,17 +387,33 @@ namespace MWGui redraw(); } + /* + Start of tes3mp addition + + Send the LocalMapBase to our GUIController when updating player markers + */ void LocalMapBase::updatePlayerMarkers() { mwmp::Main::get().getGUIController()->updatePlayersMarkers(this); } + /* + End of tes3mp addition + */ + + /* + Start of tes3mp addition + Send the MapWindow to our GUIController when updating player markers + */ void MapWindow::updatePlayerMarkers() { LocalMapBase::updatePlayerMarkers(); mwmp::Main::get().getGUIController()->updateGlobalMapMarkerTooltips(this); } + /* + End of tes3mp addition + */ void LocalMapBase::setActiveCell(const int x, const int y, bool interior) { diff --git a/apps/openmw/mwgui/mapwindow.hpp b/apps/openmw/mwgui/mapwindow.hpp index 8c89a34a3..c5877470a 100644 --- a/apps/openmw/mwgui/mapwindow.hpp +++ b/apps/openmw/mwgui/mapwindow.hpp @@ -9,10 +9,18 @@ #include +/* + Start of tes3mp addition + + Declare GUIController here so we can use it for delegates +*/ namespace mwmp { class GUIController; } +/* + End of tes3mp addition +*/ namespace MWRender { @@ -73,7 +81,15 @@ namespace MWGui class LocalMapBase { + /* + Start of tes3mp addition + + Allow the use of GUIController by declaring it as a friend class + */ friend class mwmp::GUIController; + /* + End of tes3mp addition + */ public: LocalMapBase(CustomMarkerCollection& markers, MWRender::LocalMap* localMapRender, bool fogOfWarEnabled = true); virtual ~LocalMapBase(); @@ -142,10 +158,28 @@ namespace MWGui std::vector mDoorMarkerWidgets; std::vector mMagicMarkerWidgets; std::vector mCustomMarkerWidgets; + + /* + Start of tes3mp addition + + Add a new group of Widgets for player markers + */ std::vector mPlayerMarkerWidgets; + /* + End of tes3mp addition + */ virtual void updateCustomMarkers(); + + /* + Start of tes3mp addition + + Send the LocalMapBase to our GUIController when updating player markers + */ virtual void updatePlayerMarkers(); + /* + End of tes3mp addition + */ void applyFogOfWar(); @@ -203,7 +237,15 @@ namespace MWGui class MapWindow : public MWGui::WindowPinnableBase, public LocalMapBase, public NoDrop { + /* + Start of tes3mp addition + + Allow the use of GUIController by declaring it as a friend class + */ friend class mwmp::GUIController; + /* + End of tes3mp addition + */ public: MapWindow(CustomMarkerCollection& customMarkers, DragAndDrop* drag, MWRender::LocalMap* localMapRender, SceneUtil::WorkQueue* workQueue); virtual ~MapWindow(); @@ -232,7 +274,16 @@ namespace MWGui void onFrame(float dt); virtual void updateCustomMarkers(); + + /* + Start of tes3mp addition + + Send the MapWindow to our GUIController when updating player markers + */ virtual void updatePlayerMarkers(); + /* + End of tes3mp addition + */ /// Clear all savegame-specific data void clear(); diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index b14ebe1c0..786c5a37b 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -20,6 +20,17 @@ #include #include +/* + Start of tes3mp addition + + Include additional headers for multiplayer purposes +*/ +#include "../mwmp/Main.hpp" +#include "../mwmp/GUIController.hpp" +/* + End of tes3mp addition +*/ + #include #include @@ -48,9 +59,6 @@ #include -#include "../mwmp/Main.hpp" -#include "../mwmp/GUIController.hpp" - #include "../mwbase/inputmanager.hpp" #include "../mwbase/statemanager.hpp" #include "../mwbase/soundmanager.hpp"