diff --git a/server/robotserver/playermgr.cc b/server/robotserver/playermgr.cc index 2791a4eb..1c895dbf 100644 --- a/server/robotserver/playermgr.cc +++ b/server/robotserver/playermgr.cc @@ -8,6 +8,7 @@ #include #include #include +#include #include "playermgr.h" #include "player.h" @@ -17,7 +18,8 @@ void PlayerMgr::Init() { - for (int i = 1; i <= 19; ++i) { +#if 0 + for (int i = 1; i <= 300; ++i) { int idx = i; std::string account_id = a8::Format("6513_2006_%d", {idx}); auto hum = std::make_shared(); @@ -25,6 +27,21 @@ void PlayerMgr::Init() account_id_hash_[hum->GetAccountId()] = hum; socket_id_hash_[hum->GetSocketId()] = hum; } +#endif + f8::Timer::Instance()->SetInterval + ( + 3000, + [this] (int et, const a8::Args* args) + { + if (et == a8::TIMER_EXEC_EVENT) { + int idx = account_id_hash_.size() + 1; + std::string account_id = a8::Format("6513_2006_%d", {idx}); + auto hum = std::make_shared(); + hum->Init(idx, account_id); + account_id_hash_[hum->GetAccountId()] = hum; + socket_id_hash_[hum->GetSocketId()] = hum; + } + }); } void PlayerMgr::UnInit()