[Scummvm-git-logs] scummvm master -> c618a5f6b86e5375428ea8e776a1c50642075798

bluegr noreply at scummvm.org
Sat Nov 15 14:12:21 UTC 2025


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
b73e54fef4 NUVIE: Replace use of Std::set
50bf04d589 ULTIMA4: Replace use of Std::set
c618a5f6b8 ULTIMA: Move set and priority_queue implementations into the Ultima 8 subengine


Commit: b73e54fef4eb0bdc2dab48ba1f69a703b6822400
    https://github.com/scummvm/scummvm/commit/b73e54fef4eb0bdc2dab48ba1f69a703b6822400
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2025-11-15T16:12:16+02:00

Commit Message:
NUVIE: Replace use of Std::set

Changed paths:
    engines/ultima/nuvie/actors/actor_manager.cpp
    engines/ultima/nuvie/actors/actor_manager.h
    engines/ultima/nuvie/conf/configuration.cpp
    engines/ultima/nuvie/conf/configuration.h
    engines/ultima/nuvie/files/nuvie_file_list.cpp
    engines/ultima/nuvie/files/nuvie_file_list.h


diff --git a/engines/ultima/nuvie/actors/actor_manager.cpp b/engines/ultima/nuvie/actors/actor_manager.cpp
index b2e8a95a97b..ae2cdecb5bb 100644
--- a/engines/ultima/nuvie/actors/actor_manager.cpp
+++ b/engines/ultima/nuvie/actors/actor_manager.cpp
@@ -1106,7 +1106,7 @@ void ActorManager::loadAvatarTiles(const Common::Path &datadir) {
 
 	uint8 avatar_portrait = Game::get_game()->get_portrait()->get_avatar_portrait_num();
 
-	Std::set<Std::string> files = getCustomTileFilenames(datadir, "avatar_###_####.bmp");
+	Std::vector<Std::string> files = getCustomTileFilenames(datadir, "avatar_###_####.bmp");
 
 	for (const Std::string &filename : files) {
 		if (filename.size() != 19) { // avatar_nnn_nnnn.bmp
@@ -1134,7 +1134,7 @@ void ActorManager::loadAvatarTiles(const Common::Path &datadir) {
 void ActorManager::loadNPCTiles(const Common::Path &datadir) {
 	Common::Path imagefile;
 
-	Std::set<Std::string> files = getCustomTileFilenames(datadir, "actor_###_####.bmp");
+	Std::vector<Std::string> files = getCustomTileFilenames(datadir, "actor_###_####.bmp");
 
 	for (const Std::string &filename : files) {
 		if (filename.size() != 18) { // actor_nnn_nnnn.bmp
@@ -1157,7 +1157,7 @@ void ActorManager::loadNPCTiles(const Common::Path &datadir) {
 	return;
 }
 
-Std::set<Std::string> ActorManager::getCustomTileFilenames(const Common::Path &datadir, const Std::string &filenamePrefix) {
+Std::vector<Std::string> ActorManager::getCustomTileFilenames(const Common::Path &datadir, const Std::string &filenamePrefix) {
 	NuvieFileList filelistDataDir;
 	NuvieFileList filelistSaveGameDir;
 	Common::Path path;
@@ -1169,10 +1169,19 @@ Std::set<Std::string> ActorManager::getCustomTileFilenames(const Common::Path &d
 	path.joinInPlace(datadir);
 	filelistSaveGameDir.open(path, filenamePrefix.c_str(), NUVIE_SORT_NAME_ASC);
 
-	Std::set<Std::string> files = filelistSaveGameDir.get_filenames();
-	Std::set<Std::string> dataFiles = filelistDataDir.get_filenames();
-	files.insert(dataFiles.begin(), dataFiles.end());
-	return files;
+	const Std::list<NuvieFileDesc> &files = filelistSaveGameDir.get_filelist();
+	const Std::list<NuvieFileDesc> &dataFiles = filelistDataDir.get_filelist();
+
+	Common::EqualTo<Std::string> comparitor;
+	Std::vector<Std::string> filenames;
+	for (const auto &desc : files) {
+		filenames.push_back(desc.filename);
+	}
+	for (const auto &desc : dataFiles) {
+		filenames.push_back(desc.filename);
+	}
+	Common::sort(filenames.begin(), filenames.end(), comparitor);
+	return filenames;
 }
 
 Actor *ActorManager::findActorAtImpl(uint16 x, uint16 y, uint8 z, bool (*predicateWrapper)(void *predicate, const Actor *), bool incDoubleTile, bool incSurroundingObjs, void *predicate) const {
diff --git a/engines/ultima/nuvie/actors/actor_manager.h b/engines/ultima/nuvie/actors/actor_manager.h
index 68c51dc2280..da96e476234 100644
--- a/engines/ultima/nuvie/actors/actor_manager.h
+++ b/engines/ultima/nuvie/actors/actor_manager.h
@@ -164,7 +164,7 @@ private:
 	void loadNPCTiles(const Common::Path &datadir);
 	void loadAvatarTiles(const Common::Path &datadir);
 	void loadCustomBaseTiles();
-	Std::set<Std::string> getCustomTileFilenames(const Common::Path &datadir, const Std::string &filenamePrefix);
+	Std::vector<Std::string> getCustomTileFilenames(const Common::Path &datadir, const Std::string &filenamePrefix);
 };
 
 } // End of namespace Nuvie
diff --git a/engines/ultima/nuvie/conf/configuration.cpp b/engines/ultima/nuvie/conf/configuration.cpp
index ac847982116..f9c830ed509 100644
--- a/engines/ultima/nuvie/conf/configuration.cpp
+++ b/engines/ultima/nuvie/conf/configuration.cpp
@@ -264,17 +264,6 @@ ConfigNode *Configuration::getNode(const Std::string &key) {
 	return new ConfigNode(*this, key);
 }
 
-Std::set<Std::string> Configuration::listKeys(const Std::string &key, bool longformat) const {
-	Std::set<Std::string> keys;
-	for (auto *tree : _trees) {
-		Common::Array<Common::String> treeKeys = tree->listKeys(key, longformat);
-		for (const auto &k : treeKeys) {
-			keys.insert(k);
-		}
-	}
-	return keys;
-}
-
 void Configuration::getSubkeys(KeyTypeList &ktl, const Std::string &basekey) {
 	for (Shared::XMLTree *tree : _trees) {
 		Shared::XMLTree::KeyTypeList l;
diff --git a/engines/ultima/nuvie/conf/configuration.h b/engines/ultima/nuvie/conf/configuration.h
index 4a4a973b7e2..31dc613fb78 100644
--- a/engines/ultima/nuvie/conf/configuration.h
+++ b/engines/ultima/nuvie/conf/configuration.h
@@ -108,9 +108,6 @@ public:
 	// get node ref. (delete it afterwards)
 	ConfigNode *getNode(const Std::string &key);
 
-	// list all subkeys of a key. (no guaranteed order in result)
-	Std::set<Std::string> listKeys(const Std::string &key, bool longformat = false) const;
-
 	typedef Common::Pair<Common::String, Common::String> KeyType;
 	typedef Common::Array<KeyType> KeyTypeList;
 
diff --git a/engines/ultima/nuvie/files/nuvie_file_list.cpp b/engines/ultima/nuvie/files/nuvie_file_list.cpp
index a79fe163645..5241fd3c6bd 100644
--- a/engines/ultima/nuvie/files/nuvie_file_list.cpp
+++ b/engines/ultima/nuvie/files/nuvie_file_list.cpp
@@ -94,12 +94,8 @@ void NuvieFileList::close() {
 	return;
 }
 
-Std::set<Std::string> NuvieFileList::get_filenames() const {
-	Std::set<Std::string> filenames;
-	for (const auto &desc : file_list) {
-		filenames.insert(desc.filename);
-	}
-	return filenames;
+const Std::list<NuvieFileDesc> &NuvieFileList::get_filelist() const {
+	return file_list;
 }
 
 } // End of namespace Nuvie
diff --git a/engines/ultima/nuvie/files/nuvie_file_list.h b/engines/ultima/nuvie/files/nuvie_file_list.h
index 3adbdfe1898..4b54193d86a 100644
--- a/engines/ultima/nuvie/files/nuvie_file_list.h
+++ b/engines/ultima/nuvie/files/nuvie_file_list.h
@@ -70,7 +70,7 @@ public:
 	const Std::string *get_latest() const;
 	uint32 get_num_files() const;
 
-	Std::set<Std::string> get_filenames() const;
+	const Std::list<NuvieFileDesc> &get_filelist() const;
 
 	void close();
 };


Commit: 50bf04d58954196ac74936374f1027c6e3b4a490
    https://github.com/scummvm/scummvm/commit/50bf04d58954196ac74936374f1027c6e3b4a490
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2025-11-15T16:12:16+02:00

Commit Message:
ULTIMA4: Replace use of Std::set

Changed paths:
    engines/ultima/ultima4/map/location.cpp
    engines/ultima/ultima4/views/menu.cpp
    engines/ultima/ultima4/views/menuitem.cpp
    engines/ultima/ultima4/views/menuitem.h


diff --git a/engines/ultima/ultima4/map/location.cpp b/engines/ultima/ultima4/map/location.cpp
index 4846ebaedbc..332c12f6d26 100644
--- a/engines/ultima/ultima4/map/location.cpp
+++ b/engines/ultima/ultima4/map/location.cpp
@@ -172,7 +172,7 @@ TileId Location::getReplacementTile(MapCoords atCoords, const Tile *forTile) {
 	const static int dirs_per_step = sizeof(dirs) / sizeof(*dirs);
 	int loop_count = 0;
 
-	Std::set<MapCoords> searched;
+	//std::set<MapCoords> searched;
 	Common::List<MapCoords> searchQueue;
 
 	//Pathfinding to closest traversable tile with appropriate replacement properties.
@@ -182,7 +182,7 @@ TileId Location::getReplacementTile(MapCoords atCoords, const Tile *forTile) {
 		MapCoords currentStep = searchQueue.front();
 		searchQueue.pop_front();
 
-		searched.insert(currentStep);
+		//searched.insert(currentStep);
 
 		for (int i = 0; i < dirs_per_step; i++) {
 			MapCoords newStep(currentStep);
diff --git a/engines/ultima/ultima4/views/menu.cpp b/engines/ultima/ultima4/views/menu.cpp
index 4e8017c53f0..6fddc3203ff 100644
--- a/engines/ultima/ultima4/views/menu.cpp
+++ b/engines/ultima/ultima4/views/menu.cpp
@@ -260,8 +260,7 @@ void Menu::activateItem(int id, MenuEvent::Type action) {
 
 bool Menu::activateItemByShortcut(int key, MenuEvent::Type action) {
 	for (auto *i : _items) {
-		const Std::set<int> &shortcuts = i->getShortcutKeys();
-		if (shortcuts.find(key) != shortcuts.end()) {
+		if (i->hasShortcutKey(key)) {
 			activateItem(i->getId(), action);
 			// if the selection doesn't close the menu, highlight the selection
 			if (!i->getClosesMenu())
diff --git a/engines/ultima/ultima4/views/menuitem.cpp b/engines/ultima/ultima4/views/menuitem.cpp
index 1b0452b5760..7ae65fe9acb 100644
--- a/engines/ultima/ultima4/views/menuitem.cpp
+++ b/engines/ultima/ultima4/views/menuitem.cpp
@@ -59,8 +59,10 @@ bool MenuItem::isSelected() const {
 bool MenuItem::isVisible() const {
 	return _visible;
 }
-const Std::set<int> &MenuItem::getShortcutKeys() const {
-	return _shortcutKeys;
+bool MenuItem::hasShortcutKey(int sc) const {
+	Common::Array<int>::const_iterator begin = _shortcutKeys.begin();
+	Common::Array<int>::const_iterator end = _shortcutKeys.end();
+	return (Common::find(begin, end, sc) != end);
 }
 bool MenuItem::getClosesMenu() const {
 	return _closesMenu;
@@ -95,7 +97,8 @@ void MenuItem::setVisible(bool v) {
 }
 
 void MenuItem::addShortcutKey(int sc) {
-	_shortcutKeys.insert(sc);
+	if (!hasShortcutKey(sc))
+		_shortcutKeys.push_back(sc);
 }
 
 void MenuItem::setClosesMenu(bool closesMenu) {
diff --git a/engines/ultima/ultima4/views/menuitem.h b/engines/ultima/ultima4/views/menuitem.h
index fd195ce255c..9239439a0a7 100644
--- a/engines/ultima/ultima4/views/menuitem.h
+++ b/engines/ultima/ultima4/views/menuitem.h
@@ -64,7 +64,7 @@ public:
 	bool isHighlighted() const;
 	bool isSelected() const;
 	bool isVisible() const;
-	const Std::set<int> &getShortcutKeys() const;
+	bool hasShortcutKey(int key) const;
 	bool getClosesMenu() const;
 
 	void setId(int id);
@@ -85,7 +85,7 @@ protected:
 	bool _selected;
 	bool _visible;
 	int _scOffset;
-	Std::set<int> _shortcutKeys;
+	Common::Array<int> _shortcutKeys;
 	bool _closesMenu;
 };
 


Commit: c618a5f6b86e5375428ea8e776a1c50642075798
    https://github.com/scummvm/scummvm/commit/c618a5f6b86e5375428ea8e776a1c50642075798
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2025-11-15T16:12:16+02:00

Commit Message:
ULTIMA: Move set and priority_queue implementations into the Ultima 8 subengine

Changed paths:
  A engines/ultima/ultima8/misc/priority_queue.h
  A engines/ultima/ultima8/misc/set.h
    engines/ultima/shared/std/containers.h
    engines/ultima/ultima8/kernel/kernel.cpp
    engines/ultima/ultima8/usecode/uc_machine.h
    engines/ultima/ultima8/world/actors/pathfinder.h
    engines/ultima/ultima8/world/sort_item.h


diff --git a/engines/ultima/shared/std/containers.h b/engines/ultima/shared/std/containers.h
index 0acd10cace3..eadb8e0bdbf 100644
--- a/engines/ultima/shared/std/containers.h
+++ b/engines/ultima/shared/std/containers.h
@@ -42,139 +42,10 @@ public:
 	vector(size_t newSize, const T elem) : Common::Array<T>(newSize, elem) {}
 };
 
-template<class T>
-class set {
-	struct Comparitor {
-		bool operator()(const T &a, const T &b) const {
-			return a == b;
-		}
-	};
-private:
-	Common::Array<T> _items;
-	Comparitor _comparitor;
-public:
-	typedef T *iterator;
-	typedef const T *const_iterator;
-
-	iterator begin() { return _items.begin(); }
-	iterator end() { return _items.end(); }
-	const_iterator begin() const { return _items.begin(); }
-	const_iterator end() const { return _items.end(); }
-
-	/**
-	 * Clear the set
-	 */
-	void clear() {
-		_items.clear();
-	}
-
-	/**
-	 * Inserts a new item
-	 */
-	void insert(T val) {
-		_items.push_back(val);
-		Common::sort(begin(), end(), _comparitor);
-	}
-
-	/**
-	 * Inserts a range of items
-	 */
-	void insert(iterator first, iterator last) {
-		for (; first != last; ++first)
-			_items.push_back(*first);
-		Common::sort(begin(), end(), _comparitor);
-	}
-
-	/**
-	 * Swaps a set
-	 */
-	void swap(set<T> &arr) {
-		_items.swap(arr);
-	}
-
-	/**
-	 * Find an item
-	 */
-	iterator find(const T item) {
-		iterator it = begin();
-		for (; it != end() && *it != item; ++it) {}
-		return it;
-	}
-	const_iterator find(const T item) const {
-		const_iterator it = begin();
-		for (; it != end() && *it != item; ++it) {
-		}
-		return it;
-	}
-};
-
 template<class T>
 class list : public Common::List<T> {
 };
 
-/**
- * Queue ordered by a provided priority function
- * NOTE: Unlike in the C std library, we have to provde a comparitor that sorts
- * the array so that the smallest priority comes last
- */
-template <class _Ty, class _Container, class _Pr>
-class priority_queue {
-public:
-	priority_queue() : c(), comp() {}
-
-	explicit priority_queue(const _Pr &_Pred) : c(), comp(_Pred) {}
-
-	priority_queue(const _Pr &_Pred, const _Container &_Cont) : c(_Cont), comp(_Pred) {
-		make_heap(c.begin(), c.end(), comp);
-	}
-
-	template <class _InIt>
-	priority_queue(_InIt _First, _InIt _Last, const _Pr &_Pred, const _Container &_Cont) : c(_Cont), comp(_Pred) {
-		c.insert(c.end(), _First, _Last);
-		make_heap(c.begin(), c.end(), comp);
-	}
-
-	template <class _InIt>
-	priority_queue(_InIt _First, _InIt _Last) : c(_First, _Last), comp() {
-		make_heap(c.begin(), c.end(), comp);
-	}
-
-	template <class _InIt>
-	priority_queue(_InIt _First, _InIt _Last, const _Pr &_Pred) : c(_First, _Last), comp(_Pred) {
-		make_heap(c.begin(), c.end(), comp);
-	}
-
-	bool empty() const {
-		return c.empty();
-	}
-
-	size_t size() const {
-		return c.size();
-	}
-
-	typename _Container::const_reference top() const {
-		return c.back();
-	}
-
-	void push(const typename _Container::value_type &_Val) {
-		c.push_back(_Val);
-		Common::sort(c.begin(), c.end(), comp);
-	}
-
-	void pop() {
-		c.pop_back();
-	}
-
-	void swap(priority_queue &_Right) {
-		SWAP(c, _Right.c);
-		SWAP(comp, _Right.comp);
-	}
-
-protected:
-	_Container c;
-	_Pr comp;
-};
-
 } // End of namespace Std
 } // End of namespace Ultima
 
diff --git a/engines/ultima/ultima8/kernel/kernel.cpp b/engines/ultima/ultima8/kernel/kernel.cpp
index f0cb37e0f3e..4f4d22423d0 100644
--- a/engines/ultima/ultima8/kernel/kernel.cpp
+++ b/engines/ultima/ultima8/kernel/kernel.cpp
@@ -23,6 +23,7 @@
 #include "ultima/ultima8/kernel/kernel.h"
 #include "ultima/ultima8/kernel/process.h"
 #include "ultima/ultima8/misc/id_man.h"
+#include "ultima/ultima8/misc/set.h"
 #include "ultima/ultima8/ultima8.h"
 
 namespace Ultima {
@@ -420,7 +421,7 @@ bool Kernel::load(Common::ReadStream *rs, uint32 version) {
 	}
 
 	// Integrity check for processes
-	Std::set<ProcId> procs;
+	Set<ProcId> procs;
 	for (const auto *p : _processes) {
 		if (!_pIDs->isIDUsed(p->getPid())) {
 			warning("Process id %d exists but not marked used.  Corrupt save?", p->getPid());
diff --git a/engines/ultima/ultima8/misc/priority_queue.h b/engines/ultima/ultima8/misc/priority_queue.h
new file mode 100644
index 00000000000..906930529e9
--- /dev/null
+++ b/engines/ultima/ultima8/misc/priority_queue.h
@@ -0,0 +1,97 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA8_MISC_PRIORITY_QUEUE_H
+#define ULTIMA8_MISC_PRIORITY_QUEUE_H
+
+#include "common/algorithm.h"
+#include "common/util.h"
+
+namespace Ultima {
+namespace Ultima8 {
+
+/**
+ * Queue ordered by a provided priority function
+ * NOTE: Unlike in the C std library, we have to provde a comparitor that sorts
+ * the array so that the smallest priority comes last
+ */
+template <class _Ty, class _Container, class _Pr>
+class PriorityQueue {
+public:
+	PriorityQueue() : c(), comp() {}
+
+	explicit PriorityQueue(const _Pr &_Pred) : c(), comp(_Pred) {}
+
+	PriorityQueue(const _Pr &_Pred, const _Container &_Cont) : c(_Cont), comp(_Pred) {
+		make_heap(c.begin(), c.end(), comp);
+	}
+
+	template <class _InIt>
+	PriorityQueue(_InIt _First, _InIt _Last, const _Pr &_Pred, const _Container &_Cont) : c(_Cont), comp(_Pred) {
+		c.insert(c.end(), _First, _Last);
+		make_heap(c.begin(), c.end(), comp);
+	}
+
+	template <class _InIt>
+	PriorityQueue(_InIt _First, _InIt _Last) : c(_First, _Last), comp() {
+		make_heap(c.begin(), c.end(), comp);
+	}
+
+	template <class _InIt>
+	PriorityQueue(_InIt _First, _InIt _Last, const _Pr &_Pred) : c(_First, _Last), comp(_Pred) {
+		make_heap(c.begin(), c.end(), comp);
+	}
+
+	bool empty() const {
+		return c.empty();
+	}
+
+	size_t size() const {
+		return c.size();
+	}
+
+	typename _Container::const_reference top() const {
+		return c.back();
+	}
+
+	void push(const typename _Container::value_type &_Val) {
+		c.push_back(_Val);
+		Common::sort(c.begin(), c.end(), comp);
+	}
+
+	void pop() {
+		c.pop_back();
+	}
+
+	void swap(PriorityQueue &_Right) {
+		SWAP(c, _Right.c);
+		SWAP(comp, _Right.comp);
+	}
+
+protected:
+	_Container c;
+	_Pr comp;
+};
+
+} // End of namespace Ultima8
+} // End of namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima8/misc/set.h b/engines/ultima/ultima8/misc/set.h
new file mode 100644
index 00000000000..177cfc5e2e3
--- /dev/null
+++ b/engines/ultima/ultima8/misc/set.h
@@ -0,0 +1,100 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA8_MISC_SET_H
+#define ULTIMA8_MISC_SET_H
+
+#include "common/algorithm.h"
+#include "common/array.h"
+
+namespace Ultima {
+namespace Ultima8 {
+
+template<class T>
+class Set {
+	struct Comparitor {
+		bool operator()(const T &a, const T &b) const {
+			return a == b;
+		}
+	};
+private:
+	Common::Array<T> _items;
+	Comparitor _comparitor;
+public:
+	typedef T *iterator;
+	typedef const T *const_iterator;
+
+	iterator begin() { return _items.begin(); }
+	iterator end() { return _items.end(); }
+	const_iterator begin() const { return _items.begin(); }
+	const_iterator end() const { return _items.end(); }
+
+	/**
+	 * Clear the set
+	 */
+	void clear() {
+		_items.clear();
+	}
+
+	/**
+	 * Inserts a new item
+	 */
+	void insert(T val) {
+		_items.push_back(val);
+		Common::sort(begin(), end(), _comparitor);
+	}
+
+	/**
+	 * Inserts a range of items
+	 */
+	void insert(iterator first, iterator last) {
+		for (; first != last; ++first)
+			_items.push_back(*first);
+		Common::sort(begin(), end(), _comparitor);
+	}
+
+	/**
+	 * Swaps a set
+	 */
+	void swap(Set<T> &arr) {
+		_items.swap(arr);
+	}
+
+	/**
+	 * Find an item
+	 */
+	iterator find(const T item) {
+		iterator it = begin();
+		for (; it != end() && *it != item; ++it) {}
+		return it;
+	}
+	const_iterator find(const T item) const {
+		const_iterator it = begin();
+		for (; it != end() && *it != item; ++it) {
+		}
+		return it;
+	}
+};
+
+} // End of namespace Ultima8
+} // End of namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima8/usecode/uc_machine.h b/engines/ultima/ultima8/usecode/uc_machine.h
index 38834319fa7..cd5828e4f15 100644
--- a/engines/ultima/ultima8/usecode/uc_machine.h
+++ b/engines/ultima/ultima8/usecode/uc_machine.h
@@ -23,6 +23,7 @@
 #define ULTIMA8_USECODE_UCMACHINE_H
 
 #include "ultima/ultima8/misc/common_types.h"
+#include "ultima/ultima8/misc/set.h"
 #include "ultima/shared/std/string.h"
 #include "ultima/shared/std/containers.h"
 #include "ultima/ultima8/usecode/intrinsics.h"
@@ -115,9 +116,9 @@ private:
 	// tracing
 	bool _tracingEnabled;
 	bool _traceAll;
-	Std::set<ObjId> _traceObjIDs;
-	Std::set<ProcId> _tracePIDs;
-	Std::set<uint16> _traceClasses;
+	Set<ObjId> _traceObjIDs;
+	Set<ProcId> _tracePIDs;
+	Set<uint16> _traceClasses;
 
 	inline bool trace_show(ProcId pid, ObjId objid, uint16 ucclass) {
 		if (!_tracingEnabled) return false;
diff --git a/engines/ultima/ultima8/world/actors/pathfinder.h b/engines/ultima/ultima8/world/actors/pathfinder.h
index 3e516970643..4675fe3dd95 100644
--- a/engines/ultima/ultima8/world/actors/pathfinder.h
+++ b/engines/ultima/ultima8/world/actors/pathfinder.h
@@ -25,6 +25,7 @@
 #include "ultima/shared/std/containers.h"
 #include "ultima/ultima8/misc/direction.h"
 #include "ultima/ultima8/misc/point3.h"
+#include "ultima/ultima8/misc/priority_queue.h"
 #include "ultima/ultima8/world/actors/animation.h"
 
 //#define DEBUG_PATHFINDER
@@ -96,7 +97,7 @@ protected:
 	int32 _actorXd, _actorYd, _actorZd;
 
 	Common::Array<PathfindingState> _visited;
-	Std::priority_queue<PathNode *, Std::vector<PathNode *>, PathNodeCmp> _nodes;
+	PriorityQueue<PathNode *, Std::vector<PathNode *>, PathNodeCmp> _nodes;
 
 	/** List of nodes for garbage collection later and order is not important */
 	Std::vector<PathNode *> _cleanupNodes;
diff --git a/engines/ultima/ultima8/world/sort_item.h b/engines/ultima/ultima8/world/sort_item.h
index 97754cee45d..d25dbda15f2 100644
--- a/engines/ultima/ultima8/world/sort_item.h
+++ b/engines/ultima/ultima8/world/sort_item.h
@@ -120,7 +120,7 @@ struct SortItem {
 
 	int32   _order;      // Rendering _order. -1 is not yet drawn
 
-	// Note that Std::priority_queue could be used here, BUT there is no guarantee that it's implementation
+	// Note that PriorityQueue could be used here, BUT there is no guarantee that it's implementation
 	// will be friendly to insertions
 	// Alternatively i could use Std::list, BUT there is no guarantee that it will keep won't delete
 	// the unused nodes after doing a clear




More information about the Scummvm-git-logs mailing list