From 4ec29a8c551a635bfcc244b6d6d80d20a4524de9 Mon Sep 17 00:00:00 2001
From: D-AIRY <admin@ds-servers.com>
Date: Wed, 23 Dec 2020 13:34:28 +0300
Subject: [PATCH] Fixed updater for a new ent file format

---
 source/common                 |  2 +-
 source/game/EntityManager.cpp | 12 ++++++++----
 source/game/EntityManager.h   |  2 ++
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/source/common b/source/common
index 12785328c..e3014e94d 160000
--- a/source/common
+++ b/source/common
@@ -1 +1 @@
-Subproject commit 12785328cefb95553e293d215b37a4cb89cee666
+Subproject commit e3014e94d2fe3e5211344f785df552ad38a62b89
diff --git a/source/game/EntityManager.cpp b/source/game/EntityManager.cpp
index 4145cc34e..92107cac1 100644
--- a/source/game/EntityManager.cpp
+++ b/source/game/EntityManager.cpp
@@ -417,10 +417,14 @@ bool CEntityManager::exportList(const char * file)
 	proptable_t * pTbl;
 	int ic = 0;
 
-	FILE *fp = fopen(file, "w");
-	if(fp)
+	if(m_isOldImported)
 	{
-		fclose(fp);
+		FILE *fp = fopen(file, "w");
+		if(fp)
+		{
+			fclose(fp);
+		}
+		m_isOldImported = false;
 	}
 
 	// conf->set("meta", "count", "0");
@@ -491,7 +495,7 @@ bool CEntityManager::import(const char * file, bool shouldSendProgress)
 	int ic = conf->getSectionCount();
 	tmpList.reserve(ic);
 
-
+	m_isOldImported = conf->getKeyCount("meta") != 0;
 
 	{
 		XGUID guid;
diff --git a/source/game/EntityManager.h b/source/game/EntityManager.h
index 5cbd65f3a..a411a015b 100644
--- a/source/game/EntityManager.h
+++ b/source/game/EntityManager.h
@@ -188,6 +188,8 @@ private:
 	void registerWaitForGUID(const XGUID &guid, CEntityPointer *pPtr);
 	void unregisterWaitForGUID(const XGUID &guid, CEntityPointer *pPtr);
 	void notifyWaitForGUID(const XGUID &guid, CBaseEntity *pEnt);
+
+	bool m_isOldImported = false;
 };
 
 #endif
-- 
GitLab