bool WaitingList::clientLogin(const Player* player) { if(player->hasFlag(PlayerFlag_CanAlwaysLogin) || player->getAccountType() >= ACCOUNT_TYPE_GAMEMASTER || player->isAccountManager()) return true; if(waitList.empty() && Status::getInstance()->getPlayersOnline() < Status::getInstance()->getMaxPlayersOnline()) { //no waiting list and enough room return true; } cleanUpList(); uint32_t slot; WaitListIterator it = findClient(player, slot); if(it != waitList.end()) { if((Status::getInstance()->getPlayersOnline() + slot) <= Status::getInstance()->getMaxPlayersOnline()) { //should be able to login now delete *it; waitList.erase(it); return true; } else { //let them wait a bit longer (*it)->timeout = OTSYS_TIME() + (getTimeOut(slot) * 1000); return false; } } Wait* wait = new Wait(); if(player->isPremium()) { slot = 1; for(WaitListIterator it = waitList.begin(); it != waitList.end(); ++it) { if(!(*it)->premium) { waitList.insert(it, wait); break; } ++slot; } } else { waitList.push_back(wait); slot = (uint32_t)waitList.size(); } wait->name = player->getName(); wait->acc = player->getAccount(); wait->ip = player->getIP(); wait->premium = player->isPremium(); wait->timeout = OTSYS_TIME() + (getTimeOut(slot) * 1000); return false; }
void setTimeOut() { m_iOwner = -1; m_uiErrCount++; m_tExpTime = gcTime() + std::chrono::seconds(getTimeOut()); gcAssert(isInTimeOut()); }
void StateMachine::update(int state, AnimationModuleInterface * _animation, int channel){ if(_prevChessState!=state){ GotoState(INTERACTIVE,true); _currentAnimation=(char *)GetNextAnimation().pszGetPointer(); _animation->PlayAnimation((char *)_currentAnimation.pszGetPointer() ,channel); } else { setTimeOut(getTimeOut() + 1); if (getState() == INTERACTIVE){ if (getTimeOut() > 300) GotoState(IDLE_LOOK_FRONT, true); } else if ((getState() == IDLE_LOOK_FRONT) || (getState() == IDLE_LOOK_LEFT) || (getState() == IDLE_LOOK_RIGHT)) if (getTimeOut() > 300) GotoState(SLEEPING_BY_NODDING, true); } _prevChessState=state; }
/** functions with actions, which must be performed periodically -> called periodically by Scheduler_c ==> sends base data msg if configured in the needed rates possible errors: * dependant error in CanIo_c on CAN send problems <!--@param ai32_demandedExecEnd optional timestamp, where timeEvent shall return execution to calling function--> @see CanPkg_c::getData @see CanPkgExt_c::getData @see CanIo_c::operator<< */ void BaseCommon_c::timeEvent() { checkCreateReceiveFilter(); // check for different base data types whether the previously // sending node stopped sending -> other nodes can now step in if ( checkMode(IsoAgLib::IdentModeImplement) &&(lastedTimeSinceUpdate() >= getTimeOut( ) ) && (mc_selectedDataSourceISOName.isSpecified()) ) { // the previously sending node didn't send the information for 3 seconds -> give other items a chance mc_selectedDataSourceISOName.setUnspecified(); } if ( mpc_ident && ( ! mpc_ident->isClaimedAddress() ) ) { // local isoname for sending is registrated, but it is not yet fully claimed // --> nothing to do return; } // check if we are in tractor mode and have a pointer to the sending isoname if ( checkMode(IsoAgLib::IdentModeTractor) ) { // all tractor mode timeEvent() functions have the only target to send messages, // now: // 1) getISOName() != NULL // 2) getSystemMgmtInstance4Comm().existLocalMemberISOName(*getISOName(), true) indicates, that a corresponding // item has already performed its address claim // ==> we can directly call sending time event in this case timeEventTracMode(); return; } else { // we are in implement mode // call this function also if isoName == NULL, because some functions do settings which are independent from isoName timeEventImplMode(); return; } }
ProviderInfo(std::shared_ptr<const MCFCore::Misc::DownloadProvider> &pProvider) : m_pProvider(pProvider) , m_tExpTime(gcTime() - std::chrono::seconds(getTimeOut())) { }