本文整理汇总了C++中CDate::getMin方法的典型用法代码示例。如果您正苦于以下问题:C++ CDate::getMin方法的具体用法?C++ CDate::getMin怎么用?C++ CDate::getMin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDate
的用法示例。
在下文中一共展示了CDate::getMin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: simulateMatch
void CSinglePlayerGame::simulateMatch(const CPfMatches &match)
{
CEventManager *eventMngr = CGameEngine::getInstance()->getEventManager();
std::string currentTimestamp = match.getDMatch().getTimestamp();
IPfTeamPlayersDAO *teamPlayersDAO = m_daoFactory->getIPfTeamPlayersDAO();
IPfTeamAveragesDAO *teamsAvgDAO = m_daoFactory->getIPfTeamAveragesDAO();
eventMngr->addEvent(new CStartMatchEvent(match.getDMatch(), match.getXMatch()));
int xHomeTeam = match.getXFkTeamHome();
int xAwayTeam = match.getXFkTeamAway();
CPfTeamAverages *homeTeamAvg = teamsAvgDAO->findByXTeam(xHomeTeam, currentTimestamp);
CPfTeamAverages *awayTeamAvg = teamsAvgDAO->findByXTeam(xAwayTeam, currentTimestamp);
int nHomeGoals = getRandomNGoals(homeTeamAvg, awayTeamAvg);
int nAwayGoals = getRandomNGoals(awayTeamAvg, homeTeamAvg);
delete homeTeamAvg;
delete awayTeamAvg;
if( nHomeGoals>0 ){
std::vector<CPfTeamPlayers*>* teamPlayesList = teamPlayersDAO->findLineUpByXFkTeam(xHomeTeam, currentTimestamp);
while( nHomeGoals>0 ){
int numPlayer = rand()%teamPlayesList->size();
if(numPlayer == 0) { //Goalie don't score
numPlayer = 10;
}
CPfTeamPlayers *teamPlayer = teamPlayesList->operator[](numPlayer);
int minute = rand()%90;
CDate eventDate = match.getDMatch();
eventDate.setMin(eventDate.getMin()+minute);
eventMngr->addEvent(new CGoalMatchEvent(eventDate, match.getXMatch(), xHomeTeam, teamPlayer->getXTeamPlayer(), minute, false));
nHomeGoals--;
}
teamPlayersDAO->freeVector(teamPlayesList);
}
if( nAwayGoals>0 ){
std::vector<CPfTeamPlayers*>* teamPlayesList = teamPlayersDAO->findLineUpByXFkTeam(xAwayTeam, currentTimestamp);
while( nAwayGoals>0 ){
int numPlayer = rand()%teamPlayesList->size();
if(numPlayer == 0) { //Goalie don't score
numPlayer = 10;
}
CPfTeamPlayers *teamPlayer = teamPlayesList->operator[](numPlayer);
int minute = rand()%90;
CDate eventDate = match.getDMatch();
eventDate.setMin(eventDate.getMin()+minute);
eventMngr->addEvent(new CGoalMatchEvent(eventDate, match.getXMatch(), xAwayTeam, teamPlayer->getXTeamPlayer(), minute, false));
nAwayGoals--;
}
teamPlayersDAO->freeVector(teamPlayesList);
}
CDate eventDate = match.getDMatch();
eventDate.setMin(eventDate.getMin()+90);
eventMngr->addEvent(new CEndMatchEvent(eventDate, match.getXMatch()));
}