Fixed another tiny bug.

This commit is contained in:
Ognjen Milan Robovic 2023-11-20 20:52:40 -05:00
parent af5b4f7a75
commit 975cb4f01b
3 changed files with 22 additions and 6 deletions

View File

@ -174,9 +174,16 @@ static int syntax_select (char * string, int * length) {
// it's best to modify only variable 'length', hence we check with 'string_compare_limit' function. // it's best to modify only variable 'length', hence we check with 'string_compare_limit' function.
for (select = offset = 0; select != syntax_count; ++select) { // We're looping defined syntax rules: for (select = offset = 0; select != syntax_count; ++select) { // We're looping defined syntax rules:
if (syntax_enrange [select] == FALSE) { // Choosing the comparisson: if (syntax_enrange [select] == FALSE) { // Choosing the comparisson:
if (syntax_derange [select] == FALSE) {
if (string_compare_limit (string, syntax_begin [select], string_length (syntax_begin [select])) == TRUE) { // Limiting our string comparisson. if (string_compare_limit (string, syntax_begin [select], string_length (syntax_begin [select])) == TRUE) { // Limiting our string comparisson.
break; // If strings are same, we exit the loop. break; // If strings are same, we exit the loop.
} }
} else {
if ((string_compare_limit (string, syntax_begin [select], string_length (syntax_begin [select])) == TRUE)
&& (character_compare_array (string [offset + string_length (syntax_begin [select])], syntax_end [select]) == TRUE)) {
break;
}
}
} else { // Else, we compare any character. } else { // Else, we compare any character.
if (character_compare_array (string [offset], syntax_begin [select]) == TRUE) { // With our obviously named function... if (character_compare_array (string [offset], syntax_begin [select]) == TRUE) { // With our obviously named function...
break; // We found it, exit the loop! break; // We found it, exit the loop!
@ -209,7 +216,8 @@ static int syntax_select (char * string, int * length) {
break; break;
} }
} else { } else {
if (string_compare (syntax_end [select], "") == TRUE) { // And here's our empty string exception. if (syntax_end [select] [0] == CHARACTER_NULL) { // And here's our empty string exception.
* length = offset;
break; break;
} }
if (character_compare_array (string [offset], syntax_end [select]) == TRUE) { if (character_compare_array (string [offset], syntax_end [select]) == TRUE) {

View File

@ -13,11 +13,17 @@ It is distributed in the hope that it will be useful or harmful, it really depen
/* /*
static void (* game_action [GAME_ACTION_COUNT]) (game_t * game, player_t * player); static void (* game_action [GAME_ACTION_COUNT]) (game_t * game, player_t * player);
*/ */
static number_t game_is_active (game_t * game) { return (game->active = curses_active); }/* static number_t game_is_active (game_t * game) { return (game->active = curses_active); }
/*
So, what are actually getters and setters, and why you should never use them? Lets explain.
@C
static number_t game_get_screen_width (game_t * game) { return (game->screen_width); } static number_t game_get_screen_width (game_t * game) { return (game->screen_width); }
static number_t game_get_screen_height (game_t * game) { return (game->screen_height); } static number_t game_get_screen_height (game_t * game) { return (game->screen_height); }
static number_t game_set_screen_width (game_t * game, number_t width) { return (game->screen_width = width); } static number_t game_set_screen_width (game_t * game, number_t width) { return (game->screen_width = width); }
static number_t game_set_screen_height (game_t * game, number_t height) { return (game->screen_height = height); }*/ static number_t game_set_screen_height (game_t * game, number_t height) { return (game->screen_height = height); }
@
*/
static void game_configure (game_t * game, player_t * player) { static void game_configure (game_t * game, player_t * player) {
curses_configure (); curses_configure ();
@ -46,7 +52,7 @@ void play_game (void) {
game_configure (& game, & player); game_configure (& game, & player);
while (game_is_active (& game) && curses_active) { while (game_is_active (& game)) {
game_synchronize (& game, & player); game_synchronize (& game, & player);
} }
} }

View File

@ -32,6 +32,8 @@ static void data_echo (void) {
char byte [4] = " "; char byte [4] = " ";
int i; int i;
char character;
_meme = MEME = meme; _meme = MEME = meme;
for (i = 0; i != data [0]; ++i) { for (i = 0; i != data [0]; ++i) {