|
|
@ -162,6 +162,30 @@ int* getMarkerParameters( char* input ){ |
|
|
|
return array; |
|
|
|
} |
|
|
|
|
|
|
|
void handleGame(){ |
|
|
|
char* input = getUserInput(); |
|
|
|
int nextState = handleCommand( input ); |
|
|
|
|
|
|
|
// check commands, if no command found return for new Input |
|
|
|
// gameCommands are saved and processed after this block |
|
|
|
int gameCommand = -1; |
|
|
|
if( nextState == -1 ){ // no stateCommand |
|
|
|
gameCommand = handleGameInput( input ); |
|
|
|
if( gameCommand == -1 ){ |
|
|
|
printf("command not found!"); |
|
|
|
return; |
|
|
|
} |
|
|
|
}else{ |
|
|
|
GAME.currentState = nextState; |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
// gameCommand processing |
|
|
|
if( gameCommand == 1 ) { // set marker in field |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
int startGame( int code ){ |
|
|
|
if( code == -1 ){ // command test |
|
|
|
return 1; |
|
|
@ -172,16 +196,7 @@ int startGame( int code ){ |
|
|
|
initializeBoard( board ); |
|
|
|
|
|
|
|
while( GAME.currentState == 1 ){ |
|
|
|
char* input = getUserInput(); |
|
|
|
int nextState = handleCommand( input ); |
|
|
|
|
|
|
|
if( nextState == -1 ){ // no stateCommand |
|
|
|
int gameCommand = handleGameInput( input ); |
|
|
|
|
|
|
|
printf("command not found!"); |
|
|
|
}else{ |
|
|
|
GAME.currentState = nextState; |
|
|
|
} |
|
|
|
handleGame(); |
|
|
|
} |
|
|
|
|
|
|
|
return 0; |