当前位置: 首页>>代码示例>>C++>>正文


C++ Agent::getType方法代码示例

本文整理汇总了C++中Agent::getType方法的典型用法代码示例。如果您正苦于以下问题:C++ Agent::getType方法的具体用法?C++ Agent::getType怎么用?C++ Agent::getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Agent的用法示例。


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

示例1: addOrUpdateAgent

Agent* AgentList::addOrUpdateAgent(sockaddr* publicSocket, sockaddr* localSocket, char agentType, uint16_t agentId) {
    AgentList::iterator agent = end();
    
    if (publicSocket) {
        for (agent = begin(); agent != end(); agent++) {
            if (agent->matches(publicSocket, localSocket, agentType)) {
                // we already have this agent, stop checking
                break;
            }
        }
    } 
    
    if (agent == end()) {
        // we didn't have this agent, so add them
        Agent* newAgent = new Agent(publicSocket, localSocket, agentType, agentId);
        
        if (socketMatch(publicSocket, localSocket)) {
            // likely debugging scenario with two agents on local network
            // set the agent active right away
            newAgent->activatePublicSocket();
        }
   
        if (newAgent->getType() == AGENT_TYPE_VOXEL_SERVER ||
            newAgent->getType() == AGENT_TYPE_AVATAR_MIXER ||
            newAgent->getType() == AGENT_TYPE_AUDIO_MIXER) {
            // this is currently the cheat we use to talk directly to our test servers on EC2
            // to be removed when we have a proper identification strategy
            newAgent->activatePublicSocket();
        }
        
        addAgentToList(newAgent);
        
        return newAgent;
    } else {
        
        if (agent->getType() == AGENT_TYPE_AUDIO_MIXER ||
            agent->getType() == AGENT_TYPE_VOXEL_SERVER) {
            // until the Audio class also uses our agentList, we need to update
            // the lastRecvTimeUsecs for the audio mixer so it doesn't get killed and re-added continously
            agent->setLastHeardMicrostamp(usecTimestampNow());
        }
        
        // we had this agent already, do nothing for now
        return &*agent;
    }    
}
开发者ID:Ventrella,项目名称:hifi,代码行数:46,代码来源:AgentList.cpp

示例2:

int Grid1D::getNumCooperators(){

  list<Agent*> ags;
  int count = 0;
  Agent* a = NULL;

  set<Agent*>::iterator i;
  for (i = agents.begin(); i != agents.end(); ++i) {  
    a = *i;
    if ((a->getType()) == COOP){
      count++;
    }
  }
  return count;
}
开发者ID:calucita,项目名称:Tesis,代码行数:15,代码来源:Grid1D.cpp

示例3: clone

void Agent::clone(Agent b){
	type = b.getType();
	decompositionTime = b.decompositionTime;
	decomposed = b.decomposed;
	shooted = b.shooted;
	lifeTime = b.lifeTime;
	infected = b.infected;
	gender = b.gender;
	age = b.age;
	hasAGun = b.hasAGun;
	infectionTime = b.infectionTime;
	yearTime = b.yearTime;
	deadByConversion = b.deadByConversion;
	naturalDead = b.naturalDead;
	lifeExpectancy = b.lifeExpectancy;
	numBabies = b.numBabies;
}
开发者ID:diogonal,项目名称:paraprj,代码行数:17,代码来源:Agent.cpp


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