void Barista::Update(double dt, float& ingredients, float& trash, float& reserve, MessageBoard* mb, int& drinksPrepared, int& deliveriesPrepared) { //Need to start brewing if there is a order switch (currentState) { case S_IDLE: m_v2Direction.Set(0, -1); UpdateIdle(dt, mb); break; case S_REFILL: m_v2Direction.Set(0, -1); UpdateRefill(dt, ingredients, reserve, mb); break; case S_BREW: m_v2Direction.Set(0, -1); UpdateBrew(dt, ingredients, trash, mb, drinksPrepared, deliveriesPrepared); break; default: break; } spriteAnim->Update(dt); spriteAnim_Legend->Update(dt); if (m_v2Direction.x == -1) this->spriteAnim->currentAni = WALK_LEFT; else if (m_v2Direction.x == 1) this->spriteAnim->currentAni = WALK_RIGHT; else if (m_v2Direction.y == 1) this->spriteAnim->currentAni = WALK_UP; else if (m_v2Direction.y == -1) this->spriteAnim->currentAni = WALK_DOWN; else this->spriteAnim->currentAni = WALK_DOWN; }
void DoomsDayDevice::Update( ) { switch( m_eDoomsDayDeviceState ) { case kDoomsDayDeviceState_Idle: { UpdateIdle( ); return; } break; case kDoomsDayDeviceState_Fire: { UpdateFire( ); return; } break; case kDoomsDayDeviceState_End: { UpdateEnd( ); return; } break; default: { ASSERT( !"DoomsDayDevice::Update: Invalid state." ); return; } break; } }
nuiTCPClient* nuiTCPServer::Accept() { int n = 1; int s = accept(mSocket, NULL, NULL); mAcceptedCount++; if (s >= 0) { //printf("%x accept %d\n", this, s); UpdateIdle(); nuiTCPClient* pClient = OnCreateClient(s); return pClient; } return NULL; }
bool nuiTCPClient::Connect(const nuiNetworkHost& rHost) { if (!Init(AF_INET, SOCK_STREAM, 0)) return false; struct addrinfo* addr = nuiSocket::GetAddrInfo(rHost); int res = connect(mSocket, addr->ai_addr, addr->ai_addrlen); if (res) DumpError(this, res, __FUNC__); UpdateIdle(); freeaddrinfo(addr); mReadConnected = mWriteConnected = res == 0; return mReadConnected; }
int nuiTCPClient::Receive(uint8* pData, int32 len) { #ifdef WIN32 int res = recv(mSocket, (char*)pData, len, MSG_WAITALL); #else //int res = recv(mSocket, (char*)pData, len, MSG_WAITALL); int res = read(mSocket, pData, len); //printf("%p read returned %d\n", this, res); #endif UpdateIdle(); mReadConnected = res != 0; if (res > 0) mReceived += res; return res; }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void C_AlyxEmpEffect::ClientThink( void ) { if ( gpGlobals->frametime <= 0.0f ) return; float flDuration = GetStateDurationPercentage(); switch( m_nState ) { case ENERGYCORE_STATE_OFF: UpdateIdle( 1.0f - flDuration ); break; case ENERGYCORE_STATE_CHARGING: UpdateCharging( flDuration ); break; case ENERGYCORE_STATE_DISCHARGING: UpdateDischarging( ); break; } }
int nuiTCPClient::Send(const uint8* pData, int len) { #ifdef WIN32 int res = send(mSocket, (const char*)pData, len, 0); #else int res = send(mSocket, pData, len, 0); #endif UpdateIdle(); if (res < 0) { if (errno == EWOULDBLOCK && mNonBlocking) return res; DumpError(this, res, __FUNC__); mWriteConnected = false; } else mSent += res; return res; }
int nuiTCPClient::ReceiveAvailable(std::vector<uint8>& rData) { int PendingBytes = 0; #ifdef WIN32 int result = WSAIoctl(mSocket, FIONREAD, NULL, 0, &PendingBytes, sizeof(PendingBytes), NULL, NULL, NULL); #else int result = ioctl(mSocket, FIONREAD, &PendingBytes); #endif if (!PendingBytes || result != 0) return 0; rData.resize(PendingBytes); #ifdef WIN32 int res = recv(mSocket, (char*)&rData[0], rData.size(), MSG_WAITALL); #else int res = recv(mSocket, &rData[0], rData.size(), MSG_WAITALL); #endif mReadConnected = res != 0; UpdateIdle(); if (res < 0) { if (errno == EWOULDBLOCK && mNonBlocking) return res; rData.clear(); return res; } rData.resize(res); mReceived += res; return res; }
void CFolderJoin::Update(HSURFACE hDestSurf) { // Let the GameSpy client manager update... GetGameSpyClientMgr()->Update(); // Update based on our current state... switch (m_nState) { case FSS_IDLE: { UpdateIdle(hDestSurf); break; } case FSS_GETSERVICES: { UpdateGetServices(hDestSurf); break; } case FSS_GETPINGS: { UpdateGetPings(hDestSurf); break; } case FSS_GETALLDATA: { UpdateGetAllData(hDestSurf); break; } case FSS_GETSELPING: { UpdateGetSelPing(hDestSurf); break; } case FSS_DUMMYSTATUS: { UpdateDummyStatus(hDestSurf); break; } } // Update our sub menus... UpdateLists(); // Check for required sorting... if (m_bNeedServerSorting) { m_bNeedServerSorting = LTFALSE; SortServers(); } // Enable or disable the join control as necessary... m_pJoin->Enable((GetCurGameServerHandle() != LTNULL)); }
bool SolveExhaustive() { return UpdateIdle(true); }
WeaponState CClientWeaponDisc::UpdateModelState( bool bFire ) { WeaponState eRet = W_IDLE; // Determine what we should be doing... // (mostly updates animations, also // updates a couple supporting variables) if ( bFire ) { UpdateFiring(); } else if ( g_pLTClient->IsCommandOn( COMMAND_ID_DEFEND ) && g_pLTClient->IsCommandOn( COMMAND_ID_DEFEND_MODIFIER ) ) { UpdateSwatDefense(); } else if ( g_pLTClient->IsCommandOn( COMMAND_ID_DEFEND ) && !g_pLTClient->IsCommandOn( COMMAND_ID_DEFEND_MODIFIER ) ) { UpdateHoldDefense(); } else { UpdateIdle(); } // this is reset here just in case it was set while the hold // animation was not playing m_bPlayImpactHoldAnimation = false; if ( m_bFire ) { // gadgets...always the special case :-( bool bGadgetSpecialCase = m_pAmmo->eType != GADGET; // doesn't actually fire, just updates the // ammo and clears the m_bFire flag eRet = UpdateAmmoFromFire( bGadgetSpecialCase ); // clear the fire flag m_bFire = false; } // See if we just finished deselecting the weapon... if ( m_bWeaponDeselected ) { m_bWeaponDeselected = false; if ( m_cbDeselect ) { // call the deselect callback m_cbDeselect( m_nWeaponId, m_pcbData ); // clear out the callback data m_cbDeselect = 0; m_pcbData = 0; } // deactivate the current weapon, its not used anymore Deactivate(); } return eRet; }
nuiTCPClient* nuiTCPServer::OnCreateClient(nuiSocket::SocketType sock) { UpdateIdle(); return new nuiTCPClient(sock); }