예제 #1
0
//-------------------------------------------------------------------------
bool DcMidiData::set14bit(int offset, int val)
{
    bool rtval = false;

    if( (offset+1) <= _data.length())
    {
        _data[offset] = getHi(val);
        _data[offset+1] = getLo(val);
        rtval = true;
    }

    return rtval;
}
예제 #2
0
//
// If players are to be serviced, then
// - if there is room in tables, send player there
// - if no room, decide if we should spawn table
//
int CWaitingList::tick(long now)
{
  if (!isOwner())
  {
    // This waiting list is owned by another Lounge
    // Server instance
    return 0;
  }

  if (CLounge::Inst()->getShutdown())
  {
    printf("Server is shutting down, waiting list not serviced.\n");
    return 0;
  }
  
  printf("   Waiting list %d has %d players waiting.\n",
         queueNumber_, players_.size());
  
  const int TimeBetweenSpawns = 60;
  
  if (state_ == WS_Spawning &&
      (now - spawnTime_ > TimeBetweenSpawns))
  { // more than N seconds has passed since
    // last spawn
    state_ = WS_Servicing;
  }
  
  if (state_ == WS_Servicing)
  {
    // If we have more players in queue than the
    // spawn threshold, spawn new table
    if (players_.size() >= GetTableSpawnThreshold(tables_.size()) )
    {
      state_ = WS_Spawning;
      CLounge::Inst()->spawnTable(pGame_->getGameType(),
                                  getGameType(), // queueIndex!
                                  getTableMax(),
                                  getLo(),
                                  getHi(),
                                  pGame_->isHiLoSplit());
      spawnTime_ = now;
    } 
  }
  
  return 0;
}