diff --git a/CHANGELOG.md b/CHANGELOG.md index 9dd6351ad..ad07fab5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ------ Bug #4540: Rain delay when exiting water + Bug #4701: PrisonMarker record is not hardcoded like other markers Feature #2229: Improve pathfinding AI Feature #3442: Default values for fallbacks from ini file Feature #4673: Weapon sheathing diff --git a/apps/opencs/model/world/data.cpp b/apps/opencs/model/world/data.cpp index f3f897a29..63c7a52a8 100644 --- a/apps/opencs/model/world/data.cpp +++ b/apps/opencs/model/world/data.cpp @@ -977,15 +977,19 @@ int CSMWorld::Data::startLoading (const boost::filesystem::path& path, bool base void CSMWorld::Data::loadFallbackEntries() { // Load default marker definitions, if game files do not have them for some reason - std::pair markers[] = { - std::make_pair("divinemarker", "marker_divine.nif"), - std::make_pair("doormarker", "marker_arrow.nif"), - std::make_pair("northmarker", "marker_north.nif"), - std::make_pair("templemarker", "marker_temple.nif"), - std::make_pair("travelmarker", "marker_travel.nif") + std::pair staticMarkers[] = { + std::make_pair("DivineMarker", "marker_divine.nif"), + std::make_pair("DoorMarker", "marker_arrow.nif"), + std::make_pair("NorthMarker", "marker_north.nif"), + std::make_pair("TempleMarker", "marker_temple.nif"), + std::make_pair("TravelMarker", "marker_travel.nif") }; - for (const std::pair marker : markers) + std::pair doorMarkers[] = { + std::make_pair("PrisonMarker", "marker_prison.nif") + }; + + for (const std::pair marker : staticMarkers) { if (mReferenceables.searchId (marker.first)==-1) { @@ -995,6 +999,17 @@ void CSMWorld::Data::loadFallbackEntries() mReferenceables.appendRecord (record, CSMWorld::UniversalId::Type_Static); } } + + for (const std::pair marker : doorMarkers) + { + if (mReferenceables.searchId (marker.first)==-1) + { + CSMWorld::Record record; + record.mBase = ESM::Door(marker.first, std::string(), marker.second, std::string(), std::string(), std::string()); + record.mState = CSMWorld::RecordBase::State_BaseOnly; + mReferenceables.appendRecord (record, CSMWorld::UniversalId::Type_Door); + } + } } bool CSMWorld::Data::continueLoading (CSMDoc::Messages& messages) diff --git a/apps/openmw/mwworld/esmstore.cpp b/apps/openmw/mwworld/esmstore.cpp index 01d8e4b82..c85e3d30e 100644 --- a/apps/openmw/mwworld/esmstore.cpp +++ b/apps/openmw/mwworld/esmstore.cpp @@ -141,6 +141,7 @@ void ESMStore::setUp(bool validateRecords) mAttributes.setUp(); mDialogs.setUp(); mStatics.setUp(); + mDoors.setUp(); if (validateRecords) validate(); diff --git a/apps/openmw/mwworld/store.cpp b/apps/openmw/mwworld/store.cpp index b6bf2b7eb..ec9965a6c 100644 --- a/apps/openmw/mwworld/store.cpp +++ b/apps/openmw/mwworld/store.cpp @@ -1059,11 +1059,11 @@ namespace MWWorld { // Load default marker definitions, if game files do not have them for some reason std::pair markers[] = { - std::make_pair("divinemarker", "marker_divine.nif"), - std::make_pair("doormarker", "marker_arrow.nif"), - std::make_pair("northmarker", "marker_north.nif"), - std::make_pair("templemarker", "marker_temple.nif"), - std::make_pair("travelmarker", "marker_travel.nif") + std::make_pair("DivineMarker", "marker_divine.nif"), + std::make_pair("DoorMarker", "marker_arrow.nif"), + std::make_pair("NorthMarker", "marker_north.nif"), + std::make_pair("TempleMarker", "marker_temple.nif"), + std::make_pair("TravelMarker", "marker_travel.nif") }; for (const std::pair marker : markers) @@ -1080,6 +1080,28 @@ namespace MWWorld } } + template<> + void Store::setUp() + { + // Load default Door type marker definitions + std::pair markers[] = { + std::make_pair("PrisonMarker", "marker_prison.nif") + }; + + for (const std::pair marker : markers) + { + if (search(marker.first) == 0) + { + ESM::Door newMarker = ESM::Door(marker.first, std::string(), marker.second, std::string(), std::string(), std::string()); + std::pair ret = mStatic.insert(std::make_pair(marker.first, newMarker)); + if (ret.first != mStatic.end()) + { + mShared.push_back(&ret.first->second); + } + } + } + } + template <> inline RecordId Store::load(ESM::ESMReader &esm) { // The original letter case of a dialogue ID is saved, because it's printed diff --git a/components/esm/loaddoor.hpp b/components/esm/loaddoor.hpp index 3afe5d5e4..955abec89 100644 --- a/components/esm/loaddoor.hpp +++ b/components/esm/loaddoor.hpp @@ -22,6 +22,21 @@ struct Door void blank(); ///< Set record to default state (does not touch the ID). + + Door(const std::string id, const std::string name, const std::string &model, + const std::string script, const std::string opensound, const std::string closesound) + : mId(id) + , mName(name) + , mModel(model) + , mScript(script) + , mOpenSound(opensound) + , mCloseSound(closesound) + { + } + + Door() + { + } }; } #endif