]> git.deb.at Git - pkg/netris.git/blob - debian/patches/02_line-count-patch
Finalize the changelog
[pkg/netris.git] / debian / patches / 02_line-count-patch
1 Author: Piotr Krukowiecki <piotrwww@krukowiecki.net>    vim:ft=diff:
2 Description: patch to display line counter, BTS #304224
3
4 Index: b/curses.c
5 ===================================================================
6 --- a/curses.c
7 +++ b/curses.c
8 @@ -258,6 +258,12 @@ ExtFunc void PlotUnderline(int scr, int
9  
10  ExtFunc void ShowDisplayInfo(void)
11  {
12 +       if (game == GT_classicTwo) {
13 +               move(statusYPos - 5, statusXPos);
14 +               printw("Enemy lines: %3d/%4d", enemyLinesCleared, enemyTotalLinesCleared);
15 +       }
16 +       move(statusYPos - 4, statusXPos);
17 +       printw("My lines:    %3d/%4d", myLinesCleared, myTotalLinesCleared);
18         move(statusYPos - 3, statusXPos);
19         printw("Won:  %3d", won);
20         move(statusYPos - 2, statusXPos);
21 @@ -282,7 +288,7 @@ ExtFunc void ShowDisplayInfo(void)
22         printw("Speed: %dms", speed / 1000);
23         clrtoeol();
24         if (robotEnable) {
25 -               move(statusYPos - 6, statusXPos);
26 +               move(statusYPos - 7, statusXPos);
27                 if (fairRobot)
28                         addstr("Controlled by a fair robot");
29                 else
30 @@ -290,7 +296,7 @@ ExtFunc void ShowDisplayInfo(void)
31                 clrtoeol();
32         }
33         if (opponentFlags & SCF_usingRobot) {
34 -               move(statusYPos - 5, statusXPos);
35 +               move(statusYPos - 6, statusXPos);
36                 if (opponentFlags & SCF_fairRobot)
37                         addstr("The opponent is a fair robot");
38                 else
39 Index: b/game.c
40 ===================================================================
41 --- a/game.c
42 +++ b/game.c
43 @@ -103,6 +103,7 @@ ExtFunc void OneGame(int scr, int scr2)
44         int key;
45         char *p, *cmd;
46  
47 +       myLinesCleared = enemyLinesCleared = 0;
48         speed = stepDownInterval;
49         ResetBaseTime();
50         InitBoard(scr);
51 @@ -297,7 +298,15 @@ ExtFunc void OneGame(int scr, int scr2)
52                                                         DropPiece(scr2);
53                                                         break;
54                                                 case NP_clear:
55 -                                                       ClearFullLines(scr2);
56 +                                                       {
57 +                                                               int cleared = ClearFullLines(scr2);
58 +                                                               if (cleared) {
59 +                                                                       enemyLinesCleared += cleared;
60 +                                                                       enemyTotalLinesCleared += cleared;
61 +                                                                       ShowDisplayInfo();
62 +                                                                       RefreshScreen();
63 +                                                               }
64 +                                                       }
65                                                         break;
66                                                 case NP_insertJunk:
67                                                 {
68 @@ -343,7 +352,12 @@ ExtFunc void OneGame(int scr, int scr2)
69         nextPiece:
70                 dropMode = 0;
71                 FreezePiece(scr);
72 -               linesCleared = ClearFullLines(scr);
73 +               myLinesCleared += linesCleared = ClearFullLines(scr);
74 +               myTotalLinesCleared += linesCleared;
75 +               if (linesCleared) {
76 +                       ShowDisplayInfo();
77 +                       RefreshScreen();
78 +               }
79                 if (linesCleared > 0 && spied)
80                         SendPacket(NP_clear, 0, NULL);
81                 if (game == GT_classicTwo && linesCleared > 1) {
82 Index: b/netris.h
83 ===================================================================
84 --- a/netris.h
85 +++ b/netris.h
86 @@ -182,6 +182,11 @@ EXT char scratch[1024];
87  extern ShapeOption stdOptions[];
88  extern char *version_string;
89  
90 +EXT int myLinesCleared;
91 +EXT int enemyLinesCleared;
92 +EXT int myTotalLinesCleared;
93 +EXT int enemyTotalLinesCleared;
94 +
95  #include "proto.h"
96  
97  #endif /* NETRIS_H */