• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ Team类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Team的典型用法代码示例。如果您正苦于以下问题:C++ Team类的具体用法?C++ Team怎么用?C++ Team使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Team类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: calcSRS

std::vector<double> calcSRS(std::unordered_map<std::string, double>* srsHash, std::string teamName, boost::gregorian::date date){
    Team *team = Team::findTeam(teamName);

    double opp_srs = 0;
    int num_opps = 0, pt_diff = 0;

    typedef std::unordered_map<std::string, TeamGame*> gamesHashType;
    gamesHashType gamesHash = team->getGamesByDate();

    for (auto &game : gamesHash){
        if (game.second->getDate() >= date) continue; //only use games before date
        if (srsHash->find(game.second->getOpp()) == srsHash->end()) continue; //exclude non-Division-I schools

        opp_srs += srsHash->at(game.second->getOpp());
        pt_diff += game.second->getOpts() - game.second->getDpts();
        num_opps++;
    }

    double srs = 0, sos = 0;

    if (num_opps > 0) {
        if (opp_srs != opp_srs){ //check for nan
            srs = pt_diff/num_opps;
            sos = 0;
        }
        else {
            srs = (pt_diff + opp_srs) / num_opps;
            sos = opp_srs / num_opps;
        }
    }

    std::vector<double> result = {srs,sos};

    return result;
}
开发者ID:soulish,项目名称:NCAA_C,代码行数:35,代码来源:generateSRS.cpp


示例2: add_team

void Game :: add_team (char * source_filename, int tanks_n)
{
	
	Team * team;
	
	int x;
	int y;
	
	int tank_i;
	
	team = new Team(this, source_filename, this->teams.size());
	
	this->teams.push_back(team);
	
	for (tank_i = 0; tank_i < tanks_n; tank_i++)
	{
		x = rand() % GAME_WIDTH;
		y = rand() % GAME_HEIGHT;
		while (this->location_free(x, y, true) == false)
		{
			x = rand() % GAME_WIDTH;
			y = rand() % GAME_HEIGHT;
		}
		
		team->add_tank(x, y);
	}
	
	team->place_flag_randomly();
	
}
开发者ID:endeav0r,项目名称:endeavormac,代码行数:30,代码来源:game.cpp


示例3: teamdata

void World::restoreUnits( Sqlite3 & db, GoalMap & goal_map ) {
	Statement teamdata( db, "SELECT x, y, faction_id, goal_id FROM TEAM" );
	int count = 0;
	for (;;) {
		const int rc = teamdata.step();
		if ( rc == SQLITE_DONE ) break;
		int x, y, faction, goal_id;
		teamdata.column( 0, x );
		teamdata.column( 1, y );
		teamdata.column( 2, faction );
		teamdata.column( 3, goal_id );
		auto goal_it = goal_map.find( goal_id );
		Hex * hex = this->tryFind( x, y );
		if ( hex == nullptr ) {
			cerr << "Cannot place team at: (" << x << "," << y << ")" << endl;
		} else {
			Team * team = new Team( hex, faction );
			this->units.push_back( team );
			if ( goal_it != goal_map.end() ) {
				team->setGoal( goal_it->second );
			}
			count += 1;
		}
	}
	cout << "Read " << count << " team records." << endl;	
}
开发者ID:sfkleach,项目名称:worlds-apart,代码行数:26,代码来源:world.cpp


示例4: U32

  //
  // Process the recycler
  //
  void Base::Recycler::Process()
  {
    // Work out how much resource is pending from refunds
    U32 refund = 0;
    for (UnitObjList::Iterator u(&state.GetBase().GetManager().GetRefunds()); *u; ++u)
    {
      refund += U32(F32((**u)->GetResourceValue() * (**u)->UnitType()->GetRecyclePercentage()));
    }

    Object &object = state.GetBase().GetObject();
    Team *team = object.GetTeam();
    U32 resource = team->GetResourceStore();

    // Do we have less cash now than the limit ?
    if ((resource + refund) < cash)
    {
      for (NList<Type>::Iterator t(&types); *t; ++t)
      {
        const NList<UnitObj> *units = team->GetUnitObjects((*t)->type->GetNameCrc());

        if (units && units->GetCount() > (*t)->minimum)
        {
          // Order this unit to be recycled
          UnitObj *unit = units->GetHead();
          Orders::Game::ClearSelected::Generate(object);
          Orders::Game::AddSelected::Generate(object, unit);
          Orders::Game::Recycle::Generate(object);
          state.GetBase().GetManager().AddRefund(unit);
          break;
        }
      }
    }

  }
开发者ID:grasmanek94,项目名称:darkreign2,代码行数:37,代码来源:strategic_base_recycler.cpp


示例5: ThreadByID

Model::Thread*
Model::AddThread(const system_profiler_thread_added* event, nanotime_t time)
{
	// check whether we do already know the thread
	Thread* thread = ThreadByID(event->thread);
	if (thread != NULL) {
		fprintf(stderr, "Duplicate thread: %ld\n", event->thread);
		// TODO: User feedback!
		return thread;
	}

	// get its team
	Team* team = TeamByID(event->team);
	if (team == NULL) {
		fprintf(stderr, "No team for thread: %ld\n", event->thread);
		return NULL;
	}

	// create the thread and add it
	thread = new(std::nothrow) Thread(team, event, time);
	if (thread == NULL)
		return NULL;
	ObjectDeleter<Thread> threadDeleter(thread);

	if (!fThreads.BinaryInsert(thread, &Thread::CompareByID))
		return NULL;

	if (!team->AddThread(thread)) {
		fThreads.RemoveItem(thread);
		return NULL;
	}

	threadDeleter.Detach();
	return thread;
}
开发者ID:DonCN,项目名称:haiku,代码行数:35,代码来源:Model.cpp


示例6: printStartMsg

void tstTeamMngr::testGetAllTeams()
{
  printStartMsg("tstTeamMngr::testGetAllTeams");
  
  TournamentDB* db = getScenario01(true);
  TeamMngr tmngr(db);
  
  // run on empty table
  QList<Team> result = tmngr.getAllTeams();
  CPPUNIT_ASSERT(result.length() == 0);
  
  // actually create a valid team
  CPPUNIT_ASSERT(tmngr.createNewTeam("t1") == OK);
  CPPUNIT_ASSERT(tmngr.createNewTeam("t2") == OK);
  
  // run on filled table
  result = tmngr.getAllTeams();
  CPPUNIT_ASSERT(result.length() == 2);
  Team t = result.at(0);
  CPPUNIT_ASSERT(t.getId() == 1);
  CPPUNIT_ASSERT(t.getName() == "t1");
  t = result.at(1);
  CPPUNIT_ASSERT(t.getId() == 2);
  CPPUNIT_ASSERT(t.getName() == "t2");
  
  delete db;
  printEndMsg();
}
开发者ID:Foorgol,项目名称:QTournament,代码行数:28,代码来源:tstTeamMngr.cpp


示例7: outputTeamPoints

void UserInput::outputTeamPoints(Team user, Team computer)
{
	cout << "User's team points: " << user.getPoints() << endl;;  // prints the team points for user
	cout << "Computer's team points: " << computer.getPoints() << endl; // prints the team points for the computer

	outputWinner(user.getPoints(), computer.getPoints());
}
开发者ID:jflinn18,项目名称:CS172-FP,代码行数:7,代码来源:UserInput.cpp


示例8: initializeLogData

void Logistics::initializeLogData()
{
	LogisticsData::instance->removeMechsInForceGroup();

	LogisticsData::instance->init();
	Team* pTeam = Team::home;

	if ( pTeam )
	{
		for ( int i = pTeam->getRosterSize() - 1; i > -1; i-- )
		{
			Mover* pMover = (Mover*)pTeam->getMover( i );
			LogisticsPilot* pPilot = LogisticsData::instance->getPilot(pMover->getPilot()->getName());

			unsigned long base, highlight1, highlight2;
			((Mech3DAppearance*)pMover->getAppearance())->getPaintScheme( highlight1, 
				highlight2, base );
			
			
			if ( pMover->getObjectType()->getObjectTypeClass() == BATTLEMECH_TYPE )
			{
				LogisticsVariant* pVar = LogisticsData::instance->getVariant( ((BattleMech*)pMover)->variantName );
				LogisticsData::instance->addMechToInventory( 
					pVar, 1, pPilot,
					base, highlight1, highlight2 );
			}
		}
	}
}
开发者ID:Jacic,项目名称:MechCommander2,代码行数:29,代码来源:logistics.cpp


示例9: exec

int exec(const char path[])
{
	Image image;
	if (image.Open(path) != E_NO_ERROR)
		return E_NO_SUCH_FILE;

	Team *newTeam = new Team(path);
	if (newTeam == 0)
		return E_NO_MEMORY;

	if (image.Load(*newTeam) != E_NO_ERROR) {
		printf("error loading image\n");
		newTeam->ReleaseRef();
		return E_NOT_IMAGE;
	}

	const char *filename = path + strlen(path);
	while (filename > path && *filename != '/')
		filename--;
	
	char appName[OS_NAME_LENGTH];
	snprintf(appName, OS_NAME_LENGTH, "%.12s thread", filename + 1);

	thread_start_t entry = reinterpret_cast<thread_start_t>(image.GetEntryAddress());
	Thread *child = new Thread(appName, newTeam, entry, 0);
	if (child == 0) {
		newTeam->ReleaseRef();
		return E_NO_MEMORY;
	}
		
	return E_NO_ERROR;	// Maybe return a handle to the team, but then it would
						// have to be explicitly closed
}
开发者ID:FFalcon,项目名称:jbushOS,代码行数:33,代码来源:SystemCall.cpp


示例10: Game

DeathMatch::DeathMatch():
    Game(games::gDeathMatch) {

    settings::C_EnabledWeapons  = settings::C_EnabledWeaponsByUser;
    settings::C_EnabledSpecials = settings::C_EnabledSpecialsByUser;

    music::play();

    if (settings::C_playerIteamL  | settings::C_playerIteamR)
        players::addPlayer (teams::addTeam(new DMTeam(settings::C_playerITeamColor)), controllers::cPlayer1);
    if (settings::C_playerIIteamL | settings::C_playerIIteamR)
        players::addPlayer (teams::addTeam(new DMTeam(settings::C_playerIITeamColor)), controllers::cPlayer2);

    for (int i=0; i<settings::C_botsDeath; ++i) {
        Team* newTeam = teams::addTeam(new DMTeam());
        Color3f color(newTeam->color());
        color.h(newTeam->color().h()+10*randomizer::random(-5, 5));
        color.v(newTeam->color().v()+randomizer::random(-0.5f, 0.5f));
        players::addPlayer(newTeam, controllers::cBot, color);
    }

    teams::assignHomes(spaceObjects::addHome(HOME_MIDDLE, 100, Color3f(0.9f, 0.7f, 1.0f)));
    players::createShips();

    spaceObjects::populateSpace(5.f, 10.f, 4);
    zones::createRaster(4,3);
}
开发者ID:AlohaWu,项目名称:M.A.R.S.,代码行数:27,代码来源:DeathMatch.cpp


示例11: synthetize

void Role::synthetize()
{
    int gem,crystal;
    Team* team;

    team=dataInterface->getMyTeam();
    gem=team->getGem();
    crystal=team->getCrystal();

    state=5;
    decisionArea->enable(0);
    decisionArea->enable(1);
    tipArea->reset();
    handArea->reset();
    playerArea->reset();

    tipArea->setMsg(tr("请选择用来合成的星石:"));
    if(crystal>=3)
        tipArea->addBoxItem(tr("1.三个水晶"));
    if(crystal>=2&&gem>=1)
        tipArea->addBoxItem(tr("2.两个水晶和一个宝石"));
    if(crystal>=1&&gem>=2)
        tipArea->addBoxItem(tr("3.一个水晶和两个宝石"));
    if(gem>=3)
        tipArea->addBoxItem(tr("4.三个宝石"));
    tipArea->showBox();
}
开发者ID:dreamStar,项目名称:Asteriated_Grail,代码行数:27,代码来源:Role.cpp


示例12: TNLAssert

// Makes sure that the mTeams[] structure has the proper player counts
// Needs to be called manually before accessing the structure
// Bot counts do work on client.  Yay!
// Rating may only work on server... not tested on client
void Game::countTeamPlayers() const
{
   for(S32 i = 0; i < getTeamCount(); i++)
   {
      TNLAssert(dynamic_cast<Team *>(getTeam(i)), "Invalid team");      // Assert for safety
      static_cast<Team *>(getTeam(i))->clearStats();                    // static_cast for speed
   }

   for(S32 i = 0; i < getClientCount(); i++)
   {
      ClientInfo *clientInfo = getClientInfo(i);

      S32 teamIndex = clientInfo->getTeamIndex();

      if(teamIndex >= 0 && teamIndex < getTeamCount())
      { 
         // Robot could be neutral or hostile, skip out-of-range team numbers
         TNLAssert(dynamic_cast<Team *>(getTeam(teamIndex)), "Invalid team");
         Team *team = static_cast<Team *>(getTeam(teamIndex));            

         if(clientInfo->isRobot())
            team->incrementBotCount();
         else
            team->incrementPlayerCount();

         // The following bit won't work on the client... 
         if(isServer())
         {
            const F32 BASE_RATING = .1f;
            team->addRating(max(clientInfo->getCalculatedRating(), BASE_RATING));    
         }
      }
   }
}
开发者ID:LibreGames,项目名称:bitfighter,代码行数:38,代码来源:game.cpp


示例13: addMember

/**
 * \brief 增加成员
 * \param leaderid 队长id
 * \param userid 队员ID
 * \return true 成功 false 失败
 */
bool GlobalTeamIndex::addMember(const DWORD leaderid , const DWORD userid)
{
	bool bret = false;
	mlock.lock();
	if(leaderid == userid)
	{
		Team t;
		t.setLeader(leaderid);
		bret = team.insert(TeamMap_value_type(leaderid , t)).second;
	}
	else
	{
		TeamMap_iterator iter = team.find(leaderid);
		if(iter != team.end())
		{
			bret = iter->second.addMember(userid);
		}
		else
		{
			bret = false;
		}
	}
	mlock.unlock();
	return bret;
}
开发者ID:xiongshaogang,项目名称:Svr-15-11-4,代码行数:31,代码来源:Team.cpp


示例14: Game

Rally::Rally():
    Game(games::gRally) {

    settings::C_EnabledWeapons  = settings::C_EnabledWeaponsByUser;
    settings::C_EnabledSpecials = settings::C_EnabledSpecialsByUser;

    music::play();

    if (settings::C_playerIteamL  | settings::C_playerIteamR)
        players::addPlayer (teams::addTeam(new DMTeam(settings::C_playerITeamColor)), controllers::cPlayer1);
    if (settings::C_playerIIteamL | settings::C_playerIIteamR)
        players::addPlayer (teams::addTeam(new DMTeam(settings::C_playerIITeamColor)), controllers::cPlayer2);

    for (int i=0; i<settings::C_botsDeath; ++i) {
        Team* newTeam = teams::addTeam(new DMTeam());
        Color3f color(newTeam->color());
        color.h(newTeam->color().h()+10*randomizer::random(-5, 5));
        color.v(newTeam->color().v()+randomizer::random(-0.5f, 0.5f));
        players::addPlayer(newTeam, controllers::cBot, color);
    }

    Home* home = spaceObjects::addHome(HOME_RALLY, 100, Color3f(1.f, 1.f, 1.f));
    teams::assignHomes(home);
    players::createShips();

    //spaceObjects::populateSpace(5.f, 10.f, 4);
    zones::createRaster(4,3);

    track_ = new Track(home);
}
开发者ID:AlohaWu,项目名称:M.A.R.S.,代码行数:30,代码来源:Rally.cpp


示例15:

Officer::~Officer()
{
    if( m_id.GetTeamId() != 255 )
    {
        Team *team = &g_app->m_location->m_teams[ m_id.GetTeamId() ];
        team->UnRegisterSpecial( m_id );
    }
}
开发者ID:gene9,项目名称:Darwinia-and-Multiwinia-Source-Code,代码行数:8,代码来源:officer.cpp


示例16: user_timer_get_clock

status_t
user_timer_get_clock(clockid_t clockID, bigtime_t& _time)
{
	switch (clockID) {
		case CLOCK_MONOTONIC:
			_time = system_time();
			return B_OK;

		case CLOCK_REALTIME:
			_time = real_time_clock_usecs();
			return B_OK;

		case CLOCK_THREAD_CPUTIME_ID:
		{
			Thread* thread = thread_get_current_thread();
			InterruptsSpinLocker timeLocker(thread->time_lock);
			_time = thread->CPUTime(false);
			return B_OK;
		}

		case CLOCK_PROCESS_USER_CPUTIME_ID:
		{
			Team* team = thread_get_current_thread()->team;
			InterruptsSpinLocker timeLocker(team->time_lock);
			_time = team->UserCPUTime();
			return B_OK;
		}

		case CLOCK_PROCESS_CPUTIME_ID:
		default:
		{
			// get the ID of the target team (or the respective placeholder)
			team_id teamID;
			if (clockID == CLOCK_PROCESS_CPUTIME_ID) {
				teamID = B_CURRENT_TEAM;
			} else {
				if (clockID < 0)
					return B_BAD_VALUE;
				if (clockID == team_get_kernel_team_id())
					return B_NOT_ALLOWED;

				teamID = clockID;
			}

			// get the team
			Team* team = Team::Get(teamID);
			if (team == NULL)
				return B_BAD_VALUE;
			BReference<Team> teamReference(team, true);

			// get the time
			InterruptsSpinLocker timeLocker(team->time_lock);
			_time = team->CPUTime(false);

			return B_OK;
		}
	}
}
开发者ID:naveedasmat,项目名称:haiku,代码行数:58,代码来源:UserTimer.cpp


示例17: Search

Team* TeamLinkedList::Search(const string& teamName) const
{
    Team* teamptr = head;
    while (teamptr != NULL && teamptr->Name() != teamName)
    {
        teamptr = teamptr->next;
    }
    return teamptr;
}
开发者ID:sieut,项目名称:csgo-elo,代码行数:9,代码来源:Hashtable.cpp


示例18: setInputMode

//------------------------------------------------------------------------------
void GameLogicClientSoccer::onTeamAssignmentChanged(Player * player)
{
    if (player == puppet_master_->getLocalPlayer())
    {
        TEAM_ID team_id = score_.getTeamId(puppet_master_->getLocalPlayer()->getId());

        // also update mine warning billboards
        TankMineVisual::setLocalPlayerTeam(team_id);
        
        if (team_id != INVALID_TEAM_ID)
        {
        } else
        {
            setInputMode(IM_CONTROL_CAMERA);
        }
    }



    Team * team = score_.getTeam(player->getId());

    if (player == puppet_master_->getLocalPlayer())
    {
        if (team == NULL)
        {
            puppet_master_->getHud()->addMessage("You have been assigned to no team.");

            // Hide respawn counter
            show_respawn_text_ = false;
            handleRespawnCounter(0.0f);
        } else
        {
            show_respawn_text_ = true;
            puppet_master_->getHud()->addMessage(std::string("You have been assigned to ") +
                                                 team->getName() +
                                                 ".",
                                                 team->getColor());

            sendRespawnRequest(0);
        }
    } else if (puppet_master_->getLocalPlayer()->isLevelDataSet())
    {
        // Notification if other player changes team
        if (team)
        {
            puppet_master_->getHud()->addMessage(player->getName()   +
                                                 " has been assigned to " +
                                                 team->getName() +
                                                 ".",
                                                 team->getColor());
        } else
        {
            puppet_master_->getHud()->addMessage(player->getName() + " has been assigned to no team.");
        }
    }    
}
开发者ID:krichter722,项目名称:zeroballistics,代码行数:57,代码来源:GameLogicClientSoccer.cpp


示例19: setTeamTier

void TeamLine::setTeamTier(const Team &team, const QString &tier)
{
    ui->teamName->setText(tr("%1 (%2)", "Team and tier in find battle").arg(team.name(), tier));

    QLabel *pokes[] = {ui->poke1, ui->poke2, ui->poke3, ui->poke4, ui->poke5, ui->poke6};

    for (int i = 0; i < 6; i++) {
        pokes[i]->setPixmap(PokemonInfo::Icon(team.poke(i).num()));
    }
}
开发者ID:Alicirno,项目名称:pokemon-online,代码行数:10,代码来源:teamline.cpp


示例20:

static Unit *GetSelectedUnit()
{
	Team *team = NULL;

	if (g_app->m_location &&
	    (team = g_app->m_location->GetMyTeam()))
		return team->GetMyUnit();
	else
		return NULL;
}
开发者ID:gene9,项目名称:Darwinia-and-Multiwinia-Source-Code,代码行数:10,代码来源:control_help.cpp



注:本文中的Team类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Technique类代码示例发布时间:2022-05-31
下一篇:
C++ TeDatabasePortal类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap