Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10229


Ignore:
Timestamp:
Feb 1, 2015, 2:50:46 PM (9 years ago)
Author:
landauf
Message:

fixed warnings & details

Location:
code/branches/minigame4DHS14/src/modules/mini4dgame
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/minigame4DHS14/src/modules/mini4dgame/Mini4Dgame.cc

    r10225 r10229  
    190190    void Mini4Dgame::setStone(int x,int y,int z,int w)//Vector4 move, const int playerColor)
    191191    {
    192         Vector4 move = Vector4(x,y,z,w);
     192        Mini4DgamePosition move = Mini4DgamePosition(x,y,z,w);
    193193        ObjectList<Mini4DgameBoard>::iterator it = ObjectList<Mini4DgameBoard>::begin();
    194194        it->makeMove(move);
  • code/branches/minigame4DHS14/src/modules/mini4dgame/Mini4DgameBoard.cc

    r10225 r10229  
    8484        @param the position where to put the stone plus the player who makes the move
    8585    */
    86     bool Mini4DgameBoard::isValidMove(const Vector4 move)
     86    bool Mini4DgameBoard::isValidMove(const Mini4DgamePosition& move)
    8787    {
    8888        return (move.x<4 && move.y<4 && move.z<4 && move.w<4
    8989                        && move.x>=0 && move.y>=0 && move.z>=0 && move.w>=0
    90                         && this->board[(int)move.x][(int)move.y][(int)move.z][(int)move.w] == mini4DgamePlayerColor::none);
     90                        && this->board[move.x][move.y][move.z][move.w] == mini4DgamePlayerColor::none);
    9191    }
    9292
    9393        void Mini4DgameBoard::undoMove()
    9494        {
    95                 Vector4 move = moves.back();
     95            const Mini4DgamePosition& move = moves.back();
    9696                moves.pop_back();
    97         this->board[(int)move.x][(int)move.y][(int)move.z][(int)move.w] = mini4DgamePlayerColor::none;
    98         this->blinkingBillboards[(int)move.x][(int)move.y][(int)move.z][(int)move.w]->destroy();
    99         this->blinkingBillboards[(int)move.x][(int)move.y][(int)move.z][(int)move.w] = 0;
     97        this->board[move.x][move.y][move.z][move.w] = mini4DgamePlayerColor::none;
     98        this->blinkingBillboards[move.x][move.y][move.z][move.w]->destroy();
     99        this->blinkingBillboards[move.x][move.y][move.z][move.w] = 0;
    100100        if(player_toggle_){
    101101                this->player_toggle_ = false;
     
    109109    @param the position where to put the stone plus the player who makes the move
    110110    */
    111     void Mini4DgameBoard::makeMove(const Vector4 move)
     111    void Mini4DgameBoard::makeMove(const Mini4DgamePosition& move)
    112112    {
    113113        if(this->isValidMove(move))
     
    116116                {
    117117                        //stop blinking of last move
    118                         Vector4 lastMove = moves.back();
    119                         this->blinkingBillboards[(int)lastMove.x][(int)lastMove.y][(int)lastMove.z][(int)lastMove.w]
     118                    const Mini4DgamePosition& lastMove = moves.back();
     119                        this->blinkingBillboards[lastMove.x][lastMove.y][lastMove.z][lastMove.w]
    120120                                        ->setActive(false);
    121                         this->blinkingBillboards[(int)lastMove.x][(int)lastMove.y][(int)lastMove.z][(int)lastMove.w]
     121                        this->blinkingBillboards[lastMove.x][lastMove.y][lastMove.z][lastMove.w]
    122122                                        ->setScale(0.1);
    123123                }
     
    133133                }
    134134
    135                 this->board[(int)move.x][(int)move.y][(int)move.z][(int)move.w] = (mini4DgamePlayerColor::color) playerColor;
     135                this->board[move.x][move.y][move.z][move.w] = (mini4DgamePlayerColor::color) playerColor;
    136136
    137137                BlinkingBillboard* bb = new BlinkingBillboard(this->getContext());
     
    139139                        bb->setAmplitude(0.1);
    140140
    141                         switch((int)move.w){
     141                        switch(move.w){
    142142                        case 0: bb->setMaterial("Numbers/One");
    143                                         bb->setPosition(60*(int)move.x-95,60*(int)move.y-95,60*(int)move.z-95);
     143                                        bb->setPosition(60.0f*move.x-95,60.0f*move.y-95,60.0f*move.z-95);
    144144                                        break;
    145145                        case 1: bb->setMaterial("Numbers/Two");
    146                                         bb->setPosition(60*(int)move.x-85,60*(int)move.y-85,60*(int)move.z-95);
     146                                        bb->setPosition(60.0f*move.x-85,60.0f*move.y-85,60.0f*move.z-95);
    147147                                        break;
    148148                        case 2: bb->setMaterial("Numbers/Three");
    149                                         bb->setPosition(60*(int)move.x-85,60*(int)move.y-95,60*(int)move.z-85);
     149                                        bb->setPosition(60.0f*move.x-85,60.0f*move.y-95,60.0f*move.z-85);
    150150                                        break;
    151151                        case 3: bb->setMaterial("Numbers/Four");
    152                                         bb->setPosition(60*(int)move.x-85,60*(int)move.y-85,60*(int)move.z-85);
     152                                        bb->setPosition(60.0f*move.x-85,60.0f*move.y-85,60.0f*move.z-85);
    153153                                        break;
    154154                        }
     
    165165
    166166                        this->attach(bb);
    167                         this->blinkingBillboards[(int)move.x][(int)move.y][(int)move.z][(int)move.w] = bb;
     167                        this->blinkingBillboards[move.x][move.y][move.z][move.w] = bb;
    168168
    169169
     
    176176                                        redFlare->setFrequency(0.5);
    177177                                        redFlare->setAmplitude(3);
    178                                         redFlare->setPosition(60*(int)winner.winningRow[i]-90,
    179                                                                         60*(int)winner.winningColumn[i]-90,
    180                                                                         60*(int)winner.winningHeight[i]-90);
     178                                        redFlare->setPosition(60.0f*(int)winner.winningRow[i]-90,
     179                                                                        60.0f*(int)winner.winningColumn[i]-90,
     180                                                                        60.0f*(int)winner.winningHeight[i]-90);
    181181                                        redFlare->setMaterial("Flares/lensflare");
    182182                                        redFlare->setColour(ColourValue(1,0,0));
  • code/branches/minigame4DHS14/src/modules/mini4dgame/Mini4DgameBoard.h

    r10227 r10229  
    4343{
    4444
     45    struct Mini4DgamePosition
     46    {
     47        Mini4DgamePosition(int x, int y, int z, int w) : x(x), y(y), z(z), w(w) {}
     48        int x;
     49        int y;
     50        int z;
     51        int w;
     52    };
     53
    4554        struct Mini4DgameWinner
    4655        {
     
    6776            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    6877
    69             bool isValidMove(const Vector4 move);
     78            bool isValidMove(const Mini4DgamePosition& move);
    7079            void undoMove();
    71             void makeMove(const Vector4 move);
     80            void makeMove(const Mini4DgamePosition& move);
    7281            Mini4DgameWinner getWinner();
    7382
     
    7786        private:
    7887            //void registerVariables();
    79             std::vector<Vector4> moves;
     88            std::vector<Mini4DgamePosition> moves;
    8089            bool player_toggle_;
    8190            BlinkingBillboard* blinkingBillboards[4][4][4][4];
Note: See TracChangeset for help on using the changeset viewer.