mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
add card uid map
This commit is contained in:
+14
-1
@@ -22,6 +22,7 @@
|
||||
#include <util/tagged_string.hpp> // for 0.2.7 fix
|
||||
#include <util/order_cache.hpp>
|
||||
#include <util/delayed_index_maps.hpp>
|
||||
#include <util/uid.hpp>
|
||||
#include <script/script_manager.hpp>
|
||||
#include <script/profiler.hpp>
|
||||
#include <wx/sstream.h>
|
||||
@@ -67,6 +68,16 @@ void Set::updateStyles(const CardP& card, bool only_content_dependent) {
|
||||
void Set::updateDelayed() {
|
||||
script_manager->updateDelayed();
|
||||
}
|
||||
void Set::buildUidMap() {
|
||||
card_uids.clear();
|
||||
FOR_EACH(c, cards) {
|
||||
while (card_uids.find(c->uid) != card_uids.end()) {
|
||||
queue_message(MESSAGE_WARNING, _("Multiple cards found with same uid:\n") + c->identification() + _("\n") + card_uids[c->uid]->identification() + _("\nPlease notify someone on the Discord server."));
|
||||
c->uid = generate_uid();
|
||||
}
|
||||
card_uids[c->uid] = c;
|
||||
}
|
||||
}
|
||||
|
||||
Context& Set::getContextForThumbnails() {
|
||||
assert(!wxThread::IsMain());
|
||||
@@ -188,7 +199,9 @@ void Set::validate(Version file_app_version) {
|
||||
// we want at least one card
|
||||
if (cards.empty()) cards.push_back(make_intrusive<Card>(*game));
|
||||
// update scripts
|
||||
script_manager->updateAll();
|
||||
script_manager->updateAll();
|
||||
// build uid map
|
||||
buildUidMap();
|
||||
}
|
||||
|
||||
void reflect_version_check(Reader& handler, const Char* key, intrusive_ptr<Packaged> const& package) {
|
||||
|
||||
Reference in New Issue
Block a user