summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/game.cpp b/src/game.cpp
index f464c41..2345d72 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -483,17 +483,9 @@ void RecordImGuiUBO() {
void RecordImGuiModalCreateEntityType() {
if (ImGui::BeginPopupModal("CreateEntityType", nullptr, ImGuiWindowFlags_AlwaysAutoResize)) {
- static bool needsReset = true;
static char modelsDir[64];
static char modelFile[64];
static char entityTypeCode[32];
- if (needsReset) {
- memset(modelsDir, '\0', 64);
- memset(modelFile, '\0', 64);
- memset(entityTypeCode, '\0', 32);
- entityTypeToCreate = Pke_New<EntityType>();
- needsReset = false;
- }
ImGui::InputText("Models Dir", modelsDir, 63);
ImGui::InputText("Model File", modelFile, 63);
@@ -508,6 +500,11 @@ void RecordImGuiModalCreateEntityType() {
if (ImGui::Button("Create")) {
// TODO some type of validation
+ memset(modelsDir, '\0', 64);
+ memset(modelFile, '\0', 64);
+ memset(entityTypeCode, '\0', 32);
+ assert(entityTypeToCreate == nullptr || entityTypeToCreate == CAFE_BABE(EntityType));
+ entityTypeToCreate = Pke_New<EntityType>();
char *sModelsDir = Pke_New<char>(strlen(modelsDir) + 1);
strncpy(sModelsDir, modelsDir, 63);
@@ -522,7 +519,6 @@ void RecordImGuiModalCreateEntityType() {
entityTypeToCreate->entityTypeCode = sEntityTypeCode;
shouldCreateEntityType = true;
- needsReset = true;
ImGui::CloseCurrentPopup();
}
ImGui::SameLine();