Debian Codegraph @

TetrisAttack/src/util.cpp

raw
1 #include "tetris.h"
2
3 BlockType& operator++(BlockType& d, int)
4 {
5 if (d == NUMBLOCKS) return d = BLOCK_1; //rollover
6 int temp = d;
7 return d = static_cast<BlockType> (++temp);
8 }
9
10 ostream& operator << (ostream& os, BlockType& v)
11 {
12 switch (v)
13 {
14 case BLOCK_1:
15 return( os << "Block 1" );
16 break;
17 case BLOCK_2:
18 return( os << "Block 2" );
19 break;
20 case BLOCK_3:
21 return( os << "Block 3" );
22 break;
23 case BLOCK_4:
24 return( os << "Block 4" );
25 break;
26 case BLOCK_5:
27 return( os << "Block 5" );
28 break;
29 default:
30 return( os << "Unknown" );
31 break;
32 }
33 }