Fix for locked server bug, bandaid to fix stupid missile code.

This commit is contained in:
KimLS 2017-02-08 19:27:51 -08:00
parent 5fa8ffd3bc
commit ed813363a5
5 changed files with 20 additions and 6 deletions

View File

@ -163,7 +163,6 @@ enum { //timer settings, all in milliseconds
ClientProximity_interval = 150, ClientProximity_interval = 150,
CombatEventTimer_expire = 12000, CombatEventTimer_expire = 12000,
Tribute_duration = 600000, Tribute_duration = 600000,
ZoneTimerResolution = 3, //sleep time between zone main loop runs (milliseconds)
FeignMemoryDuration = 120000, // Duration player must feign death to clear zonewide agro. FeignMemoryDuration = 120000, // Duration player must feign death to clear zonewide agro.
EnragedTimer = 360000, EnragedTimer = 360000,
EnragedDurationTimer = 10000 EnragedDurationTimer = 10000

View File

@ -386,6 +386,7 @@ int main(int argc, char** argv) {
Log.OutF(Logs::General, Logs::World_Server, "New Zone Server connection from {2} at {0}:{1}", Log.OutF(Logs::General, Logs::World_Server, "New Zone Server connection from {2} at {0}:{1}",
connection->Handle()->RemoteIP(), connection->Handle()->RemotePort(), connection->GetUUID()); connection->Handle()->RemoteIP(), connection->Handle()->RemotePort(), connection->GetUUID());
numzones++;
zoneserver_list.Add(new ZoneServer(connection)); zoneserver_list.Add(new ZoneServer(connection));
}); });
@ -393,6 +394,7 @@ int main(int argc, char** argv) {
Log.OutF(Logs::General, Logs::World_Server, "Removed Zone Server connection from {0}", Log.OutF(Logs::General, Logs::World_Server, "Removed Zone Server connection from {0}",
connection->GetUUID()); connection->GetUUID());
numzones--;
zoneserver_list.Remove(connection->GetUUID()); zoneserver_list.Remove(connection->GetUUID());
}); });

View File

@ -86,7 +86,6 @@ void ZSList::KillAll() {
while(iterator != list.end()) { while(iterator != list.end()) {
(*iterator)->Disconnect(); (*iterator)->Disconnect();
iterator = list.erase(iterator); iterator = list.erase(iterator);
numzones--;
} }
} }

View File

@ -76,6 +76,7 @@
#include <time.h> #include <time.h>
#include <ctime> #include <ctime>
#include <thread> #include <thread>
#include <chrono>
#ifdef _CRTDBG_MAP_ALLOC #ifdef _CRTDBG_MAP_ALLOC
#undef new #undef new
@ -108,6 +109,7 @@ EQEmuLogSys Log;
const SPDat_Spell_Struct* spells; const SPDat_Spell_Struct* spells;
int32 SPDAT_RECORDS = -1; int32 SPDAT_RECORDS = -1;
const ZoneConfig *Config; const ZoneConfig *Config;
uint64_t frame_time = 0;
void Shutdown(); void Shutdown();
extern void MapOpcodes(); extern void MapOpcodes();
@ -431,12 +433,17 @@ int main(int argc, char** argv) {
zoneupdate_timer.Start(); zoneupdate_timer.Start();
bool eqsf_open = false; bool eqsf_open = false;
std::unique_ptr<EQ::Net::EQStreamManager> eqsm; std::unique_ptr<EQ::Net::EQStreamManager> eqsm;
std::chrono::time_point<std::chrono::system_clock> frame_prev = std::chrono::system_clock::now();
EQ::Timer process_timer(50, true, [&eqsf_open, &eqsm, &stream_identifier, &eqsi, &worldwasconnected, EQ::Timer process_timer(50, true, [&](EQ::Timer* t) {
&zoneupdate_timer, &IDLEZONEUPDATE, &ZONEUPDATE, &quest_timers, &InterserverTimer](EQ::Timer* t) {
//Advance the timer to our current point in time //Advance the timer to our current point in time
Timer::SetCurrentTime(); Timer::SetCurrentTime();
//Calculate frame time
std::chrono::time_point<std::chrono::system_clock> frame_now = std::chrono::system_clock::now();
frame_time = std::chrono::duration_cast<std::chrono::milliseconds>(frame_now - frame_prev).count();
frame_prev = frame_now;
if (!eqsf_open && Config->ZonePort != 0) { if (!eqsf_open && Config->ZonePort != 0) {
Log.Out(Logs::General, Logs::Zone_Server, "Starting EQ Network server on port %d", Config->ZonePort); Log.Out(Logs::General, Logs::Zone_Server, "Starting EQ Network server on port %d", Config->ZonePort);
@ -525,7 +532,12 @@ int main(int argc, char** argv) {
while(RunLoops) { while(RunLoops) {
EQ::EventLoop::Get().Process(); EQ::EventLoop::Get().Process();
Sleep(1); if (is_zone_loaded) {
Sleep(1);
}
else {
Sleep(50);
}
} }
entity_list.Clear(); entity_list.Clear();

View File

@ -26,6 +26,8 @@
#include <string.h> #include <string.h>
extern uint64_t frame_time;
int Mob::GetBaseSkillDamage(EQEmu::skills::SkillType skill, Mob *target) int Mob::GetBaseSkillDamage(EQEmu::skills::SkillType skill, Mob *target)
{ {
int base = EQEmu::skills::GetBaseDamage(skill); int base = EQEmu::skills::GetBaseDamage(skill);
@ -1012,7 +1014,7 @@ void Mob::ProjectileAttack()
ProjectileAtk[i].skill = 0; ProjectileAtk[i].skill = 0;
ProjectileAtk[i].speed_mod = 0.0f; ProjectileAtk[i].speed_mod = 0.0f;
} else { } else {
ProjectileAtk[i].increment++; ProjectileAtk[i].increment += frame_time;
} }
} }