忍者ブログ
  • 2024.08
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 2024.10
[PR]
×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。

【2024/09/19 11:55 】 |
Game.h
Game.h
実際に遊ぶときの処理などを記述します。
Player.hなどはオブジェクトの在りようを示すだけですが、
このソースコードにはオブジェクトをどのように動かすかを
記述します。
class Game{
 private:
  Player &player; // 操作するプレイヤー
  Server &server; // 所属サーバ
  Nation *nation; // 所属国

 public:
 Game(Server &sarg, Player &parg):server(sarg), player(parg), nation(NULL){}
  void gameLoop();
  LoopControl act(const char flag[]="");
  const static int convert(const char input);
  const static char inverseConvert(const int input);
  void enterNation(Nation * const n){
    n->addPlayer(&player);
    Game::nation = n;
  }
  Server &getServer(){return server;}
  Player &getPlayer(){return player;}
  Nation *getNation(){
    const bool DEBUG = true;
    if(DEBUG){
      std::cout << "-_~DEBUG Game.h getNation()~_-" << std::endl;
      if(nation == NULL) std::cout << "shozokukokunasi" << std::endl;
      std::cout << std::endl;
    }
    return nation;
  }
};

PR
【2013/03/08 03:23 】 | EBの箱 | 有り難いご意見(0)
<<UI.h | ホーム | Server.h>>
有り難いご意見
貴重なご意見の投稿














<<前ページ | ホーム | 次ページ>>