00001 /* Crown and Cutlass 00002 * Naval Battle Done Header 00003 */ 00004 00005 #if !defined( _STATEDONE_H_ ) 00006 00007 #define _STATEDONE_H_ 00008 00009 #include <vector> 00010 #include <boost/shared_ptr.hpp> 00011 00012 #include "../Callback.h" 00013 #include "../IGameState.h" 00014 00015 using boost::shared_ptr; 00016 00017 class Ship; 00018 class Menu; 00019 class Cargo; 00020 class Texture; 00021 class Product; 00022 class CCTable; 00023 class CCLabel; 00024 00025 typedef enum {sbVictory, sbDefeat, sbNone} BattleResult; 00026 00027 class StateDone: public IGameState { 00028 public: 00029 // Constructor 00030 StateDone(Ship *enemy, BattleResult result); 00031 00032 // Destructor 00033 ~StateDone(); 00034 00035 // Need to implement the Update and Display functions 00036 void Update(const unsigned int ticks); 00037 void Display(); 00038 00039 // Need to implement the switchTo function 00040 void SwitchTo(IGameState *oldState); 00041 00042 // Need to implement the switchFrom function 00043 void SwitchFrom(); 00044 00045 // Callbacks 00046 void Exit(int ID); 00047 void Buy(int ID); 00048 void Sell(int ID); 00049 void TakeAll(int ID); 00050 void LeaveAll(int ID); 00051 00052 private: 00053 // Background texture 00054 Texture *m_background; 00055 00056 // Menu class 00057 CCTable* m_productTable; 00058 00059 CCLabel* m_firstTitle; 00060 CCLabel* m_secondTitle; 00061 CCButton* m_doneButton; 00062 00063 int m_enemyGold; 00064 shared_ptr<Cargo> m_enemyCargo; 00065 00066 // Player object from state sailing, need to pass to StateBattle 00067 shared_ptr<Cargo> m_playerCargo; 00068 00069 // List of buttons, to find out which was called. 00070 std::vector<int> m_buyList; 00071 std::vector<int> m_sellList; 00072 std::vector<int> m_takeList; 00073 std::vector<int> m_leaveList; 00074 //int GoldData; 00075 std::vector<Product*> m_productList; 00076 00077 TCallback<StateDone> m_exitCallback; 00078 TCallback<StateDone> m_buyCallback; 00079 TCallback<StateDone> m_sellCallback; 00080 TCallback<StateDone> m_buyAllCallback; 00081 TCallback<StateDone> m_sellAllCallback; 00082 00083 // Create the menu for moving cargo 00084 void SetupMenu(); 00085 00086 void SackPlayer(); 00087 00088 void SetMenuQtys(); 00089 00090 void CheckInput(); 00091 00092 // Font names 00093 static const std::string s_mainFontName; 00094 static const std::string s_highlightFontName; 00095 static const std::string s_disabledFontName; 00096 }; 00097 00098 #endif
1.4.7