Browse Source

add game command handler to the game

remotes/origin/georg
KaffeeMaus 11 months ago
parent
commit
75e050c8d4
  1. 9
      src/main/c/Georg/tictactoe.c

9
src/main/c/Georg/tictactoe.c

@ -100,7 +100,7 @@ int handleGameInput( char* input ){
if( strstr(input, "set") != NULL ){
return 1;
}else{
return false;
return -1;
}
}
@ -159,9 +159,12 @@ int startGame( int code ){
initializeBoard( board );
while( GAME.currentState == 1 ){
int nextState = handleCommand( getUserInput() );
char* input = getUserInput();
int nextState = handleCommand( input );
if( nextState == -1 ){ // no stateCommand
int gameCommand = handleGameInput( input );
if( nextState == -1 ){
printf("command not found!");
}else{
GAME.currentState = nextState;

Loading…
Cancel
Save