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


C++ ObjectTypeManager::addNewObjectType方法代码示例

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


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

示例1: initGame

void MTSec::initGame() {
    Game* game = Game::getGame();

    MTSecTurn* turn = new MTSecTurn();
    
    game->setTurnProcess(turn);

    ObjectTypeManager* obdm = game->getObjectTypeManager();
    obdm->addNewObjectType( new UniverseType());
    obdm->addNewObjectType( new EmptyObjectType( "Galaxy", "The Galaxy Object type") );
    obdm->addNewObjectType( new EmptyObjectType( "Star System","The Star System Object type") );
    uint32_t pt = obdm->addNewObjectType( new PlanetType());
    uint32_t ft = obdm->addNewObjectType( new FleetType());
    
    turn->setPlanetType(pt);
    turn->setFleetType(ft);

    OrderManager* ordm = game->getOrderManager();
    ordm->addOrderType(new Nop());
    ordm->addOrderType(new Move());
    ordm->addOrderType(new BuildFleet());
    ordm->addOrderType(new BuildWeapon());
    ordm->addOrderType(new Colonise());
    ordm->addOrderType(new SplitFleet());
    ordm->addOrderType(new MergeFleet());
    ordm->addOrderType(new Enhance());
    ordm->addOrderType(new SendPoints());
    ordm->addOrderType(new LoadArmament());
    ordm->addOrderType(new UnloadArmament());
}
开发者ID:glew,项目名称:tpserver-cpp,代码行数:30,代码来源:mtsec.cpp

示例2: initGame

void taeRuleset::initGame() {
    Game* game = Game::getGame();

    fleetBuilder = new FleetBuilder();

    //Setup turns
    TaeTurn* turn = new TaeTurn(fleetBuilder);
    game->setTurnProcess(turn);

    //Add universe object type
    ObjectTypeManager* obtm = game->getObjectTypeManager();
    obtm->addNewObjectType(new UniverseType());

    //Add Galaxy object type
    EmptyObjectType * eo = new EmptyObjectType();
    eo->setTypeName("Galaxy");
    eo->setTypeDescription("The Galaxy Object type");
    obtm->addNewObjectType(eo);

    //Add Solar system object type
    obtm->addNewObjectType(new StarSystemType());

    //Add Planet object type
    uint32_t pt = obtm->addNewObjectType(new PlanetType());
    turn->setPlanetType(pt);

    //Add Fleet object type
    uint32_t ft = obtm->addNewObjectType(new FleetType());
    turn->setFleetType(ft);
    
    //Set Order types
    OrderManager* orm = game->getOrderManager();
    orm->addOrderType(new Colonize(true));
    orm->addOrderType(new Colonize(false));
    orm->addOrderType(new Move());
    orm->addOrderType(new Attack());
    orm->addOrderType(new Reinforce());

    Logger::getLogger()->info("TaE initialised");
}
开发者ID:AfrazHussain,项目名称:tpserver-cpp,代码行数:40,代码来源:tae.cpp


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