Debian Codegraph @

src/board.cpp

raw symbols SCIP
1 /***************************************************************************
2 board.cpp - description
3 -------------------
4 begin : Thu Aug 17 2000
5 copyright : (C) 2000 by Waldemar Baraldi
6 email : [email protected]
7 ***************************************************************************/
8
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18 #include "board.h"cxx . . $ `<file>/src/board.h`/
19 #include "player.h"cxx . . $ `<file>/src/player.h`/
20 #include "mosaic.h"cxx . . $ `<file>/src/mosaic.h`/
21 #include "wallpaper.h"cxx . . $ `<file>/src/wallpaper.h`/
22
23 #define MAX_SPEEDcxx . . $ `src/board.cpp:23:9`! 80
24
25 Boardcxx . . $ Board#::Boardcxx . . $ Board#Board(49f6e7a06ebc5aa8).():AnimatedCanvascxx . . $ AnimatedCanvas#(){
26 int i,j;
27
28 for (i=0;i<BoardRowscxx . . $ BoardRows.;i++)
29 for (j=0;j<BoardColumnscxx . . $ BoardColumns.;j++){
30 boardcxx . . $ Board#board.[i][j]=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
31 changescxx . . $ Board#changes.[i][j]=false;
32 }
33 paint_allcxx . . $ Board#paint_all.=true;
34 lpscxx . . $ Board#lps.=new Listcxx . . $ List#();
35 flow_rowcxx . . $ Board#flow_row.=flow_columncxx . . $ Board#flow_column.=-1;
36 entrycxx . . $ Board#entry.=exitcxx . . $ Board#exit.=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
37 actual_outputcxx . . $ Board#actual_output.=Voidcxx . . $ Void.;
38 actual_inputcxx . . $ Board#actual_input.=Voidcxx . . $ Void.;
39 statecxx . . $ Board#state.=Playingcxx . . $ Playing.;
40 tick_amountcxx . . $ Board#tick_amount.=1;
41 tankcxx . . $ Board#tank.=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
42 backgroundcxx . . $ Board#background.=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
43 requiredcxx . . $ Board#required.=0;
44 still_requiredcxx . . $ Board#still_required.=0;
45 required_changedcxx . . $ Board#required_changed.=false;
46 entry_rowcxx . . $ Board#entry_row.=-1;
47 entry_columncxx . . $ Board#entry_column.=-1;
48 }
49
50 Boardcxx . . $ Board#::~cxx . . $ Board#`~Board`(ced63f7c635d850d).Boardcxx . . $ Board#(){
51 int i,j;
52 for (i=0;i<BoardRowscxx . . $ BoardRows.;i++)
53 for (j=0;j<BoardColumnscxx . . $ BoardColumns.;j++)
54 if (boardcxx . . $ Board#board.[i][j]) delete boardcxx . . $ Board#board.[i][j];
55 delete lpscxx . . $ Board#lps.;
56 if (backgroundcxx . . $ Board#background.) delete backgroundcxx . . $ Board#background.;
57 if (tankcxx . . $ Board#tank.) delete tankcxx . . $ Board#tank.;
58 }
59
60 void Boardcxx . . $ Board#::setStartDelaycxx . . $ Board#setStartDelay(d4f767463ce0a6b3).(int delay){
61 if (tankcxx . . $ Board#tank.) delete tankcxx . . $ Board#tank.;
62 tankcxx . . $ Board#tank.=new Tankcxx . . $ Tank#(delay);
63 tankcxx . . $ Board#tank.->setPoscxx . . $ Canvas#setPos(3e454b8ccf442868).(TankXcxx . . $ Board#TankX., TankYcxx . . $ Board#TankY.);
64 }
65
66 void Boardcxx . . $ Board#::setEntrycxx . . $ Board#setEntry(436248dd089b42d0).(Entrycxx . . $ Entry# * entry, int row, int column){
67 flow_rowcxx . . $ Board#flow_row.=row;
68 flow_columncxx . . $ Board#flow_column.=column;
69 actual_inputcxx . . $ Board#actual_input.=Voidcxx . . $ Void.;
70 actual_outputcxx . . $ Board#actual_output.=entry->getOutputcxx . . $ Entry#getOutput(fbd438076a101a96).(Voidcxx . . $ Void.);
71 setPipecxx . . $ Board#setPipe(7a526bb1f07b082a).(entry, row, column);
72 entry_rowcxx . . $ Board#entry_row.=row;
73 entry_columncxx . . $ Board#entry_column.=column;
74 entry->setLastcxx . . $ Pipe#setLast(b45ddcbc8423892c).(true);
75 lastcxx . . $ Board#last.=entry;
76 last_rowcxx . . $ Board#last_row.=row;
77 last_columncxx . . $ Board#last_column.=column;
78 }
79
80 void Boardcxx . . $ Board#::setExitcxx . . $ Board#setExit(23a7c5a8e1ac343b).(Exitcxx . . $ Exit# * exit, int row, int column){
81 setPipecxx . . $ Board#setPipe(7a526bb1f07b082a).(exit, row, column);
82 }
83
84 bool Boardcxx . . $ Board#::isRemovablecxx . . $ Board#isRemovable(cf9ef193275fa6d8).(int row, int column){
85 if (boardcxx . . $ Board#board.[row][column])
86 return boardcxx . . $ Board#board.[row][column]->isRemovablecxx . . $ Pipe#isRemovable(c9857a73d68e59ba).();
87 return true;
88 }
89
90 void Boardcxx . . $ Board#::setPipecxx . . $ Board#setPipe(7a526bb1f07b082a).(Pipecxx . . $ Pipe# * pipe, int row, int column){
91 required_changedcxx . . $ Board#required_changed.=true;
92 changescxx . . $ Board#changes.[row][column]=true;
93 Pipecxx . . $ Pipe# * aux=boardcxx . . $ Board#board.[row][column];
94 if (aux==lastcxx . . $ Board#last.) {
95 lastcxx . . $ Board#last.=pipe;
96 pipe->setLastcxx . . $ Pipe#setLast(b45ddcbc8423892c).(true);
97 }
98 if (aux){
99 if (aux->isRemovablecxx . . $ Pipe#isRemovable(c9857a73d68e59ba).()){
100 delete aux;
101 boardcxx . . $ Board#board.[row][column]=pipe;
102 pipe->setPoscxx . . $ Canvas#setPos(3e454b8ccf442868).(column*pipe->widthcxx . . $ Pipe#width(b126dc7c1de90089).()+xcxx . . $ Canvas#x., row*pipe->heightcxx . . $ Pipe#height(b126dc7c1de90089).()+ycxx . . $ Canvas#y.);
103 }
104 }else{
105 boardcxx . . $ Board#board.[row][column]=pipe;
106 pipe->setPoscxx . . $ Canvas#setPos(3e454b8ccf442868).(column*pipe->widthcxx . . $ Pipe#width(b126dc7c1de90089).()+xcxx . . $ Canvas#x., row*pipe->heightcxx . . $ Pipe#height(b126dc7c1de90089).()+ycxx . . $ Canvas#y.);
107 }
108 }
109
110 Pipecxx . . $ Pipe# * Boardcxx . . $ Board#::getPipecxx . . $ Board#getPipe(5a9eccb6f2a95fce).(int row, int column){
111 return boardcxx . . $ Board#board.[row][column];
112 }
113
114 BoardStatecxx . . $ BoardState# Boardcxx . . $ Board#::getStatecxx . . $ Board#getState(20bd5b88a4feef5c).(){
115 return statecxx . . $ Board#state.;
116 }
117
118 unsigned int Boardcxx . . $ Board#::getRequiredcxx . . $ Board#getRequired(db52760e79bf9054).(){
119 return requiredcxx . . $ Board#required.;
120 }
121
122 unsigned int Boardcxx . . $ Board#::getStillRequiredcxx . . $ Board#getStillRequired(db52760e79bf9054).(){
123 if (!required_changedcxx . . $ Board#required_changed.) return still_requiredcxx . . $ Board#still_required.;
124 else return (still_requiredcxx . . $ Board#still_required.=countStillRequiredcxx . . $ Board#countStillRequired(db52760e79bf9054).());
125 }
126
127 unsigned int Boardcxx . . $ Board#::countStillRequiredcxx . . $ Board#countStillRequired(db52760e79bf9054).(){
128 int row=entry_rowcxx . . $ Board#entry_row.;
129 int column=entry_columncxx . . $ Board#entry_column.;
130 bool end=false;
131 unsigned int used=0;
132 required_changedcxx . . $ Board#required_changed.=false;
133
134 Pipecxx . . $ Pipe# * aux_last=boardcxx . . $ Board#board.[entry_rowcxx . . $ Board#entry_row.][entry_columncxx . . $ Board#entry_column.];
135 CardinalPointcxx . . $ CardinalPoint# con=boardcxx . . $ Board#board.[row][column]->getOutputcxx . . $ Pipe#getOutput(fbd438076a101a96).(Voidcxx . . $ Void.);//Entry output
136 changescxx . . $ Board#changes.[last_rowcxx . . $ Board#last_row.][last_columncxx . . $ Board#last_column.]=true;
137 while (!end){
138 used++;
139 end=true;
140 switch (con){
141 case Eastcxx . . $ East.:{
142 column++;
143 if (column<BoardColumnscxx . . $ BoardColumns.)
144 if (boardcxx . . $ Board#board.[row][column] != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
145 if (boardcxx . . $ Board#board.[row][column]->hasConnectioncxx . . $ Pipe#hasConnection(eebf787ddd78fff5).(Westcxx . . $ West.))
146 if (!boardcxx . . $ Board#board.[row][column]->isRestrictedAsOutputcxx . . $ Pipe#isRestrictedAsOutput(eebf787ddd78fff5).(Westcxx . . $ West.)){
147 con=boardcxx . . $ Board#board.[row][column]->getOutputcxx . . $ Pipe#getOutput(fbd438076a101a96).(Westcxx . . $ West.);
148 end=false;
149 }
150 break;
151 }
152 case Southcxx . . $ South.:{
153 row++;
154 if (row<BoardRowscxx . . $ BoardRows.)
155 if (boardcxx . . $ Board#board.[row][column] != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
156 if (boardcxx . . $ Board#board.[row][column]->hasConnectioncxx . . $ Pipe#hasConnection(eebf787ddd78fff5).(Northcxx . . $ North.))
157 if (!boardcxx . . $ Board#board.[row][column]->isRestrictedAsOutputcxx . . $ Pipe#isRestrictedAsOutput(eebf787ddd78fff5).(Northcxx . . $ North.)){
158 con=boardcxx . . $ Board#board.[row][column]->getOutputcxx . . $ Pipe#getOutput(fbd438076a101a96).(Northcxx . . $ North.);
159 end=false;
160 }
161 break;
162 }
163 case Westcxx . . $ West.:{
164 column--;
165 if (column>=0)
166 if (boardcxx . . $ Board#board.[row][column] != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
167 if (boardcxx . . $ Board#board.[row][column]->hasConnectioncxx . . $ Pipe#hasConnection(eebf787ddd78fff5).(Eastcxx . . $ East.))
168 if (!boardcxx . . $ Board#board.[row][column]->isRestrictedAsOutputcxx . . $ Pipe#isRestrictedAsOutput(eebf787ddd78fff5).(Eastcxx . . $ East.)){
169 con=boardcxx . . $ Board#board.[row][column]->getOutputcxx . . $ Pipe#getOutput(fbd438076a101a96).(Eastcxx . . $ East.);
170 end=false;
171 }
172 break;
173 }
174 case Northcxx . . $ North.:{
175 row--;
176 if (row>=0)
177 if (boardcxx . . $ Board#board.[row][column] != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
178 if (boardcxx . . $ Board#board.[row][column]->hasConnectioncxx . . $ Pipe#hasConnection(eebf787ddd78fff5).(Southcxx . . $ South.))
179 if (!boardcxx . . $ Board#board.[row][column]->isRestrictedAsOutputcxx . . $ Pipe#isRestrictedAsOutput(eebf787ddd78fff5).(Southcxx . . $ South.)){
180 con=boardcxx . . $ Board#board.[row][column]->getOutputcxx . . $ Pipe#getOutput(fbd438076a101a96).(Southcxx . . $ South.);
181 end=false;
182 }
183 break;
184 }
185 default:{
186 used--; //La salida no se cuenta como uno usado
187 break;
188 }
189 }
190 if (!end){
191 aux_last=boardcxx . . $ Board#board.[row][column];
192 last_rowcxx . . $ Board#last_row.=row;
193 last_columncxx . . $ Board#last_column.=column;
194 }
195 }//while
196 used--; //La entrada no se cuenta como usado
197 if (lastcxx . . $ Board#last. != aux_last){
198 lastcxx . . $ Board#last.->setLastcxx . . $ Pipe#setLast(b45ddcbc8423892c).(false);
199 lastcxx . . $ Board#last.=aux_last;
200 lastcxx . . $ Board#last.->setLastcxx . . $ Pipe#setLast(b45ddcbc8423892c).(true);
201 }
202
203 if (used>requiredcxx . . $ Board#required.) return 0;
204 return requiredcxx . . $ Board#required.-used;
205 }
206
207 void Boardcxx . . $ Board#::addPointercxx . . $ Board#addPointer(84f18c3abe8912e5).(Pointercxx . . $ Pointer# * p){
208 lpscxx . . $ Board#lps.->insertcxx . . $ List#insert(77801c3fa529a778).(lpscxx . . $ Board#lps.->getFirstcxx . . $ List#getFirst(614bd0134ee89c3a).(), (Pointercxx . . $ Pointer# *)p);
209 }
210
211 void Boardcxx . . $ Board#::removePointercxx . . $ Board#removePointer(84f18c3abe8912e5).(Pointercxx . . $ Pointer# * p){
212 lpscxx . . $ Board#lps.->removecxx . . $ List#remove(da900e49d65ef0fc).(lpscxx . . $ Board#lps.->indexOfcxx . . $ List#indexOf(482d5cb2a3992a34).((Pointercxx . . $ Pointer#*)p));
213 }
214
215 void Boardcxx . . $ Board#::movePointercxx . . $ Board#movePointer(a5cbf92765cb065e).(Pointercxx . . $ Pointer# *p, int row, int column){
216 if (row>=0 && row<BoardRowscxx . . $ BoardRows. && column>=0 && column<BoardColumnscxx . . $ BoardColumns.){
217 if (p->getRowcxx . . $ Pointer#getRow(b126dc7c1de90089).()>=0 && p->getRowcxx . . $ Pointer#getRow(b126dc7c1de90089).()<BoardRowscxx . . $ BoardRows. && p->getColumncxx . . $ Pointer#getColumn(b126dc7c1de90089).()>=0 && p->getColumncxx . . $ Pointer#getColumn(b126dc7c1de90089).()<BoardColumnscxx . . $ BoardColumns.)
218 changescxx . . $ Board#changes.[p->getRowcxx . . $ Pointer#getRow(b126dc7c1de90089).()][p->getColumncxx . . $ Pointer#getColumn(b126dc7c1de90089).()]=true;
219 p->setRowColumncxx . . $ Pointer#setRowColumn(3e454b8ccf442868).(row, column);
220 p->setMovedcxx . . $ Pointer#setMoved(b45ddcbc8423892c).(true);
221 }
222 }
223
224 void Boardcxx . . $ Board#::setPoscxx . . $ Board#setPos(3e454b8ccf442868).(int x, int y){
225 Canvascxx . . $ Canvas#::setPoscxx . . $ Canvas#setPos(3e454b8ccf442868).(x,y);
226 int i,j;
227 for (i=0;i<BoardRowscxx . . $ BoardRows.;i++)
228 for (j=0;j<BoardColumnscxx . . $ BoardColumns.;j++)
229 if (boardcxx . . $ Board#board.[i][j])
230 boardcxx . . $ Board#board.[i][j]->setPoscxx . . $ Canvas#setPos(3e454b8ccf442868).(j*boardcxx . . $ Board#board.[i][j]->widthcxx . . $ Pipe#width(b126dc7c1de90089).()+x, i*boardcxx . . $ Board#board.[i][j]->heightcxx . . $ Pipe#height(b126dc7c1de90089).()+y);
231 paint_allcxx . . $ Board#paint_all.=true;
232 }
233
234 void Boardcxx . . $ Board#::setSpeedcxx . . $ Board#setSpeed(d4f767463ce0a6b3).(int amount){
235 tick_amountcxx . . $ Board#tick_amount.=amount;
236 }
237
238 void Boardcxx . . $ Board#::setMaxSpeedcxx . . $ Board#setMaxSpeed(49f6e7a06ebc5aa8).(){
239 tick_amountcxx . . $ Board#tick_amount.=MAX_SPEEDcxx . . $ `src/board.cpp:23:9`!;
240 }
241
242 void Boardcxx . . $ Board#::setRequiredcxx . . $ Board#setRequired(cb2f890c2fdad230).(unsigned int value){
243 requiredcxx . . $ Board#required.=value;
244 required_changedcxx . . $ Board#required_changed.=true;
245 }
246
247 void Boardcxx . . $ Board#::setBackgroundTypecxx . . $ Board#setBackgroundType(652df5c548af01a).(BackgroundTypecxx . . $ BackgroundType# type){
248 background_typecxx . . $ Board#background_type.=type;
249 }
250
251 void Boardcxx . . $ Board#::tickcxx . . $ Board#tick(49f6e7a06ebc5aa8).(){
252 int aux;
253
254 tankcxx . . $ Board#tank.->tickcxx . . $ Tank#tick(49f6e7a06ebc5aa8).();
255 lastcxx . . $ Board#last.->tickcxx . . $ Pipe#tick(49f6e7a06ebc5aa8).();
256
257 for (int i=0;i<BoardRowscxx . . $ BoardRows.;i++)
258 for (int j=0;j<BoardColumnscxx . . $ BoardColumns.;j++)
259 if (boardcxx . . $ Board#board.[i][j])
260 if (boardcxx . . $ Board#board.[i][j]->getBonuscxx . . $ Pipe#getBonus(e13c81a6292c3f1e).()!=NormalBonuscxx . . $ NormalBonus.){
261 boardcxx . . $ Board#board.[i][j]->tickcxx . . $ Pipe#tick(49f6e7a06ebc5aa8).();
262 changescxx . . $ Board#changes.[i][j]=true;
263 }
264
265 changescxx . . $ Board#changes.[last_rowcxx . . $ Board#last_row.][last_columncxx . . $ Board#last_column.]=true;
266 if (!(tankcxx . . $ Board#tank.->isEmptycxx . . $ Tank#isEmpty(c9857a73d68e59ba).())){//Descuento del tanque
267 tankcxx . . $ Board#tank.->decFullLevelcxx . . $ Tank#decFullLevel(cb2f890c2fdad230).(tick_amountcxx . . $ Board#tick_amount.);
268 changescxx . . $ Board#changes.[flow_rowcxx . . $ Board#flow_row.][flow_columncxx . . $ Board#flow_column.]=true;
269 }
270 else{//Aumento el actual
271 aux=(getPipecxx . . $ Board#getPipe(5a9eccb6f2a95fce).(flow_rowcxx . . $ Board#flow_row., flow_columncxx . . $ Board#flow_column.))->getFullLevelcxx . . $ Pipe#getFullLevel(bad1fd3a9fbe27b6).(actual_inputcxx . . $ Board#actual_input.);
272 if (aux<(getPipecxx . . $ Board#getPipe(5a9eccb6f2a95fce).(flow_rowcxx . . $ Board#flow_row., flow_columncxx . . $ Board#flow_column.))->fullcxx . . $ Pipe#full(b126dc7c1de90089).()){
273 (getPipecxx . . $ Board#getPipe(5a9eccb6f2a95fce).(flow_rowcxx . . $ Board#flow_row., flow_columncxx . . $ Board#flow_column.))->incFullLevelcxx . . $ Pipe#incFullLevel(5c0eb7cda63e3855).(actual_inputcxx . . $ Board#actual_input., tick_amountcxx . . $ Board#tick_amount.);
274 changescxx . . $ Board#changes.[flow_rowcxx . . $ Board#flow_row.][flow_columncxx . . $ Board#flow_column.]=true;
275 }
276 else{//Paso al siguiente
277 Pipecxx . . $ Pipe# * next=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
278 Pipecxx . . $ Pipe# * last=boardcxx . . $ Board#board.[flow_rowcxx . . $ Board#flow_row.][flow_columncxx . . $ Board#flow_column.];
279 actual_inputcxx . . $ Board#actual_input.=Voidcxx . . $ Void.;
280 switch (actual_outputcxx . . $ Board#actual_output.){
281 case Northcxx . . $ North.:{
282 if (flow_rowcxx . . $ Board#flow_row.>0){
283 next=getPipecxx . . $ Board#getPipe(5a9eccb6f2a95fce).(--flow_rowcxx . . $ Board#flow_row., flow_columncxx . . $ Board#flow_column.);
284 actual_inputcxx . . $ Board#actual_input.=Southcxx . . $ South.;
285 }
286 break;
287 }
288 case Southcxx . . $ South.:{
289 if (flow_rowcxx . . $ Board#flow_row.<BoardRowscxx . . $ BoardRows.-1){
290 next=getPipecxx . . $ Board#getPipe(5a9eccb6f2a95fce).(++flow_rowcxx . . $ Board#flow_row., flow_columncxx . . $ Board#flow_column.);
291 actual_inputcxx . . $ Board#actual_input.=Northcxx . . $ North.;
292 }
293 break;
294 }
295 case Eastcxx . . $ East.:{
296 if (flow_columncxx . . $ Board#flow_column.<BoardColumnscxx . . $ BoardColumns.-1){
297 next=getPipecxx . . $ Board#getPipe(5a9eccb6f2a95fce).(flow_rowcxx . . $ Board#flow_row., ++flow_columncxx . . $ Board#flow_column.);
298 actual_inputcxx . . $ Board#actual_input.=Westcxx . . $ West.;
299 }
300 break;
301 }
302 case Westcxx . . $ West.:{
303 if (flow_columncxx . . $ Board#flow_column.>0){
304 next=getPipecxx . . $ Board#getPipe(5a9eccb6f2a95fce).(flow_rowcxx . . $ Board#flow_row., --flow_columncxx . . $ Board#flow_column.);
305 actual_inputcxx . . $ Board#actual_input.=Eastcxx . . $ East.;
306 }
307 break;
308 }
309 default:break;
310 }
311 if (actual_outputcxx . . $ Board#actual_output.==Voidcxx . . $ Void.)
312 if (getStillRequiredcxx . . $ Board#getStillRequired(db52760e79bf9054).()==0)
313 statecxx . . $ Board#state.=OverWoncxx . . $ OverWon.;
314 else
315 statecxx . . $ Board#state.=OverLostcxx . . $ OverLost.;
316 else
317 if (actual_inputcxx . . $ Board#actual_input.==Voidcxx . . $ Void.){
318 statecxx . . $ Board#state.=OverLostcxx . . $ OverLost.;
319 }else{
320 if (next)
321 if (next->hasConnectioncxx . . $ Pipe#hasConnection(eebf787ddd78fff5).(actual_inputcxx . . $ Board#actual_input.) && !(next->isRestrictedAsOutputcxx . . $ Pipe#isRestrictedAsOutput(eebf787ddd78fff5).(actual_inputcxx . . $ Board#actual_input.))){
322 actual_outputcxx . . $ Board#actual_output.=next->getOutputcxx . . $ Pipe#getOutput(fbd438076a101a96).(actual_inputcxx . . $ Board#actual_input.);
323 next->incFullLevelcxx . . $ Pipe#incFullLevel(5c0eb7cda63e3855).(actual_inputcxx . . $ Board#actual_input.,tick_amountcxx . . $ Board#tick_amount.);
324
325 /** Bonus stuff*/
326 if (!next->getOwnercxx . . $ Pipe#getOwner(b9b9f9b98b58beb1).() && last->getOwnercxx . . $ Pipe#getOwner(b9b9f9b98b58beb1).())
327 next->setOwnercxx . . $ Pipe#setOwner(34e2c302b1f0e5dd).(last->getOwnercxx . . $ Pipe#getOwner(b9b9f9b98b58beb1).());
328
329 Playercxx . . $ Player# * owner;
330 if ((owner=next->getOwnercxx . . $ Pipe#getOwner(b9b9f9b98b58beb1).()))
331 switch (next->getBonuscxx . . $ Pipe#getBonus(e13c81a6292c3f1e).()){
332 case LifeBonuscxx . . $ LifeBonus.:{
333 owner->incLivescxx . . $ Player#incLives(49f6e7a06ebc5aa8).();
334 next->setBonuscxx . . $ Pipe#setBonus(e439fde3156f010b).(NormalBonuscxx . . $ NormalBonus.);
335 break;
336 }
337 case TimeBonuscxx . . $ TimeBonus.:{
338 //Debera incrementarse el valor del tiempo en board.
339 break;
340 }
341 default:{
342 owner->incScorecxx . . $ Player#incScore(e439fde3156f010b).(next->getBonuscxx . . $ Pipe#getBonus(e13c81a6292c3f1e).());
343 }
344 }
345 /*End of Bonus stuff*/
346
347 changescxx . . $ Board#changes.[flow_rowcxx . . $ Board#flow_row.][flow_columncxx . . $ Board#flow_column.]=true;
348 }else statecxx . . $ Board#state.=OverLostcxx . . $ OverLost.;
349 else statecxx . . $ Board#state.=OverLostcxx . . $ OverLost.;
350 }
351 }
352 }
353 }
354
355 void Boardcxx . . $ Board#::paintcxx . . $ Board#paint(dec28a01b93bce57).(VideoManagercxx . . $ VideoManager# * vm){
356 int i,j;
357 Indexcxx . . $ Index# * index;
358 Pointercxx . . $ Pointer# * aux;
359 int pc, pr;
360
361 if (!backgroundcxx . . $ Board#background.){
362 Imagecxx . . $ Image# * ima=vm->getImageManagercxx . . $ VideoManager#getImageManager(d5fe12bbc8163445).()->getImagecxx . . $ ImageManager#getImage(3ac71a4852078d03).(new Strcxx . . $ Str#("board_back.jpg"));
363 switch (background_typecxx . . $ Board#background_type.){
364 case WallpaperBackgroundcxx . . $ WallpaperBackground.:{
365 backgroundcxx . . $ Board#background.=new WallPapercxx . . $ WallPaper#(ima);
366 break;
367 }
368 case MosaicBackgroundcxx . . $ MosaicBackground.:{
369 backgroundcxx . . $ Board#background.=new Mosaiccxx . . $ Mosaic#(ima);
370 break;
371 }
372 }
373 backgroundcxx . . $ Board#background.->setPoscxx . . $ Canvas#setPos(3e454b8ccf442868).(xcxx . . $ Canvas#x., ycxx . . $ Canvas#y.);
374 }
375
376 /** Pinta todos los pipes.*/
377 if (paint_allcxx . . $ Board#paint_all.){
378 backgroundcxx . . $ Board#background.->paintcxx . . $ Canvas#paint(dec28a01b93bce57).(vm);
379 for (i=0;i<BoardRowscxx . . $ BoardRows.;i++)
380 for (j=0;j<BoardColumnscxx . . $ BoardColumns.;j++){
381 if (boardcxx . . $ Board#board.[i][j]) boardcxx . . $ Board#board.[i][j]->paintcxx . . $ Canvas#paint(dec28a01b93bce57).(vm);
382 changescxx . . $ Board#changes.[i][j]=false;
383 }
384 }else{/** Pinta solo los que han cambiado*/
385 for (i=0;i<BoardRowscxx . . $ BoardRows.;i++)
386 for (j=0;j<BoardColumnscxx . . $ BoardColumns.;j++){
387 if (changescxx . . $ Board#changes.[i][j]){
388 backgroundcxx . . $ Board#background.->repaintcxx . . $ Background#repaint(d983c20fd9c98de6).(vm, j*PipeWidthcxx . . $ PipeWidth., i*PipeHeightcxx . . $ PipeHeight., PipeWidthcxx . . $ PipeWidth., PipeHeightcxx . . $ PipeHeight.);
389 if (boardcxx . . $ Board#board.[i][j]) boardcxx . . $ Board#board.[i][j]->paintcxx . . $ Canvas#paint(dec28a01b93bce57).(vm);
390 changescxx . . $ Board#changes.[i][j]=false;
391 }
392 }
393 }
394
395
396 /** Pinta y marca los punteros para la proxima entrada.*/
397 index=lpscxx . . $ Board#lps.->getFirstcxx . . $ List#getFirst(614bd0134ee89c3a).();
398 for (i=0;i<lpscxx . . $ Board#lps.->nObjectscxx . . $ List#nObjects(b126dc7c1de90089).();i++){
399 aux=(Pointercxx . . $ Pointer#*)lpscxx . . $ Board#lps.->getObjectcxx . . $ List#getObject(a6ae6972207746c4).(index);
400 pr=aux->getRowcxx . . $ Pointer#getRow(b126dc7c1de90089).();
401 pc=aux->getColumncxx . . $ Pointer#getColumn(b126dc7c1de90089).();
402 if (aux->movedcxx . . $ Pointer#moved(c9857a73d68e59ba).()
403 ||(flow_columncxx . . $ Board#flow_column.==pc && flow_rowcxx . . $ Board#flow_row.==pr)
404 ||(last_columncxx . . $ Board#last_column.==pc && last_rowcxx . . $ Board#last_row.==pr)
405 ||(boardcxx . . $ Board#board.[pr][pc] && boardcxx . . $ Board#board.[pr][pc]->getBonuscxx . . $ Pipe#getBonus(e13c81a6292c3f1e).()!=NormalBonuscxx . . $ NormalBonus.)){
406 aux->setPoscxx . . $ Canvas#setPos(3e454b8ccf442868).(pc*aux->widthcxx . . $ Pointer#width.+xcxx . . $ Canvas#x., pr*aux->heightcxx . . $ Pointer#height.+ycxx . . $ Canvas#y.);
407 aux->paintcxx . . $ Pointer#paint(dec28a01b93bce57).(vm);
408 if (aux->movedcxx . . $ Pointer#moved(c9857a73d68e59ba).()) aux->setMovedcxx . . $ Pointer#setMoved(b45ddcbc8423892c).(false); else aux->setMovedcxx . . $ Pointer#setMoved(b45ddcbc8423892c).(true);
409 }
410 index=lpscxx . . $ Board#lps.->getNextcxx . . $ List#getNext(72af0511b327ff3e).(index);
411 }
412 paint_allcxx . . $ Board#paint_all.=false;
413
414 /** Pinta la mancha si el juego esta perdido.*/
415 if (statecxx . . $ Board#state.==OverLostcxx . . $ OverLost.){
416 Imagecxx . . $ Image# * mancha=vm->getImageManagercxx . . $ VideoManager#getImageManager(d5fe12bbc8163445).()->getImagecxx . . $ ImageManager#getImage(3ac71a4852078d03).(new Strcxx . . $ Str#("splash.png"));
417 int mx=flow_columncxx . . $ Board#flow_column.*PipeWidthcxx . . $ PipeWidth.+xcxx . . $ Canvas#x.;
418 int my=flow_rowcxx . . $ Board#flow_row.*PipeHeightcxx . . $ PipeHeight.+ycxx . . $ Canvas#y.;
419 switch (actual_inputcxx . . $ Board#actual_input.){
420 case Voidcxx . . $ Void.:{ //Esta contra un borde
421 switch (actual_outputcxx . . $ Board#actual_output.){
422 case Northcxx . . $ North.:my-=PipeHeightcxx . . $ PipeHeight./2;break;
423 case Southcxx . . $ South.:my+=PipeHeightcxx . . $ PipeHeight./2;break;
424 case Westcxx . . $ West.:mx-=PipeWidthcxx . . $ PipeWidth./2;break;
425 case Eastcxx . . $ East.:mx+=PipeWidthcxx . . $ PipeWidth./2;break;
426 default:break;
427 }
428 break;
429 }
430 case Northcxx . . $ North.:my-=PipeHeightcxx . . $ PipeHeight./2;break;
431 case Southcxx . . $ South.:my+=PipeHeightcxx . . $ PipeHeight./2;break;
432 case Westcxx . . $ West.:mx-=PipeWidthcxx . . $ PipeWidth./2;break;
433 case Eastcxx . . $ East.:mx+=PipeWidthcxx . . $ PipeWidth./2;break;
434 default:break;
435 }
436 vm->setClippingcxx . . $ Graphic#setClipping(748afa4755bc9595).(xcxx . . $ Canvas#x., ycxx . . $ Canvas#y., widthcxx . . $ Board#width(b126dc7c1de90089).(), heightcxx . . $ Board#height(b126dc7c1de90089).());
437 vm->enableClippingcxx . . $ Graphic#enableClipping(b45ddcbc8423892c).(true);
438 vm->blitcxx . . $ VideoManager#blit(d6e51777aa68e081).(mancha, mx, my);
439 vm->enableClippingcxx . . $ Graphic#enableClipping(b45ddcbc8423892c).(false);
440 }
441 if (tankcxx . . $ Board#tank.->isChangedcxx . . $ Tank#isChanged(c9857a73d68e59ba).()) tankcxx . . $ Board#tank.->paintcxx . . $ Tank#paint(dec28a01b93bce57).(vm);
442 }
443
444 int Boardcxx . . $ Board#::widthcxx . . $ Board#width(b126dc7c1de90089).(){
445 return BoardColumnscxx . . $ BoardColumns.*PipeWidthcxx . . $ PipeWidth.;
446 }
447
448 int Boardcxx . . $ Board#::heightcxx . . $ Board#height(b126dc7c1de90089).(){
449 return BoardRowscxx . . $ BoardRows.*PipeHeightcxx . . $ PipeHeight.;
450 }
451