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

This commit is contained in:
devn00b 2022-07-30 21:06:28 +00:00
parent e7cf104457
commit e651e2cf0f
2 changed files with 5 additions and 5 deletions

View file

@ -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
}
}
}
}
}

View file

@ -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__);
}
}