Advertisement
Orrexon

Broke off the tankIter Initialization

Apr 10th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.44 KB | None | 0 0
  1. bool PrototypeState::Enter()
  2. {
  3.     state_window = ServiceLocator<Window>::get_service();
  4.     game_world = GameWorld::create();
  5.     game_world->Initialize();
  6.     game_world->TankStateEnter(sf::Vector2f(HALFTILEWIDTH + 1 * TILEWIDTH, HALFTILEHEIGHT + 18 * TILEHEIGHT), RED);
  7.     game_world->TankStateEnter(sf::Vector2f(HALFTILEWIDTH + 18 * TILEWIDTH, HALFTILEHEIGHT + 1 * TILEHEIGHT), GREEN);
  8.    
  9.     game_world->SetTankIterator();//<-------------------------------------THE NEW FUNCTION, DEF BELLOW.
  10.    
  11.     ServiceLocator<GameWorld>::set_service(game_world);
  12.    
  13.     graph = ServiceLocator<Graph>::get_service();
  14.    
  15.     BlackBoard<GameWorld>* black = new BlackBoard<GameWorld>;
  16.     black->Start();
  17.     ServiceLocator<BlackBoard<GameWorld>>::set_service(black);
  18.  
  19.  
  20.     BTree = new bt1::FirstBTFindBase;
  21.     bt1::ConditionArrived<GameWorld>* condition1 = new bt1::ConditionArrived<GameWorld>;
  22.     bt1::ConditionBaseWalkable<GameWorld>* condition2 = new bt1::ConditionBaseWalkable<GameWorld>;
  23.     bt1::ActionFindPathAndGo<GameWorld>* action1 = new bt1::ActionFindPathAndGo<GameWorld>;
  24.     bt1::ActionSetArrived<GameWorld>* action2 = new bt1::ActionSetArrived<GameWorld>;
  25.     BTree->SearchBaseAndGo->addChild(condition1);
  26.     BTree->SearchBaseAndGo->addChild(condition2);
  27.     BTree->SearchBaseAndGo->addChild(action1);
  28.     BTree->SearchBaseAndGo->addChild(action2);
  29.    
  30.     ServiceLocator<bt1::FirstBTFindBase>::set_service(BTree);
  31.  
  32.     return true;
  33. }
  34.  
  35. void GameWorld::SetTankIterator()
  36. {
  37.     tankIter = tanks.begin();
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement