Add patch for multiple_definitions errors with gcc-10 (Closes: #956988)
Andreas Rönnquist
4 years ago
0 | Author: Andreas Rönnquist <gusnan@debian.org> | |
1 | Description: Fixes a few "multiple definition of" instances | |
2 | ||
3 | --- a/src/timer.c | |
4 | +++ b/src/timer.c | |
5 | @@ -23,6 +23,15 @@ | |
6 | #include "allegro.h" | |
7 | #include "timer.h" | |
8 | ||
9 | +// the variables used by the timers | |
10 | +volatile int frame_count; | |
11 | +volatile int fps; | |
12 | +volatile int logic_count; | |
13 | +volatile int lps; | |
14 | +volatile int cycle_count; | |
15 | +volatile int game_count; | |
16 | + | |
17 | + | |
18 | // keeps track of frames each second | |
19 | void fps_counter(void) { | |
20 | fps = frame_count; | |
21 | @@ -60,4 +69,4 @@ | |
22 | game_count ++; | |
23 | ||
24 | return TRUE; | |
25 | -} | |
26 | +} | |
27 | --- a/src/timer.h | |
28 | +++ b/src/timer.h | |
29 | @@ -24,12 +24,12 @@ | |
30 | #define _TIMERS_H_ | |
31 | ||
32 | // the variables used by the timers | |
33 | -volatile int frame_count; | |
34 | -volatile int fps; | |
35 | -volatile int logic_count; | |
36 | -volatile int lps; | |
37 | -volatile int cycle_count; | |
38 | -volatile int game_count; | |
39 | +extern volatile int frame_count; | |
40 | +extern volatile int fps; | |
41 | +extern volatile int logic_count; | |
42 | +extern volatile int lps; | |
43 | +extern volatile int cycle_count; | |
44 | +extern volatile int game_count; | |
45 | ||
46 | ||
47 | // functions | |
48 | @@ -37,4 +37,4 @@ | |
49 | void fps_counter(void); | |
50 | void cycle_counter(void); | |
51 | ||
52 | -#endif | |
53 | +#endif | |
54 | --- a/src/particle.c | |
55 | +++ b/src/particle.c | |
56 | @@ -24,7 +24,10 @@ | |
57 | #include "defs.h" | |
58 | ||
59 | // pointer to datafile | |
60 | -DATAFILE *data; | |
61 | +extern DATAFILE *data; | |
62 | + | |
63 | +// the particles themselves | |
64 | +Tparticle particle[MAX_PARTICLES]; | |
65 | ||
66 | ||
67 | // set datafile to use | |
68 | --- a/src/particle.h | |
69 | +++ b/src/particle.h | |
70 | @@ -42,7 +42,7 @@ | |
71 | ||
72 | ||
73 | // the particles themselves | |
74 | -Tparticle particle[MAX_PARTICLES]; | |
75 | +extern Tparticle particle[MAX_PARTICLES]; | |
76 | ||
77 | // functions | |
78 | void set_datafile(DATAFILE *d); | |
79 | --- a/src/player.c | |
80 | +++ b/src/player.c | |
81 | @@ -25,6 +25,9 @@ | |
82 | #include "timer.h" | |
83 | #include "../data/data.h" | |
84 | ||
85 | +// the player | |
86 | +Tplayer player; | |
87 | + | |
88 | // draws the player depending on his state | |
89 | void draw_player(BITMAP *bmp, Tplayer *p, int x, int y) { | |
90 | BITMAP *head, *body; | |
91 | --- a/src/player.h | |
92 | +++ b/src/player.h | |
93 | @@ -53,7 +53,7 @@ | |
94 | ||
95 | ||
96 | // the player | |
97 | -Tplayer player; | |
98 | +extern Tplayer player; | |
99 | ||
100 | // functions | |
101 | void draw_player(BITMAP *bmp, Tplayer *p, int x, int y); | |
102 | --- a/src/bullet.c | |
103 | +++ b/src/bullet.c | |
104 | @@ -26,6 +26,9 @@ | |
105 | #include "timer.h" | |
106 | #include "../data/data.h" | |
107 | ||
108 | +// the bullets themselves | |
109 | +Tbullet bullet[MAX_BULLETS]; | |
110 | + | |
111 | ||
112 | // sets values on a bullet | |
113 | void set_bullet(Tbullet *b, int x, int y, double dx, double dy, BITMAP *bmp, int bad) { | |
114 | --- a/src/bullet.h | |
115 | +++ b/src/bullet.h | |
116 | @@ -42,7 +42,7 @@ | |
117 | #define MAX_BULLETS 64 | |
118 | ||
119 | // the bullets themselves | |
120 | -Tbullet bullet[MAX_BULLETS]; | |
121 | +extern Tbullet bullet[MAX_BULLETS]; | |
122 | ||
123 | // functions | |
124 | void reset_bullets(Tbullet *b, int max); | |
125 | --- a/src/script.c | |
126 | +++ b/src/script.c | |
127 | @@ -35,7 +35,7 @@ | |
128 | ||
129 | ||
130 | // datafile to use | |
131 | -DATAFILE *data; | |
132 | +extern DATAFILE *data; | |
133 | // internal buffers | |
134 | BITMAP *buffer; | |
135 | BITMAP *swap_buffer; | |
136 | @@ -44,6 +44,9 @@ | |
137 | // any objects | |
138 | Tscript_object *objects = NULL; | |
139 | ||
140 | +// array holding the sounds ids | |
141 | +int active_sounds[MAX_SCRIPT_SOUNDS]; | |
142 | + | |
143 | ||
144 | ||
145 | // shows a speak bulb | |
146 | --- a/src/script.h | |
147 | +++ b/src/script.h | |
148 | @@ -42,7 +42,7 @@ | |
149 | // max number of sounds played by the script | |
150 | #define MAX_SCRIPT_SOUNDS 16 | |
151 | // array holding the sounds ids | |
152 | -int active_sounds[MAX_SCRIPT_SOUNDS]; | |
153 | +extern int active_sounds[MAX_SCRIPT_SOUNDS]; | |
154 | ||
155 | ||
156 | // functions | |
157 | --- a/src/edit.c | |
158 | +++ b/src/edit.c | |
159 | @@ -34,7 +34,7 @@ | |
160 | // path to current map | |
161 | char edit_path_and_file[1024]; | |
162 | // datafile to use | |
163 | -DATAFILE *data; | |
164 | +extern DATAFILE *data; | |
165 | // current edit mode | |
166 | int edit_mode; | |
167 |