Changeset a35b458 in mainline for uspace/app/tetris/scores.c


Ignore:
Timestamp:
2018-03-02T20:10:49Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f1380b7
Parents:
3061bc1
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
Message:

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/tetris/scores.c

    r3061bc1 ra35b458  
    9898{
    9999        int i;
    100        
     100
    101101        clear_screen();
    102102        moveto(10, 0);
    103103        printf("\tRank \tLevel \tName\t                     points\n");
    104104        printf("\t========================================================\n");
    105        
     105
    106106        for (i = 0; i < NUMSPOTS - 1; i++)
    107107                printf("\t%6d %6d %-16s %20d\n",
    108108                    i + 1, scores[i].hs_level, scores[i].hs_name, scores[i].hs_score);
    109        
     109
    110110        if (!firstgame) {
    111111                printf("\t========================================================\n");
     
    113113                    scores[NUMSPOTS - 1].hs_level, scores[NUMSPOTS - 1].hs_name, scores[NUMSPOTS - 1].hs_score);
    114114        }
    115        
     115
    116116        printf("\n\n\n\n\tPress any key to return to main menu.");
    117117        getchar();
     
    125125        cons_event_t ev;
    126126        kbd_event_t *kev;
    127        
     127
    128128        clear_screen();
    129129        moveto(10, 10);
     
    133133        i = 6;
    134134        off = 6;
    135        
     135
    136136        moveto(10 , 28);
    137137        printf("%s%.*s", scores[NUMSPOTS - 1].hs_name, MAXLOGNAME-i,
    138138            "........................................");
    139        
     139
    140140        while (1) {
    141141                console_flush(console);
    142142                if (!console_get_event(console, &ev))
    143143                        exit(1);
    144                
     144
    145145                if (ev.type != CEV_KEY || ev.ev.key.type == KEY_RELEASE)
    146146                        continue;
    147                
     147
    148148                kev = &ev.ev.key;
    149                
     149
    150150                if (kev->key == KC_ENTER || kev->key == KC_NENTER)
    151151                        break;
    152                
     152
    153153                if (kev->key == KC_BACKSPACE) {
    154154                        if (i > 0) {
    155155                                wchar_t uc;
    156                                
     156
    157157                                --i;
    158158                                while (off > 0) {
     
    164164                                                break;
    165165                                }
    166                                
     166
    167167                                scores[NUMSPOTS - 1].hs_name[off] = '\0';
    168168                        }
     
    176176                        }
    177177                }
    178                
     178
    179179                moveto(10, 28);
    180180                printf("%s%.*s", scores[NUMSPOTS - 1].hs_name, MAXLOGNAME - i,
    181181                    "........................................");
    182182        }
    183        
     183
    184184        scores[NUMSPOTS - 1].hs_score = score;
    185185        scores[NUMSPOTS - 1].hs_level = level;
    186        
     186
    187187        i = NUMSPOTS - 1;
    188188        while ((i > 0) && (scores[i - 1].hs_score < score))
    189189                i--;
    190        
     190
    191191        for (j = NUMSPOTS - 2; j > i; j--)
    192192                copyhiscore(j, j-1);
    193        
     193
    194194        copyhiscore(i, NUMSPOTS - 1);
    195195}
     
    235235                return;
    236236        }
    237        
     237
    238238        cnt = fwrite(scores, sizeof(struct highscore), NUMSPOTS, f);
    239239        rc = fclose(f);
Note: See TracChangeset for help on using the changeset viewer.