aboutsummaryrefslogtreecommitdiff
path: root/source/Ires.cpp
diff options
context:
space:
mode:
authorrtk0c <[email protected]>2022-05-22 23:05:03 -0700
committerrtk0c <[email protected]>2022-05-22 23:05:03 -0700
commit123f741e3f5374b93ac39887b62bfa0d66762ae2 (patch)
treecedbc4b2dd87e2caadfde48a0c12a0336672bdd3 /source/Ires.cpp
parentc568f0a8c9f0aef00c770b494ee1ff3a89ab48de (diff)
Changeset: 36 Add basic machinery for levels (no saving/loading yet)
Diffstat (limited to 'source/Ires.cpp')
-rw-r--r--source/Ires.cpp8
1 files changed, 1 insertions, 7 deletions
diff --git a/source/Ires.cpp b/source/Ires.cpp
index 7a99be3..10a6867 100644
--- a/source/Ires.cpp
+++ b/source/Ires.cpp
@@ -302,13 +302,7 @@ void IresManager::DiscoverFiles(const fs::path& dir) {
std::pair<IresObject*, bool> IresManager::Add(IresObject* ires) {
auto& name = ires->mName;
if (name.empty()) {
- int n = std::rand();
-#define IRES_NAME_ERR_MESSAGE "Unnamed %s #%d", IresObject::ToString(ires->GetKind()).data(), n
- // NOTE: does not include null-terminator
- int size = snprintf(nullptr, 0, IRES_NAME_ERR_MESSAGE);
- name.resize(size); // std::string::resize handles storage for null-terminator alreaedy
- snprintf(name.data(), size, IRES_NAME_ERR_MESSAGE);
-#undef IRES_NAME_ERR_MESSAGE
+ name = Utils::MakeRandomNumberedName(IresObject::ToString(ires->GetKind()).data());
}
auto& uid = ires->mUid;