White space cleanup and some constification
[Project_algorithmic_C.git] / src / main.c
index b0bf5b91dcfbd259bcd87554a78b9b5bf3ec5e36..224e35cbf347d2ef8331aa9d50ef4fe4d1589c19 100644 (file)
@@ -15,14 +15,14 @@ int main() {
     bool exit_condition = false;
     unsigned int nb_white = 0, nb_black = 0;
 
-    char* title_msg = "Jeu Othello";
-    char* score_msg = "Pions %s: %d";
-    char* invalid_move_msg = "Coup invalide";
-    char* player_msg = "Joueur %d (%s) joue !";
-    char* winner_msg = "Joueur %d (%s) gagne !";
-    char* draw_msg = "Egalite !";
-    char* exit_msg = "Pressez une touche pour sortir ou \'r\' pour rejouer";
-   
+    const char* title_msg = "Jeu Othello";
+    const char* score_msg = "Pions %s: %d";
+    const char* invalid_move_msg = "Coup invalide";
+    const char* player_msg = "Joueur %d (%s) joue !";
+    const char* winner_msg = "Joueur %d (%s) gagne !";
+    const char* draw_msg = "Egalite !";
+    const char* exit_msg = "Pressez une touche pour sortir ou \'r\' pour rejouer";
+
     /* linked list of playable shots */
     struct shots_list_s playable_shots;
     INIT_LIST_HEAD(&playable_shots.list);
@@ -73,10 +73,10 @@ int main() {
 
         nb_white = count_pawns_type(pawns, white);
         nb_black = count_pawns_type(pawns, black);
-        
+
         mvprintw(center_y, center_x - 42/2 - snprintf(NULL, 0, score_msg, "noirs", nb_black) - 2, score_msg, "noirs", nb_black);
         mvprintw(center_y, center_x + 42/2 + 2, score_msg, "blancs", nb_white);
-        
+
         //display_array(1, 1, pawns);
 
         int y;
@@ -86,7 +86,7 @@ int main() {
         do {
             y = 0;
             x_char = "";
-            char* prompt_msg = "Prochain pion ? (ligne colonne - chiffre lettre):";
+            const char* prompt_msg = "Prochain pion ? (ligne colonne - chiffre lettre):";
             int prmt_rt = prompt_values(stdscr, center_y + 26/2 + 1, (center_x - strlen(prompt_msg)/2), prompt_msg, &y, &x_char);
             int x = map_col_letter_to_index(x_char);
             nb_pawns_reversed = valid_shot(y, x, player, pawns);
@@ -129,11 +129,11 @@ int main() {
                 clear();
             }
         }
-        
+
         refresh();
 
     } while (!exit_condition);
-    
+
     endwin();
 
     exit(EXIT_SUCCESS);