Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 4, 2016, 11:23:59 AM (8 years ago)
Author:
landauf
Message:

moved maze-generator-code into separate class. made all static variables private members. this fixes a number of issues when reloading the hover game.

File:
1 copied

Legend:

Unmodified
Added
Removed
  • code/branches/presentationHS15/src/modules/hover/MazeGenerator.h

    r11026 r11035  
    2828
    2929/**
    30     @file Hover.h
    31     @brief Gametype. For more information see .cc file
     30    @file MazeGenerator.h
    3231    @ingroup Hover
    3332*/
    3433
    35 #ifndef _Hover_H__
    36 #define _Hover_H__
     34#ifndef _MazeGenerator_H__
     35#define _MazeGenerator_H__
    3736
    3837#include "HoverPrereqs.h"
    39 #include "HoverOrigin.h"
    40 
    41 #include "gametypes/Gametype.h"
    42 #include "core/EventIncludes.h"
    43 #include "core/command/Executor.h"
    44 #include "core/config/ConfigValueIncludes.h"
    45 
    46 #include "gamestates/GSLevel.h"
    47 #include "chat/ChatManager.h"
    48 #include <vector>
    49 
    50 // ! HACK
    51 #include "infos/PlayerInfo.h"
    52 
    53 #include "core/command/ConsoleCommand.h"
    54 
    55 #include "tools/Timer.h"
    56 
    57 
    5838
    5939namespace orxonox
    6040{
    61 
    6241    enum eDirection
    6342    {
     
    6948    };
    7049
    71     class _HoverExport Hover : public Gametype
     50    class _HoverExport MazeGenerator
    7251    {
    73        public:
    74             Hover(Context* context);
     52        public:
     53            MazeGenerator();
    7554
    76             virtual void start();
    77             virtual void end();
     55            void generateMaze();
     56            void renderMaze();
     57            void mazeOut();
     58            void levelOut();
    7859
    79             virtual void tick(float dt);         
    80 
    81             void setOrigin(HoverOrigin* origin)
    82                        { this->origin_ = origin; }
    83 
    84             int getFlags();
    85             WeakPtr<HoverOrigin> origin_;
     60            int* getLevelcode() const
     61                { return this->levelcode_; }
     62            int getNumCells() const
     63                { return NUM_CELLS; }
    8664
    8765        private:
    88             int CellIdx();
    89             int RandomInt();
    90             int RandomInt4();
    91             int Flags_;
     66            bool isDirValid( eDirection Dir );
     67            eDirection getDirection();
    9268
    93             bool IsDirValid( eDirection Dir );
    94             eDirection GetDirection();
    95             void GenerateMaze();
    96             void RenderMaze();
    97             void MazeOut();
    98             void LevelOut();
    99             std::vector<HoverFlag*> flagVector;
     69            int cellIdx();
     70            int randomInt();
     71            int randomInt4();
    10072
     73            static const int NUM_CELLS = 10;
     74            int* levelcode_;
     75            unsigned char* maze_;
    10176
     77            // current traversing position
     78            int ptX_;
     79            int ptY_;
     80
     81            int headingX_[9];
     82            int headingY_[9];
     83            int mask_[9];
    10284    };
    10385}
    10486
    105 #endif /* _Hover_H__ */
     87#endif /* _MazeGenerator_H__ */
Note: See TracChangeset for help on using the changeset viewer.