From 9d0d075e3007b0cdf5a9d4c83f174dc588aa7f06 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Sun, 9 Oct 2011 09:24:33 +0000 Subject: [PATCH] flood-it: fixed bug, optimizations git-svn-id: svn://kolibrios.org@2283 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/games/flood-it/trunk/flood-it.c | 42 +++++++++++------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/programs/games/flood-it/trunk/flood-it.c b/programs/games/flood-it/trunk/flood-it.c index da15bb443..6d6f5f269 100644 --- a/programs/games/flood-it/trunk/flood-it.c +++ b/programs/games/flood-it/trunk/flood-it.c @@ -1,4 +1,4 @@ -//Leency 06.10.2011, Flood-it! v2.1, GPL +//Leency 06.10.2011, Flood-it! v2.2, GPL #include "lib\kolibri.h" #include "lib\random.h" @@ -31,7 +31,7 @@ char *BOARD_SIZES[]={ "S", "L", 0 }; #ifdef LANG_RUS - char *BUTTON_CAPTIONS[]={ " Ќ®ў п [F2]", " Џ®¬®йм [F1]", " ‚л室 [Esc]", 0}; + char *BUTTON_CAPTIONS[]={ " ‡ ­®ў® [F2]", " Џ®¬®йм [F1]", " ‚л室 [Esc]", 0}; char CLICKS_TEXT[]=" Љ«ЁЄЁ: /"; char LEVELS_TEXT[]="Џ®«Ґ:"; @@ -72,9 +72,9 @@ char *BOARD_SIZES[]={ "S", "L", 0 }; #endif -int color_matrix[28*28]; //цвета для поля с квадратиками +unsigned char color_matrix[28*28]; //цвета для поля с квадратиками -int loose_matrix[14*14]={ +unsigned char loose_matrix[14*14]={ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 2, 3, 3, 3, 2, 3, 2, 3, 2, 2, @@ -91,7 +91,7 @@ int loose_matrix[14*14]={ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }; -int win_matrix[14*14]={ +unsigned char win_matrix[14*14]={ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 4, 1, 4, @@ -123,7 +123,11 @@ void main() IF (id==1) || (id==4) ExitProcess(); IF (id==2) goto _NEW_GAME_MARK; IF (id==3) goto _HELP_MARK; - IF (id>=100) make_turn(id-100); + IF (id>=100) + { + make_turn(id-100); + break; + } if (id>=10) { id=id-10*3; @@ -240,21 +244,18 @@ void draw_window() void new_game() { - int i, j; + int i; - //randomize(); - CLICKS = 0; - for (i=0;icolor_matrix[0]) goto _LOOSE_MARK; + for (i=0;icolor_matrix[0]) goto _LOOSE_MARK; goto _WIN_MARK; } @@ -326,9 +325,8 @@ int check_for_end() return 1; } - for (i=0;icolor_matrix[0]) return 0; + for (i=0;icolor_matrix[0]) return 0; //всё поле одного цвета и фишек меньше MAX_CLICKS -> победа