Rhys ! avatar Rhys ! committed bdc1d72 Draft

using reference rather than pointer for update()

Comments (0)

Files changed (9)

 									<listOptionValue builtIn="false" value="/usr/include/c++/4.6/x86_64-linux-gnu"/>
 									<listOptionValue builtIn="false" value="/usr/include/c++/4.6/x86_64-linux-gnu/bits"/>
 								</option>
+								<option id="llvm.c_cpp.compiler.option.other.verbose.444046932" name="Verbose (-v)" superClass="llvm.c_cpp.compiler.option.other.verbose" value="false" valueType="boolean"/>
+								<option id="llvm.c_cpp.compiler.option.warnings.allwarn.72451900" name="All warnings (-Wall)" superClass="llvm.c_cpp.compiler.option.warnings.allwarn" value="false" valueType="boolean"/>
+								<option id="llvm.c_cpp.compiler.option.misc.other.1756948661" name="Other flags" superClass="llvm.c_cpp.compiler.option.misc.other" value="-c -fmessage-length=0 -std=c++0x" valueType="string"/>
 								<inputType id="cdt.managedbuild.tool.llvm.cpp.compiler.input.242133418" superClass="cdt.managedbuild.tool.llvm.cpp.compiler.input"/>
 							</tool>
 						</toolChain>

.settings/org.eclipse.cdt.managedbuilder.core.prefs

 environment/buildEnvironmentInclude/cdt.managedbuild.config.llvm.clang.linux.exe.debug.1973398871/CPLUS_INCLUDE_PATH/operation=remove
 environment/buildEnvironmentInclude/cdt.managedbuild.config.llvm.clang.linux.exe.debug.1973398871/append=true
 environment/buildEnvironmentInclude/cdt.managedbuild.config.llvm.clang.linux.exe.debug.1973398871/appendContributed=true
+environment/buildEnvironmentInclude/cdt.managedbuild.config.llvm.clang.linux.exe.release.70754471/CPATH/delimiter=\:
+environment/buildEnvironmentInclude/cdt.managedbuild.config.llvm.clang.linux.exe.release.70754471/CPATH/operation=remove
+environment/buildEnvironmentInclude/cdt.managedbuild.config.llvm.clang.linux.exe.release.70754471/CPLUS_INCLUDE_PATH/delimiter=\:
+environment/buildEnvironmentInclude/cdt.managedbuild.config.llvm.clang.linux.exe.release.70754471/CPLUS_INCLUDE_PATH/operation=remove
+environment/buildEnvironmentInclude/cdt.managedbuild.config.llvm.clang.linux.exe.release.70754471/append=true
+environment/buildEnvironmentInclude/cdt.managedbuild.config.llvm.clang.linux.exe.release.70754471/appendContributed=true
 environment/buildEnvironmentLibrary/cdt.managedbuild.config.llvm.clang.linux.exe.debug.1973398871/LIBRARY_PATH/delimiter=\:
 environment/buildEnvironmentLibrary/cdt.managedbuild.config.llvm.clang.linux.exe.debug.1973398871/LIBRARY_PATH/operation=remove
 environment/buildEnvironmentLibrary/cdt.managedbuild.config.llvm.clang.linux.exe.debug.1973398871/append=true
 environment/buildEnvironmentLibrary/cdt.managedbuild.config.llvm.clang.linux.exe.debug.1973398871/appendContributed=true
+environment/buildEnvironmentLibrary/cdt.managedbuild.config.llvm.clang.linux.exe.release.70754471/LIBRARY_PATH/delimiter=\:
+environment/buildEnvironmentLibrary/cdt.managedbuild.config.llvm.clang.linux.exe.release.70754471/LIBRARY_PATH/operation=remove
+environment/buildEnvironmentLibrary/cdt.managedbuild.config.llvm.clang.linux.exe.release.70754471/append=true
+environment/buildEnvironmentLibrary/cdt.managedbuild.config.llvm.clang.linux.exe.release.70754471/appendContributed=true

ActiveStageManager.hpp

 
     void update() {
         GameStage* current_stage = this->stage_stack.top();
-        GameStage::Status css = current_stage->update(this);
+        GameStage::Status css = current_stage->update(*this);
 
         if (this->next_stage != nullptr || css == GameStage::Status::FINISH) {
             current_stage->deactivate();
     virtual void deactivate() { };
     // Called each time the stage becomes inactive by finishing.
     virtual void cleanup() { };
-    virtual Status update(ActiveStageManager* smgr) = 0;
+    virtual Status update(ActiveStageManager& smgr) = 0;
     virtual void draw() = 0;
 };
 

HighScoreStage.hpp

         this->adventure_name = adventure_name;
     }
 
-    virtual Status update(ActiveStageManager*) {
+    virtual Status update(ActiveStageManager&) {
         std::string in;
         getline(std::cin, in);
         return GameStage::Status::FINISH;

MainMenuStage.hpp

 public:
     MainMenuStage(ZorkishGame& game) : ZorkishStage(game) {};
 
-    virtual Status update(ActiveStageManager* smgr) {
+    virtual Status update(ActiveStageManager& smgr) {
         switch (this->input_int()) {
         case 1:
-            smgr->set_next_stage(&this->game.select_adventure());
+            smgr.set_next_stage(&this->game.select_adventure());
             break;
         case 2:
-            smgr->set_next_stage(&this->game.hall_of_fame());
+            smgr.set_next_stage(&this->game.hall_of_fame());
             break;
         case 3:
-            smgr->set_next_stage(&this->game.help());
+            smgr.set_next_stage(&this->game.help());
             break;
         case 4:
-            smgr->set_next_stage(&this->game.about());
+            smgr.set_next_stage(&this->game.about());
             break;
         case 5:
             return GameStage::Status::FINISH;

SelectAdventureStage.hpp

 public:
     SelectAdventureStage(ZorkishGame& game) : ZorkishStage(game) {};
 
-    virtual Status update(ActiveStageManager* smgr) {
+    virtual Status update(ActiveStageManager& smgr) {
         switch (this->input_int()) {
         case 1:
-            smgr->set_next_stage(&this->game.test_adventure());
+            smgr.set_next_stage(&this->game.test_adventure());
             return GameStage::Status::FINISH;
         default:
             this->message = "Please select a number listed above.";

SimpleDisplayStage.hpp

 public:
     SimpleDisplayStage(ZorkishGame& game) : ZorkishStage(game) {};
 
-    virtual Status update(ActiveStageManager*) {
+    virtual Status update(ActiveStageManager&) {
         int c;
         while ((c = std::cin.get()) != '\n');
         return GameStage::Status::FINISH;

TestAdventure.hpp

         this->cleanup();
     }
 
-    virtual Status update(ActiveStageManager* smgr) {
+    virtual Status update(ActiveStageManager& smgr) {
         if (!this->alive) {
             if (this->hiscore) {
                 this->game.high_score().set_score(10, this->moves, "Test Adventure");
-                smgr->set_next_stage(&this->game.high_score());
+                smgr.set_next_stage(&this->game.high_score());
             }
 
             return GameStage::Status::FINISH;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.