コード例 #1
0
ファイル: mtsec.cpp プロジェクト: glew/tpserver-cpp
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());
}
コード例 #2
0
ファイル: tae.cpp プロジェクト: AfrazHussain/tpserver-cpp
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");
}