Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void initBoard(Game &game, char *argv[])
- {
- string line, num, role, color;
- int sqr;
- ifstream boardstm ( argv[1] );
- for (int i=0; i<game.board.numSquares; i++) {
- game.board.squares[ i ].slide.kind = REGULAR;
- game.board.squares[ i ].slide.color = NONE;
- }
- if ( boardstm.is_open() )
- {
- getline (boardstm,line, ' ');
- getline (boardstm,line);
- game.board.numSquares = atoi( line.c_str() );
- while ( boardstm.good() )
- {
- getline (boardstm, num, ' ');
- sqr = atoi( num.c_str() );
- getline (boardstm, role, ' ');
- getline (boardstm, color);
- if ( role.compare( "BEGIN" ) == 0 )
- game.board.squares[ sqr ].slide.kind = BEGIN;
- else if ( role.compare( "END" ) == 0 )
- game.board.squares[ sqr ].slide.kind = END;
- else if ( role.compare( "STARTSQ" ) == 0 )
- game.board.squares[ sqr ].slide.kind = STARTSQ;
- else if ( role.compare( "HOMESQ" ) == 0 )
- game.board.squares[ sqr ].slide.kind = HOMESQ;
- if ( color.compare( "BLUE" ) == 0 )
- game.board.squares[ sqr ].slide.color = BLUE;
- else if ( color.compare( "YELLOW" ) == 0 )
- game.board.squares[ sqr ].slide.color = YELLOW;
- else if ( color.compare( "GREEN" ) == 0 )
- game.board.squares[ sqr ].slide.color = GREEN;
- else if ( color.compare( "RED" ) == 0 )
- game.board.squares[ sqr ].slide.color = RED;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement