From e651e2cf0fb5df2ef15ddfee3eedbbdde196f3b2 Mon Sep 17 00:00:00 2001
From: devn00b <deveq2emu@gmail.com>
Date: Sat, 30 Jul 2022 21:06:28 +0000
Subject: [PATCH] Fixes for crash on windows with UTF-16 NPC names (should
 never happen) and Fix for high CPU usage on windows with constant loading
 zones

---
 EQ2/source/WorldServer/WorldDatabase.cpp | 6 +++---
 EQ2/source/WorldServer/zoneserver.cpp    | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/EQ2/source/WorldServer/WorldDatabase.cpp b/EQ2/source/WorldServer/WorldDatabase.cpp
index 101bffc63..e671afb6c 100644
--- a/EQ2/source/WorldServer/WorldDatabase.cpp
+++ b/EQ2/source/WorldServer/WorldDatabase.cpp
@@ -2972,7 +2972,7 @@ string WorldDatabase::GetExpansionIDByVersion(int16 version)
 void WorldDatabase::LoadSpecialZones(){
 	Query query;
 	ZoneServer* zone = 0;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT id, name, always_loaded, city_zone FROM zones where always_loaded = 1 or city_zone = 1");
+	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT id, name, always_loaded FROM zones where always_loaded = 1");
 	if(result && mysql_num_rows(result) > 0) {
 		MYSQL_ROW row;
 		while(result && (row = mysql_fetch_row(result))){
@@ -2981,7 +2981,7 @@ void WorldDatabase::LoadSpecialZones(){
 			zone->Init();
 
 			zone->SetAlwaysLoaded(atoi(row[2]) == 1);
-			zone->SetCityZone(atoi(row[3]) == 1);
+//			zone->SetCityZone(atoi(row[3]) == 1);
 		}
 	}
 }
@@ -8087,4 +8087,4 @@ void WorldDatabase::UpdateStartingLanguage(int32 char_id, uint8 race_id, int32 s
 			}
 		}
 	}
-}
\ No newline at end of file
+}
diff --git a/EQ2/source/WorldServer/zoneserver.cpp b/EQ2/source/WorldServer/zoneserver.cpp
index a8c9aa328..6197ae51c 100644
--- a/EQ2/source/WorldServer/zoneserver.cpp
+++ b/EQ2/source/WorldServer/zoneserver.cpp
@@ -2824,7 +2824,7 @@ bool ZoneServer::CallSpawnScript(Spawn* npc, int8 type, Spawn* spawn, const char
 			int count = 0;
 			for (int s = 0; s < strlen(npc->GetName()); s++)
 			{
-				if (isalnum(npc->GetName()[s]))
+				if (isalnum((unsigned char)npc->GetName()[s]))
 				{
 					tmpScript += npc->GetName()[s];
 					count++;
@@ -8324,4 +8324,4 @@ void ZoneServer::RemoveClientsFromZone(ZoneServer* zone) {
 		}
 	}
 	MClientList.releasereadlock(__FUNCTION__, __LINE__);
-}
\ No newline at end of file
+}