Codebase list blockattack / 8230bb8
Imported Upstream version 1.3.1 Markus Koschany 8 years ago
283 changed file(s) with 43732 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
Binary diff not shown
0 Block Attack - Rise of the Blocks by
1 Poul Sander <blockattack@poulsander.com>
2 http://blockattack.sf.net
3
4 Gonéri Le Bouder
5 Done some work for making it work with SHAREDIR and all Scons scripts
6
7 Contains SFont - SDL Font Library by
8 Karl Bartel <karlb@gmx.net>
0 /*
1 BlockGame.hpp (this was cut from main.cpp for the overview)
2 Copyright (C) 2005 Poul Sander
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 Poul Sander
19 Rævehøjvej 36, V. 1111
20 2800 Kgs. Lyngby
21 DENMARK
22 poul.sander@tdcadsl.dk
23 */
24
25 ////////////////////////////////////////////////////////////////////////////////
26 //The BloackGame class represents a board, score, time etc. for a single player/
27 ////////////////////////////////////////////////////////////////////////////////
28 class BlockGame
29 {
30 private:
31 int prevTowerHeight;
32 bool bGarbageFallLeft;
33
34 bool bDraw;
35 bool bReplaying; //true if we are watching a replay
36 bool bNetworkPlayer; //must recieve packages from the net
37 bool bDisconnected; //The player has disconnected
38 Uint32 nextGarbageNumber;
39 int pushedPixelAt;
40 int nrPushedPixel, nrFellDown, nrStops;
41 bool garbageToBeCleared[7][30];
42 Uint32 lastAImove;
43
44 Sint16 AI_LineOffset; //how many lines have changed since command
45 string strHolder;
46 unsigned int hangTicks; //How many times have hang been decreased?
47 //int the two following index 0 may NOT be used (what the fuck did I meen?)
48 Uint8 chainSize[NUMBEROFCHAINS]; //Contains the chains
49 bool chainUsed[NUMBEROFCHAINS]; //True if the chain is used
50
51 Uint32 nextRandomNumber;
52
53 Uint16 rand2()
54 {
55 nextRandomNumber = nextRandomNumber*1103515245 + 12345;
56 return ((Uint16)(nextRandomNumber/65536)) % 32768;
57 }
58
59 int firstUnusedChain()
60 {
61 bool found=false;
62 int i = 0;
63 while(!found)
64 {
65 if(!chainUsed[++i])
66 found=true;
67 if(i>NUMBEROFCHAINS-2)
68 found=true;
69 }
70 return i;
71 }
72
73 public:
74 char name[30];
75 int gameStartedAt;
76 int gameEndedAfter; //How long did the game last?
77 int linesCleared;
78 SDL_Surface* sBoard;
79 int TowerHeight;
80 BlockGame *garbageTarget;
81 Sint32 board[7][30];
82 int stop;
83 int speedLevel;
84 int pixels;
85 int MovesLeft;
86 bool timetrial, stageClear, vsMode, puzzleMode;
87 int Level; //Only used in stageClear and puzzle (not implemented)
88 int stageClearLimit; //stores number of lines user must clear to win
89 int topx,topy;
90 int combo;
91 int chain;
92 int cursorx; //stores cursor position
93 int cursory; // -||-
94 double speed, baseSpeed; //factor for speed. Lower value = faster gameplay
95 unsigned long int score;
96 bool bGameOver;
97 bool hasWonTheGame;
98 int AI_MoveSpeed; //How often will the computer move? milliseconds
99 bool AI_Enabled;
100 Replay theReplay; //Stores the replay
101
102 Uint32 handicap;
103
104 //Constructor
105 BlockGame(int tx, int ty)
106 {
107 tmp = IMG_Load2("gfx/BackBoard.png");
108 sBoard = SDL_DisplayFormat(tmp);
109 SDL_FreeSurface(tmp);
110 srand((int)time(NULL));
111 nrFellDown = 0;
112 nrPushedPixel = 0;
113 garbageTarget = this;
114 nrStops=0;
115 topx = tx;
116 topy = ty;
117 cursorx = 2;
118 cursory = 3;
119 stop = 0;
120 pixels = 0;
121 score = 0;
122 bGameOver = false;
123 bDraw = false;
124 bReplaying=false; //No replay by default
125 bDisconnected=false;
126 bNetworkPlayer = false;
127 timetrial = false;
128 stageClear = false;
129 vsMode = false;
130 puzzleMode = false;
131 linesCleared = 0;
132 AI_Enabled = false;
133 AI_MoveSpeed=100;
134 hasWonTheGame = false;
135 combo=0; //counts
136 chain=0;
137 hangTicks = 0;
138 baseSpeed = 0.5; //All other speeds are relative to this
139 speed = baseSpeed;
140 speedLevel = 1;
141 gameStartedAt = SDL_GetTicks();
142 gameEndedAfter = 0;
143 pushedPixelAt = gameStartedAt;
144 nextGarbageNumber = 10;
145 handicap=0;
146 for(int i=0;i<7;i++)
147 for(int j=0;j<30;j++)
148 {
149 board[i][j] = -1;
150 }
151 for(int i=0;i<NUMBEROFCHAINS;i++)
152 {
153 chainUsed[i]=false;
154 chainSize[i] = 0;
155 }
156 theReplay = Replay();
157 showGame = true; //The game is now active
158 } //Constructor
159
160 //Deconstructor, never really used... game used to crash when called, cause of the way sBoard was created
161 //It should work now and can be used if we want to assign more players in network games that we need to free later
162 ~BlockGame()
163 {
164 theReplay.~Replay();
165 SDL_FreeSurface(sBoard);
166 }
167
168 void setGameSpeed(Uint8 globalSpeedLevel)
169 {
170 switch(globalSpeedLevel)
171 {
172 case 0:
173 baseSpeed=0.5;
174 break;
175 case 1:
176 baseSpeed=0.4;
177 break;
178 case 2:
179 baseSpeed=0.3;
180 break;
181 case 3:
182 baseSpeed=0.25;
183 break;
184 case 4:
185 baseSpeed=0.2;
186 break;
187 default:
188 baseSpeed=0.15;
189 break;
190 };
191 }
192
193 void setHandicap(Uint8 globalHandicap)
194 {
195 handicap=1000*((Uint32)globalHandicap);
196 }
197
198 //Set the move speed of the AI based on the aiLevel parameter
199 void setAIlevel(Uint8 aiLevel)
200 {
201 AI_MoveSpeed=120-(20*(aiLevel-3));
202 };
203
204 #ifdef NETWORK
205 #define garbageStackSize 10
206 Uint8 garbageStack[garbageStackSize][3]; //A garbage stack with space for 10 garbage blocks. 0=x,1=y,2=type
207 int garbageStackUsed;
208
209 void emptyGarbageStack()
210 {
211 for(int i=0;i<10;i++)
212 for(int j=0;j<3;j++)
213 garbageStack[i][j] = 0;
214 garbageStackUsed = 0;
215 }
216
217 bool pushGarbage(Uint8 width,Uint8 height,Uint8 type)
218 {
219 if(garbageStackUsed>=garbageStackSize)
220 return false;
221 garbageStack[garbageStackUsed][0]=width;
222 garbageStack[garbageStackUsed][1]=height;
223 garbageStack[garbageStackUsed][2]=type;
224 garbageStackUsed++;
225 return true;
226 }
227
228 bool popGarbage(Uint8 *width,Uint8 *height,Uint8 *type)
229 {
230 if(garbageStackUsed<1)
231 return false;
232 garbageStackUsed--;
233 *width=garbageStack[garbageStackUsed][0];
234 *height=garbageStack[garbageStackUsed][1];
235 *type=garbageStack[garbageStackUsed][2];
236 return true;
237 }
238
239 #endif
240
241 //Loads BackBoard again if surface format has changed
242 void convertSurface()
243 {
244 SDL_FreeSurface(sBoard);
245 cout << "2.1" << endl;
246 sBoard = SDL_DisplayFormat(backBoard);
247 cout << "2.2" << endl;
248 }
249
250 //Instead of creating new object new game is called, to prevent memory leaks
251 void NewGame(int tx, int ty)
252 {
253 bReplaying = false;
254 bNetworkPlayer=false;
255 bDisconnected =false;
256 nrFellDown = 0;
257 lastNrOfPlayers = 1; //At least one player :-)
258 nrPushedPixel = 0;
259 nrStops = 0;
260 topx = tx;
261 topy = ty;
262 cursorx = 2;
263 cursory = 3;
264 stop = 0;
265 pixels = 0;
266 score = 0;
267 bGameOver = false;
268 bDraw = false;
269 timetrial = false;
270 stageClear = false;
271 linesCleared = 0;
272 hasWonTheGame = false;
273 vsMode = false;
274 puzzleMode = false;
275 combo=0;
276 chain=0;
277 AI_Enabled = false;
278 baseSpeed= 0.5;
279 speed = baseSpeed;
280 speedLevel = 1;
281 gameStartedAt = SDL_GetTicks()+3000;
282 pushedPixelAt = gameStartedAt;
283 nextGarbageNumber = 10;
284 handicap=0;
285 for(int i=0;i<7;i++)
286 for(int j=0;j<30;j++)
287 {
288 board[i][j] = -1;
289 }
290 for(int i=0;i<NUMBEROFCHAINS;i++)
291 {
292 chainUsed[i]=false;
293 chainSize[i] = 0;
294 }
295 lastAImove = SDL_GetTicks()+3000;
296 showGame = true;
297 theReplay.~Replay();
298 theReplay = Replay();
299 } //NewGame
300
301 //Starts a new stage game, takes level as input!
302 void NewStageGame(int level, int tx, int ty)
303 {
304 if(level > -1)
305 {
306 NewGame(tx,ty);
307 stageClear = true;
308 Level = level;
309 stageClearLimit = 30+(Level%6)*10;
310 baseSpeed = 0.5/((double)(Level*0.5)+1.0);
311 speed = baseSpeed;
312 }
313 }
314
315 void NewPuzzleGame(int level, int tx, int ty)
316 {
317 if(level>-1)
318 {
319 NewGame(tx,ty);
320 puzzleMode = true;
321 Level = level;
322 MovesLeft = nrOfMovesAllowed[Level];
323 for(int i=0;i<6;i++)
324 for(int j=0;j<12;j++)
325 {
326 board[i][j+1] = puzzleLevels[Level][i][j];
327 }
328 baseSpeed = 100000;
329 speed = 100000;
330
331 //Now push the blines up
332 for(int i=19;i>0;i--)
333 for(int j=0;j<6;j++)
334 {
335 board[j][i] = board[j][i-1];
336 }
337 for(int j=0;j<6;j++)
338 {
339 board[j][0] = rand() % 6;
340 if(j > 0)
341 {
342 if(board[j][0] == board[j-1][0])
343 board[j][0] = rand() % 6;
344 }
345 if(board[j][0] == board[j][1])
346 board[j][0] = 6;
347 if(board[j][0] == board[j][1])
348 board[j][0] = 6;
349
350 }
351 }
352 }
353
354 //Starts new Vs Game (two Player)
355 void NewVsGame(int tx, int ty,BlockGame *target)
356 {
357 NewGame(tx,ty);
358 vsMode = true;
359 putStartBlocks();
360 garbageTarget = target;
361 }
362
363 //Starts new Vs Game (two Player)
364 void NewVsGame(int tx, int ty,BlockGame *target,bool AI)
365 {
366 NewGame(tx,ty);
367 vsMode = true;
368 AI_Enabled = AI;
369 putStartBlocks();
370 garbageTarget = target;
371 }
372
373 //Go in Demonstration mode, no movement
374 void Demonstration(bool toggle)
375 {
376 speed=0;
377 baseSpeed = 0;
378 }
379
380 //We want to play the replay (must have been loaded beforehand)
381 void playReplay(int tx, int ty)
382 {
383 Replay temp = theReplay;
384 NewGame(tx,ty);
385 gameStartedAt = SDL_GetTicks();
386 theReplay.~Replay();
387 theReplay=temp;
388 temp.~Replay();
389 bReplaying = true; //We are playing, no calculations
390 bNetworkPlayer = false; //Take input from replay file
391 }
392
393 #ifdef NETWORK
394 //network play
395 void playNetwork(int tx, int ty)
396 {
397 NewGame(tx,ty);
398 gameStartedAt = SDL_GetTicks();
399 bReplaying = false; //We are playing, no calculations
400 bNetworkPlayer = true; //Don't Take input from replay file
401 emptyGarbageStack();
402 }
403 #endif
404
405 //Prints "winner" and ends game
406 void setPlayerWon()
407 {
408 if(!bGameOver)
409 gameEndedAfter = SDL_GetTicks()-gameStartedAt; //We game ends now!
410 theReplay.setFinalFrame(getPackage(),1);
411 bGameOver = true;
412 hasWonTheGame = true;
413 showGame = false;
414 if(SoundEnabled)Mix_PlayChannel(1,applause,0);
415 }
416
417 //void SetGameOver();
418
419 //Sets disconnected:
420 void setDisconnect()
421 {
422 bDisconnected = true;
423 SetGameOver();
424 }
425
426 //Prints "draw" and ends the game
427 void setDraw()
428 {
429 bGameOver = true;
430 theReplay.setFinalFrame(getPackage(),3);
431 hasWonTheGame = false;
432 bDraw = true;
433 showGame = false;
434 Mix_HaltChannel(1);
435 }
436
437 //Function to get a boardpackage
438 boardPackage getPackage()
439 {
440 boardPackage bp;
441 bp.time = (Uint32)(SDL_GetTicks()-gameStartedAt);
442 for(int i=0;i<6;i++)
443 for(int j=0;j<13;j++)
444 {
445 if(board[i][j]%10<7)
446 bp.brick[i][j]=board[i][j]%10+1;
447 if((board[i][j]/1000000)%10>0)
448 {
449 int aInt=0; //N=1, S=2, W=4, E=8
450 if(i==0)
451 aInt+=4;
452 else
453 if((board[i-1][j])!=(board[i][j]))
454 aInt+=4;
455 if(i==5)
456 aInt+=8;
457 else
458 if((board[i+1][j])!=(board[i][j]))
459 aInt+=8;
460 if(j==0)
461 aInt+=2;
462 else
463 if((board[i][j-1])!=(board[i][j]))
464 aInt+=2;
465 if((board[i][j+1])!=(board[i][j]))
466 aInt+=1;
467 switch(aInt)
468 {
469 case 8:
470 bp.brick[i][j]=8;
471 break;
472 case 7:
473 bp.brick[i][j]=10;
474 break;
475 case 11:
476 bp.brick[i][j]=11;
477 break;
478 case 9:
479 bp.brick[i][j]=12;
480 break;
481 case 5:
482 bp.brick[i][j]=13;
483 break;
484 case 6:
485 bp.brick[i][j]=14;
486 break;
487 case 10:
488 bp.brick[i][j]=15;
489 break;
490 case 3: //M
491 bp.brick[i][j]=16;
492 break;
493 case 0:
494 bp.brick[i][j]=17;
495 break;
496 case 1:
497 bp.brick[i][j]=18;
498 break;
499 case 2:
500 bp.brick[i][j]=19;
501 break;
502 case 4:
503 bp.brick[i][j]=20;
504 break;
505 default:
506 bp.brick[i][j]=0;
507 };
508 //cout << "garbage added to replay: " << aInt << endl;
509 }
510 if((board[i][j]/BLOCKHANG)%10==1) //If "get ready"
511 bp.brick[i][j]+=30;
512 }
513 bp.cursorX = (Uint8)cursorx;
514 bp.cursorY = (Uint8)cursory;
515 bp.score = (Uint32)score;
516 bp.pixels = (Uint8)pixels;
517 bp.chain = (Uint8)chain;
518 bp.speed = (Uint8)speedLevel;
519 Uint8 result = 0;
520 if(bGameOver)
521 result+=1;
522 if(hasWonTheGame)
523 result+=2;
524 if(bDraw)
525 result+=4;
526 bp.result = (Uint8)result;
527 return bp;
528 }
529
530 //Takes a package and sets the board like it
531 void setBoard(boardPackage bp)
532 {
533 //gameStartedAt = SDL_GetTicks()-bp.time;
534 for(int i=0;i<6;i++)
535 for(int j=0;j<13;j++)
536 {
537 //if(bp.brick[i][j]/8==0)
538 board[i][j]=bp.brick[i][j]-1;
539 //else
540 // board[i][j]=-1;
541 }
542 cursorx=bp.cursorX;
543 cursory=bp.cursorY;
544 score=bp.score;
545 pixels=bp.pixels;
546 chain=bp.chain;
547 speedLevel=bp.speed;
548 Uint8 result = bp.result;
549 if(result%2==1)
550 {
551 bGameOver=true;
552 result-=1;
553 }
554 if(result%4==2)
555 {
556 hasWonTheGame = true;
557 result-=2;
558 }
559 if(result==4)
560 {
561 bDraw = true;
562 }
563
564 }
565
566 //Test if LineNr is an empty line, returns false otherwise.
567 bool LineEmpty(int lineNr)
568 {
569 bool empty = true;
570 for(int i = 0; i <7; i++)
571 if(board[i][lineNr] != -1)
572 empty = false;
573 return empty;
574 }
575
576 //Test if the entire board is empty (used for Puzzles)
577 bool BoardEmpty()
578 {
579 bool empty = true;
580 for(int i=0;i<6;i++)
581 for(int j=1;j<13;j++)
582 if(board[i][j] != -1)
583 empty = false;
584 return empty;
585 }
586
587 //Anything that the user can't move? In that case Game Over cannot occur
588 bool hasStaticContent()
589 {
590 for(int i=0;i<6;i++)
591 for(int j=1;j<13;j++)
592 if(board[i][j] >= 10000000) //Higher than this means combos (garbage is static, but the stack is static but nothing to do about it)
593 return true; //They are static
594 return false; //Return false if no static object found
595 }
596
597 /*
598 Generates some blocks so the user don't see a board without blocks
599 */
600 //void putStartBlocks(Uint32);
601
602 void putStartBlocks()
603 {
604 putStartBlocks(time(0));
605 }
606
607 void putStartBlocks(Uint32 n)
608 {
609 for(int i=0;i<7;i++)
610 for(int j=0;j<30;j++)
611 {
612 board[i][j] = -1;
613 }
614 nextRandomNumber = n;
615 int choice = rand2()%3; //Pick a random layout
616 switch(choice)
617 {
618 case 0:
619 //row 0:
620 board[0][0]=1;
621 board[1][0]=0;
622 board[2][0]=4;
623 board[3][0]=3;
624 board[4][0]=3;
625 board[5][0]=5;
626 //row 1:
627 board[0][1]=1;
628 board[1][1]=4;
629 board[2][1]=2;
630 board[3][1]=0;
631 board[4][1]=4;
632 board[5][1]=5;
633 //row 2:
634 board[0][2]=2;
635 board[1][2]=3;
636 board[2][2]=0;
637 board[3][2]=4;
638 board[4][2]=1;
639 board[5][2]=1;
640 //row 3:
641 board[0][3]=3;
642 board[1][3]=2;
643 board[2][3]=3;
644 board[3][3]=1;
645 board[4][3]=0;
646 board[5][3]=4;
647 //row 4:
648 board[0][4]=2;
649 board[1][4]=3;
650 board[2][4]=3;
651 board[3][4]=1;
652 board[4][4]=4;
653 board[5][4]=0;
654 //row 5:
655 board[0][5]=-1;
656 board[1][5]=5;
657 board[2][5]=5;
658 board[3][5]=-1;
659 board[4][5]=1;
660 board[5][5]=-1;
661 break;
662 case 1:
663 //row 0:
664 board[0][0]=3;
665 board[1][0]=5;
666 board[2][0]=0;
667 board[3][0]=0;
668 board[4][0]=4;
669 board[5][0]=2;
670 //row 1:
671 board[0][1]=3;
672 board[1][1]=5;
673 board[2][1]=-1;
674 board[3][1]=5;
675 board[4][1]=4;
676 board[5][1]=2;
677 //row 2:
678 board[0][2]=2;
679 board[1][2]=-1;
680 board[2][2]=-1;
681 board[3][2]=4;
682 board[4][2]=0;
683 board[5][2]=3;
684 //row 3:
685 board[0][3]=2;
686 board[5][3]=3;
687 break;
688 default:
689 //row 0:
690 board[0][0]=4;
691 board[1][0]=5;
692 board[2][0]=2;
693 board[3][0]=0;
694 board[4][0]=1;
695 board[5][0]=5;
696 //row 1:
697 board[0][1]=4;
698 board[1][1]=5;
699 board[2][1]=2;
700 board[3][1]=1;
701 board[4][1]=0;
702 board[5][1]=2;
703 //row 2:
704 board[0][2]=2;
705 board[1][2]=4;
706 board[2][2]=-1;
707 board[3][2]=0;
708 board[4][2]=1;
709 board[5][2]=5;
710 //row 3:
711 board[0][3]=4;
712 board[1][3]=2;
713 board[2][3]=-1;
714 board[3][3]=1;
715 board[4][3]=0;
716 board[5][3]=2;
717 //row 4:
718 board[0][4]=4;
719 board[1][4]=2;
720 board[2][4]=-1;
721 board[3][4]=0;
722 board[4][4]=1;
723 board[5][4]=-1;
724 break;
725 };
726 }
727
728 //decreases hang for all hanging blocks and wait for waiting blocks
729 void ReduceStuff()
730 {
731 unsigned int howMuchHang = (SDL_GetTicks() - FRAMELENGTH*hangTicks)/FRAMELENGTH;
732 if (howMuchHang>0)
733 {
734 for(int i=0; i<7; i++)
735 for(int j=0; j<30; j++)
736 {
737 if((board[i][j]/BLOCKHANG)%10==1)
738 {
739 int hangNumber = (board[i][j]/10)%100;
740 if(hangNumber<=howMuchHang)
741 {
742 board[i][j]-=BLOCKHANG;
743 board[i][j]-=hangNumber*10;
744 }
745 else
746 {
747 board[i][j]-=10*howMuchHang;
748 }
749 }
750 if((board[i][j]/BLOCKWAIT)%10==1)
751 {
752 int hangNumber = (board[i][j]/10)%100;
753 if(hangNumber<=howMuchHang)
754 {
755 //The blocks must be cleared
756 board[i][j]-=hangNumber*10;
757 }
758 else
759 {
760 board[i][j]-=10*howMuchHang;
761 }
762 }
763 }
764 }
765 hangTicks+=howMuchHang;
766 }
767
768 //Creates garbage using a given wide and height
769 bool CreateGarbage(int wide, int height)
770 {
771 #ifdef NETWORK
772 if(bNetworkPlayer)
773 {
774 pushGarbage(wide,height,0);
775 }
776 else
777 #endif
778 {
779 if(wide>6) wide = 6;
780 if(height>12) height = 12;
781 int startPosition = 12;
782 while((!(LineEmpty(startPosition))) || (startPosition == 29))
783 startPosition++;
784 if(startPosition == 29) return false; //failed to place blocks
785 if(29-startPosition<height) return false; //not enough space
786 int start, end;
787 if(bGarbageFallLeft)
788 {start=0; end=start+wide;}
789 else
790 {start=6-wide; end = 6;}
791 for(int i = startPosition; i <startPosition+height; i++)
792 for(int j = start; j < end; j++)
793 {
794 board[j][i] = 1000000+nextGarbageNumber;
795 }
796 nextGarbageNumber++;
797 if(nextGarbageNumber>999999) nextGarbageNumber = 10;
798 bGarbageFallLeft = !(bGarbageFallLeft);
799 return true;
800 }
801 }
802
803 //Creates garbage using a given wide and height
804 bool CreateGreyGarbage()
805 {
806 #ifdef NETWORK
807 if(bNetworkPlayer)
808 {
809 pushGarbage(6,1,1);
810 }
811 else
812 #endif
813 {
814 int startPosition = 12;
815 while((!(LineEmpty(startPosition))) || (startPosition == 29))
816 startPosition++;
817 if(startPosition == 29) return false; //failed to place blocks
818 if(29-startPosition<1) return false; //not enough space
819 int start, end;
820 {start=0; end=6;}
821 for(int i = startPosition; i <startPosition+1; i++)
822 for(int j = start; j < end; j++)
823 {
824 board[j][i] = 2*1000000+nextGarbageNumber;
825 }
826 nextGarbageNumber++;
827 if(nextGarbageNumber>999999) nextGarbageNumber = 10;
828 return true;
829 }
830 }
831
832
833 //Clears garbage, must take one the lower left corner!
834 int GarbageClearer(int x,int y, int number, bool aLineToClear,int chain)
835 {
836 if((board[x][y])%1000000 != number) return -1;
837 if(aLineToClear)
838 {
839 board[x][y] = rand() % 6;
840 board[x][y] += 10*HANGTIME+BLOCKHANG+CHAINPLACE*chain;
841 }
842 garbageToBeCleared[x][y] = false;
843 GarbageClearer(x+1,y,number,aLineToClear,chain);
844 GarbageClearer(x,y+1,number,false,chain);
845 return 1;
846 }
847
848 //Marks garbage that must be cleared
849 int GarbageMarker(int x, int y)
850 {
851 if((x>6)||(x<0)||(y<0)||(y>29)) return -1;
852 if(((board[x][y])/1000000 == 1)&&(garbageToBeCleared[x][y] == false))
853 {
854 garbageToBeCleared[x][y] = true;
855 //Float fill
856 GarbageMarker(x-1,y);
857 GarbageMarker(x+1,y);
858 GarbageMarker(x,y-1);
859 GarbageMarker(x,y+1);
860 }
861 return 1;
862 }
863
864 int FirstGarbageMarker(int x,int y)
865 {
866 if((x>6)||(x<0)||(y<0)||(y>29)) return -1;
867 if(((board[x][y])/1000000 == 2)&&(garbageToBeCleared[x][y] == false))
868 {
869 for(int i=0;i<6;i++)
870 garbageToBeCleared[i][y] = true;
871 }
872 else
873 if(((board[x][y])/1000000 == 1)&&(garbageToBeCleared[x][y] == false))
874 {
875 garbageToBeCleared[x][y] = true;
876 //Float fill
877 GarbageMarker(x-1,y);
878 GarbageMarker(x+1,y);
879 GarbageMarker(x,y-1);
880 GarbageMarker(x,y+1);
881 }
882 return 1;
883 }
884
885 //Clear Blocks if 3 or more is alligned (naive implemented)
886 void ClearBlocks()
887 {
888
889 bool toBeCleared[7][30]; //true if blok must be removed
890
891 int previus=-1; //the last block checked
892 int combo=0;
893 for(int i=0;i<30;i++)
894 for(int j=0;j<7;j++)
895 {
896 toBeCleared[j][i] = false;
897 garbageToBeCleared[j][i] = false;
898 }
899 for(int i=0;i<7;i++)
900 {
901 bool faaling = false;
902 for(int j=0;j<30;j++)
903 {
904 if((faaling)&&(board[i][j]>-1)&&(board[i][j]%10000000<7))
905 {
906 board[i][j]+=BLOCKFALL;
907 }
908 if((!faaling)&&((board[i][j]/BLOCKFALL)%10==1))
909 board[i][j]-=BLOCKFALL;
910 if(!((board[i][j]>-1)&&(board[i][j]%10000000<7)))
911 faaling=true;
912 if(((board[i][j]/1000000)%10==1)||((board[i][j]/1000000)%10==2)||((board[i][j]/BLOCKHANG)%10==1)||((board[i][j]/BLOCKWAIT)%10==1))
913 faaling = false;
914 }
915 }
916
917
918 for(int j=0;j<7;j++)
919 {
920 previus = -1;
921 combo=0;
922
923 for(int i=1;i<30;i++)
924 {
925 if((board[j][i]>-1)&&(board[j][i]%10000000<7))
926 {
927 if (board[j][i]%10000000 == previus)
928 {
929 combo++;
930 }
931 else
932 {
933 if(combo>2)
934 for(int k = i-combo; k<i;k++)
935 {
936 toBeCleared[j][k] = true;
937 }
938 combo=1;
939 previus = board[j][i]%10000000;
940 }
941 } //if board
942 else
943 {
944 if(combo>2)
945 for(int k = i-combo; k<i;k++)
946 {
947 toBeCleared[j][k] = true;
948 }
949 combo = 0;
950 previus = -1;
951 }
952
953 } //for i
954 } //for j
955
956
957 combo = 0;
958 chain = 0;
959 for(int i=0; i<6;i++)
960 for(int j=0; j<30;j++)
961 {
962 //Clears blocks marked for clearing
963 Sint32 temp=board[i][j];
964 if(1==((temp/BLOCKWAIT)%10))
965 if(((temp/10)%100)==0)
966 {
967 if(chainSize[chain]<chainSize[board[i][j]/10000000])
968 chain = board[i][j]/10000000;
969
970 theBallManeger.addBall(topx+40+i*50,topy+600-j*50,true,board[i][j]%10);
971 theBallManeger.addBall(topx+i*50,topy+600-j*50,false,board[i][j]%10);
972 theExplosionManeger.addExplosion(topx-10+i*50,topy+570-j*50);
973 board[i][j]=-2;
974 }
975 }
976 for(int i=0; i<7;i++)
977 {
978 bool setChain=false;
979 for(int j=0; j<30;j++)
980 {
981 if(board[i][j]==-1)
982 setChain=false;
983 if(board[i][j]==-2)
984 {
985 board[i][j]=-1;
986 setChain=true;
987 if(SoundEnabled)Mix_PlayChannel(0,boing,0);
988 }
989 if(board[i][j]!=-1)
990 if((setChain)&&((board[i][j]/GARBAGE)%10!=1)&&((board[i][j]/GARBAGE)%10!=2))
991 {
992 board[i][j]=((board[i][j]%CHAINPLACE)+CHAINPLACE*chain);
993 //somethingsGottaFall = true;
994 }
995
996 }
997 }
998 combo=0;
999 int startvalue;
1000 if(pixels == 0)
1001 startvalue=1;
1002 else
1003 startvalue=0;
1004 for(int i=startvalue;i<30;i++)
1005 {
1006 previus=-1;
1007 combo=0;
1008 for(int j=0;j<7;j++)
1009 {
1010 if(((board[j][i]>-1)&&(board[j][i]%10000000<7)))
1011 {
1012 if (board[j][i]%10000000 == previus)
1013 {
1014 combo++;
1015 }
1016 else
1017 {
1018 if(combo>2)
1019 for(int k = j-combo; k<j;k++)
1020 {
1021 toBeCleared[k][i] = true;
1022 }
1023 combo=1;
1024 previus = board[j][i]%10000000;
1025 }
1026 } //if board
1027 else
1028 {
1029 if(combo>2)
1030 for(int k = j-combo; k<j;k++)
1031 {
1032 toBeCleared[k][i] = true;
1033 }
1034 combo = 0;
1035 previus = -1;
1036 }
1037
1038 } //for j
1039 } //for i
1040 bool blockIsFalling[6][30]; //See that is falling
1041 for(int i=0;i<30;i++)
1042 for(int j=0;j<6;j++)
1043 blockIsFalling[j][i] = false;
1044
1045
1046
1047 combo = 0;
1048 chain = 0;
1049 int grey = 0;
1050 for(int i=0;i<30;i++)
1051 for(int j=0;j<6;j++)
1052 if (toBeCleared[j][i])
1053 {
1054 //see if any garbage is around:
1055 FirstGarbageMarker(j-1,i);
1056 FirstGarbageMarker(j+1,i);
1057 FirstGarbageMarker(j,i-1);
1058 FirstGarbageMarker(j,i+1);
1059 //that is checked now :-)
1060 if(board[j][i]%10000000==6)
1061 grey++;
1062 if((vsMode) && (grey>2) && (board[j][i]%10000000==6))
1063 garbageTarget->CreateGreyGarbage();
1064 if((board[j][i]>-1)&&(board[j][i]%10000000<7))
1065 board[j][i]+=BLOCKWAIT+10*FALLTIME;
1066
1067 if(chainSize[board[j][i]/10000000]>chainSize[chain])
1068 chain=board[j][i]/10000000;
1069 combo++;
1070 stop+=140*combo;
1071 score +=10;
1072 if(combo>3)
1073 score+=3*combo; //More points if more cleared simontanously
1074 }
1075 score+=chainSize[chain]*100;
1076 if(chain==0)
1077 {
1078 chain=firstUnusedChain();
1079 chainSize[chain]=0;
1080 chainUsed[chain]=true;
1081 }
1082 chainSize[chain]++;
1083 for(int i=0;i<30;i++)
1084 for(int j=0;j<6;j++)
1085 {
1086 //if(board[j][i]/10==(BLOCKWAIT+10*FALLTIME)/10)
1087 if(toBeCleared[j][i])
1088 {
1089 board[j][i]=(board[j][i]%10000000)+chain*10000000;
1090 }
1091 }
1092
1093 { //This is here we add text to screen!
1094 bool dead = false;
1095 for(int i=29;i>=0;i--)
1096 for(int j=0;j<6;j++)
1097 if (toBeCleared[j][i])
1098 {
1099 if(!dead)
1100 {
1101 dead=true;
1102 string tempS = itoa(chainSize[chain]);
1103 if(chainSize[chain]>1)
1104 theTextManeger.addText(topx-10+j*50,topy+600-i*50,tempS,1000);
1105 }
1106 }
1107 } //This was there text was added
1108
1109 if(vsMode)
1110 switch(combo)
1111 {
1112 case 0: case 1: case 2: case 3: break;
1113 case 4: garbageTarget->CreateGarbage(3,1); break;
1114 case 5: garbageTarget->CreateGarbage(4,1); break;
1115 case 6: garbageTarget->CreateGarbage(5,1); break;
1116 case 7: garbageTarget->CreateGarbage(6,1); break;
1117 case 8: garbageTarget->CreateGarbage(4,1); garbageTarget->CreateGarbage(4,1); break;
1118 case 9: garbageTarget->CreateGarbage(5,1); garbageTarget->CreateGarbage(4,1); break;
1119 case 10: garbageTarget->CreateGarbage(5,1); garbageTarget->CreateGarbage(5,1); break;
1120 case 11: garbageTarget->CreateGarbage(6,1); garbageTarget->CreateGarbage(5,1); break;
1121 case 12: garbageTarget->CreateGarbage(6,1); garbageTarget->CreateGarbage(6,1); break;
1122 case 13: garbageTarget->CreateGarbage(5,1); garbageTarget->CreateGarbage(5,1); garbageTarget->CreateGarbage(4,1); break;
1123 default: garbageTarget->CreateGarbage(5,1); garbageTarget->CreateGarbage(5,1); garbageTarget->CreateGarbage(4,1); break;
1124 }
1125 for(int i=0;i<30;i++)
1126 for(int j=0;j<6;j++)
1127 if (garbageToBeCleared[j][i])
1128 {
1129 GarbageClearer(j,i,board[j][i]%1000000,true,chain); //Clears the blocks and all blocks connected to it.
1130 }
1131
1132 chain=0;
1133
1134 //Break chains (if a block is stable it is resetted to (chain == 0)):
1135 for(int i=0;i<7;i++)
1136 {
1137 bool faaling = false; //In the beginning we are NOT falling
1138 for(int j=0;j<30;j++)
1139 {
1140 if((faaling)&&(board[i][j]>-1)&&(board[i][j]<7))
1141 {
1142 board[i][j]+=BLOCKFALL;
1143 }
1144 if((!faaling)&&((board[i][j]/BLOCKFALL)%10==1))
1145 board[i][j]-=BLOCKFALL;
1146 if((!faaling)&&(board[i][j]>0)&&(board[i][j]/10000000!=0)&&((board[i][j]/BLOCKWAIT)%10!=1)&&((board[i][j]/BLOCKHANG)%10!=1))
1147 {
1148 if(chainSize[board[i][j]/10000000]>chainSize[chain])
1149 chain=board[i][j]/10000000;
1150 board[i][j]=board[i][j]%10000000;
1151 }
1152 if(!((board[i][j]>-1)&&(board[i][j]<7)))
1153 faaling=true;
1154 if(((board[i][j]/1000000)%10==1)||((board[i][j]/BLOCKHANG)%10==1)||((board[i][j]/BLOCKWAIT)%10==1))
1155 faaling = false;
1156 }
1157 }
1158
1159 //Create garbage as a result
1160 //if((vsMode)&&(chainSize[chain]>1)) garbageTarget->CreateGarbage(6,chainSize[chain]-1);
1161
1162 //Calculate chain
1163 chain=0;
1164 for(int i=0; i<6;i++)
1165 for(int j=0; j<30;j++)
1166 {
1167 if(chainSize[board[i][j]/10000000]>chain)
1168 chain=chainSize[board[i][j]/10000000];
1169 }
1170
1171 //Make space in table for more things
1172 if(chain==0)
1173 for(int i=0;i<NUMBEROFCHAINS;i++)
1174 if(chainUsed[i]==true)
1175 {
1176 if((vsMode)&&(chainSize[i]>1)) garbageTarget->CreateGarbage(6,chainSize[i]-1);
1177 if((SoundEnabled)&&(chainSize[i]>4))Mix_PlayChannel(1,applause,0);
1178 chainUsed[i]=false;
1179 }
1180 } //ClearBlocks
1181
1182 //prints "Game Over" and ends game
1183 void SetGameOver()
1184 {
1185 if(!bGameOver)
1186 gameEndedAfter = SDL_GetTicks()-gameStartedAt; //We game ends now!
1187 theReplay.setFinalFrame(getPackage(),0);
1188 bGameOver = true;
1189 showGame = false;
1190 }
1191
1192 //Moves all peaces a spot down if possible
1193 int FallBlock(int x, int y, int number)
1194 {
1195 if(y == 0) return -1;
1196 if(x>0)
1197 if(board[x-1][y] == number)
1198 return -1;
1199 int i=x;
1200 bool canFall = true;
1201 //checks a line of a garbage block and see if something is under it
1202 while((board[i][y] == number)&&(canFall)&&(i<6))
1203 {
1204 if(board[i][y-1] != -1) canFall = false;
1205 i++;
1206 }
1207 if(canFall)
1208 {
1209 //cout << "Now falling" << endl;
1210 for(int j = x;j<i;j++)
1211 {
1212 board[j][y-1] = board[j][y];
1213 board[j][y] = -1;
1214 }
1215 }
1216 return 0;
1217 } //FallBlock
1218
1219
1220 //Makes all Garbage fall one spot
1221 void GarbageFall()
1222 {
1223 for(int i=0;i<30;i++)
1224 for(int j=0;j<7; j++)
1225 {
1226 if((((board[j][i]/1000000)%10) == 1)||(((board[j][i]/1000000)%10) == 2))
1227 FallBlock(j,i,board[j][i]);
1228 }
1229 }
1230
1231 //Makes the blocks fall (it doesn't test time, this must be done before hand)
1232 void FallDown()
1233 {
1234 bool falling =false; //nothing is moving unless proven otherwise
1235 for(int i=0;i<29;i++)
1236 for(int j=0;j<6;j++)
1237 {
1238 if((board[j][i]==-1) && (board[j][i+1]!=-1) && (board[j][i+1]%BLOCKFALL<7))
1239 {
1240 board[j][i] = board[j][i+1];
1241 board[j][i+1] = -1;
1242 falling = true; //something is moving!
1243 }
1244 if((board[j][i]/BLOCKWAIT)%10==1)
1245 falling=true;
1246 }
1247 if(!falling) //If nothing is falling
1248 {
1249 if((puzzleMode)&&(!bGameOver)&&(MovesLeft==0)&&(!(BoardEmpty())))
1250 {
1251 //Puzzle not won
1252 SetGameOver();
1253 }
1254 }
1255 GarbageFall(); //Makes the garbage fall
1256 nrFellDown++; //Sets number of this fall, so we know then the next will occur
1257 }
1258
1259 //Moves the cursor, receaves N,S,E or W as a char an moves as desired
1260 void MoveCursor(char way)
1261 {
1262 if(!bGameOver) //If game over nothing happends
1263 {
1264 if((way == 'N') && ((cursory<10)||(TowerHeight>12) ||(((pixels==50)||(pixels==0)) && (cursory<11))))
1265 cursory++;
1266 if((way == 'S') && (cursory>0))
1267 cursory--;
1268 if((way == 'W') && (cursorx>0))
1269 cursorx--;
1270 if((way == 'E') && (cursorx<4))
1271 cursorx++;
1272 }
1273 }
1274
1275 //switches the two blocks at the cursor position, unless game over
1276 void SwitchAtCursor()
1277 {
1278 if((board[cursorx][cursory+1]<7) && (board[cursorx+1][cursory+1]<7) && (!bGameOver) && ((!puzzleMode)||(MovesLeft>0)) && (gameStartedAt-(int)SDL_GetTicks()<=0))
1279 {
1280 int temp = board[cursorx][cursory+1];
1281 board[cursorx][cursory+1] = board[cursorx+1][cursory+1];
1282 board[cursorx+1][cursory+1] = temp;
1283 }
1284 if((puzzleMode)&&(gameStartedAt-(int)SDL_GetTicks()<=0)&&(MovesLeft>0)) MovesLeft--;
1285 }
1286
1287 //Generates a new line and moves the field one block up (restart puzzle mode)
1288 void PushLine()
1289 {
1290 //If not game over, not high tower and not puzzle mode
1291 if((!bGameOver) && TowerHeight<13 && (!puzzleMode) && (gameStartedAt-(int)SDL_GetTicks()<=0)&&(chain==0))
1292 {
1293 for(int i=19;i>0;i--)
1294 for(int j=0;j<6;j++)
1295 {
1296 board[j][i] = board[j][i-1];
1297 }
1298 for(int j=0;j<6;j++)
1299 {
1300 board[j][0] = rand2() % 4;
1301 if(j > 0)
1302 {
1303 if(board[j][0] == board[j-1][0])
1304 board[j][0] = rand2() % 6;
1305 }
1306 if(board[j][0] == board[j][1])
1307 board[j][0] = rand2() % 6;
1308 if(board[j][0] == board[j][1])
1309 board[j][0] = rand2() % 6;
1310 while((j>0)&&(board[j][0]==board[j-1][0]))
1311 board[j][0] = rand2() % 6;
1312 }
1313 score+=1;
1314 MoveCursor('N');
1315 if(vsMode)
1316 {
1317 if(rand2()%6==1)
1318 board[rand2()%6][0]=6;
1319 }
1320 pixels = 0;
1321 stop=0;
1322 pushedPixelAt = SDL_GetTicks();
1323 linesCleared++;
1324 AI_LineOffset++;
1325 nrPushedPixel=(int)((double)(pushedPixelAt-gameStartedAt)/(1000.0*speed));
1326 } //if !bGameOver
1327
1328 //Restart Puzzle mode
1329 if(puzzleMode)
1330 {
1331 //Reloads level
1332 MovesLeft = nrOfMovesAllowed[Level];
1333 for(int i=0;i<6;i++)
1334 for(int j=0;j<12;j++)
1335 {
1336 board[i][j+1] = puzzleLevels[Level][i][j];
1337 }
1338 score=0;
1339 bGameOver=false;
1340 showGame = true;
1341 }
1342
1343 if((TowerHeight>12) && (!puzzleMode)&&(!bGameOver)&&(chain==0))
1344 {
1345 if((theTopScoresEndless.isHighScore(score))&&(!AI_Enabled))
1346 {
1347 if(SoundEnabled)Mix_PlayChannel(1,applause,0);
1348 theTopScoresEndless.addScore(name,score);
1349 cout << "New high score!" << endl;
1350 }
1351 SetGameOver();
1352 }
1353 }//PushLine
1354
1355 //Pushes a single pixel, so it appears to scrool
1356 void PushPixels()
1357 {
1358 nrPushedPixel++;
1359 if ((pixels < 50) && TowerHeight<13)
1360 {
1361 pixels++;
1362 }
1363 else
1364 PushLine();
1365 if (pixels>50)
1366 pixels=0;
1367 }
1368
1369 //See how high the tower is, saved in integer TowerHeight
1370 /*void FindTowerHeight()
1371 {
1372 /*
1373 This function needs to be corrected, if an empty line appears towerheight become to low!
1374 /
1375 bool found = false;
1376 bool notNew = false;
1377 TowerHeight = 0;
1378 for(int i=0; i<19;i++)
1379 //while(!found)
1380 {
1381 found = true;
1382 for(int j=0;j<6;j++)
1383 if(board[j][i] != -1)
1384 found = false;
1385 if((!found) && (notNew))
1386 notNew =false;
1387 if((found)&&(!notNew))
1388 {
1389 TowerHeight=i;
1390 notNew = true;
1391 }
1392 }
1393 TowerHeight--;
1394 }*/
1395
1396 //See how high the tower is, saved in integer TowerHeight
1397 void FindTowerHeight()
1398 {
1399 /*
1400 Old implementation, used until I find the bug in the other.
1401 This function has a bug in stage clear! if an empty line appears.
1402 */
1403 prevTowerHeight = TowerHeight;
1404 bool found = false;
1405 TowerHeight = 0;
1406 while(!found)
1407 {
1408 found = true;
1409 for(int j=0;j<6;j++)
1410 if(board[j][TowerHeight] != -1)
1411 found = false;
1412 TowerHeight++;
1413 }
1414 TowerHeight--;
1415 }
1416
1417 ///////////////////////////////////////////////////////////////////////////
1418 /////////////////////////// AI starts here! ///////////////////////////////
1419 ///////////////////////////////////////////////////////////////////////////
1420 //First the helpet functions:
1421 inline int nrOfType(int line, int type)
1422 {
1423 // cout << "Start_ nrOfType" << endl;
1424 int counter = 0;
1425 for(int i=0; i<6; i++)
1426 if(board[i][line]==type)counter++;
1427 return counter;
1428 }
1429
1430 int AIcolorToClear;
1431 int AIlineToClear;
1432
1433 //See if a combo can be made in this line
1434 int horiInLine(int line)
1435 {
1436 //cout << "Start_ hori in line" << endl;
1437 int nrOfType[7] = {0,0,0,0,0,0,0};
1438 int iTemp;
1439 int max = 0;
1440 for(int i=0; i<6; i++)
1441 {
1442 iTemp = board[i][line];
1443 if((iTemp>-1)&&(iTemp<7))
1444 nrOfType[iTemp]++;
1445 }
1446 for(int j=0; j<7; j++)
1447 {
1448 if(nrOfType[j]>max)
1449 {
1450 max = nrOfType[j];
1451 AIcolorToClear = j;
1452 }
1453 }
1454 return max;
1455 }
1456
1457 bool horiClearPossible()
1458 {
1459 //cout << "Start_ horiclear possible" << endl;
1460 int i=13;
1461 bool solutionFound = false;
1462 do{
1463 if(horiInLine(i)>2)
1464 {
1465 AI_LineOffset = 0;
1466 AIlineToClear = i;
1467 solutionFound = true;
1468 }
1469 i--;
1470 }while((!solutionFound)&&(i>0));
1471 return solutionFound;
1472 }
1473
1474 //the Line Has Unmoveable Objects witch might stall the AI
1475 bool lineHasGarbage(int line)
1476 {
1477 for(int i=0;i<6;i++)
1478 if(board[i][line]>1000000)
1479 return true;
1480 return false;
1481 }
1482
1483 //Types 0..6 in line
1484 inline int nrOfRealTypes(int line)
1485 {
1486 //cout << "Start_ nrOfReal" << endl;
1487 int counter = 0;
1488 for(int i=0; i<6; i++)
1489 if((board[i][line]>-1)&&(board[i][line]<7))counter++;
1490 return counter;
1491 }
1492
1493 //See if there is a tower
1494 bool ThereIsATower()
1495 {
1496 //cout << "Start_ there is a tower" << endl;
1497 bool bThereIsATower = false; //Unless proven otherwise!
1498 bool topReached = false; //If we have reached the top
1499 int lineNumber = 0;
1500 bool emptySpacesFound = false;
1501 do
1502 {
1503 if((emptySpacesFound) && (nrOfRealTypes(lineNumber)>0)&&(nrOfType(lineNumber,-1)>0))
1504 {
1505 AIlineToClear = lineNumber;
1506 if(lineHasGarbage(lineNumber))
1507 return false;
1508 else
1509 bThereIsATower = true;
1510 }
1511 else
1512 emptySpacesFound=false;
1513 if((!emptySpacesFound)&&(nrOfType(lineNumber,-1)>0))
1514 emptySpacesFound = true;
1515 if(lineNumber<12)
1516 lineNumber++;
1517 else
1518 topReached = true;
1519 }while((!bThereIsATower)&&(!topReached));
1520 //if(bThereIsATower)
1521 //cout << "There is actually a tower" << endl;
1522 return bThereIsATower;
1523 }
1524
1525 double firstInLine1(int line)
1526 {
1527 for(int i=0;i<6;i++)
1528 if((board[i][line]>-1)&&(board[i][line]<7))
1529 return (double)i;
1530 return 3.0;
1531 }
1532
1533 //returns the first coordinate of the block of type
1534 double firstInLine(int line, int type)
1535 {
1536 for(int i=0;i<6;i++)
1537 if(board[i][line]==type)
1538 return (double)i;
1539 return 3.0;
1540 }
1541
1542 //There in the line shall we move
1543 int closestTo(int line,int place)
1544 {
1545 if((int)firstInLine1(line)>place)
1546 return (int)firstInLine1(line)-1;
1547 for(int i=place;i>=0;i--)
1548 {
1549 if((board[i][line]>-1)&&(board[i][line]<7))
1550 return i;
1551 }
1552 AIstatus=0;
1553 return place;
1554 }
1555
1556 //The AI will remove a tower
1557 inline void AI_ClearTower()
1558 {
1559 // cout << "AI: ClearTower, line: " << AIlineToClear << endl;
1560 int place = (int)firstInLine(AIlineToClear-1,-1); //Find an empty field to frop a brick into
1561 int xplace = closestTo(AIlineToClear,place); //Find the brick to drop in it
1562 if(cursory+1<AIlineToClear)
1563 MoveCursor('N');
1564 else
1565 if(cursory+1>AIlineToClear)
1566 MoveCursor('S');
1567 else
1568 if(cursorx<xplace)
1569 MoveCursor('E');
1570 else
1571 if(cursorx>xplace)
1572 MoveCursor('W');
1573 else
1574 SwitchAtCursor();
1575 if(!ThereIsATower())
1576 AIstatus = 0;
1577 }
1578
1579 //The AI will try to clear block horisontally
1580 inline void AI_ClearHori()
1581 {
1582 // cout << "AI: ClearHori";
1583 int lowestLine = AIlineToClear;
1584 //AIcolorToClear
1585 bool found =true;
1586 /*for(int i; (i<12)&&(!found);i++)
1587 {
1588 if(horiInLine(i)>2)
1589 {
1590 int lowestLine = i;
1591 found = true;
1592 }
1593 }*/
1594 for(int i=0;i<7;i++)
1595 {
1596 if(nrOfType(lowestLine,i)>2)
1597 AIcolorToClear = i;
1598 }
1599 if(found)
1600 {
1601 if(cursory>lowestLine-1)
1602 MoveCursor('S');
1603 else if(cursory<lowestLine-1)
1604 MoveCursor('N');
1605 else if(nrOfType(lowestLine,AIcolorToClear)>2)
1606 {
1607 int left=0,right=0;
1608 if(board[0][lowestLine]==AIcolorToClear) left++;
1609 if(board[1][lowestLine]==AIcolorToClear) left++;
1610 if(board[2][lowestLine]==AIcolorToClear) left++;
1611 if(board[3][lowestLine]==AIcolorToClear) right++;
1612 if(board[4][lowestLine]==AIcolorToClear) right++;
1613 if(board[5][lowestLine]==AIcolorToClear) right++;
1614 int xplace = 0;
1615 if(left<right)
1616 {
1617 // cout << ", right>left";
1618 int count=0;
1619 for(int i=0;(i<4)&&(count<1);i++)
1620 if((board[i][lowestLine]==AIcolorToClear)&&((i==0)||(board[i+1][lowestLine]!=AIcolorToClear)))
1621 {
1622 count++;
1623 xplace = i;
1624 }
1625 }
1626 else
1627 {
1628 // cout << ", left>=right";
1629 int count=0;
1630 for(int i=3;(i<=5)&&(count<1);i++)
1631 if((board[i][lowestLine]==AIcolorToClear)&&(board[i-1][lowestLine]!=AIcolorToClear))
1632 {
1633 count++;
1634 xplace = --i;
1635 }
1636 }
1637 //cout << ", xplace: " << xplace;
1638 if(cursorx<xplace)
1639 MoveCursor('E');
1640 else
1641 if(cursorx>xplace)
1642 MoveCursor('W');
1643 else
1644 if(cursorx==xplace)
1645 SwitchAtCursor();
1646 else
1647 AIstatus = 0;
1648 }
1649 else
1650 AIstatus = 0;
1651 }
1652 else
1653 AIstatus = 0;
1654 //cout << endl; //for debugging
1655 }
1656
1657 //Test if vertical clear is possible
1658 inline bool veriClearPossible()
1659 {
1660 bool found=false;
1661 int colors[7] = {0,0,0,0,0,0,0};
1662 for(int i=12;(i>0)&&(!found);i--)
1663 {
1664 for(int j=0;j<7;j++)
1665 {
1666 if(nrOfType(i,j)==0)
1667 colors[j]=0;
1668 else
1669 if(++colors[j]>2)
1670 {
1671 AIcolorToClear = j;
1672 AIlineToClear = i;
1673 found=true;
1674 }
1675
1676 }
1677 }
1678 return found;
1679 }
1680
1681
1682
1683 //There in the line shall we move
1684 int closestTo(int line, int type,int place)
1685 {
1686 if((int)firstInLine(line,type)>place)
1687 return (int)firstInLine(line,type)-1;
1688 for(int i=place;i>=0;i--)
1689 {
1690 if(board[i][line]==type)
1691 return i;
1692 }
1693 AIstatus=0;
1694 return place;
1695 }
1696
1697 //The AI will try to clear blocks vertically
1698 inline void AI_ClearVertical()
1699 {
1700 // cout << "AI: ClearVeri";
1701 //First we find the place there we will align the bricks
1702 int placeToCenter = (int)(firstInLine(AIlineToClear,AIcolorToClear)/3.0+firstInLine(AIlineToClear+1,AIcolorToClear)/3.0+firstInLine(AIlineToClear+2,AIcolorToClear)/3.0);
1703 int unlimitedLoop=0;
1704 while(((board[placeToCenter][AIlineToClear]>1000000)||(board[placeToCenter][AIlineToClear+1]>1000000)||(board[placeToCenter][AIlineToClear+2]>1000000))&&(unlimitedLoop<10))
1705 {
1706 unlimitedLoop++;
1707 placeToCenter++;
1708 if(placeToCenter>5)
1709 placeToCenter=0;
1710 }
1711 //cout << ", ptc: " << placeToCenter << ", line: " << AIlineToClear << ", cy: " << cursory;
1712 if(cursory+1>AIlineToClear+2)
1713 {
1714 // cout << ", cursory>line+2";
1715 MoveCursor('S');
1716 }
1717 if(cursory+1<AIlineToClear)
1718 MoveCursor('N');
1719 bool toAlign[3]={true,true,true};
1720 if(board[placeToCenter][AIlineToClear+0]==AIcolorToClear)
1721 toAlign[0]=false;
1722 if(board[placeToCenter][AIlineToClear+1]==AIcolorToClear)
1723 toAlign[1]=false;
1724 if(board[placeToCenter][AIlineToClear+2]==AIcolorToClear)
1725 toAlign[2]=false;
1726 //cout << "status: " << toAlign[0] << " " << toAlign[1] << " " << toAlign[2];
1727 if(cursory+1==AIlineToClear)
1728 {
1729 if(toAlign[0]==false)
1730 MoveCursor('N');
1731 else
1732 {
1733 if(cursorx>closestTo(AIlineToClear,AIcolorToClear,placeToCenter))
1734 MoveCursor('W');
1735 else
1736 if(cursorx<closestTo(AIlineToClear,AIcolorToClear,placeToCenter))
1737 MoveCursor('E');
1738 else
1739 SwitchAtCursor();
1740 }
1741 }
1742 else
1743 if(cursory+1==AIlineToClear+1)
1744 {
1745 if(toAlign[1]==false)
1746 {
1747 if(toAlign[2])
1748 MoveCursor('N');
1749 else
1750 MoveCursor('S');
1751 }
1752 else
1753 {
1754 if(cursorx>closestTo(AIlineToClear+1,AIcolorToClear,placeToCenter))
1755 MoveCursor('W');
1756 else
1757 if(cursorx<closestTo(AIlineToClear+1,AIcolorToClear,placeToCenter))
1758 MoveCursor('E');
1759 else
1760 SwitchAtCursor();
1761 }
1762 }
1763 else
1764 if(cursory+1==AIlineToClear+2)
1765 {
1766 if(toAlign[2]==false)
1767 MoveCursor('S');
1768 else
1769 {
1770 if(cursorx>closestTo(AIlineToClear+2,AIcolorToClear,placeToCenter))
1771 MoveCursor('W');
1772 else
1773 if(cursorx<closestTo(AIlineToClear+2,AIcolorToClear,placeToCenter))
1774 MoveCursor('E');
1775 else
1776 SwitchAtCursor();
1777 }
1778 }
1779
1780 if((!toAlign[0])&&(!toAlign[1])&&(!toAlign[2]))
1781 AIstatus = 0;
1782 if((nrOfType(AIlineToClear,AIcolorToClear)==0)||(nrOfType(AIlineToClear+1,AIcolorToClear)==0)||(nrOfType(AIlineToClear+2,AIcolorToClear)==0))
1783 AIstatus = 0;
1784 //cout << endl;
1785 }
1786
1787
1788
1789 short AIstatus; //Status flags:
1790 //0: nothing, 2: clear tower, 3: clear horisontal, 4: clear vertical
1791 //1: make more lines, 5: make 2 lines, 6: make 1 line
1792 bool firstLineCreated;
1793
1794 void AI_Move()
1795 {
1796 switch(AIstatus)
1797 {
1798 case 1: if(TowerHeight<8)PushLine(); else AIstatus = 0;
1799 break;
1800 case 2: AI_ClearTower();
1801 break;
1802 case 3: AI_ClearHori();
1803 break;
1804 case 4: AI_ClearVertical();
1805 break;
1806 case 5: if(!firstLineCreated){PushLine(); firstLineCreated = true;}
1807 else {PushLine(); AIstatus = 0;}
1808 break;
1809 case 6: PushLine(); AIstatus = 0;
1810 break;
1811 default:
1812 if(TowerHeight<6) AIstatus = 1;
1813 else
1814 if(horiClearPossible()) AIstatus = 3;
1815 else
1816 if(veriClearPossible()) AIstatus = 4;
1817 else
1818 if(ThereIsATower()) AIstatus = 2;
1819 else
1820 AIstatus = 5;
1821 break;
1822 }
1823 }
1824
1825 //////////////////////////////////////////////////////////////////////////
1826 ///////////////////////////// AI ends here! //////////////////////////////
1827 //////////////////////////////////////////////////////////////////////////
1828
1829 //Draws all the bricks to the board (including garbage)
1830 inline void PaintBricks()
1831 {
1832 for(int i=0;((i<13)&&(i<30));i++)
1833 for(int j=0;j<6;j++)
1834 {
1835 if((board[j][i]%10 != -1) && (board[j][i]%10 < 7) && ((board[j][i]/1000000)%10==0))
1836 {
1837 DrawIMG(bricks[board[j][i]%10],sBoard,j*50,600-i*50-pixels);
1838 if((board[j][i]/BLOCKWAIT)%10==1)
1839 DrawIMG(bomb[(SDL_GetTicks()/BOMBTIME)%2],sBoard,j*50,600-i*50-pixels);
1840 if((board[j][i]/BLOCKHANG)%10==1)
1841 DrawIMG(ready[(SDL_GetTicks()/READYTIME)%2],sBoard,j*50,600-i*50-pixels);
1842
1843 }
1844 if((board[j][i]/1000000)%10==1)
1845 {
1846 int left, right, over, under;
1847 int number = board[j][i];
1848 if(j<1) left = -1; else left = board[j-1][i];
1849 if(j>5) right = -1; else right = board[j+1][i];
1850 if(i>28) over = -1; else over = board[j][i+1];
1851 if(i<1) under = -1; else under = board[j][i-1];
1852 if((left == number)&&(right == number)&&(over == number)&&(under == number))
1853 DrawIMG(garbageFill,sBoard,j*50,600-i*50-pixels);
1854 if((left != number)&&(right == number)&&(over == number)&&(under == number))
1855 DrawIMG(garbageL,sBoard,j*50,600-i*50-pixels);
1856 if((left == number)&&(right != number)&&(over == number)&&(under == number))
1857 DrawIMG(garbageR,sBoard,j*50,600-i*50-pixels);
1858 if((left == number)&&(right == number)&&(over != number)&&(under == number))
1859 DrawIMG(garbageT,sBoard,j*50,600-i*50-pixels);
1860 if((left == number)&&(right == number)&&(over == number)&&(under != number))
1861 DrawIMG(garbageB,sBoard,j*50,600-i*50-pixels);
1862 if((left != number)&&(right == number)&&(over != number)&&(under == number))
1863 DrawIMG(garbageTL,sBoard,j*50,600-i*50-pixels);
1864 if((left != number)&&(right == number)&&(over == number)&&(under != number))
1865 DrawIMG(garbageBL,sBoard,j*50,600-i*50-pixels);
1866 if((left == number)&&(right != number)&&(over != number)&&(under == number))
1867 DrawIMG(garbageTR,sBoard,j*50,600-i*50-pixels);
1868 if((left == number)&&(right != number)&&(over == number)&&(under != number))
1869 DrawIMG(garbageBR,sBoard,j*50,600-i*50-pixels);
1870 if((left == number)&&(right != number)&&(over != number)&&(under != number))
1871 DrawIMG(garbageMR,sBoard,j*50,600-i*50-pixels);
1872 if((left == number)&&(right == number)&&(over != number)&&(under != number))
1873 DrawIMG(garbageM,sBoard,j*50,600-i*50-pixels);
1874 if((left != number)&&(right == number)&&(over != number)&&(under != number))
1875 DrawIMG(garbageML,sBoard,j*50,600-i*50-pixels);
1876 }
1877 if((board[j][i]/1000000)%10==2)
1878 {
1879 if(j==0)
1880 DrawIMG(garbageGML,sBoard,j*50,600-i*50-pixels);
1881 else
1882 if(j==5)
1883 DrawIMG(garbageGMR,sBoard,j*50,600-i*50-pixels);
1884 else
1885 DrawIMG(garbageGM,sBoard,j*50,600-i*50-pixels);
1886 }
1887 }
1888 const int j = 0;
1889
1890 int garbageSize=0;
1891 for(int i=0;i<20;i++)
1892 {
1893 if((board[j][i]/1000000)%10==1)
1894 {
1895 int left, right, over, under;
1896 int number = board[j][i];
1897 if(j<1) left = -1; else left = board[j-1][i];
1898 if(j>5) right = -1; else right = board[j+1][i];
1899 if(i>28) over = -1; else over = board[j][i+1];
1900 if(i<1) under = -1; else under = board[j][i-1];
1901 if(((left != number)&&(right == number)&&(over != number)&&(under == number))&&(garbageSize>0))
1902 {
1903 DrawIMG(smiley[board[j][i]%4],sBoard,100,600-i*50-pixels+25*garbageSize);
1904 }
1905 if(!((left != number)&&(right == number)&&(over == number)&&(under == number))) //not in garbage
1906 {
1907 garbageSize=0;
1908 }
1909 else
1910 {
1911 //cout << "In garbage" << endl;
1912 garbageSize++;
1913 }
1914
1915 }
1916 }
1917 }
1918
1919 //Paints the bricks gotten from a replay/net package
1920 void SimplePaintBricks()
1921 {
1922 /*
1923 We will need to mark the blocks that must have a bomb, we will here need to see, what is falling
1924 */
1925 bool bbomb[6][13]; //has a bom on it!
1926 bool falling[6][13]; //this is falling
1927 bool getReady[6][13]; //getReady
1928 for(int i=0;i<6;i++)
1929 for(int j=0;j<13;j++)
1930 {
1931 bbomb[i][j]=false; //All false by default
1932 falling[i][j]=false;
1933 if(board[i][j]>29)
1934 getReady[i][j]=true;
1935 else
1936 getReady[i][j]=false;
1937 }
1938 //See that is falling
1939 for(int i=0;i<6;i++)
1940 {
1941 bool rowFalling = false;
1942 for(int j=0;j<13;j++)
1943 {
1944 if(rowFalling)
1945 falling[i][j]=true;
1946 if((!rowFalling)&&(board[i][j]%30==-1))
1947 rowFalling = true;
1948 if((rowFalling)&&(board[i][j]%30>6))
1949 rowFalling = false;
1950 if(getReady[i][j])
1951 {
1952 falling[i][j]=true; //getReady is the same as falling
1953 rowFalling = false;
1954 }
1955 }
1956 }
1957 //Now looking at rows:
1958 for(int i=0;i<6;i++)
1959 {
1960 int count = 0;
1961 int color = -1;
1962 for(int j=1;j<13;j++)
1963 {
1964 if((board[i][j]%30==color)&&(!falling[i][j]))
1965 count++;
1966 else
1967 if(falling[i][j])
1968 {
1969 count = 0;
1970 }
1971 else
1972 {
1973 color=board[i][j]%30;
1974 count=1;
1975 }
1976 if((count>2)&&(color>-1)&&(color)<7)
1977 {
1978 bbomb[i][j]=true;
1979 bbomb[i][j-1]=true;
1980 bbomb[i][j-2]=true;
1981 }
1982 }
1983 }
1984 //now looking for lines
1985 for(int i=1;i<13;i++)
1986 {
1987 int count = 0;
1988 int color = -1;
1989 for(int j=0;j<6;j++)
1990 {
1991 if((board[j][i]%30==color)&&(!falling[j][i]))
1992 count++;
1993 else
1994 if(falling[j][i])
1995 {
1996 count = 0;
1997 }
1998 else
1999 {
2000 color=board[j][i]%30;
2001 count=1;
2002 }
2003 if((count>2)&&(color>-1)&&(color<7))
2004 {
2005 bbomb[j][i]=true;
2006 bbomb[j-1][i]=true;
2007 bbomb[j-2][i]=true;
2008 }
2009 }
2010 }
2011 for(int i=0;((i<13)&&(i<30));i++)
2012 for(int j=0;j<6;j++)
2013 {
2014 if((board[j][i]%10 != -1) && (board[j][i]%30 < 7))
2015 {
2016 DrawIMG(bricks[board[j][i]%10],sBoard,j*50,600-i*50-pixels);
2017 if(bbomb[j][i])
2018 DrawIMG(bomb[(SDL_GetTicks()/BOMBTIME)%2],sBoard,j*50,600-i*50-pixels);
2019 if(getReady[j][i])
2020 DrawIMG(ready[(SDL_GetTicks()/READYTIME)%2],sBoard,j*50,600-i*50-pixels);
2021 }
2022 if(board[j][i]%30>6)
2023 {
2024 if(board[j][i]%30==7)
2025 DrawIMG(garbageR,sBoard,j*50,600-i*50-pixels); //good
2026 if(board[j][i]%30==9)
2027 DrawIMG(garbageML,sBoard,j*50,600-i*50-pixels); //good
2028 if(board[j][i]%30==10)
2029 DrawIMG(garbageMR,sBoard,j*50,600-i*50-pixels); //good
2030 if(board[j][i]%30==11)
2031 DrawIMG(garbageTR,sBoard,j*50,600-i*50-pixels); //good
2032 if(board[j][i]%30==12)
2033 DrawIMG(garbageTL,sBoard,j*50,600-i*50-pixels); //good
2034 if(board[j][i]%30==13)
2035 DrawIMG(garbageBL,sBoard,j*50,600-i*50-pixels); //good
2036 if(board[j][i]%30==14)
2037 DrawIMG(garbageBR,sBoard,j*50,600-i*50-pixels); //good
2038 if(board[j][i]%30==15)
2039 DrawIMG(garbageM,sBoard,j*50,600-i*50-pixels); //good
2040 if(board[j][i]%30==16)
2041 DrawIMG(garbageFill,sBoard,j*50,600-i*50-pixels); //good
2042 if(board[j][i]%30==17)
2043 DrawIMG(garbageT,sBoard,j*50,600-i*50-pixels); //good
2044 if(board[j][i]%30==18)
2045 DrawIMG(garbageB,sBoard,j*50,600-i*50-pixels); //good
2046 if(board[j][i]%30==19)
2047 DrawIMG(garbageL,sBoard,j*50,600-i*50-pixels); //good
2048 //cout << "IS: " << board[j][i] << endl;
2049 }
2050
2051
2052 }
2053
2054 int garbageSize=0;
2055 for(int i=0;i<20;i++)
2056 {
2057 if((board[0][i]%30==12)&&(garbageSize>0))
2058 {
2059 DrawIMG(smiley[0],sBoard,100,600-i*50-pixels+25*garbageSize);
2060 }
2061 if(board[0][i]%30!=19) //not in garbage
2062 {
2063 garbageSize=0;
2064 }
2065 else
2066 {
2067 //cout << "In garbage" << endl;
2068 garbageSize++;
2069 }
2070
2071 }
2072 }
2073
2074 //Draws everything
2075 void DoPaintJob()
2076 {
2077 DrawIMG(backBoard,sBoard,0,0);
2078 if((!bReplaying)&&(!bNetworkPlayer))
2079 PaintBricks();
2080 else
2081 SimplePaintBricks();
2082 if(stageClear) DrawIMG(blackLine,sBoard,0,700+50*(stageClearLimit-linesCleared)-pixels-1);
2083 if(puzzleMode&&(!bGameOver))
2084 {
2085 //We need to write nr. of moves left!
2086 strHolder = "Moves left: " + itoa(MovesLeft);
2087 SFont_Write(sBoard,fBlueFont,5,5,strHolder.c_str());
2088 }
2089 #if defined(DEBUG)
2090 if(AI_Enabled&&(!bGameOver))
2091 {
2092 strHolder = "AI_status: " + itoa(AIstatus)+ ", "+ itoa(AIlineToClear);
2093 SFont_Write(sBoard,fBlueFont,5,5,strHolder.c_str());
2094 }
2095 #endif
2096 if(!bGameOver)DrawIMG(cursor[(SDL_GetTicks()/600)%2],sBoard,cursorx*50-4,550-cursory*50-pixels-4);
2097 if((int)SDL_GetTicks()<gameStartedAt)
2098 switch(abs((int)SDL_GetTicks()-gameStartedAt)/1000)
2099 {
2100 case 2:
2101 DrawIMG(counter[2],sBoard,100,250);
2102 break;
2103 case 1:
2104 DrawIMG(counter[1],sBoard,100,250);
2105 break;
2106 case 0:
2107 DrawIMG(counter[0],sBoard,100,250);
2108 break;
2109 default:
2110 break;
2111 }
2112 if(bGameOver)
2113 if(hasWonTheGame)DrawIMG(iWinner,sBoard,0,250);
2114 else if(bDraw) DrawIMG(iDraw,sBoard,0,250);
2115 else
2116 DrawIMG(iGameOver,sBoard,0,250);
2117 }
2118
2119 //Updates evrything, if not called nothing happends
2120 void Update()
2121 {
2122 int nowTime = SDL_GetTicks(); //We remember the time, so it don't change during this call
2123 if(bReplaying)
2124 {
2125 setBoard(theReplay.getFrameSec((Uint32)(nowTime-gameStartedAt)));
2126 if(theReplay.isFinnished((Uint32)(nowTime-gameStartedAt)))
2127 switch(theReplay.getFinalStatus())
2128 {
2129 case 1: //Winner
2130 bGameOver = true;
2131 hasWonTheGame = true;
2132 break;
2133 case 2: //Looser
2134 case 4: //GameOver
2135 bGameOver = true;
2136 break;
2137 case 3: //draw
2138 bGameOver =true;
2139 bDraw = true;
2140 break;
2141 default:
2142 bGameOver = true;
2143 //Nothing
2144 break;
2145 };
2146 }
2147 if((!bReplaying)&&(!bNetworkPlayer))
2148 {
2149 FindTowerHeight();
2150 if((linesCleared-TowerHeight>stageClearLimit) && (stageClear) && (!bGameOver))
2151 {
2152 stageCleared[Level] = true;
2153
2154 ofstream outfile;
2155 outfile.open(stageClearSavePath.c_str(), ios::binary |ios::trunc);
2156 if(!outfile)
2157 {
2158 cout << "Error writing to file: stageClear.save" << endl;
2159 }
2160 else
2161 {
2162 for(int i=0;i<nrOfStageLevels;i++)
2163 {
2164 bool tempBool = stageCleared[i];
2165 outfile.write(reinterpret_cast<char*>(&tempBool),sizeof(bool));
2166 }
2167 outfile.close();
2168 }
2169 setPlayerWon();
2170 }
2171 if((TowerHeight>12)&&(prevTowerHeight<13)&&(!puzzleMode))
2172 {
2173 if(SoundEnabled) Mix_PlayChannel(1,heartBeat,0);
2174 stop+=1000;
2175 }
2176
2177
2178 while(nowTime-gameStartedAt>nrStops*40) //Increase stops, till we reach nowTime
2179 {
2180 if (stop>0)
2181 {
2182 stop = stop-20;
2183 if(stop<=0) nrPushedPixel=(int)((nowTime-gameStartedAt)/(1000.0*speed));
2184 }
2185 if (stop<0)
2186 stop = 0;
2187 nrStops++;
2188 }
2189 //If we have static content, we don't raise at all!
2190 if(hasStaticContent())
2191 stop++;
2192 if((puzzleMode)&&(!bGameOver)&&BoardEmpty())
2193 {
2194 if(!singlePuzzle)
2195 {
2196 puzzleCleared[Level] = true;
2197 ofstream outfile;
2198 outfile.open(puzzleSavePath.c_str(), ios::binary |ios::trunc);
2199 if(!outfile)
2200 {
2201 cout << "Error writing to file: " << puzzleSavePath << endl;
2202 }
2203 else
2204 {
2205 for(int i=0;i<nrOfPuzzles;i++)
2206 {
2207 bool tempBool = puzzleCleared[i];
2208 outfile.write(reinterpret_cast<char*>(&tempBool),sizeof(bool));
2209 }
2210 outfile.close();
2211 }
2212 }
2213 setPlayerWon();
2214 }
2215 //increse speed:
2216 if ((nowTime-gameStartedAt>20000*speedLevel)&&(speedLevel <99)&&(!bGameOver))
2217 { speed = (baseSpeed*0.9)/((double)speedLevel*0.5); speedLevel++; nrPushedPixel=(int)((double)(nowTime-gameStartedAt)/(1000.0*speed));}
2218 //To prevent the stack from raising a lot then we stop a chain (don't work anymore)
2219 if(chain>0)
2220 stop+=1;
2221 //Raises the stack
2222 if ((nowTime-gameStartedAt>nrPushedPixel*1000*speed) && (!bGameOver)&&(!stop))
2223 while((nowTime-gameStartedAt>nrPushedPixel*1000*speed)&&(!(puzzleMode)))
2224 PushPixels();
2225 if(!bGameOver)ClearBlocks();
2226 /*************************************************************
2227 Ai stuff
2228 **************************************************************/
2229 if(bGameOver) {
2230 AIstatus = 0; //Enusres that AI is resetted
2231 }
2232 else
2233 if(AI_Enabled)
2234 if(lastAImove+AI_MoveSpeed<SDL_GetTicks())
2235 {
2236 AI_Move();
2237 lastAImove=SDL_GetTicks();
2238 }
2239
2240 /*************************************************************
2241 Ai stuff ended
2242 **************************************************************/
2243 if ((nowTime>gameStartedAt+nrFellDown*140) && (!bGameOver)) FallDown();
2244 if((nowTime<gameStartedAt)&&(puzzleMode)) {FallDown(); nrFellDown--;}
2245 ReduceStuff();
2246 if ((timetrial) && (!bGameOver) && (nowTime-gameStartedAt>2*60*1000))
2247 {
2248 if(SoundEnabled) Mix_PlayChannel(1,timesUp,0);
2249 if((theTopScoresTimeTrial.isHighScore(score))&&(!AI_Enabled))
2250 {
2251 theTopScoresTimeTrial.addScore(name,score);
2252 //new highscore
2253 }
2254 SetGameOver();
2255 }
2256 }
2257 if((!bGameOver)&&(!bReplaying))
2258 theReplay.setFrameSecTo((Uint32)(nowTime-gameStartedAt),getPackage());
2259 DoPaintJob();
2260 }
2261
2262 }; //class BlockGame
2263 ////////////////////////////////////////////////////////////////////////////////
2264 ///////////////////////// BlockAttack class end ////////////////////////////////
2265 ////////////////////////////////////////////////////////////////////////////////
0 /*
1 Block Attack - Rise of the Blocks, SDL game, besed on Nintendo's Tetris Attack
2 Copyright (C) 2005 Poul Sander
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 Poul Sander
19 Rævehjvej 36, V. 1111
20 2800 Kgs. Lyngby
21 DENMARK
22 poul@poulsander.com
23 http://blockattack.sf.net
24 */
25
26 ////////////////////////////////////////////////////////////////////////////////
27 //The BloackGame class represents a board, score, time etc. for a single player/
28 ////////////////////////////////////////////////////////////////////////////////
29 class BlockGame
30 {
31 private:
32 int prevTowerHeight;
33 bool bGarbageFallLeft;
34
35 bool bDraw;
36 bool bReplaying; //true if we are watching a replay
37 bool bNetworkPlayer; //must recieve packages from the net
38 bool bDisconnected; //The player has disconnected
39 Uint32 nextGarbageNumber;
40 int pushedPixelAt;
41 int nrPushedPixel, nrFellDown, nrStops;
42 bool garbageToBeCleared[7][30];
43 Uint32 lastAImove;
44
45 Sint16 AI_LineOffset; //how many lines have changed since command
46 string strHolder;
47 unsigned int hangTicks; //How many times have hang been decreased?
48 //int the two following index 0 may NOT be used (what the fuck did I meen?)
49 Uint8 chainSize[NUMBEROFCHAINS]; //Contains the chains
50 bool chainUsed[NUMBEROFCHAINS]; //True if the chain is used
51
52 Uint32 nextRandomNumber;
53
54 Uint16 rand2()
55 {
56 nextRandomNumber = nextRandomNumber*1103515245 + 12345;
57 return ((Uint16)(nextRandomNumber/65536)) % 32768;
58 }
59
60 int firstUnusedChain()
61 {
62 bool found=false;
63 int i = 0;
64 while(!found)
65 {
66 if(!chainUsed[++i])
67 found=true;
68 if(i>NUMBEROFCHAINS-2)
69 found=true;
70 }
71 return i;
72 }
73
74 public:
75 char name[30];
76 int gameStartedAt;
77 int gameEndedAfter; //How long did the game last?
78 int linesCleared;
79 SDL_Surface* sBoard;
80 int TowerHeight;
81 BlockGame *garbageTarget;
82 Sint32 board[7][30];
83 int stop;
84 int speedLevel;
85 int pixels;
86 int MovesLeft;
87 bool timetrial, stageClear, vsMode, puzzleMode;
88 int Level; //Only used in stageClear and puzzle (not implemented)
89 int stageClearLimit; //stores number of lines user must clear to win
90 int topx,topy;
91 int combo;
92 int chain;
93 int cursorx; //stores cursor position
94 int cursory; // -||-
95 double speed, baseSpeed; //factor for speed. Lower value = faster gameplay
96 unsigned long int score;
97 bool bGameOver;
98 bool hasWonTheGame;
99 int AI_MoveSpeed; //How often will the computer move? milliseconds
100 bool AI_Enabled;
101 Replay theReplay; //Stores the replay
102
103 Uint32 handicap;
104
105 //Constructor
106 BlockGame(int tx, int ty)
107 {
108 tmp = IMG_Load2("gfx/BackBoard.png");
109 sBoard = SDL_DisplayFormat(tmp);
110 SDL_FreeSurface(tmp);
111 srand((int)time(NULL));
112 nrFellDown = 0;
113 nrPushedPixel = 0;
114 garbageTarget = this;
115 nrStops=0;
116 topx = tx;
117 topy = ty;
118 cursorx = 2;
119 cursory = 3;
120 stop = 0;
121 pixels = 0;
122 score = 0;
123 bGameOver = false;
124 bDraw = false;
125 bReplaying=false; //No replay by default
126 bDisconnected=false;
127 bNetworkPlayer = false;
128 timetrial = false;
129 stageClear = false;
130 vsMode = false;
131 puzzleMode = false;
132 linesCleared = 0;
133 AI_Enabled = false;
134 AI_MoveSpeed=100;
135 hasWonTheGame = false;
136 combo=0; //counts
137 chain=0;
138 hangTicks = 0;
139 baseSpeed = 0.5; //All other speeds are relative to this
140 speed = baseSpeed;
141 speedLevel = 1;
142 gameStartedAt = SDL_GetTicks();
143 gameEndedAfter = 0;
144 pushedPixelAt = gameStartedAt;
145 nextGarbageNumber = 10;
146 handicap=0;
147 for(int i=0;i<7;i++)
148 for(int j=0;j<30;j++)
149 {
150 board[i][j] = -1;
151 }
152 for(int i=0;i<NUMBEROFCHAINS;i++)
153 {
154 chainUsed[i]=false;
155 chainSize[i] = 0;
156 }
157 theReplay = Replay();
158 showGame = true; //The game is now active
159 } //Constructor
160
161 //Deconstructor, never really used... game used to crash when called, cause of the way sBoard was created
162 //It should work now and can be used if we want to assign more players in network games that we need to free later
163 ~BlockGame()
164 {
165 theReplay.~Replay();
166 SDL_FreeSurface(sBoard);
167 }
168
169 void setGameSpeed(Uint8 globalSpeedLevel)
170 {
171 switch(globalSpeedLevel)
172 {
173 case 0:
174 baseSpeed=0.5;
175 break;
176 case 1:
177 baseSpeed=0.4;
178 break;
179 case 2:
180 baseSpeed=0.3;
181 break;
182 case 3:
183 baseSpeed=0.25;
184 break;
185 case 4:
186 baseSpeed=0.2;
187 break;
188 default:
189 baseSpeed=0.15;
190 break;
191 };
192 }
193
194 void setHandicap(Uint8 globalHandicap)
195 {
196 handicap=1000*((Uint32)globalHandicap);
197 }
198
199 //Set the move speed of the AI based on the aiLevel parameter
200 void setAIlevel(Uint8 aiLevel)
201 {
202 AI_MoveSpeed=120-(20*(aiLevel-3));
203 };
204
205 #ifdef NETWORK
206 #define garbageStackSize 10
207 Uint8 garbageStack[garbageStackSize][3]; //A garbage stack with space for 10 garbage blocks. 0=x,1=y,2=type
208 int garbageStackUsed;
209
210 void emptyGarbageStack()
211 {
212 for(int i=0;i<10;i++)
213 for(int j=0;j<3;j++)
214 garbageStack[i][j] = 0;
215 garbageStackUsed = 0;
216 }
217
218 bool pushGarbage(Uint8 width,Uint8 height,Uint8 type)
219 {
220 if(garbageStackUsed>=garbageStackSize)
221 return false;
222 garbageStack[garbageStackUsed][0]=width;
223 garbageStack[garbageStackUsed][1]=height;
224 garbageStack[garbageStackUsed][2]=type;
225 garbageStackUsed++;
226 return true;
227 }
228
229 bool popGarbage(Uint8 *width,Uint8 *height,Uint8 *type)
230 {
231 if(garbageStackUsed<1)
232 return false;
233 garbageStackUsed--;
234 *width=garbageStack[garbageStackUsed][0];
235 *height=garbageStack[garbageStackUsed][1];
236 *type=garbageStack[garbageStackUsed][2];
237 return true;
238 }
239
240 #endif
241
242 //Loads BackBoard again if surface format has changed
243 void convertSurface()
244 {
245 SDL_FreeSurface(sBoard);
246 // cout << "2.1" << endl;
247 sBoard = SDL_DisplayFormat(backBoard);
248 // cout << "2.2" << endl;
249 }
250
251 //Instead of creating new object new game is called, to prevent memory leaks
252 void NewGame(int tx, int ty)
253 {
254 bReplaying = false;
255 bNetworkPlayer=false;
256 bDisconnected =false;
257 nrFellDown = 0;
258 lastNrOfPlayers = 1; //At least one player :-)
259 nrPushedPixel = 0;
260 nrStops = 0;
261 topx = tx;
262 topy = ty;
263 cursorx = 2;
264 cursory = 3;
265 stop = 0;
266 pixels = 0;
267 score = 0;
268 bGameOver = false;
269 bDraw = false;
270 timetrial = false;
271 stageClear = false;
272 linesCleared = 0;
273 hasWonTheGame = false;
274 vsMode = false;
275 puzzleMode = false;
276 combo=0;
277 chain=0;
278 AI_Enabled = false;
279 baseSpeed= 0.5;
280 speed = baseSpeed;
281 speedLevel = 1;
282 gameStartedAt = SDL_GetTicks()+3000;
283 pushedPixelAt = gameStartedAt;
284 nextGarbageNumber = 10;
285 handicap=0;
286 for(int i=0;i<7;i++)
287 for(int j=0;j<30;j++)
288 {
289 board[i][j] = -1;
290 }
291 for(int i=0;i<NUMBEROFCHAINS;i++)
292 {
293 chainUsed[i]=false;
294 chainSize[i] = 0;
295 }
296 lastAImove = SDL_GetTicks()+3000;
297 showGame = true;
298 theReplay.~Replay();
299 theReplay = Replay();
300 } //NewGame
301
302 //Starts a new stage game, takes level as input!
303 void NewStageGame(int level, int tx, int ty)
304 {
305 if(level > -1)
306 {
307 NewGame(tx,ty);
308 stageClear = true;
309 Level = level;
310 stageClearLimit = 30+(Level%6)*10;
311 baseSpeed = 0.5/((double)(Level*0.5)+1.0);
312 speed = baseSpeed;
313 }
314 }
315
316 void NewPuzzleGame(int level, int tx, int ty)
317 {
318 if(level>-1)
319 {
320 NewGame(tx,ty);
321 puzzleMode = true;
322 Level = level;
323 MovesLeft = nrOfMovesAllowed[Level];
324 for(int i=0;i<6;i++)
325 for(int j=0;j<12;j++)
326 {
327 board[i][j+1] = puzzleLevels[Level][i][j];
328 }
329 baseSpeed = 100000;
330 speed = 100000;
331
332 //Now push the blines up
333 for(int i=19;i>0;i--)
334 for(int j=0;j<6;j++)
335 {
336 board[j][i] = board[j][i-1];
337 }
338 for(int j=0;j<6;j++)
339 {
340 board[j][0] = rand() % 6;
341 if(j > 0)
342 {
343 if(board[j][0] == board[j-1][0])
344 board[j][0] = rand() % 6;
345 }
346 if(board[j][0] == board[j][1])
347 board[j][0] = 6;
348 if(board[j][0] == board[j][1])
349 board[j][0] = 6;
350
351 }
352 }
353 }
354
355 //Starts new Vs Game (two Player)
356 void NewVsGame(int tx, int ty,BlockGame *target)
357 {
358 NewGame(tx,ty);
359 vsMode = true;
360 putStartBlocks();
361 garbageTarget = target;
362 }
363
364 //Starts new Vs Game (two Player)
365 void NewVsGame(int tx, int ty,BlockGame *target,bool AI)
366 {
367 NewGame(tx,ty);
368 vsMode = true;
369 AI_Enabled = AI;
370 putStartBlocks();
371 garbageTarget = target;
372 }
373
374 //Go in Demonstration mode, no movement
375 void Demonstration(bool toggle)
376 {
377 speed=0;
378 baseSpeed = 0;
379 }
380
381 //We want to play the replay (must have been loaded beforehand)
382 void playReplay(int tx, int ty)
383 {
384 Replay temp = theReplay;
385 NewGame(tx,ty);
386 gameStartedAt = SDL_GetTicks();
387 theReplay.~Replay();
388 theReplay=temp;
389 temp.~Replay();
390 bReplaying = true; //We are playing, no calculations
391 bNetworkPlayer = false; //Take input from replay file
392 }
393
394 #ifdef NETWORK
395 //network play
396 void playNetwork(int tx, int ty)
397 {
398 NewGame(tx,ty);
399 gameStartedAt = SDL_GetTicks();
400 bReplaying = false; //We are playing, no calculations
401 bNetworkPlayer = true; //Don't Take input from replay file
402 emptyGarbageStack();
403 }
404 #endif
405
406 //Prints "winner" and ends game
407 void setPlayerWon()
408 {
409 if(!bGameOver)
410 gameEndedAfter = SDL_GetTicks()-gameStartedAt; //We game ends now!
411 theReplay.setFinalFrame(getPackage(),1);
412 bGameOver = true;
413 hasWonTheGame = true;
414 showGame = false;
415 if(SoundEnabled)Mix_PlayChannel(1,applause,0);
416 }
417
418 //void SetGameOver();
419
420 //Sets disconnected:
421 void setDisconnect()
422 {
423 bDisconnected = true;
424 SetGameOver();
425 }
426
427 //Prints "draw" and ends the game
428 void setDraw()
429 {
430 bGameOver = true;
431 theReplay.setFinalFrame(getPackage(),3);
432 hasWonTheGame = false;
433 bDraw = true;
434 showGame = false;
435 Mix_HaltChannel(1);
436 }
437
438 //Function to get a boardpackage
439 boardPackage getPackage()
440 {
441 boardPackage bp;
442 bp.time = (Uint32)(SDL_GetTicks()-gameStartedAt);
443 for(int i=0;i<6;i++)
444 for(int j=0;j<13;j++)
445 {
446 if(board[i][j]%10<7)
447 bp.brick[i][j]=board[i][j]%10+1;
448 if((board[i][j]/1000000)%10>0)
449 {
450 int aInt=0; //N=1, S=2, W=4, E=8
451 if(i==0)
452 aInt+=4;
453 else
454 if((board[i-1][j])!=(board[i][j]))
455 aInt+=4;
456 if(i==5)
457 aInt+=8;
458 else
459 if((board[i+1][j])!=(board[i][j]))
460 aInt+=8;
461 if(j==0)
462 aInt+=2;
463 else
464 if((board[i][j-1])!=(board[i][j]))
465 aInt+=2;
466 if((board[i][j+1])!=(board[i][j]))
467 aInt+=1;
468 switch(aInt)
469 {
470 case 8:
471 bp.brick[i][j]=8;
472 break;
473 case 7:
474 bp.brick[i][j]=10;
475 break;
476 case 11:
477 bp.brick[i][j]=11;
478 break;
479 case 9:
480 bp.brick[i][j]=12;
481 break;
482 case 5:
483 bp.brick[i][j]=13;
484 break;
485 case 6:
486 bp.brick[i][j]=14;
487 break;
488 case 10:
489 bp.brick[i][j]=15;
490 break;
491 case 3: //M
492 bp.brick[i][j]=16;
493 break;
494 case 0:
495 bp.brick[i][j]=17;
496 break;
497 case 1:
498 bp.brick[i][j]=18;
499 break;
500 case 2:
501 bp.brick[i][j]=19;
502 break;
503 case 4:
504 bp.brick[i][j]=20;
505 break;
506 default:
507 bp.brick[i][j]=0;
508 };
509 //cout << "garbage added to replay: " << aInt << endl;
510 }
511 if((board[i][j]/BLOCKHANG)%10==1) //If "get ready"
512 bp.brick[i][j]+=30;
513 }
514 bp.cursorX = (Uint8)cursorx;
515 bp.cursorY = (Uint8)cursory;
516 bp.score = (Uint32)score;
517 bp.pixels = (Uint8)pixels;
518 bp.chain = (Uint8)chain;
519 bp.speed = (Uint8)speedLevel;
520 Uint8 result = 0;
521 if(bGameOver)
522 result+=1;
523 if(hasWonTheGame)
524 result+=2;
525 if(bDraw)
526 result+=4;
527 bp.result = (Uint8)result;
528 return bp;
529 }
530
531 //Takes a package and sets the board like it
532 void setBoard(boardPackage bp)
533 {
534 //gameStartedAt = SDL_GetTicks()-bp.time;
535 for(int i=0;i<6;i++)
536 for(int j=0;j<13;j++)
537 {
538 //if(bp.brick[i][j]/8==0)
539 board[i][j]=bp.brick[i][j]-1;
540 //else
541 // board[i][j]=-1;
542 }
543 cursorx=bp.cursorX;
544 cursory=bp.cursorY;
545 score=bp.score;
546 pixels=bp.pixels;
547 chain=bp.chain;
548 speedLevel=bp.speed;
549 Uint8 result = bp.result;
550 if(result%2==1)
551 {
552 bGameOver=true;
553 result-=1;
554 }
555 if(result%4==2)
556 {
557 hasWonTheGame = true;
558 result-=2;
559 }
560 if(result==4)
561 {
562 bDraw = true;
563 }
564
565 }
566
567 //Test if LineNr is an empty line, returns false otherwise.
568 bool LineEmpty(int lineNr)
569 {
570 bool empty = true;
571 for(int i = 0; i <7; i++)
572 if(board[i][lineNr] != -1)
573 empty = false;
574 return empty;
575 }
576
577 //Test if the entire board is empty (used for Puzzles)
578 bool BoardEmpty()
579 {
580 bool empty = true;
581 for(int i=0;i<6;i++)
582 for(int j=1;j<13;j++)
583 if(board[i][j] != -1)
584 empty = false;
585 return empty;
586 }
587
588 //Anything that the user can't move? In that case Game Over cannot occur
589 bool hasStaticContent()
590 {
591 for(int i=0;i<6;i++)
592 for(int j=1;j<13;j++)
593 if(board[i][j] >= 10000000) //Higher than this means combos (garbage is static, but the stack is static but nothing to do about it)
594 return true; //They are static
595 return false; //Return false if no static object found
596 }
597
598 /*
599 Generates some blocks so the user don't see a board without blocks
600 */
601 //void putStartBlocks(Uint32);
602
603 void putStartBlocks()
604 {
605 putStartBlocks(time(0));
606 }
607
608 void putStartBlocks(Uint32 n)
609 {
610 for(int i=0;i<7;i++)
611 for(int j=0;j<30;j++)
612 {
613 board[i][j] = -1;
614 }
615 nextRandomNumber = n;
616 int choice = rand2()%3; //Pick a random layout
617 switch(choice)
618 {
619 case 0:
620 //row 0:
621 board[0][0]=1;
622 board[1][0]=0;
623 board[2][0]=4;
624 board[3][0]=3;
625 board[4][0]=3;
626 board[5][0]=5;
627 //row 1:
628 board[0][1]=1;
629 board[1][1]=4;
630 board[2][1]=2;
631 board[3][1]=0;
632 board[4][1]=4;
633 board[5][1]=5;
634 //row 2:
635 board[0][2]=2;
636 board[1][2]=3;
637 board[2][2]=0;
638 board[3][2]=4;
639 board[4][2]=1;
640 board[5][2]=1;
641 //row 3:
642 board[0][3]=3;
643 board[1][3]=2;
644 board[2][3]=3;
645 board[3][3]=1;
646 board[4][3]=0;
647 board[5][3]=4;
648 //row 4:
649 board[0][4]=2;
650 board[1][4]=3;
651 board[2][4]=3;
652 board[3][4]=1;
653 board[4][4]=4;
654 board[5][4]=0;
655 //row 5:
656 board[0][5]=-1;
657 board[1][5]=5;
658 board[2][5]=5;
659 board[3][5]=-1;
660 board[4][5]=1;
661 board[5][5]=-1;
662 break;
663 case 1:
664 //row 0:
665 board[0][0]=3;
666 board[1][0]=5;
667 board[2][0]=0;
668 board[3][0]=0;
669 board[4][0]=4;
670 board[5][0]=2;
671 //row 1:
672 board[0][1]=3;
673 board[1][1]=5;
674 board[2][1]=-1;
675 board[3][1]=5;
676 board[4][1]=4;
677 board[5][1]=2;
678 //row 2:
679 board[0][2]=2;
680 board[1][2]=-1;
681 board[2][2]=-1;
682 board[3][2]=4;
683 board[4][2]=0;
684 board[5][2]=3;
685 //row 3:
686 board[0][3]=2;
687 board[5][3]=3;
688 break;
689 default:
690 //row 0:
691 board[0][0]=4;
692 board[1][0]=5;
693 board[2][0]=2;
694 board[3][0]=0;
695 board[4][0]=1;
696 board[5][0]=5;
697 //row 1:
698 board[0][1]=4;
699 board[1][1]=5;
700 board[2][1]=2;
701 board[3][1]=1;
702 board[4][1]=0;
703 board[5][1]=2;
704 //row 2:
705 board[0][2]=2;
706 board[1][2]=4;
707 board[2][2]=-1;
708 board[3][2]=0;
709 board[4][2]=1;
710 board[5][2]=5;
711 //row 3:
712 board[0][3]=4;
713 board[1][3]=2;
714 board[2][3]=-1;
715 board[3][3]=1;
716 board[4][3]=0;
717 board[5][3]=2;
718 //row 4:
719 board[0][4]=4;
720 board[1][4]=2;
721 board[2][4]=-1;
722 board[3][4]=0;
723 board[4][4]=1;
724 board[5][4]=-1;
725 break;
726 };
727 }
728
729 //decreases hang for all hanging blocks and wait for waiting blocks
730 void ReduceStuff()
731 {
732 unsigned int howMuchHang = (SDL_GetTicks() - FRAMELENGTH*hangTicks)/FRAMELENGTH;
733 if (howMuchHang>0)
734 {
735 for(int i=0; i<7; i++)
736 for(int j=0; j<30; j++)
737 {
738 if((board[i][j]/BLOCKHANG)%10==1)
739 {
740 int hangNumber = (board[i][j]/10)%100;
741 if(hangNumber<=howMuchHang)
742 {
743 board[i][j]-=BLOCKHANG;
744 board[i][j]-=hangNumber*10;
745 }
746 else
747 {
748 board[i][j]-=10*howMuchHang;
749 }
750 }
751 if((board[i][j]/BLOCKWAIT)%10==1)
752 {
753 int hangNumber = (board[i][j]/10)%100;
754 if(hangNumber<=howMuchHang)
755 {
756 //The blocks must be cleared
757 board[i][j]-=hangNumber*10;
758 }
759 else
760 {
761 board[i][j]-=10*howMuchHang;
762 }
763 }
764 }
765 }
766 hangTicks+=howMuchHang;
767 }
768
769 //Creates garbage using a given wide and height
770 bool CreateGarbage(int wide, int height)
771 {
772 #ifdef NETWORK
773 if(bNetworkPlayer)
774 {
775 pushGarbage(wide,height,0);
776 }
777 else
778 #endif
779 {
780 if(wide>6) wide = 6;
781 if(height>12) height = 12;
782 int startPosition = 12;
783 while((!(LineEmpty(startPosition))) || (startPosition == 29))
784 startPosition++;
785 if(startPosition == 29) return false; //failed to place blocks
786 if(29-startPosition<height) return false; //not enough space
787 int start, end;
788 if(bGarbageFallLeft)
789 {start=0; end=start+wide;}
790 else
791 {start=6-wide; end = 6;}
792 for(int i = startPosition; i <startPosition+height; i++)
793 for(int j = start; j < end; j++)
794 {
795 board[j][i] = 1000000+nextGarbageNumber;
796 }
797 nextGarbageNumber++;
798 if(nextGarbageNumber>999999) nextGarbageNumber = 10;
799 bGarbageFallLeft = !(bGarbageFallLeft);
800 return true;
801 }
802 }
803
804 //Creates garbage using a given wide and height
805 bool CreateGreyGarbage()
806 {
807 #ifdef NETWORK
808 if(bNetworkPlayer)
809 {
810 pushGarbage(6,1,1);
811 }
812 else
813 #endif
814 {
815 int startPosition = 12;
816 while((!(LineEmpty(startPosition))) || (startPosition == 29))
817 startPosition++;
818 if(startPosition == 29) return false; //failed to place blocks
819 if(29-startPosition<1) return false; //not enough space
820 int start, end;
821 {start=0; end=6;}
822 for(int i = startPosition; i <startPosition+1; i++)
823 for(int j = start; j < end; j++)
824 {
825 board[j][i] = 2*1000000+nextGarbageNumber;
826 }
827 nextGarbageNumber++;
828 if(nextGarbageNumber>999999) nextGarbageNumber = 10;
829 return true;
830 }
831 }
832
833
834 //Clears garbage, must take one the lower left corner!
835 int GarbageClearer(int x,int y, int number, bool aLineToClear,int chain)
836 {
837 if((board[x][y])%1000000 != number) return -1;
838 if(aLineToClear)
839 {
840 board[x][y] = rand() % 6;
841 board[x][y] += 10*HANGTIME+BLOCKHANG+CHAINPLACE*chain;
842 }
843 garbageToBeCleared[x][y] = false;
844 GarbageClearer(x+1,y,number,aLineToClear,chain);
845 GarbageClearer(x,y+1,number,false,chain);
846 return 1;
847 }
848
849 //Marks garbage that must be cleared
850 int GarbageMarker(int x, int y)
851 {
852 if((x>6)||(x<0)||(y<0)||(y>29)) return -1;
853 if(((board[x][y])/1000000 == 1)&&(garbageToBeCleared[x][y] == false))
854 {
855 garbageToBeCleared[x][y] = true;
856 //Float fill
857 GarbageMarker(x-1,y);
858 GarbageMarker(x+1,y);
859 GarbageMarker(x,y-1);
860 GarbageMarker(x,y+1);
861 }
862 return 1;
863 }
864
865 int FirstGarbageMarker(int x,int y)
866 {
867 if((x>6)||(x<0)||(y<0)||(y>29)) return -1;
868 if(((board[x][y])/1000000 == 2)&&(garbageToBeCleared[x][y] == false))
869 {
870 for(int i=0;i<6;i++)
871 garbageToBeCleared[i][y] = true;
872 }
873 else
874 if(((board[x][y])/1000000 == 1)&&(garbageToBeCleared[x][y] == false))
875 {
876 garbageToBeCleared[x][y] = true;
877 //Float fill
878 GarbageMarker(x-1,y);
879 GarbageMarker(x+1,y);
880 GarbageMarker(x,y-1);
881 GarbageMarker(x,y+1);
882 }
883 return 1;
884 }
885
886 //Clear Blocks if 3 or more is alligned (naive implemented)
887 void ClearBlocks()
888 {
889
890 bool toBeCleared[7][30]; //true if blok must be removed
891
892 int previus=-1; //the last block checked
893 int combo=0;
894 for(int i=0;i<30;i++)
895 for(int j=0;j<7;j++)
896 {
897 toBeCleared[j][i] = false;
898 garbageToBeCleared[j][i] = false;
899 }
900 for(int i=0;i<7;i++)
901 {
902 bool faaling = false;
903 for(int j=0;j<30;j++)
904 {
905 if((faaling)&&(board[i][j]>-1)&&(board[i][j]%10000000<7))
906 {
907 board[i][j]+=BLOCKFALL;
908 }
909 if((!faaling)&&((board[i][j]/BLOCKFALL)%10==1))
910 board[i][j]-=BLOCKFALL;
911 if(!((board[i][j]>-1)&&(board[i][j]%10000000<7)))
912 faaling=true;
913 if(((board[i][j]/1000000)%10==1)||((board[i][j]/1000000)%10==2)||((board[i][j]/BLOCKHANG)%10==1)||((board[i][j]/BLOCKWAIT)%10==1))
914 faaling = false;
915 }
916 }
917
918
919 for(int j=0;j<7;j++)
920 {
921 previus = -1;
922 combo=0;
923
924 for(int i=1;i<30;i++)
925 {
926 if((board[j][i]>-1)&&(board[j][i]%10000000<7))
927 {
928 if (board[j][i]%10000000 == previus)
929 {
930 combo++;
931 }
932 else
933 {
934 if(combo>2)
935 for(int k = i-combo; k<i;k++)
936 {
937 toBeCleared[j][k] = true;
938 }
939 combo=1;
940 previus = board[j][i]%10000000;
941 }
942 } //if board
943 else
944 {
945 if(combo>2)
946 for(int k = i-combo; k<i;k++)
947 {
948 toBeCleared[j][k] = true;
949 }
950 combo = 0;
951 previus = -1;
952 }
953
954 } //for i
955 } //for j
956
957
958 combo = 0;
959 chain = 0;
960 for(int i=0; i<6;i++)
961 for(int j=0; j<30;j++)
962 {
963 //Clears blocks marked for clearing
964 Sint32 temp=board[i][j];
965 if(1==((temp/BLOCKWAIT)%10))
966 if(((temp/10)%100)==0)
967 {
968 if(chainSize[chain]<chainSize[board[i][j]/10000000])
969 chain = board[i][j]/10000000;
970
971 theBallManeger.addBall(topx+40+i*50,topy+600-j*50,true,board[i][j]%10);
972 theBallManeger.addBall(topx+i*50,topy+600-j*50,false,board[i][j]%10);
973 theExplosionManeger.addExplosion(topx-10+i*50,topy+570-j*50);
974 board[i][j]=-2;
975 }
976 }
977 for(int i=0; i<7;i++)
978 {
979 bool setChain=false;
980 for(int j=0; j<30;j++)
981 {
982 if(board[i][j]==-1)
983 setChain=false;
984 if(board[i][j]==-2)
985 {
986 board[i][j]=-1;
987 setChain=true;
988 if(SoundEnabled)Mix_PlayChannel(0,boing,0);
989 }
990 if(board[i][j]!=-1)
991 if((setChain)&&((board[i][j]/GARBAGE)%10!=1)&&((board[i][j]/GARBAGE)%10!=2))
992 {
993 board[i][j]=((board[i][j]%CHAINPLACE)+CHAINPLACE*chain);
994 //somethingsGottaFall = true;
995 }
996
997 }
998 }
999 combo=0;
1000 int startvalue;
1001 if(pixels == 0)
1002 startvalue=1;
1003 else
1004 startvalue=0;
1005 for(int i=startvalue;i<30;i++)
1006 {
1007 previus=-1;
1008 combo=0;
1009 for(int j=0;j<7;j++)
1010 {
1011 if(((board[j][i]>-1)&&(board[j][i]%10000000<7)))
1012 {
1013 if (board[j][i]%10000000 == previus)
1014 {
1015 combo++;
1016 }
1017 else
1018 {
1019 if(combo>2)
1020 for(int k = j-combo; k<j;k++)
1021 {
1022 toBeCleared[k][i] = true;
1023 }
1024 combo=1;
1025 previus = board[j][i]%10000000;
1026 }
1027 } //if board
1028 else
1029 {
1030 if(combo>2)
1031 for(int k = j-combo; k<j;k++)
1032 {
1033 toBeCleared[k][i] = true;
1034 }
1035 combo = 0;
1036 previus = -1;
1037 }
1038
1039 } //for j
1040 } //for i
1041 bool blockIsFalling[6][30]; //See that is falling
1042 for(int i=0;i<30;i++)
1043 for(int j=0;j<6;j++)
1044 blockIsFalling[j][i] = false;
1045
1046
1047
1048 combo = 0;
1049 chain = 0;
1050 int grey = 0;
1051 for(int i=0;i<30;i++)
1052 for(int j=0;j<6;j++)
1053 if (toBeCleared[j][i])
1054 {
1055 //see if any garbage is around:
1056 FirstGarbageMarker(j-1,i);
1057 FirstGarbageMarker(j+1,i);
1058 FirstGarbageMarker(j,i-1);
1059 FirstGarbageMarker(j,i+1);
1060 //that is checked now :-)
1061 if(board[j][i]%10000000==6)
1062 grey++;
1063 if((vsMode) && (grey>2))
1064 garbageTarget->CreateGreyGarbage();
1065 if((board[j][i]>-1)&&(board[j][i]%10000000<7))
1066 board[j][i]+=BLOCKWAIT+10*FALLTIME;
1067
1068 if(chainSize[board[j][i]/10000000]>chainSize[chain])
1069 chain=board[j][i]/10000000;
1070 combo++;
1071 stop+=140*combo;
1072 score +=10;
1073 if(combo>3)
1074 score+=3*combo; //More points if more cleared simontanously
1075 }
1076 score+=chainSize[chain]*100;
1077 if(chain==0)
1078 {
1079 chain=firstUnusedChain();
1080 chainSize[chain]=0;
1081 chainUsed[chain]=true;
1082 }
1083 chainSize[chain]++;
1084 for(int i=0;i<30;i++)
1085 for(int j=0;j<6;j++)
1086 {
1087 //if(board[j][i]/10==(BLOCKWAIT+10*FALLTIME)/10)
1088 if(toBeCleared[j][i])
1089 {
1090 board[j][i]=(board[j][i]%10000000)+chain*10000000;
1091 }
1092 }
1093
1094 { //This is here we add text to screen!
1095 bool dead = false;
1096 for(int i=29;i>=0;i--)
1097 for(int j=0;j<6;j++)
1098 if (toBeCleared[j][i])
1099 {
1100 if(!dead)
1101 {
1102 dead=true;
1103 string tempS = itoa(chainSize[chain]);
1104 if(chainSize[chain]>1)
1105 theTextManeger.addText(topx-10+j*50,topy+600-i*50,tempS,1000);
1106 }
1107 }
1108 } //This was there text was added
1109
1110 if(vsMode)
1111 switch(combo)
1112 {
1113 case 0: case 1: case 2: case 3: break;
1114 case 4: garbageTarget->CreateGarbage(3,1); break;
1115 case 5: garbageTarget->CreateGarbage(4,1); break;
1116 case 6: garbageTarget->CreateGarbage(5,1); break;
1117 case 7: garbageTarget->CreateGarbage(6,1); break;
1118 case 8: garbageTarget->CreateGarbage(4,1); garbageTarget->CreateGarbage(4,1); break;
1119 case 9: garbageTarget->CreateGarbage(5,1); garbageTarget->CreateGarbage(4,1); break;
1120 case 10: garbageTarget->CreateGarbage(5,1); garbageTarget->CreateGarbage(5,1); break;
1121 case 11: garbageTarget->CreateGarbage(6,1); garbageTarget->CreateGarbage(5,1); break;
1122 case 12: garbageTarget->CreateGarbage(6,1); garbageTarget->CreateGarbage(6,1); break;
1123 case 13: garbageTarget->CreateGarbage(5,1); garbageTarget->CreateGarbage(5,1); garbageTarget->CreateGarbage(4,1); break;
1124 default: garbageTarget->CreateGarbage(5,1); garbageTarget->CreateGarbage(5,1); garbageTarget->CreateGarbage(4,1); break;
1125 }
1126 for(int i=0;i<30;i++)
1127 for(int j=0;j<6;j++)
1128 if (garbageToBeCleared[j][i])
1129 {
1130 GarbageClearer(j,i,board[j][i]%1000000,true,chain); //Clears the blocks and all blocks connected to it.
1131 }
1132
1133 chain=0;
1134
1135 //Break chains (if a block is stable it is resetted to (chain == 0)):
1136 for(int i=0;i<7;i++)
1137 {
1138 bool faaling = false; //In the beginning we are NOT falling
1139 for(int j=0;j<30;j++)
1140 {
1141 if((faaling)&&(board[i][j]>-1)&&(board[i][j]<7))
1142 {
1143 board[i][j]+=BLOCKFALL;
1144 }
1145 if((!faaling)&&((board[i][j]/BLOCKFALL)%10==1))
1146 board[i][j]-=BLOCKFALL;
1147 if((!faaling)&&(board[i][j]>0)&&(board[i][j]/10000000!=0)&&((board[i][j]/BLOCKWAIT)%10!=1)&&((board[i][j]/BLOCKHANG)%10!=1))
1148 {
1149 if(chainSize[board[i][j]/10000000]>chainSize[chain])
1150 chain=board[i][j]/10000000;
1151 board[i][j]=board[i][j]%10000000;
1152 }
1153 if(!((board[i][j]>-1)&&(board[i][j]<7)))
1154 faaling=true;
1155 if(((board[i][j]/1000000)%10==1)||((board[i][j]/BLOCKHANG)%10==1)||((board[i][j]/BLOCKWAIT)%10==1))
1156 faaling = false;
1157 }
1158 }
1159
1160 //Create garbage as a result
1161 //if((vsMode)&&(chainSize[chain]>1)) garbageTarget->CreateGarbage(6,chainSize[chain]-1);
1162
1163 //Calculate chain
1164 chain=0;
1165 for(int i=0; i<6;i++)
1166 for(int j=0; j<30;j++)
1167 {
1168 if(chainSize[board[i][j]/10000000]>chain)
1169 chain=chainSize[board[i][j]/10000000];
1170 }
1171
1172 //Make space in table for more things
1173 if(chain==0)
1174 for(int i=0;i<NUMBEROFCHAINS;i++)
1175 if(chainUsed[i]==true)
1176 {
1177 if((vsMode)&&(chainSize[i]>1)) garbageTarget->CreateGarbage(6,chainSize[i]-1);
1178 if((SoundEnabled)&&(chainSize[i]>4))Mix_PlayChannel(1,applause,0);
1179 chainUsed[i]=false;
1180 }
1181 } //ClearBlocks
1182
1183 //prints "Game Over" and ends game
1184 void SetGameOver()
1185 {
1186 if(!bGameOver)
1187 gameEndedAfter = SDL_GetTicks()-gameStartedAt; //We game ends now!
1188 theReplay.setFinalFrame(getPackage(),0);
1189 bGameOver = true;
1190 showGame = false;
1191 }
1192
1193 //Moves all peaces a spot down if possible
1194 int FallBlock(int x, int y, int number)
1195 {
1196 if(y == 0) return -1;
1197 if(x>0)
1198 if(board[x-1][y] == number)
1199 return -1;
1200 int i=x;
1201 bool canFall = true;
1202 //checks a line of a garbage block and see if something is under it
1203 while((board[i][y] == number)&&(canFall)&&(i<6))
1204 {
1205 if(board[i][y-1] != -1) canFall = false;
1206 i++;
1207 }
1208 if(canFall)
1209 {
1210 //cout << "Now falling" << endl;
1211 for(int j = x;j<i;j++)
1212 {
1213 board[j][y-1] = board[j][y];
1214 board[j][y] = -1;
1215 }
1216 }
1217 return 0;
1218 } //FallBlock
1219
1220
1221 //Makes all Garbage fall one spot
1222 void GarbageFall()
1223 {
1224 for(int i=0;i<30;i++)
1225 for(int j=0;j<7; j++)
1226 {
1227 if((((board[j][i]/1000000)%10) == 1)||(((board[j][i]/1000000)%10) == 2))
1228 FallBlock(j,i,board[j][i]);
1229 }
1230 }
1231
1232 //Makes the blocks fall (it doesn't test time, this must be done before hand)
1233 void FallDown()
1234 {
1235 bool falling =false; //nothing is moving unless proven otherwise
1236 for(int i=0;i<29;i++)
1237 for(int j=0;j<6;j++)
1238 {
1239 if((board[j][i]==-1) && (board[j][i+1]!=-1) && (board[j][i+1]%BLOCKFALL<7))
1240 {
1241 board[j][i] = board[j][i+1];
1242 board[j][i+1] = -1;
1243 falling = true; //something is moving!
1244 }
1245 if((board[j][i]/BLOCKWAIT)%10==1)
1246 falling=true;
1247 }
1248 if(!falling) //If nothing is falling
1249 {
1250 if((puzzleMode)&&(!bGameOver)&&(MovesLeft==0)&&(!(BoardEmpty())))
1251 {
1252 //Puzzle not won
1253 SetGameOver();
1254 }
1255 }
1256 GarbageFall(); //Makes the garbage fall
1257 nrFellDown++; //Sets number of this fall, so we know then the next will occur
1258 }
1259
1260 //Moves the cursor, receaves N,S,E or W as a char an moves as desired
1261 void MoveCursor(char way)
1262 {
1263 if(!bGameOver) //If game over nothing happends
1264 {
1265 if((way == 'N') && ((cursory<10)||(TowerHeight>12) ||(((pixels==50)||(pixels==0)) && (cursory<11))))
1266 cursory++;
1267 if((way == 'S') && (cursory>0))
1268 cursory--;
1269 if((way == 'W') && (cursorx>0))
1270 cursorx--;
1271 if((way == 'E') && (cursorx<4))
1272 cursorx++;
1273 }
1274 }
1275
1276 //switches the two blocks at the cursor position, unless game over
1277 void SwitchAtCursor()
1278 {
1279 if((board[cursorx][cursory+1]<7) && (board[cursorx+1][cursory+1]<7) && (!bGameOver) && ((!puzzleMode)||(MovesLeft>0)) && (gameStartedAt-(int)SDL_GetTicks()<=0))
1280 {
1281 int temp = board[cursorx][cursory+1];
1282 board[cursorx][cursory+1] = board[cursorx+1][cursory+1];
1283 board[cursorx+1][cursory+1] = temp;
1284 }
1285 if((puzzleMode)&&(gameStartedAt-(int)SDL_GetTicks()<=0)&&(MovesLeft>0)) MovesLeft--;
1286 }
1287
1288 //Generates a new line and moves the field one block up (restart puzzle mode)
1289 void PushLine()
1290 {
1291 //If not game over, not high tower and not puzzle mode
1292 if((!bGameOver) && TowerHeight<13 && (!puzzleMode) && (gameStartedAt-(int)SDL_GetTicks()<=0)&&(chain==0))
1293 {
1294 for(int i=19;i>0;i--)
1295 for(int j=0;j<6;j++)
1296 {
1297 board[j][i] = board[j][i-1];
1298 }
1299 for(int j=0;j<6;j++)
1300 {
1301 board[j][0] = rand2() % 4;
1302 if(j > 0)
1303 {
1304 if(board[j][0] == board[j-1][0])
1305 board[j][0] = rand2() % 6;
1306 }
1307 if(board[j][0] == board[j][1])
1308 board[j][0] = rand2() % 6;
1309 if(board[j][0] == board[j][1])
1310 board[j][0] = rand2() % 6;
1311 while((j>0)&&(board[j][0]==board[j-1][0]))
1312 board[j][0] = rand2() % 6;
1313 }
1314 score+=1;
1315 MoveCursor('N');
1316 if(vsMode)
1317 {
1318 if(rand2()%6==1)
1319 board[rand2()%6][0]=6;
1320 }
1321 pixels = 0;
1322 stop=0;
1323 pushedPixelAt = SDL_GetTicks();
1324 linesCleared++;
1325 AI_LineOffset++;
1326 nrPushedPixel=(int)((double)(pushedPixelAt-gameStartedAt)/(1000.0*speed));
1327 } //if !bGameOver
1328
1329 //Restart Puzzle mode
1330 if(puzzleMode)
1331 {
1332 //Reloads level
1333 MovesLeft = nrOfMovesAllowed[Level];
1334 for(int i=0;i<6;i++)
1335 for(int j=0;j<12;j++)
1336 {
1337 board[i][j+1] = puzzleLevels[Level][i][j];
1338 }
1339 score=0;
1340 bGameOver=false;
1341 showGame = true;
1342 }
1343
1344 if((TowerHeight>12) && (!puzzleMode)&&(!bGameOver)&&(chain==0))
1345 {
1346 if((theTopScoresEndless.isHighScore(score))&&(!AI_Enabled))
1347 {
1348 if(SoundEnabled)Mix_PlayChannel(1,applause,0);
1349 theTopScoresEndless.addScore(name,score);
1350 cout << "New high score!" << endl;
1351 }
1352 SetGameOver();
1353 }
1354 }//PushLine
1355
1356 //Pushes a single pixel, so it appears to scrool
1357 void PushPixels()
1358 {
1359 nrPushedPixel++;
1360 if ((pixels < 50) && TowerHeight<13)
1361 {
1362 pixels++;
1363 }
1364 else
1365 PushLine();
1366 if (pixels>50)
1367 pixels=0;
1368 }
1369
1370 //See how high the tower is, saved in integer TowerHeight
1371 /*void FindTowerHeight()
1372 {
1373 /*
1374 This function needs to be corrected, if an empty line appears towerheight become to low!
1375 /
1376 bool found = false;
1377 bool notNew = false;
1378 TowerHeight = 0;
1379 for(int i=0; i<19;i++)
1380 //while(!found)
1381 {
1382 found = true;
1383 for(int j=0;j<6;j++)
1384 if(board[j][i] != -1)
1385 found = false;
1386 if((!found) && (notNew))
1387 notNew =false;
1388 if((found)&&(!notNew))
1389 {
1390 TowerHeight=i;
1391 notNew = true;
1392 }
1393 }
1394 TowerHeight--;
1395 }*/
1396
1397 //See how high the tower is, saved in integer TowerHeight
1398 void FindTowerHeight()
1399 {
1400 /*
1401 Old implementation, used until I find the bug in the other.
1402 This function has a bug in stage clear! if an empty line appears.
1403 */
1404 prevTowerHeight = TowerHeight;
1405 bool found = false;
1406 TowerHeight = 0;
1407 while(!found)
1408 {
1409 found = true;
1410 for(int j=0;j<6;j++)
1411 if(board[j][TowerHeight] != -1)
1412 found = false;
1413 TowerHeight++;
1414 }
1415 TowerHeight--;
1416 }
1417
1418 ///////////////////////////////////////////////////////////////////////////
1419 /////////////////////////// AI starts here! ///////////////////////////////
1420 ///////////////////////////////////////////////////////////////////////////
1421 //First the helpet functions:
1422 inline int nrOfType(int line, int type)
1423 {
1424 // cout << "Start_ nrOfType" << endl;
1425 int counter = 0;
1426 for(int i=0; i<6; i++)
1427 if(board[i][line]==type)counter++;
1428 return counter;
1429 }
1430
1431 int AIcolorToClear;
1432 int AIlineToClear;
1433
1434 //See if a combo can be made in this line
1435 int horiInLine(int line)
1436 {
1437 //cout << "Start_ hori in line" << endl;
1438 int nrOfType[7] = {0,0,0,0,0,0,0};
1439 int iTemp;
1440 int max = 0;
1441 for(int i=0; i<6; i++)
1442 {
1443 iTemp = board[i][line];
1444 if((iTemp>-1)&&(iTemp<7))
1445 nrOfType[iTemp]++;
1446 }
1447 for(int j=0; j<7; j++)
1448 {
1449 if(nrOfType[j]>max)
1450 {
1451 max = nrOfType[j];
1452 AIcolorToClear = j;
1453 }
1454 }
1455 return max;
1456 }
1457
1458 bool horiClearPossible()
1459 {
1460 //cout << "Start_ horiclear possible" << endl;
1461 int i=13;
1462 bool solutionFound = false;
1463 do{
1464 if(horiInLine(i)>2)
1465 {
1466 AI_LineOffset = 0;
1467 AIlineToClear = i;
1468 solutionFound = true;
1469 }
1470 i--;
1471 }while((!solutionFound)&&(i>0));
1472 return solutionFound;
1473 }
1474
1475 //the Line Has Unmoveable Objects witch might stall the AI
1476 bool lineHasGarbage(int line)
1477 {
1478 for(int i=0;i<6;i++)
1479 if(board[i][line]>1000000)
1480 return true;
1481 return false;
1482 }
1483
1484 //Types 0..6 in line
1485 inline int nrOfRealTypes(int line)
1486 {
1487 //cout << "Start_ nrOfReal" << endl;
1488 int counter = 0;
1489 for(int i=0; i<6; i++)
1490 if((board[i][line]>-1)&&(board[i][line]<7))counter++;
1491 return counter;
1492 }
1493
1494 //See if there is a tower
1495 bool ThereIsATower()
1496 {
1497 //cout << "Start_ there is a tower" << endl;
1498 bool bThereIsATower = false; //Unless proven otherwise!
1499 bool topReached = false; //If we have reached the top
1500 int lineNumber = 0;
1501 bool emptySpacesFound = false;
1502 do
1503 {
1504 if((emptySpacesFound) && (nrOfRealTypes(lineNumber)>0)&&(nrOfType(lineNumber,-1)>0))
1505 {
1506 AIlineToClear = lineNumber;
1507 if(lineHasGarbage(lineNumber))
1508 return false;
1509 else
1510 bThereIsATower = true;
1511 }
1512 else
1513 emptySpacesFound=false;
1514 if((!emptySpacesFound)&&(nrOfType(lineNumber,-1)>0))
1515 emptySpacesFound = true;
1516 if(lineNumber<12)
1517 lineNumber++;
1518 else
1519 topReached = true;
1520 }while((!bThereIsATower)&&(!topReached));
1521 //if(bThereIsATower)
1522 //cout << "There is actually a tower" << endl;
1523 return bThereIsATower;
1524 }
1525
1526 double firstInLine1(int line)
1527 {
1528 for(int i=0;i<6;i++)
1529 if((board[i][line]>-1)&&(board[i][line]<7))
1530 return (double)i;
1531 return 3.0;
1532 }
1533
1534 //returns the first coordinate of the block of type
1535 double firstInLine(int line, int type)
1536 {
1537 for(int i=0;i<6;i++)
1538 if(board[i][line]==type)
1539 return (double)i;
1540 return 3.0;
1541 }
1542
1543 //There in the line shall we move
1544 int closestTo(int line,int place)
1545 {
1546 if((int)firstInLine1(line)>place)
1547 return (int)firstInLine1(line)-1;
1548 for(int i=place;i>=0;i--)
1549 {
1550 if((board[i][line]>-1)&&(board[i][line]<7))
1551 return i;
1552 }
1553 AIstatus=0;
1554 return place;
1555 }
1556
1557 //The AI will remove a tower
1558 inline void AI_ClearTower()
1559 {
1560 // cout << "AI: ClearTower, line: " << AIlineToClear << endl;
1561 int place = (int)firstInLine(AIlineToClear-1,-1); //Find an empty field to frop a brick into
1562 int xplace = closestTo(AIlineToClear,place); //Find the brick to drop in it
1563 if(cursory+1<AIlineToClear)
1564 MoveCursor('N');
1565 else
1566 if(cursory+1>AIlineToClear)
1567 MoveCursor('S');
1568 else
1569 if(cursorx<xplace)
1570 MoveCursor('E');
1571 else
1572 if(cursorx>xplace)
1573 MoveCursor('W');
1574 else
1575 SwitchAtCursor();
1576 if(!ThereIsATower())
1577 AIstatus = 0;
1578 }
1579
1580 //The AI will try to clear block horisontally
1581 inline void AI_ClearHori()
1582 {
1583 // cout << "AI: ClearHori";
1584 int lowestLine = AIlineToClear;
1585 //AIcolorToClear
1586 bool found =true;
1587 /*for(int i; (i<12)&&(!found);i++)
1588 {
1589 if(horiInLine(i)>2)
1590 {
1591 int lowestLine = i;
1592 found = true;
1593 }
1594 }*/
1595 for(int i=0;i<7;i++)
1596 {
1597 if(nrOfType(lowestLine,i)>2)
1598 AIcolorToClear = i;
1599 }
1600 if(found)
1601 {
1602 if(cursory>lowestLine-1)
1603 MoveCursor('S');
1604 else if(cursory<lowestLine-1)
1605 MoveCursor('N');
1606 else if(nrOfType(lowestLine,AIcolorToClear)>2)
1607 {
1608 int left=0,right=0;
1609 if(board[0][lowestLine]==AIcolorToClear) left++;
1610 if(board[1][lowestLine]==AIcolorToClear) left++;
1611 if(board[2][lowestLine]==AIcolorToClear) left++;
1612 if(board[3][lowestLine]==AIcolorToClear) right++;
1613 if(board[4][lowestLine]==AIcolorToClear) right++;
1614 if(board[5][lowestLine]==AIcolorToClear) right++;
1615 int xplace = 0;
1616 if(left<right)
1617 {
1618 // cout << ", right>left";
1619 int count=0;
1620 for(int i=0;(i<4)&&(count<1);i++)
1621 if((board[i][lowestLine]==AIcolorToClear)&&((i==0)||(board[i+1][lowestLine]!=AIcolorToClear)))
1622 {
1623 count++;
1624 xplace = i;
1625 }
1626 }
1627 else
1628 {
1629 // cout << ", left>=right";
1630 int count=0;
1631 for(int i=3;(i<=5)&&(count<1);i++)
1632 if((board[i][lowestLine]==AIcolorToClear)&&(board[i-1][lowestLine]!=AIcolorToClear))
1633 {
1634 count++;
1635 xplace = --i;
1636 }
1637 }
1638 //cout << ", xplace: " << xplace;
1639 if(cursorx<xplace)
1640 MoveCursor('E');
1641 else
1642 if(cursorx>xplace)
1643 MoveCursor('W');
1644 else
1645 if(cursorx==xplace)
1646 SwitchAtCursor();
1647 else
1648 AIstatus = 0;
1649 }
1650 else
1651 AIstatus = 0;
1652 }
1653 else
1654 AIstatus = 0;
1655 //cout << endl; //for debugging
1656 }
1657
1658 //Test if vertical clear is possible
1659 inline bool veriClearPossible()
1660 {
1661 bool found=false;
1662 int colors[7] = {0,0,0,0,0,0,0};
1663 for(int i=12;(i>0)&&(!found);i--)
1664 {
1665 for(int j=0;j<7;j++)
1666 {
1667 if(nrOfType(i,j)==0)
1668 colors[j]=0;
1669 else
1670 if(++colors[j]>2)
1671 {
1672 AIcolorToClear = j;
1673 AIlineToClear = i;
1674 found=true;
1675 }
1676
1677 }
1678 }
1679 return found;
1680 }
1681
1682
1683
1684 //There in the line shall we move
1685 int closestTo(int line, int type,int place)
1686 {
1687 if((int)firstInLine(line,type)>place)
1688 return (int)firstInLine(line,type)-1;
1689 for(int i=place;i>=0;i--)
1690 {
1691 if(board[i][line]==type)
1692 return i;
1693 }
1694 AIstatus=0;
1695 return place;
1696 }
1697
1698 //The AI will try to clear blocks vertically
1699 inline void AI_ClearVertical()
1700 {
1701 // cout << "AI: ClearVeri";
1702 //First we find the place there we will align the bricks
1703 int placeToCenter = (int)(firstInLine(AIlineToClear,AIcolorToClear)/3.0+firstInLine(AIlineToClear+1,AIcolorToClear)/3.0+firstInLine(AIlineToClear+2,AIcolorToClear)/3.0);
1704 int unlimitedLoop=0;
1705 while(((board[placeToCenter][AIlineToClear]>1000000)||(board[placeToCenter][AIlineToClear+1]>1000000)||(board[placeToCenter][AIlineToClear+2]>1000000))&&(unlimitedLoop<10))
1706 {
1707 unlimitedLoop++;
1708 placeToCenter++;
1709 if(placeToCenter>5)
1710 placeToCenter=0;
1711 }
1712 //cout << ", ptc: " << placeToCenter << ", line: " << AIlineToClear << ", cy: " << cursory;
1713 if(cursory+1>AIlineToClear+2)
1714 {
1715 // cout << ", cursory>line+2";
1716 MoveCursor('S');
1717 }
1718 if(cursory+1<AIlineToClear)
1719 MoveCursor('N');
1720 bool toAlign[3]={true,true,true};
1721 if(board[placeToCenter][AIlineToClear+0]==AIcolorToClear)
1722 toAlign[0]=false;
1723 if(board[placeToCenter][AIlineToClear+1]==AIcolorToClear)
1724 toAlign[1]=false;
1725 if(board[placeToCenter][AIlineToClear+2]==AIcolorToClear)
1726 toAlign[2]=false;
1727 //cout << "status: " << toAlign[0] << " " << toAlign[1] << " " << toAlign[2];
1728 if(cursory+1==AIlineToClear)
1729 {
1730 if(toAlign[0]==false)
1731 MoveCursor('N');
1732 else
1733 {
1734 if(cursorx>closestTo(AIlineToClear,AIcolorToClear,placeToCenter))
1735 MoveCursor('W');
1736 else
1737 if(cursorx<closestTo(AIlineToClear,AIcolorToClear,placeToCenter))
1738 MoveCursor('E');
1739 else
1740 SwitchAtCursor();
1741 }
1742 }
1743 else
1744 if(cursory+1==AIlineToClear+1)
1745 {
1746 if(toAlign[1]==false)
1747 {
1748 if(toAlign[2])
1749 MoveCursor('N');
1750 else
1751 MoveCursor('S');
1752 }
1753 else
1754 {
1755 if(cursorx>closestTo(AIlineToClear+1,AIcolorToClear,placeToCenter))
1756 MoveCursor('W');
1757 else
1758 if(cursorx<closestTo(AIlineToClear+1,AIcolorToClear,placeToCenter))
1759 MoveCursor('E');
1760 else
1761 SwitchAtCursor();
1762 }
1763 }
1764 else
1765 if(cursory+1==AIlineToClear+2)
1766 {
1767 if(toAlign[2]==false)
1768 MoveCursor('S');
1769 else
1770 {
1771 if(cursorx>closestTo(AIlineToClear+2,AIcolorToClear,placeToCenter))
1772 MoveCursor('W');
1773 else
1774 if(cursorx<closestTo(AIlineToClear+2,AIcolorToClear,placeToCenter))
1775 MoveCursor('E');
1776 else
1777 SwitchAtCursor();
1778 }
1779 }
1780
1781 if((!toAlign[0])&&(!toAlign[1])&&(!toAlign[2]))
1782 AIstatus = 0;
1783 if((nrOfType(AIlineToClear,AIcolorToClear)==0)||(nrOfType(AIlineToClear+1,AIcolorToClear)==0)||(nrOfType(AIlineToClear+2,AIcolorToClear)==0))
1784 AIstatus = 0;
1785 //cout << endl;
1786 }
1787
1788
1789
1790 short AIstatus; //Status flags:
1791 //0: nothing, 2: clear tower, 3: clear horisontal, 4: clear vertical
1792 //1: make more lines, 5: make 2 lines, 6: make 1 line
1793 bool firstLineCreated;
1794
1795 void AI_Move()
1796 {
1797 switch(AIstatus)
1798 {
1799 case 1: if(TowerHeight<8)PushLine(); else AIstatus = 0;
1800 break;
1801 case 2: AI_ClearTower();
1802 break;
1803 case 3: AI_ClearHori();
1804 break;
1805 case 4: AI_ClearVertical();
1806 break;
1807 case 5: if(!firstLineCreated){PushLine(); firstLineCreated = true;}
1808 else {PushLine(); AIstatus = 0;}
1809 break;
1810 case 6: PushLine(); AIstatus = 0;
1811 break;
1812 default:
1813 if(TowerHeight<6) AIstatus = 1;
1814 else
1815 if(horiClearPossible()) AIstatus = 3;
1816 else
1817 if(veriClearPossible()) AIstatus = 4;
1818 else
1819 if(ThereIsATower()) AIstatus = 2;
1820 else
1821 AIstatus = 5;
1822 break;
1823 }
1824 }
1825
1826 //////////////////////////////////////////////////////////////////////////
1827 ///////////////////////////// AI ends here! //////////////////////////////
1828 //////////////////////////////////////////////////////////////////////////
1829
1830 //Draws all the bricks to the board (including garbage)
1831 inline void PaintBricks()
1832 {
1833 for(int i=0;((i<13)&&(i<30));i++)
1834 for(int j=0;j<6;j++)
1835 {
1836 if((board[j][i]%10 != -1) && (board[j][i]%10 < 7) && ((board[j][i]/1000000)%10==0))
1837 {
1838 DrawIMG(bricks[board[j][i]%10],sBoard,j*50,600-i*50-pixels);
1839 if((board[j][i]/BLOCKWAIT)%10==1)
1840 DrawIMG(bomb[(SDL_GetTicks()/BOMBTIME)%2],sBoard,j*50,600-i*50-pixels);
1841 if((board[j][i]/BLOCKHANG)%10==1)
1842 DrawIMG(ready[(SDL_GetTicks()/READYTIME)%2],sBoard,j*50,600-i*50-pixels);
1843
1844 }
1845 if((board[j][i]/1000000)%10==1)
1846 {
1847 int left, right, over, under;
1848 int number = board[j][i];
1849 if(j<1) left = -1; else left = board[j-1][i];
1850 if(j>5) right = -1; else right = board[j+1][i];
1851 if(i>28) over = -1; else over = board[j][i+1];
1852 if(i<1) under = -1; else under = board[j][i-1];
1853 if((left == number)&&(right == number)&&(over == number)&&(under == number))
1854 DrawIMG(garbageFill,sBoard,j*50,600-i*50-pixels);
1855 if((left != number)&&(right == number)&&(over == number)&&(under == number))
1856 DrawIMG(garbageL,sBoard,j*50,600-i*50-pixels);
1857 if((left == number)&&(right != number)&&(over == number)&&(under == number))
1858 DrawIMG(garbageR,sBoard,j*50,600-i*50-pixels);
1859 if((left == number)&&(right == number)&&(over != number)&&(under == number))
1860 DrawIMG(garbageT,sBoard,j*50,600-i*50-pixels);
1861 if((left == number)&&(right == number)&&(over == number)&&(under != number))
1862 DrawIMG(garbageB,sBoard,j*50,600-i*50-pixels);
1863 if((left != number)&&(right == number)&&(over != number)&&(under == number))
1864 DrawIMG(garbageTL,sBoard,j*50,600-i*50-pixels);
1865 if((left != number)&&(right == number)&&(over == number)&&(under != number))
1866 DrawIMG(garbageBL,sBoard,j*50,600-i*50-pixels);
1867 if((left == number)&&(right != number)&&(over != number)&&(under == number))
1868 DrawIMG(garbageTR,sBoard,j*50,600-i*50-pixels);
1869 if((left == number)&&(right != number)&&(over == number)&&(under != number))
1870 DrawIMG(garbageBR,sBoard,j*50,600-i*50-pixels);
1871 if((left == number)&&(right != number)&&(over != number)&&(under != number))
1872 DrawIMG(garbageMR,sBoard,j*50,600-i*50-pixels);
1873 if((left == number)&&(right == number)&&(over != number)&&(under != number))
1874 DrawIMG(garbageM,sBoard,j*50,600-i*50-pixels);
1875 if((left != number)&&(right == number)&&(over != number)&&(under != number))
1876 DrawIMG(garbageML,sBoard,j*50,600-i*50-pixels);
1877 }
1878 if((board[j][i]/1000000)%10==2)
1879 {
1880 if(j==0)
1881 DrawIMG(garbageGML,sBoard,j*50,600-i*50-pixels);
1882 else
1883 if(j==5)
1884 DrawIMG(garbageGMR,sBoard,j*50,600-i*50-pixels);
1885 else
1886 DrawIMG(garbageGM,sBoard,j*50,600-i*50-pixels);
1887 }
1888 }
1889 const int j = 0;
1890
1891 int garbageSize=0;
1892 for(int i=0;i<20;i++)
1893 {
1894 if((board[j][i]/1000000)%10==1)
1895 {
1896 int left, right, over, under;
1897 int number = board[j][i];
1898 if(j<1) left = -1; else left = board[j-1][i];
1899 if(j>5) right = -1; else right = board[j+1][i];
1900 if(i>28) over = -1; else over = board[j][i+1];
1901 if(i<1) under = -1; else under = board[j][i-1];
1902 if(((left != number)&&(right == number)&&(over != number)&&(under == number))&&(garbageSize>0))
1903 {
1904 DrawIMG(smiley[board[j][i]%4],sBoard,100,600-i*50-pixels+25*garbageSize);
1905 }
1906 if(!((left != number)&&(right == number)&&(over == number)&&(under == number))) //not in garbage
1907 {
1908 garbageSize=0;
1909 }
1910 else
1911 {
1912 //cout << "In garbage" << endl;
1913 garbageSize++;
1914 }
1915
1916 }
1917 }
1918 }
1919
1920 //Paints the bricks gotten from a replay/net package
1921 void SimplePaintBricks()
1922 {
1923 /*
1924 We will need to mark the blocks that must have a bomb, we will here need to see, what is falling
1925 */
1926 bool bbomb[6][13]; //has a bom on it!
1927 bool falling[6][13]; //this is falling
1928 bool getReady[6][13]; //getReady
1929 for(int i=0;i<6;i++)
1930 for(int j=0;j<13;j++)
1931 {
1932 bbomb[i][j]=false; //All false by default
1933 falling[i][j]=false;
1934 if(board[i][j]>29)
1935 getReady[i][j]=true;
1936 else
1937 getReady[i][j]=false;
1938 }
1939 //See that is falling
1940 for(int i=0;i<6;i++)
1941 {
1942 bool rowFalling = false;
1943 for(int j=0;j<13;j++)
1944 {
1945 if(rowFalling)
1946 falling[i][j]=true;
1947 if((!rowFalling)&&(board[i][j]%30==-1))
1948 rowFalling = true;
1949 if((rowFalling)&&(board[i][j]%30>6))
1950 rowFalling = false;
1951 if(getReady[i][j])
1952 {
1953 falling[i][j]=true; //getReady is the same as falling
1954 rowFalling = false;
1955 }
1956 }
1957 }
1958 //Now looking at rows:
1959 for(int i=0;i<6;i++)
1960 {
1961 int count = 0;
1962 int color = -1;
1963 for(int j=1;j<13;j++)
1964 {
1965 if((board[i][j]%30==color)&&(!falling[i][j]))
1966 count++;
1967 else
1968 if(falling[i][j])
1969 {
1970 count = 0;
1971 }
1972 else
1973 {
1974 color=board[i][j]%30;
1975 count=1;
1976 }
1977 if((count>2)&&(color>-1)&&(color)<7)
1978 {
1979 bbomb[i][j]=true;
1980 bbomb[i][j-1]=true;
1981 bbomb[i][j-2]=true;
1982 }
1983 }
1984 }
1985 //now looking for lines
1986 for(int i=1;i<13;i++)
1987 {
1988 int count = 0;
1989 int color = -1;
1990 for(int j=0;j<6;j++)
1991 {
1992 if((board[j][i]%30==color)&&(!falling[j][i]))
1993 count++;
1994 else
1995 if(falling[j][i])
1996 {
1997 count = 0;
1998 }
1999 else
2000 {
2001 color=board[j][i]%30;
2002 count=1;
2003 }
2004 if((count>2)&&(color>-1)&&(color<7))
2005 {
2006 bbomb[j][i]=true;
2007 bbomb[j-1][i]=true;
2008 bbomb[j-2][i]=true;
2009 }
2010 }
2011 }
2012 for(int i=0;((i<13)&&(i<30));i++)
2013 for(int j=0;j<6;j++)
2014 {
2015 if((board[j][i]%10 != -1) && (board[j][i]%30 < 7))
2016 {
2017 DrawIMG(bricks[board[j][i]%10],sBoard,j*50,600-i*50-pixels);
2018 if(bbomb[j][i])
2019 DrawIMG(bomb[(SDL_GetTicks()/BOMBTIME)%2],sBoard,j*50,600-i*50-pixels);
2020 if(getReady[j][i])
2021 DrawIMG(ready[(SDL_GetTicks()/READYTIME)%2],sBoard,j*50,600-i*50-pixels);
2022 }
2023 if(board[j][i]%30>6)
2024 {
2025 if(board[j][i]%30==7)
2026 DrawIMG(garbageR,sBoard,j*50,600-i*50-pixels); //good
2027 if(board[j][i]%30==9)
2028 DrawIMG(garbageML,sBoard,j*50,600-i*50-pixels); //good
2029 if(board[j][i]%30==10)
2030 DrawIMG(garbageMR,sBoard,j*50,600-i*50-pixels); //good
2031 if(board[j][i]%30==11)
2032 DrawIMG(garbageTR,sBoard,j*50,600-i*50-pixels); //good
2033 if(board[j][i]%30==12)
2034 DrawIMG(garbageTL,sBoard,j*50,600-i*50-pixels); //good
2035 if(board[j][i]%30==13)
2036 DrawIMG(garbageBL,sBoard,j*50,600-i*50-pixels); //good
2037 if(board[j][i]%30==14)
2038 DrawIMG(garbageBR,sBoard,j*50,600-i*50-pixels); //good
2039 if(board[j][i]%30==15)
2040 DrawIMG(garbageM,sBoard,j*50,600-i*50-pixels); //good
2041 if(board[j][i]%30==16)
2042 DrawIMG(garbageFill,sBoard,j*50,600-i*50-pixels); //good
2043 if(board[j][i]%30==17)
2044 DrawIMG(garbageT,sBoard,j*50,600-i*50-pixels); //good
2045 if(board[j][i]%30==18)
2046 DrawIMG(garbageB,sBoard,j*50,600-i*50-pixels); //good
2047 if(board[j][i]%30==19)
2048 DrawIMG(garbageL,sBoard,j*50,600-i*50-pixels); //good
2049 //cout << "IS: " << board[j][i] << endl;
2050 }
2051
2052
2053 }
2054
2055 int garbageSize=0;
2056 for(int i=0;i<20;i++)
2057 {
2058 if((board[0][i]%30==12)&&(garbageSize>0))
2059 {
2060 DrawIMG(smiley[0],sBoard,100,600-i*50-pixels+25*garbageSize);
2061 }
2062 if(board[0][i]%30!=19) //not in garbage
2063 {
2064 garbageSize=0;
2065 }
2066 else
2067 {
2068 //cout << "In garbage" << endl;
2069 garbageSize++;
2070 }
2071
2072 }
2073 }
2074
2075 //Draws everything
2076 void DoPaintJob()
2077 {
2078 DrawIMG(backBoard,sBoard,0,0);
2079 if((!bReplaying)&&(!bNetworkPlayer))
2080 PaintBricks();
2081 else
2082 SimplePaintBricks();
2083 if(stageClear) DrawIMG(blackLine,sBoard,0,700+50*(stageClearLimit-linesCleared)-pixels-1);
2084 if(puzzleMode&&(!bGameOver))
2085 {
2086 //We need to write nr. of moves left!
2087 strHolder = "Moves left: " + itoa(MovesLeft);
2088 SFont_Write(sBoard,fBlueFont,5,5,strHolder.c_str());
2089 }
2090 #if defined(DEBUG)
2091 if(AI_Enabled&&(!bGameOver))
2092 {
2093 strHolder = "AI_status: " + itoa(AIstatus)+ ", "+ itoa(AIlineToClear);
2094 SFont_Write(sBoard,fBlueFont,5,5,strHolder.c_str());
2095 }
2096 #endif
2097 if(!bGameOver)DrawIMG(cursor[(SDL_GetTicks()/600)%2],sBoard,cursorx*50-4,550-cursory*50-pixels-4);
2098 if((int)SDL_GetTicks()<gameStartedAt)
2099 switch(abs((int)SDL_GetTicks()-gameStartedAt)/1000)
2100 {
2101 case 2:
2102 DrawIMG(counter[2],sBoard,100,250);
2103 break;
2104 case 1:
2105 DrawIMG(counter[1],sBoard,100,250);
2106 break;
2107 case 0:
2108 DrawIMG(counter[0],sBoard,100,250);
2109 break;
2110 default:
2111 break;
2112 }
2113 if(bGameOver)
2114 if(hasWonTheGame)DrawIMG(iWinner,sBoard,0,250);
2115 else if(bDraw) DrawIMG(iDraw,sBoard,0,250);
2116 else
2117 DrawIMG(iGameOver,sBoard,0,250);
2118 }
2119
2120 //Updates evrything, if not called nothing happends
2121 void Update()
2122 {
2123 int nowTime = SDL_GetTicks(); //We remember the time, so it don't change during this call
2124 if(bReplaying)
2125 {
2126 setBoard(theReplay.getFrameSec((Uint32)(nowTime-gameStartedAt)));
2127 if(theReplay.isFinnished((Uint32)(nowTime-gameStartedAt)))
2128 switch(theReplay.getFinalStatus())
2129 {
2130 case 1: //Winner
2131 bGameOver = true;
2132 hasWonTheGame = true;
2133 break;
2134 case 2: //Looser
2135 case 4: //GameOver
2136 bGameOver = true;
2137 break;
2138 case 3: //draw
2139 bGameOver =true;
2140 bDraw = true;
2141 break;
2142 default:
2143 bGameOver = true;
2144 //Nothing
2145 break;
2146 };
2147 }
2148 if((!bReplaying)&&(!bNetworkPlayer))
2149 {
2150 FindTowerHeight();
2151 if((linesCleared-TowerHeight>stageClearLimit) && (stageClear) && (!bGameOver))
2152 {
2153 stageCleared[Level] = true;
2154
2155 ofstream outfile;
2156 outfile.open(stageClearSavePath.c_str(), ios::binary |ios::trunc);
2157 if(!outfile)
2158 {
2159 cout << "Error writing to file: stageClear.save" << endl;
2160 }
2161 else
2162 {
2163 for(int i=0;i<nrOfStageLevels;i++)
2164 {
2165 bool tempBool = stageCleared[i];
2166 outfile.write(reinterpret_cast<char*>(&tempBool),sizeof(bool));
2167 }
2168 outfile.close();
2169 }
2170 setPlayerWon();
2171 }
2172 if((TowerHeight>12)&&(prevTowerHeight<13)&&(!puzzleMode))
2173 {
2174 if(SoundEnabled) Mix_PlayChannel(1,heartBeat,0);
2175 stop+=1000;
2176 }
2177
2178
2179 while(nowTime-gameStartedAt>nrStops*40) //Increase stops, till we reach nowTime
2180 {
2181 if (stop>0)
2182 {
2183 stop = stop-20;
2184 if(stop<=0) nrPushedPixel=(int)((nowTime-gameStartedAt)/(1000.0*speed));
2185 }
2186 if (stop<0)
2187 stop = 0;
2188 nrStops++;
2189 }
2190 //If we have static content, we don't raise at all!
2191 if(hasStaticContent())
2192 stop++;
2193 if((puzzleMode)&&(!bGameOver)&&BoardEmpty())
2194 {
2195 if(!singlePuzzle)
2196 {
2197 puzzleCleared[Level] = true;
2198 ofstream outfile;
2199 outfile.open(puzzleSavePath.c_str(), ios::binary |ios::trunc);
2200 if(!outfile)
2201 {
2202 cout << "Error writing to file: " << puzzleSavePath << endl;
2203 }
2204 else
2205 {
2206 for(int i=0;i<nrOfPuzzles;i++)
2207 {
2208 bool tempBool = puzzleCleared[i];
2209 outfile.write(reinterpret_cast<char*>(&tempBool),sizeof(bool));
2210 }
2211 outfile.close();
2212 }
2213 }
2214 setPlayerWon();
2215 }
2216 //increse speed:
2217 if ((nowTime-gameStartedAt>20000*speedLevel)&&(speedLevel <99)&&(!bGameOver))
2218 { speed = (baseSpeed*0.9)/((double)speedLevel*0.5); speedLevel++; nrPushedPixel=(int)((double)(nowTime-gameStartedAt)/(1000.0*speed));}
2219 //To prevent the stack from raising a lot then we stop a chain (don't work anymore)
2220 if(chain>0)
2221 stop+=1;
2222 //Raises the stack
2223 if ((nowTime-gameStartedAt>nrPushedPixel*1000*speed) && (!bGameOver)&&(!stop))
2224 while((nowTime-gameStartedAt>nrPushedPixel*1000*speed)&&(!(puzzleMode)))
2225 PushPixels();
2226 if(!bGameOver)ClearBlocks();
2227 /*************************************************************
2228 Ai stuff
2229 **************************************************************/
2230 if(bGameOver) {
2231 AIstatus = 0; //Enusres that AI is resetted
2232 }
2233 else
2234 if(AI_Enabled)
2235 if(lastAImove+AI_MoveSpeed<SDL_GetTicks())
2236 {
2237 AI_Move();
2238 lastAImove=SDL_GetTicks();
2239 }
2240
2241 /*************************************************************
2242 Ai stuff ended
2243 **************************************************************/
2244 if ((nowTime>gameStartedAt+nrFellDown*140) && (!bGameOver)) FallDown();
2245 if((nowTime<gameStartedAt)&&(puzzleMode)) {FallDown(); nrFellDown--;}
2246 ReduceStuff();
2247 if ((timetrial) && (!bGameOver) && (nowTime-gameStartedAt>2*60*1000))
2248 {
2249 if(SoundEnabled) Mix_PlayChannel(1,timesUp,0);
2250 if((theTopScoresTimeTrial.isHighScore(score))&&(!AI_Enabled))
2251 {
2252 theTopScoresTimeTrial.addScore(name,score);
2253 //new highscore
2254 }
2255 SetGameOver();
2256 }
2257 }
2258 if((!bGameOver)&&(!bReplaying))
2259 theReplay.setFrameSecTo((Uint32)(nowTime-gameStartedAt),getPackage());
2260 DoPaintJob();
2261 }
2262
2263 }; //class BlockGame
2264 ////////////////////////////////////////////////////////////////////////////////
2265 ///////////////////////// BlockAttack class end ////////////////////////////////
2266 ////////////////////////////////////////////////////////////////////////////////
0 /*
1 Copyright (C) 2004 Lion Vollnhals
2 Copyright (C) 2003 Matthias Braun
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18 #ifndef __LIB_2D_FONT_HPP__
19 #define __LIB_2D_FONT_HPP__
20
21 #include <string>
22 #include <stdexcept>
23 #include "SFont.h"
24
25 /** A thin c++ wrapper around my custom SFont version */
26 class SFont
27 {
28 public:
29 int getHeight() const
30 { return SFont_TextHeight(font); }
31
32 int getTextWidth(const char* text) const
33 { return SFont_TextWidth(font, text); }
34 int getTextWidth(const std::string& text) const
35 { return getTextWidth(text.c_str()); }
36
37 void write(SDL_Surface* surface, const char* text, int x, int y) const
38 { SFont_Write(surface, font, x, y, text); }
39
40 void write(SDL_Surface* surface, const std::string& text, int x, int y) const
41 { Write(surface, text.c_str(), x, y); }
42
43 Font(SDL_Surface* surface)
44 {
45 font = SFont_InitFont(surface);
46 if(!font)
47 throw std::runtime_error("Couldn't initialize font.");
48 }
49 ~Font()
50 { SFont_FreeFont(font); }
51
52 private:
53 SFont_Font* font;
54 };
55
56 #endif
57
58
0 GNU GENERAL PUBLIC LICENSE
1 Version 2, June 1991
2
3 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
4 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
5 Everyone is permitted to copy and distribute verbatim copies
6 of this license document, but changing it is not allowed.
7
8 Preamble
9
10 The licenses for most software are designed to take away your
11 freedom to share and change it. By contrast, the GNU General Public
12 License is intended to guarantee your freedom to share and change free
13 software--to make sure the software is free for all its users. This
14 General Public License applies to most of the Free Software
15 Foundation's software and to any other program whose authors commit to
16 using it. (Some other Free Software Foundation software is covered by
17 the GNU Library General Public License instead.) You can apply it to
18 your programs, too.
19
20 When we speak of free software, we are referring to freedom, not
21 price. Our General Public Licenses are designed to make sure that you
22 have the freedom to distribute copies of free software (and charge for
23 this service if you wish), that you receive source code or can get it
24 if you want it, that you can change the software or use pieces of it
25 in new free programs; and that you know you can do these things.
26
27 To protect your rights, we need to make restrictions that forbid
28 anyone to deny you these rights or to ask you to surrender the rights.
29 These restrictions translate to certain responsibilities for you if you
30 distribute copies of the software, or if you modify it.
31
32 For example, if you distribute copies of such a program, whether
33 gratis or for a fee, you must give the recipients all the rights that
34 you have. You must make sure that they, too, receive or can get the
35 source code. And you must show them these terms so they know their
36 rights.
37
38 We protect your rights with two steps: (1) copyright the software, and
39 (2) offer you this license which gives you legal permission to copy,
40 distribute and/or modify the software.
41
42 Also, for each author's protection and ours, we want to make certain
43 that everyone understands that there is no warranty for this free
44 software. If the software is modified by someone else and passed on, we
45 want its recipients to know that what they have is not the original, so
46 that any problems introduced by others will not reflect on the original
47 authors' reputations.
48
49 Finally, any free program is threatened constantly by software
50 patents. We wish to avoid the danger that redistributors of a free
51 program will individually obtain patent licenses, in effect making the
52 program proprietary. To prevent this, we have made it clear that any
53 patent must be licensed for everyone's free use or not licensed at all.
54
55 The precise terms and conditions for copying, distribution and
56 modification follow.
57
58 GNU GENERAL PUBLIC LICENSE
59 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
60
61 0. This License applies to any program or other work which contains
62 a notice placed by the copyright holder saying it may be distributed
63 under the terms of this General Public License. The "Program", below,
64 refers to any such program or work, and a "work based on the Program"
65 means either the Program or any derivative work under copyright law:
66 that is to say, a work containing the Program or a portion of it,
67 either verbatim or with modifications and/or translated into another
68 language. (Hereinafter, translation is included without limitation in
69 the term "modification".) Each licensee is addressed as "you".
70
71 Activities other than copying, distribution and modification are not
72 covered by this License; they are outside its scope. The act of
73 running the Program is not restricted, and the output from the Program
74 is covered only if its contents constitute a work based on the
75 Program (independent of having been made by running the Program).
76 Whether that is true depends on what the Program does.
77
78 1. You may copy and distribute verbatim copies of the Program's
79 source code as you receive it, in any medium, provided that you
80 conspicuously and appropriately publish on each copy an appropriate
81 copyright notice and disclaimer of warranty; keep intact all the
82 notices that refer to this License and to the absence of any warranty;
83 and give any other recipients of the Program a copy of this License
84 along with the Program.
85
86 You may charge a fee for the physical act of transferring a copy, and
87 you may at your option offer warranty protection in exchange for a fee.
88
89 2. You may modify your copy or copies of the Program or any portion
90 of it, thus forming a work based on the Program, and copy and
91 distribute such modifications or work under the terms of Section 1
92 above, provided that you also meet all of these conditions:
93
94 a) You must cause the modified files to carry prominent notices
95 stating that you changed the files and the date of any change.
96
97 b) You must cause any work that you distribute or publish, that in
98 whole or in part contains or is derived from the Program or any
99 part thereof, to be licensed as a whole at no charge to all third
100 parties under the terms of this License.
101
102 c) If the modified program normally reads commands interactively
103 when run, you must cause it, when started running for such
104 interactive use in the most ordinary way, to print or display an
105 announcement including an appropriate copyright notice and a
106 notice that there is no warranty (or else, saying that you provide
107 a warranty) and that users may redistribute the program under
108 these conditions, and telling the user how to view a copy of this
109 License. (Exception: if the Program itself is interactive but
110 does not normally print such an announcement, your work based on
111 the Program is not required to print an announcement.)
112
113 These requirements apply to the modified work as a whole. If
114 identifiable sections of that work are not derived from the Program,
115 and can be reasonably considered independent and separate works in
116 themselves, then this License, and its terms, do not apply to those
117 sections when you distribute them as separate works. But when you
118 distribute the same sections as part of a whole which is a work based
119 on the Program, the distribution of the whole must be on the terms of
120 this License, whose permissions for other licensees extend to the
121 entire whole, and thus to each and every part regardless of who wrote it.
122
123 Thus, it is not the intent of this section to claim rights or contest
124 your rights to work written entirely by you; rather, the intent is to
125 exercise the right to control the distribution of derivative or
126 collective works based on the Program.
127
128 In addition, mere aggregation of another work not based on the Program
129 with the Program (or with a work based on the Program) on a volume of
130 a storage or distribution medium does not bring the other work under
131 the scope of this License.
132
133 3. You may copy and distribute the Program (or a work based on it,
134 under Section 2) in object code or executable form under the terms of
135 Sections 1 and 2 above provided that you also do one of the following:
136
137 a) Accompany it with the complete corresponding machine-readable
138 source code, which must be distributed under the terms of Sections
139 1 and 2 above on a medium customarily used for software interchange; or,
140
141 b) Accompany it with a written offer, valid for at least three
142 years, to give any third party, for a charge no more than your
143 cost of physically performing source distribution, a complete
144 machine-readable copy of the corresponding source code, to be
145 distributed under the terms of Sections 1 and 2 above on a medium
146 customarily used for software interchange; or,
147
148 c) Accompany it with the information you received as to the offer
149 to distribute corresponding source code. (This alternative is
150 allowed only for noncommercial distribution and only if you
151 received the program in object code or executable form with such
152 an offer, in accord with Subsection b above.)
153
154 The source code for a work means the preferred form of the work for
155 making modifications to it. For an executable work, complete source
156 code means all the source code for all modules it contains, plus any
157 associated interface definition files, plus the scripts used to
158 control compilation and installation of the executable. However, as a
159 special exception, the source code distributed need not include
160 anything that is normally distributed (in either source or binary
161 form) with the major components (compiler, kernel, and so on) of the
162 operating system on which the executable runs, unless that component
163 itself accompanies the executable.
164
165 If distribution of executable or object code is made by offering
166 access to copy from a designated place, then offering equivalent
167 access to copy the source code from the same place counts as
168 distribution of the source code, even though third parties are not
169 compelled to copy the source along with the object code.
170
171 4. You may not copy, modify, sublicense, or distribute the Program
172 except as expressly provided under this License. Any attempt
173 otherwise to copy, modify, sublicense or distribute the Program is
174 void, and will automatically terminate your rights under this License.
175 However, parties who have received copies, or rights, from you under
176 this License will not have their licenses terminated so long as such
177 parties remain in full compliance.
178
179 5. You are not required to accept this License, since you have not
180 signed it. However, nothing else grants you permission to modify or
181 distribute the Program or its derivative works. These actions are
182 prohibited by law if you do not accept this License. Therefore, by
183 modifying or distributing the Program (or any work based on the
184 Program), you indicate your acceptance of this License to do so, and
185 all its terms and conditions for copying, distributing or modifying
186 the Program or works based on it.
187
188 6. Each time you redistribute the Program (or any work based on the
189 Program), the recipient automatically receives a license from the
190 original licensor to copy, distribute or modify the Program subject to
191 these terms and conditions. You may not impose any further
192 restrictions on the recipients' exercise of the rights granted herein.
193 You are not responsible for enforcing compliance by third parties to
194 this License.
195
196 7. If, as a consequence of a court judgment or allegation of patent
197 infringement or for any other reason (not limited to patent issues),
198 conditions are imposed on you (whether by court order, agreement or
199 otherwise) that contradict the conditions of this License, they do not
200 excuse you from the conditions of this License. If you cannot
201 distribute so as to satisfy simultaneously your obligations under this
202 License and any other pertinent obligations, then as a consequence you
203 may not distribute the Program at all. For example, if a patent
204 license would not permit royalty-free redistribution of the Program by
205 all those who receive copies directly or indirectly through you, then
206 the only way you could satisfy both it and this License would be to
207 refrain entirely from distribution of the Program.
208
209 If any portion of this section is held invalid or unenforceable under
210 any particular circumstance, the balance of the section is intended to
211 apply and the section as a whole is intended to apply in other
212 circumstances.
213
214 It is not the purpose of this section to induce you to infringe any
215 patents or other property right claims or to contest validity of any
216 such claims; this section has the sole purpose of protecting the
217 integrity of the free software distribution system, which is
218 implemented by public license practices. Many people have made
219 generous contributions to the wide range of software distributed
220 through that system in reliance on consistent application of that
221 system; it is up to the author/donor to decide if he or she is willing
222 to distribute software through any other system and a licensee cannot
223 impose that choice.
224
225 This section is intended to make thoroughly clear what is believed to
226 be a consequence of the rest of this License.
227
228 8. If the distribution and/or use of the Program is restricted in
229 certain countries either by patents or by copyrighted interfaces, the
230 original copyright holder who places the Program under this License
231 may add an explicit geographical distribution limitation excluding
232 those countries, so that distribution is permitted only in or among
233 countries not thus excluded. In such case, this License incorporates
234 the limitation as if written in the body of this License.
235
236 9. The Free Software Foundation may publish revised and/or new versions
237 of the General Public License from time to time. Such new versions will
238 be similar in spirit to the present version, but may differ in detail to
239 address new problems or concerns.
240
241 Each version is given a distinguishing version number. If the Program
242 specifies a version number of this License which applies to it and "any
243 later version", you have the option of following the terms and conditions
244 either of that version or of any later version published by the Free
245 Software Foundation. If the Program does not specify a version number of
246 this License, you may choose any version ever published by the Free Software
247 Foundation.
248
249 10. If you wish to incorporate parts of the Program into other free
250 programs whose distribution conditions are different, write to the author
251 to ask for permission. For software which is copyrighted by the Free
252 Software Foundation, write to the Free Software Foundation; we sometimes
253 make exceptions for this. Our decision will be guided by the two goals
254 of preserving the free status of all derivatives of our free software and
255 of promoting the sharing and reuse of software generally.
256
257 NO WARRANTY
258
259 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
260 FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
261 OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
262 PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
263 OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
264 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
265 TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
266 PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
267 REPAIR OR CORRECTION.
268
269 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
270 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
271 REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
272 INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
273 OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
274 TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
275 YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
276 PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
277 POSSIBILITY OF SUCH DAMAGES.
278
279 END OF TERMS AND CONDITIONS
280
281 How to Apply These Terms to Your New Programs
282
283 If you develop a new program, and you want it to be of the greatest
284 possible use to the public, the best way to achieve this is to make it
285 free software which everyone can redistribute and change under these terms.
286
287 To do so, attach the following notices to the program. It is safest
288 to attach them to the start of each source file to most effectively
289 convey the exclusion of warranty; and each file should have at least
290 the "copyright" line and a pointer to where the full notice is found.
291
292 <one line to give the program's name and a brief idea of what it does.>
293 Copyright (C) <year> <name of author>
294
295 This program is free software; you can redistribute it and/or modify
296 it under the terms of the GNU General Public License as published by
297 the Free Software Foundation; either version 2 of the License, or
298 (at your option) any later version.
299
300 This program is distributed in the hope that it will be useful,
301 but WITHOUT ANY WARRANTY; without even the implied warranty of
302 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
303 GNU General Public License for more details.
304
305 You should have received a copy of the GNU General Public License
306 along with this program; if not, write to the Free Software
307 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
308
309
310 Also add information on how to contact you by electronic and paper mail.
311
312 If the program is interactive, make it output a short notice like this
313 when it starts in an interactive mode:
314
315 Gnomovision version 69, Copyright (C) year name of author
316 Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317 This is free software, and you are welcome to redistribute it
318 under certain conditions; type `show c' for details.
319
320 The hypothetical commands `show w' and `show c' should show the appropriate
321 parts of the General Public License. Of course, the commands you use may
322 be called something other than `show w' and `show c'; they could even be
323 mouse-clicks or menu items--whatever suits your program.
324
325 You should also get your employer (if you work as a programmer) or your
326 school, if any, to sign a "copyright disclaimer" for the program, if
327 necessary. Here is a sample; alter the names:
328
329 Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330 `Gnomovision' (which makes passes at compilers) written by James Hacker.
331
332 <signature of Ty Coon>, 1 April 1989
333 Ty Coon, President of Vice
334
335 This General Public License does not permit incorporating your program into
336 proprietary programs. If your program is a subroutine library, you may
337 consider it more useful to permit linking proprietary applications with the
338 library. If this is what you want to do, use the GNU Library General
339 Public License instead of this License.
0 #-------------#
1 # Import Vars #
2 #-------------#
3 Import('*')
4
5 env.Install ('$destdir/$sharedir/gfx/smileys/',[
6 'gfx/smileys/0.png',
7 'gfx/smileys/1.png',
8 'gfx/smileys/2.png',
9 'gfx/smileys/3.png'])
10 env.Alias('install',['$destdir/$sharedir/gfx/smileys'])
11
12 env.Install ('$destdir/$sharedir/gfx/garbage/',[
13 'gfx/garbage/garbageB.png',
14 'gfx/garbage/garbageBL.png',
15 'gfx/garbage/garbageBR.png',
16 'gfx/garbage/garbageFill.png',
17 'gfx/garbage/garbageGM.png',
18 'gfx/garbage/garbageGML.png',
19 'gfx/garbage/garbageGMR.png',
20 'gfx/garbage/garbageL.png',
21 'gfx/garbage/garbageM.png',
22 'gfx/garbage/garbageML.png',
23 'gfx/garbage/garbageMR.png',
24 'gfx/garbage/garbageR.png',
25 'gfx/garbage/garbageT.png',
26 'gfx/garbage/garbageTL.png',
27 'gfx/garbage/garbageTR.png'])
28 env.Alias('install', ['$destdir/$sharedir/gfx/garbage'])
29
30 env.Install ('$destdir/$sharedir/gfx/counter/',[
31 'gfx/counter/1.png',
32 'gfx/counter/2.png',
33 'gfx/counter/3.png'])
34 env.Alias('install', ['$destdir/$sharedir/gfx/counter'])
35
36 env.Install ('$destdir/$sharedir/gfx/balls/',[
37 'gfx/balls/ballYellow.png',
38 'gfx/balls/ballTurkish.png',
39 'gfx/balls/ballRed.png',
40 'gfx/balls/ballPurple.png',
41 'gfx/balls/ballGreen.png',
42 'gfx/balls/ballGray.png',
43 'gfx/balls/ballBlue.png'])
44 env.Alias('install', ['$destdir/$sharedir/gfx/balls'])
45
46 env.Install ('$destdir/$sharedir/gfx/animations/bomb/',[
47 'gfx/animations/bomb/bomb_1.png',
48 'gfx/animations/bomb/bomb_2.png'])
49 env.Alias('install', ['$destdir/$sharedir/gfx/animations'])
50
51 env.Install ('$destdir/$sharedir/gfx/animations/explosion/',[
52 'gfx/animations/explosion/3.png',
53 'gfx/animations/explosion/2.png',
54 'gfx/animations/explosion/1.png',
55 'gfx/animations/explosion/0.png'])
56 env.Alias('install', ['$destdir/$sharedir/gfx/animations/explosion'])
57
58
59 env.Install ('$destdir/$sharedir/gfx/animations/cursor/',[
60 'gfx/animations/cursor/2.png',
61 'gfx/animations/cursor/1.png'])
62 env.Alias('install', ['$destdir/$sharedir/gfx/animations/cursor'])
63
64
65 env.Install ('$destdir/$sharedir/gfx/animations/ready/',[
66 'gfx/animations/ready/ready_2.png',
67 'gfx/animations/ready/ready_1.png'])
68 env.Alias('install', ['$destdir/$sharedir/gfx/animations/ready'])
69
70 env.Install ('$destdir/$sharedir/gfx/',[
71 'gfx/bSave.png',
72 'gfx/bReplays.png',
73 'gfx/bLoad.png',
74 'gfx/chainFrame.png',
75 'gfx/14P_Arial_Angle_Red.png',
76 'gfx/SmallStone.png',
77 'gfx/iGameOver.png',
78 'gfx/background1.png',
79 'gfx/blackBackGround.png',
80 'gfx/green.png',
81 'gfx/blue.png',
82 'gfx/yellow.png',
83 'gfx/turkish.png',
84 'gfx/red.png',
85 'gfx/purple.png',
86 'gfx/grey.png',
87 'gfx/blockAttack.ico',
88 'gfx/bForward.png',
89 'gfx/bConfigure.png',
90 'gfx/bSelectPuzzle.png',
91 'gfx/fileDialogbox.png',
92 'gfx/background.png',
93 'gfx/iCheckBoxArea.png',
94 'gfx/changeButtonsBack.png',
95 'gfx/BackBoard.png',
96 'gfx/boardBackBack.png',
97 'gfx/bHowToPlay.png',
98 'gfx/bOnePlayer.png',
99 'gfx/crossover.png',
100 'gfx/topscores.png',
101 'gfx/24P_Arial_Blue.png','gfx/garbage/garbageFill.png',
102 'gfx/bVsGame.png',
103 'gfx/iLoser.png',
104 'gfx/bTwoPlayers.png',
105 'gfx/bTimeTrial.png',
106 'gfx/bStageClear.png',
107 'gfx/bPuzzle.png',
108 'gfx/dialogbox.png',
109 'gfx/iLevelCheck.png',
110 'gfx/iLevelCheckBox.png',
111 'gfx/bOn.png',
112 'gfx/bNewGame.png',
113 'gfx/bNetwork.png',
114 'gfx/iWinner.png',
115 'gfx/iStageClearLimit.png',
116 'gfx/bInternet.png',
117 'gfx/options.png',
118 'gfx/bBack.png',
119 'gfx/bHighScore.png',
120 'gfx/bExit.png',
121 'gfx/bEndless.png',
122 'gfx/bConnect.png',
123 'gfx/icon.png',
124 'gfx/bChange.png',
125 'gfx/Thumbs.db',
126 'gfx/bHost.png',
127 'gfx/b1600.png',
128 'gfx/b1400.png',
129 'gfx/b1280.png',
130 'gfx/iCheckBoxArea2.png',
131 'gfx/blackLine.png',
132 'gfx/b1024.png',
133 'gfx/bOptions.png',
134 'gfx/changeButtonsBack1.png',
135 'gfx/iDraw.png',
136 'gfx/bOff.png',
137 'gfx/mouse.png'])
138 env.Alias('install', ['$destdir/$sharedir/gfx'])
139
140 env.Install ('$destdir/$sharedir/sound/',[
141 'sound/applause.ogg',
142 'sound/whistleblow.ogg',
143 'sound/heartbeat3.ogg',
144 'sound/explosion.ogg',
145 'sound/typing.ogg',
146 'sound/cameraclick.ogg',
147 'sound/pop.ogg',
148 'sound/counter.ogg'])
149 env.Alias('install', ['$destdir/$sharedir/sound'])
150
151 env.Install ('$destdir/$sharedir/res/',[
152 'res/testPuzzles',
153 'res/copy',
154 'res/puzzle.levels'])
155 env.Alias('install', ['$destdir/$sharedir/res'])
156
157 env.Install ('$destdir/$sharedir/music/',[
158 'music/bgMusic.ogg'])
159 env.Alias('install', ['$destdir/$sharedir/music'])
0 #-------------#
1 # Import Vars #
2 #-------------#
3 Import('*')
4
5 env.Install ('$sharedir/gfx/garbage/',[
6 'gfx/garbage/garbageB.png',
7 'gfx/garbage/garbageBL.png',
8 'gfx/garbage/garbageBR.png',
9 'gfx/garbage/garbageFill.png',
10 'gfx/garbage/garbageL.png',
11 'gfx/garbage/garbageM.png',
12 'gfx/garbage/garbageML.png',
13 'gfx/garbage/garbageMR.png',
14 'gfx/garbage/garbageR.png',
15 'gfx/garbage/garbageT.png',
16 'gfx/garbage/garbageTL.png',
17 'gfx/garbage/garbageTR.png'])
18 env.Alias('install', ['$sharedir/gfx/garbage'])
19
20 env.Install ('$sharedir/gfx/counter/',[
21 'gfx/counter/1.png',
22 'gfx/counter/2.png',
23 'gfx/counter/3.png'])
24 env.Alias('install', ['$sharedir/gfx/counter'])
25
26 env.Install ('$sharedir/gfx/balls/',[
27 'gfx/balls/ballYellow.png',
28 'gfx/balls/ballTurkish.png',
29 'gfx/balls/ballRed.png',
30 'gfx/balls/ballPurple.png',
31 'gfx/balls/ballGreen.png',
32 'gfx/balls/ballGray.png',
33 'gfx/balls/ballBlue.png'])
34 env.Alias('install', ['$sharedir/gfx/balls'])
35
36 env.Install ('$sharedir/gfx/animations/bomb/',[
37 'gfx/animations/bomb/bomb_1.png',
38 'gfx/animations/bomb/bomb_2.png'])
39 env.Alias('install', ['$sharedir/gfx/animations'])
40
41 env.Install ('$sharedir/gfx/animations/explosion/',[
42 'gfx/animations/explosion/3.png',
43 'gfx/animations/explosion/2.png',
44 'gfx/animations/explosion/1.png',
45 'gfx/animations/explosion/0.png'])
46 env.Alias('install', ['$sharedir/gfx/animations/explosion'])
47
48
49 env.Install ('$sharedir/gfx/animations/cursor/',[
50 'gfx/animations/cursor/2.png',
51 'gfx/animations/cursor/1.png'])
52 env.Alias('install', ['$sharedir/gfx/animations/cursor'])
53
54
55 env.Install ('$sharedir/gfx/animations/ready/',[
56 'gfx/animations/ready/ready_2.png',
57 'gfx/animations/ready/ready_1.png'])
58 env.Alias('install', ['$sharedir/gfx/animations/ready'])
59
60 env.Install ('$sharedir/gfx/nyBrikker/',[
61 'gfx/nyBrikker/yellow.png',
62 'gfx/nyBrikker/turkish.png',
63 'gfx/nyBrikker/red.png',
64 'gfx/nyBrikker/purple.png',
65 'gfx/nyBrikker/grey.png',
66 'gfx/nyBrikker/green.png',
67 'gfx/nyBrikker/blue.png'])
68 env.Alias('install', ['$sharedir/gfx/nyBrikker'])
69
70
71 env.Install ('$sharedir/gfx/',[
72 'gfx/bSave.png',
73 'gfx/bReplays.png',
74 'gfx/bLoad.png',
75 'gfx/chainFrame.png',
76 'gfx/14P_Arial_Angle_Red.png',
77 'gfx/SmallStone.png',
78 'gfx/iGameOver.png',
79 'gfx/background1.png',
80 'gfx/blackBackGround.png',
81 'gfx/green.png',
82 'gfx/blue.png',
83 'gfx/yellow.png',
84 'gfx/turkish.png',
85 'gfx/red.png',
86 'gfx/purple.png',
87 'gfx/grey.png',
88 'gfx/blockAttack.ico',
89 'gfx/bForward.png',
90 'gfx/bConfigure.png',
91 'gfx/bSelectPuzzle.png',
92 'gfx/fileDialogbox.png',
93 'gfx/background.png',
94 'gfx/iCheckBoxArea.png',
95 'gfx/changeButtonsBack.png',
96 'gfx/BackBoard.png',
97 'gfx/boardBackBack.png',
98 'gfx/bHowToPlay.png',
99 'gfx/bOnePlayer.png',
100 'gfx/crossover.png',
101 'gfx/topscores.png',
102 'gfx/24P_Arial_Blue.png',
103 'gfx/bVsGame.png',
104 'gfx/iLoser.png',
105 'gfx/bTwoPlayers.png',
106 'gfx/bTimeTrial.png',
107 'gfx/bStageClear.png',
108 'gfx/bPuzzle.png',
109 'gfx/dialogbox.png',
110 'gfx/iLevelCheck.png',
111 'gfx/iLevelCheckBox.png',
112 'gfx/bOn.png',
113 'gfx/bNewGame.png',
114 'gfx/bNetwork.png',
115 'gfx/iWinner.png',
116 'gfx/iStageClearLimit.png',
117 'gfx/bInternet.png',
118 'gfx/options.png',
119 'gfx/bBack.png',
120 'gfx/bHighScore.png',
121 'gfx/bExit.png',
122 'gfx/bEndless.png',
123 'gfx/bConnect.png',
124 'gfx/icon.png',
125 'gfx/bChange.png',
126 'gfx/Thumbs.db',
127 'gfx/bHost.png',
128 'gfx/b1600.png',
129 'gfx/b1400.png',
130 'gfx/b1280.png',
131 'gfx/iCheckBoxArea2.png',
132 'gfx/blackLine.png',
133 'gfx/b1024.png',
134 'gfx/bOptions.png',
135 'gfx/changeButtonsBack1.png',
136 'gfx/iDraw.png',
137 'gfx/bOff.png',
138 'gfx/mouse.png'])
139 env.Alias('install', ['$sharedir/gfx'])
140
141 env.Install ('$sharedir/sound/',[
142 'sound/applause.ogg',
143 'sound/whistleblow.ogg',
144 'sound/heartbeat3.ogg',
145 'sound/explosion.ogg',
146 'sound/typing.ogg',
147 'sound/cameraclick.ogg',
148 'sound/pop.ogg',
149 'sound/counter.ogg'])
150 env.Alias('install', ['$sharedir/sound'])
151
152 env.Install ('$sharedir/res/',[
153 'res/testPuzzles',
154 'res/copy',
155 'res/puzzle.levels'])
156 env.Alias('install', ['$sharedir/res'])
157
158 env.Install ('$sharedir/music/',[
159 'music/bgMusic.ogg'])
160 env.Alias('install', ['$sharedir/music'])
0 #-------------#
1 # Import Vars #
2 #-------------#
3 Import('*')
4
5 env.Install ('$destdir/$sharedir/gfx/smileys/',[
6 'gfx/smileys/0.png',
7 'gfx/smileys/1.png',
8 'gfx/smileys/2.png',
9 'gfx/smileys/3.png'])
10 env.Alias('install',['$destdir/$sharedir/gfx/smileys'])
11
12 env.Install ('$destdir/$sharedir/gfx/garbage/',[
13 'gfx/garbage/garbageB.png',
14 'gfx/garbage/garbageBL.png',
15 'gfx/garbage/garbageBR.png',
16 'gfx/garbage/garbageFill.png',
17 'gfx/garbage/garbageGM.png',
18 'gfx/garbage/garbageGML.png',
19 'gfx/garbage/garbageGMR.png',
20 'gfx/garbage/garbageL.png',
21 'gfx/garbage/garbageM.png',
22 'gfx/garbage/garbageML.png',
23 'gfx/garbage/garbageMR.png',
24 'gfx/garbage/garbageR.png',
25 'gfx/garbage/garbageT.png',
26 'gfx/garbage/garbageTL.png',
27 'gfx/garbage/garbageTR.png'])
28 env.Alias('install', ['$destdir/$sharedir/gfx/garbage'])
29
30 env.Install ('$destdir/$sharedir/gfx/counter/',[
31 'gfx/counter/1.png',
32 'gfx/counter/2.png',
33 'gfx/counter/3.png'])
34 env.Alias('install', ['$destdir/$sharedir/gfx/counter'])
35
36 env.Install ('$destdir/$sharedir/gfx/balls/',[
37 'gfx/balls/ballYellow.png',
38 'gfx/balls/ballTurkish.png',
39 'gfx/balls/ballRed.png',
40 'gfx/balls/ballPurple.png',
41 'gfx/balls/ballGreen.png',
42 'gfx/balls/ballGray.png',
43 'gfx/balls/ballBlue.png'])
44 env.Alias('install', ['$destdir/$sharedir/gfx/balls'])
45
46 env.Install ('$destdir/$sharedir/gfx/animations/bomb/',[
47 'gfx/animations/bomb/bomb_1.png',
48 'gfx/animations/bomb/bomb_2.png'])
49 env.Alias('install', ['$destdir/$sharedir/gfx/animations'])
50
51 env.Install ('$destdir/$sharedir/gfx/animations/explosion/',[
52 'gfx/animations/explosion/3.png',
53 'gfx/animations/explosion/2.png',
54 'gfx/animations/explosion/1.png',
55 'gfx/animations/explosion/0.png'])
56 env.Alias('install', ['$destdir/$sharedir/gfx/animations/explosion'])
57
58
59 env.Install ('$destdir/$sharedir/gfx/animations/cursor/',[
60 'gfx/animations/cursor/2.png',
61 'gfx/animations/cursor/1.png'])
62 env.Alias('install', ['$destdir/$sharedir/gfx/animations/cursor'])
63
64
65 env.Install ('$destdir/$sharedir/gfx/animations/ready/',[
66 'gfx/animations/ready/ready_2.png',
67 'gfx/animations/ready/ready_1.png'])
68 env.Alias('install', ['$destdir/$sharedir/gfx/animations/ready'])
69
70 env.Install ('$destdir/$sharedir/gfx/',[
71 'gfx/bSave.png',
72 'gfx/bReplays.png',
73 'gfx/bLoad.png',
74 'gfx/chainFrame.png',
75 'gfx/14P_Arial_Angle_Red.png',
76 'gfx/SmallStone.png',
77 'gfx/iGameOver.png',
78 'gfx/background1.png',
79 'gfx/blackBackGround.png',
80 'gfx/green.png',
81 'gfx/blue.png',
82 'gfx/yellow.png',
83 'gfx/turkish.png',
84 'gfx/red.png',
85 'gfx/purple.png',
86 'gfx/grey.png',
87 'gfx/blockAttack.ico',
88 'gfx/bForward.png',
89 'gfx/bConfigure.png',
90 'gfx/bSelectPuzzle.png',
91 'gfx/fileDialogbox.png',
92 'gfx/background.png',
93 'gfx/iCheckBoxArea.png',
94 'gfx/changeButtonsBack.png',
95 'gfx/BackBoard.png',
96 'gfx/boardBackBack.png',
97 'gfx/bHowToPlay.png',
98 'gfx/bOnePlayer.png',
99 'gfx/crossover.png',
100 'gfx/topscores.png',
101 'gfx/24P_Arial_Blue.png','gfx/garbage/garbageFill.png',
102 'gfx/bVsGame.png',
103 'gfx/iLoser.png',
104 'gfx/bTwoPlayers.png',
105 'gfx/bTimeTrial.png',
106 'gfx/bStageClear.png',
107 'gfx/bPuzzle.png',
108 'gfx/dialogbox.png',
109 'gfx/iLevelCheck.png',
110 'gfx/iLevelCheckBox.png',
111 'gfx/bOn.png',
112 'gfx/bNewGame.png',
113 'gfx/bNetwork.png',
114 'gfx/iWinner.png',
115 'gfx/iStageClearLimit.png',
116 'gfx/bInternet.png',
117 'gfx/options.png',
118 'gfx/bBack.png',
119 'gfx/bHighScore.png',
120 'gfx/bExit.png',
121 'gfx/bEndless.png',
122 'gfx/bConnect.png',
123 'gfx/icon.png',
124 'gfx/bChange.png',
125 'gfx/Thumbs.db',
126 'gfx/bHost.png',
127 'gfx/b1600.png',
128 'gfx/b1400.png',
129 'gfx/b1280.png',
130 'gfx/iCheckBoxArea2.png',
131 'gfx/blackLine.png',
132 'gfx/b1024.png',
133 'gfx/bOptions.png',
134 'gfx/changeButtonsBack1.png',
135 'gfx/iDraw.png',
136 'gfx/bOff.png',
137 'gfx/mouse.png'])
138 env.Alias('install', ['$destdir/$sharedir/gfx'])
139
140 env.Install ('$destdir/$sharedir/sound/',[
141 'sound/applause.ogg',
142 'sound/whistleblow.ogg',
143 'sound/heartbeat3.ogg',
144 'sound/explosion.ogg',
145 'sound/typing.ogg',
146 'sound/cameraclick.ogg',
147 'sound/pop.ogg',
148 'sound/counter.ogg'])
149 env.Alias('install', ['$destdir/$sharedir/sound'])
150
151 env.Install ('$destdir/$sharedir/res/',[
152 'res/testPuzzles',
153 'res/copy',
154 'res/puzzle.levels'])
155 env.Alias('install', ['$destdir/$sharedir/res'])
156
157 env.Install ('$destdir/$sharedir/music/',[
158 'music/bgMusic.ogg'])
159 env.Alias('install', ['$destdir/$sharedir/music'])
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
0 26
1 1
2 -1 -1 -1 -1 -1 -1
3 -1 -1 -1 -1 -1 -1
4 -1 -1 -1 -1 -1 -1
5 -1 -1 -1 -1 -1 -1
6 -1 -1 -1 -1 -1 -1
7 -1 -1 -1 -1 -1 -1
8 -1 -1 -1 -1 -1 -1
9 -1 -1 -1 -1 -1 -1
10 -1 -1 -1 -1 -1 -1
11 -1 -1 -1 -1 -1 -1
12 -1 -1 1 1 -1 -1
13 -1 1 0 0 -1 0
14 1
15 -1 -1 -1 -1 -1 -1
16 -1 -1 -1 -1 -1 -1
17 -1 -1 -1 -1 -1 -1
18 -1 -1 -1 -1 -1 -1
19 -1 -1 -1 -1 -1 -1
20 -1 -1 -1 -1 -1 -1
21 -1 -1 -1 -1 -1 -1
22 -1 0 -1 4 -1 -1
23 -1 3 4 2 -1 -1
24 -1 3 0 0 -1 -1
25 -1 0 2 2 -1 -1
26 -1 3 0 0 4 -1
27 2
28 -1 -1 -1 -1 -1 -1
29 -1 -1 -1 -1 -1 -1
30 -1 -1 -1 -1 -1 -1
31 -1 -1 -1 -1 -1 -1
32 -1 -1 -1 -1 -1 -1
33 -1 -1 -1 -1 -1 -1
34 -1 -1 -1 -1 -1 -1
35 -1 -1 0 1 -1 -1
36 -1 -1 0 1 -1 -1
37 -1 -1 1 0 -1 -1
38 -1 -1 1 0 -1 -1
39 -1 -1 0 1 -1 -1
40 2
41 -1 -1 -1 -1 -1 -1
42 -1 -1 -1 -1 -1 -1
43 -1 -1 -1 -1 -1 -1
44 -1 -1 -1 -1 -1 -1
45 -1 -1 -1 -1 -1 -1
46 -1 -1 -1 -1 -1 -1
47 -1 -1 -1 -1 -1 -1
48 -1 -1 -1 1 -1 -1
49 -1 -1 -1 2 -1 -1
50 -1 -1 -1 2 -1 -1
51 0 -1 1 1 -1 -1
52 0 -1 0 2 -1 -1
53 1
54 -1 -1 -1 -1 -1 -1
55 -1 -1 -1 -1 -1 -1
56 -1 -1 -1 -1 -1 -1
57 -1 -1 -1 -1 -1 -1
58 -1 -1 -1 -1 -1 -1
59 -1 -1 -1 -1 -1 -1
60 -1 -1 -1 -1 -1 -1
61 -1 -1 1 -1 -1 -1
62 -1 -1 0 -1 -1 -1
63 -1 -1 0 -1 -1 -1
64 -1 -1 1 -1 -1 -1
65 -1 -1 0 1 1 -1
66 1
67 -1 -1 -1 -1 -1 -1
68 -1 -1 -1 -1 -1 -1
69 -1 -1 -1 -1 -1 -1
70 -1 -1 -1 -1 -1 -1
71 -1 -1 -1 -1 -1 -1
72 -1 -1 -1 -1 -1 -1
73 -1 -1 -1 -1 -1 -1
74 -1 -1 -1 -1 -1 -1
75 -1 -1 -1 -1 -1 -1
76 -1 1 -1 -1 -1 -1
77 -1 0 1 -1 -1 -1
78 -1 1 0 0 -1 -1
79 1
80 -1 -1 -1 -1 -1 -1
81 -1 -1 -1 -1 -1 -1
82 -1 -1 -1 -1 -1 -1
83 -1 -1 -1 -1 -1 -1
84 -1 -1 -1 -1 -1 -1
85 -1 -1 -1 -1 -1 -1
86 -1 -1 -1 -1 -1 -1
87 -1 -1 -1 -1 -1 -1
88 -1 -1 -1 -1 -1 -1
89 -1 -1 -1 -1 -1 -1
90 -1 -1 4 4 -1 -1
91 -1 2 2 4 2 -1
92 2
93 -1 -1 -1 -1 -1 -1
94 -1 -1 -1 -1 -1 -1
95 -1 -1 -1 -1 -1 -1
96 -1 -1 -1 -1 -1 -1
97 -1 -1 -1 -1 -1 -1
98 -1 -1 -1 -1 -1 -1
99 -1 -1 -1 -1 -1 -1
100 -1 -1 -1 -1 -1 -1
101 -1 -1 -1 -1 -1 -1
102 -1 -1 -1 -1 -1 -1
103 -1 -1 1 0 -1 -1
104 -1 -1 1 0 1 0
105 1
106 -1 -1 5 -1 -1 -1
107 5 5 3 -1 -1 -1
108 3 3 2 -1 -1 -1
109 2 2 0 -1 -1 -1
110 0 0 1 -1 -1 -1
111 1 1 5 -1 -1 -1
112 5 5 4 -1 -1 -1
113 4 4 3 -1 -1 -1
114 3 3 2 -1 -1 -1
115 2 2 0 -1 -1 -1
116 0 0 1 0 -1 -1
117 1 1 0 0 -1 -1
118 2
119 -1 -1 -1 -1 -1 -1
120 -1 -1 -1 -1 -1 -1
121 -1 -1 -1 -1 -1 -1
122 -1 -1 -1 -1 -1 -1
123 -1 -1 -1 -1 -1 -1
124 -1 -1 -1 -1 -1 -1
125 -1 -1 -1 -1 -1 -1
126 -1 -1 0 -1 -1 -1
127 -1 -1 1 -1 -1 -1
128 -1 -1 1 -1 -1 -1
129 -1 -1 0 1 1 -1
130 -1 -1 0 1 0 -1
131 2
132 -1 -1 -1 -1 -1 -1
133 -1 -1 -1 -1 -1 -1
134 -1 -1 -1 -1 -1 -1
135 -1 -1 -1 -1 -1 -1
136 -1 -1 -1 -1 -1 -1
137 -1 -1 -1 -1 -1 -1
138 -1 -1 -1 -1 -1 -1
139 -1 -1 -1 -1 -1 -1
140 -1 -1 -1 -1 -1 -1
141 -1 -1 1 3 -1 -1
142 -1 -1 3 1 -1 -1
143 1 -1 1 3 -1 3
144 3
145 -1 -1 -1 -1 -1 -1
146 -1 -1 -1 -1 -1 -1
147 -1 -1 -1 -1 -1 -1
148 -1 -1 -1 -1 -1 -1
149 -1 -1 -1 -1 -1 -1
150 -1 -1 -1 -1 -1 -1
151 -1 -1 -1 -1 -1 -1
152 -1 -1 -1 -1 -1 -1
153 -1 -1 -1 2 -1 -1
154 -1 -1 -1 0 1 -1
155 -1 -1 1 1 0 -1
156 -1 1 2 2 0 1
157 2
158 -1 -1 -1 -1 -1 -1
159 -1 -1 -1 -1 -1 -1
160 -1 -1 -1 0 -1 -1
161 -1 -1 -1 1 -1 -1
162 -1 -1 -1 5 0 0
163 -1 -1 -1 0 1 1
164 -1 -1 -1 4 5 5
165 -1 -1 -1 3 4 4
166 -1 -1 -1 2 3 3
167 -1 -1 -1 0 2 2
168 -1 -1 -1 1 0 0
169 -1 -1 0 0 1 1
170 2
171 -1 -1 -1 -1 -1 -1
172 -1 -1 -1 -1 -1 -1
173 -1 -1 -1 -1 -1 -1
174 -1 -1 -1 -1 -1 -1
175 -1 -1 -1 -1 -1 -1
176 -1 -1 -1 5 -1 -1
177 -1 -1 -1 2 -1 -1
178 -1 -1 -1 5 -1 -1
179 -1 -1 -1 5 -1 -1
180 -1 -1 -1 2 -1 -1
181 -1 -1 2 5 -1 -1
182 -1 -1 2 5 2 2
183 3
184 -1 -1 -1 -1 -1 -1
185 -1 -1 -1 -1 -1 -1
186 -1 -1 -1 -1 -1 -1
187 -1 -1 -1 -1 -1 -1
188 -1 -1 -1 -1 -1 -1
189 -1 -1 -1 -1 -1 -1
190 -1 -1 -1 -1 -1 -1
191 -1 -1 -1 -1 -1 -1
192 -1 -1 -1 -1 -1 -1
193 -1 -1 -1 -1 -1 -1
194 -1 0 1 -1 -1 -1
195 -1 1 0 1 0 -1
196 2
197 -1 -1 -1 -1 -1 -1
198 -1 -1 -1 -1 -1 -1
199 -1 -1 -1 -1 -1 -1
200 -1 -1 -1 -1 -1 -1
201 -1 -1 -1 -1 -1 -1
202 -1 -1 -1 -1 -1 -1
203 -1 -1 -1 0 -1 -1
204 -1 -1 -1 0 -1 -1
205 -1 -1 1 3 -1 -1
206 -1 -1 0 0 -1 -1
207 -1 -1 3 1 -1 -1
208 -1 1 3 1 -1 -1
209 2
210 -1 -1 -1 -1 -1 -1
211 -1 -1 -1 -1 -1 -1
212 -1 -1 -1 -1 -1 -1
213 -1 -1 -1 -1 -1 -1
214 -1 -1 -1 -1 -1 -1
215 -1 -1 -1 -1 -1 -1
216 -1 -1 -1 -1 -1 -1
217 -1 -1 -1 -1 -1 -1
218 -1 -1 -1 0 -1 -1
219 -1 -1 3 0 -1 -1
220 -1 3 3 1 -1 -1
221 -1 1 1 0 -1 -1
222 2
223 -1 -1 -1 -1 -1 -1
224 -1 -1 -1 -1 -1 -1
225 -1 -1 -1 -1 -1 -1
226 -1 -1 -1 -1 -1 -1
227 -1 -1 -1 -1 -1 -1
228 -1 -1 -1 -1 -1 -1
229 -1 -1 -1 -1 -1 -1
230 -1 -1 -1 -1 -1 -1
231 -1 -1 -1 -1 -1 -1
232 -1 -1 2 2 -1 -1
233 -1 -1 1 0 0 -1
234 -1 -1 1 2 1 0
235 1
236 -1 -1 -1 -1 -1 -1
237 -1 -1 -1 -1 -1 -1
238 -1 -1 -1 -1 -1 -1
239 0 1 2 -1 -1 -1
240 3 4 5 -1 -1 -1
241 5 5 3 -1 -1 -1
242 3 4 2 -1 -1 -1
243 3 0 0 4 1 -1
244 1 4 1 1 0 -1
245 2 2 0 4 0 -1
246 2 2 3 4 3 -1
247 0 0 1 1 0 -1
248 3
249 -1 -1 -1 -1 -1 -1
250 -1 -1 -1 -1 -1 -1
251 -1 -1 -1 -1 -1 -1
252 -1 -1 -1 -1 -1 -1
253 -1 -1 -1 -1 -1 -1
254 -1 -1 -1 -1 -1 -1
255 -1 -1 -1 -1 -1 -1
256 -1 -1 -1 -1 -1 -1
257 -1 -1 2 -1 -1 -1
258 -1 -1 2 0 -1 -1
259 -1 -1 1 1 2 -1
260 -1 -1 0 1 0 -1
261 2
262 -1 -1 -1 -1 -1 -1
263 -1 -1 -1 -1 -1 -1
264 -1 -1 -1 -1 -1 -1
265 -1 -1 -1 2 -1 -1
266 -1 -1 -1 0 -1 -1
267 -1 -1 -1 0 -1 -1
268 -1 -1 -1 1 -1 -1
269 -1 -1 -1 1 -1 -1
270 -1 -1 -1 0 -1 -1
271 -1 -1 -1 1 -1 -1
272 -1 -1 -1 0 -1 -1
273 -1 2 2 0 2 2
274 3
275 -1 -1 -1 -1 -1 -1
276 -1 -1 -1 -1 -1 -1
277 -1 -1 -1 -1 -1 -1
278 -1 -1 -1 -1 -1 -1
279 -1 -1 -1 -1 -1 -1
280 -1 -1 -1 -1 -1 -1
281 -1 -1 -1 -1 -1 -1
282 -1 -1 -1 -1 -1 -1
283 -1 -1 -1 3 3 -1
284 -1 -1 2 0 3 -1
285 -1 -1 2 1 2 -1
286 -1 1 1 0 0 -1
287 5
288 -1 -1 -1 -1 -1 -1
289 -1 -1 -1 -1 -1 -1
290 -1 -1 -1 -1 -1 -1
291 -1 -1 -1 -1 -1 -1
292 -1 -1 -1 -1 -1 -1
293 -1 -1 -1 -1 -1 -1
294 -1 -1 -1 -1 -1 -1
295 2 2 1 1 2 2
296 0 3 4 5 3 0
297 0 4 3 3 5 0
298 1 4 1 1 5 1
299 0 2 3 3 2 0
300 3
301 -1 -1 -1 -1 -1 -1
302 -1 -1 -1 -1 -1 -1
303 -1 -1 -1 -1 -1 -1
304 -1 -1 -1 -1 -1 -1
305 -1 -1 -1 -1 -1 -1
306 -1 -1 -1 -1 -1 -1
307 2 -1 2 -1 2 -1
308 0 -1 3 -1 0 -1
309 1 -1 3 -1 1 -1
310 0 -1 4 -1 0 -1
311 1 -1 4 -1 4 -1
312 0 2 3 2 0 -1
313 3
314 -1 -1 -1 -1 -1 -1
315 -1 -1 -1 -1 -1 -1
316 -1 -1 -1 -1 -1 -1
317 -1 -1 -1 -1 -1 -1
318 -1 -1 -1 -1 -1 -1
319 -1 -1 -1 -1 -1 -1
320 -1 -1 2 -1 -1 -1
321 -1 -1 3 -1 -1 -1
322 -1 3 1 -1 -1 -1
323 -1 0 0 -1 -1 -1
324 -1 1 2 3 -1 -1
325 -1 0 1 2 -1 -1
326 3
327 -1 -1 -1 -1 -1 -1
328 -1 -1 -1 -1 -1 -1
329 -1 -1 -1 -1 -1 -1
330 -1 -1 -1 -1 -1 -1
331 -1 -1 -1 -1 -1 -1
332 -1 -1 -1 -1 -1 -1
333 -1 -1 -1 -1 -1 -1
334 -1 -1 -1 -1 -1 -1
335 -1 -1 -1 -1 -1 -1
336 -1 -1 0 1 0 -1
337 1 1 0 1 1 0
338 0 2 2 0 2 1
0 27
1 1
2 -1 -1 -1 -1 -1 -1
3 -1 -1 -1 -1 -1 -1
4 -1 -1 -1 -1 -1 -1
5 -1 -1 -1 -1 -1 -1
6 -1 -1 -1 -1 -1 -1
7 -1 -1 -1 -1 -1 -1
8 -1 -1 -1 -1 -1 -1
9 -1 -1 -1 -1 -1 -1
10 -1 -1 -1 -1 -1 -1
11 -1 -1 -1 -1 -1 -1
12 -1 -1 1 1 -1 -1
13 -1 1 0 0 -1 0
14 1
15 -1 -1 -1 -1 -1 -1
16 -1 -1 -1 -1 -1 -1
17 -1 -1 -1 -1 -1 -1
18 -1 -1 -1 -1 -1 -1
19 -1 -1 -1 -1 -1 -1
20 -1 -1 -1 -1 -1 -1
21 -1 -1 -1 -1 -1 -1
22 -1 0 -1 4 -1 -1
23 -1 3 4 2 -1 -1
24 -1 3 0 0 -1 -1
25 -1 0 2 2 -1 -1
26 -1 3 0 0 4 -1
27 2
28 -1 -1 -1 -1 -1 -1
29 -1 -1 -1 -1 -1 -1
30 -1 -1 -1 -1 -1 -1
31 -1 -1 -1 -1 -1 -1
32 -1 -1 -1 -1 -1 -1
33 -1 -1 -1 -1 -1 -1
34 -1 -1 -1 -1 -1 -1
35 -1 -1 0 1 -1 -1
36 -1 -1 0 1 -1 -1
37 -1 -1 1 0 -1 -1
38 -1 -1 1 0 -1 -1
39 -1 -1 0 1 -1 -1
40 2
41 -1 -1 -1 -1 -1 -1
42 -1 -1 -1 -1 -1 -1
43 -1 -1 -1 -1 -1 -1
44 -1 -1 -1 -1 -1 -1
45 -1 -1 -1 -1 -1 -1
46 -1 -1 -1 -1 -1 -1
47 -1 -1 -1 -1 -1 -1
48 -1 -1 -1 1 -1 -1
49 -1 -1 -1 2 -1 -1
50 -1 -1 -1 2 -1 -1
51 0 -1 1 1 -1 -1
52 0 -1 0 2 -1 -1
53 1
54 -1 -1 -1 -1 -1 -1
55 -1 -1 -1 -1 -1 -1
56 -1 -1 -1 -1 -1 -1
57 -1 -1 -1 -1 -1 -1
58 -1 -1 -1 -1 -1 -1
59 -1 -1 -1 -1 -1 -1
60 -1 -1 -1 -1 -1 -1
61 -1 -1 1 -1 -1 -1
62 -1 -1 0 -1 -1 -1
63 -1 -1 0 -1 -1 -1
64 -1 -1 1 -1 -1 -1
65 -1 -1 0 1 1 -1
66 1
67 -1 -1 -1 -1 -1 -1
68 -1 -1 -1 -1 -1 -1
69 -1 -1 -1 -1 -1 -1
70 -1 -1 -1 -1 -1 -1
71 -1 -1 -1 -1 -1 -1
72 -1 -1 -1 -1 -1 -1
73 -1 -1 -1 -1 -1 -1
74 -1 -1 -1 -1 -1 -1
75 -1 -1 -1 -1 -1 -1
76 -1 1 -1 -1 -1 -1
77 -1 0 1 -1 -1 -1
78 -1 1 0 0 -1 -1
79 1
80 -1 -1 -1 -1 -1 -1
81 -1 -1 -1 -1 -1 -1
82 -1 -1 -1 -1 -1 -1
83 -1 -1 -1 -1 -1 -1
84 -1 -1 -1 -1 -1 -1
85 -1 -1 -1 -1 -1 -1
86 -1 -1 -1 -1 -1 -1
87 -1 -1 -1 -1 -1 -1
88 -1 -1 -1 -1 -1 -1
89 -1 -1 -1 -1 -1 -1
90 -1 -1 4 4 -1 -1
91 -1 2 2 4 2 -1
92 2
93 -1 -1 -1 -1 -1 -1
94 -1 -1 -1 -1 -1 -1
95 -1 -1 -1 -1 -1 -1
96 -1 -1 -1 -1 -1 -1
97 -1 -1 -1 -1 -1 -1
98 -1 -1 -1 -1 -1 -1
99 -1 -1 -1 -1 -1 -1
100 -1 -1 -1 -1 -1 -1
101 -1 -1 -1 -1 -1 -1
102 -1 -1 -1 -1 -1 -1
103 -1 -1 1 0 -1 -1
104 -1 -1 1 0 1 0
105 1
106 -1 -1 5 -1 -1 -1
107 5 5 3 -1 -1 -1
108 3 3 2 -1 -1 -1
109 2 2 0 -1 -1 -1
110 0 0 1 -1 -1 -1
111 1 1 5 -1 -1 -1
112 5 5 4 -1 -1 -1
113 4 4 3 -1 -1 -1
114 3 3 2 -1 -1 -1
115 2 2 0 -1 -1 -1
116 0 0 1 0 -1 -1
117 1 1 0 0 -1 -1
118 2
119 -1 -1 -1 -1 -1 -1
120 -1 -1 -1 -1 -1 -1
121 -1 -1 -1 -1 -1 -1
122 -1 -1 -1 -1 -1 -1
123 -1 -1 -1 -1 -1 -1
124 -1 -1 -1 -1 -1 -1
125 -1 -1 -1 -1 -1 -1
126 -1 -1 0 -1 -1 -1
127 -1 -1 1 -1 -1 -1
128 -1 -1 1 -1 -1 -1
129 -1 -1 0 1 1 -1
130 -1 -1 0 1 0 -1
131 2
132 -1 -1 -1 -1 -1 -1
133 -1 -1 -1 -1 -1 -1
134 -1 -1 -1 -1 -1 -1
135 -1 -1 -1 -1 -1 -1
136 -1 -1 -1 -1 -1 -1
137 -1 -1 -1 -1 -1 -1
138 -1 -1 -1 -1 -1 -1
139 -1 -1 -1 -1 -1 -1
140 -1 -1 -1 -1 -1 -1
141 -1 -1 1 3 -1 -1
142 -1 -1 3 1 -1 -1
143 1 -1 1 3 -1 3
144 3
145 -1 -1 -1 -1 -1 -1
146 -1 -1 -1 -1 -1 -1
147 -1 -1 -1 -1 -1 -1
148 -1 -1 -1 -1 -1 -1
149 -1 -1 -1 -1 -1 -1
150 -1 -1 -1 -1 -1 -1
151 -1 -1 -1 -1 -1 -1
152 -1 -1 -1 -1 -1 -1
153 -1 -1 -1 2 -1 -1
154 -1 -1 -1 0 1 -1
155 -1 -1 1 1 0 -1
156 -1 1 2 2 0 1
157 2
158 -1 -1 -1 -1 -1 -1
159 -1 -1 -1 -1 -1 -1
160 -1 -1 -1 0 -1 -1
161 -1 -1 -1 1 -1 -1
162 -1 -1 -1 5 0 0
163 -1 -1 -1 0 1 1
164 -1 -1 -1 4 5 5
165 -1 -1 -1 3 4 4
166 -1 -1 -1 2 3 3
167 -1 -1 -1 0 2 2
168 -1 -1 -1 1 0 0
169 -1 -1 0 0 1 1
170 2
171 -1 -1 -1 -1 -1 -1
172 -1 -1 -1 -1 -1 -1
173 -1 -1 -1 -1 -1 -1
174 -1 -1 -1 -1 -1 -1
175 -1 -1 -1 -1 -1 -1
176 -1 -1 -1 5 -1 -1
177 -1 -1 -1 2 -1 -1
178 -1 -1 -1 5 -1 -1
179 -1 -1 -1 5 -1 -1
180 -1 -1 -1 2 -1 -1
181 -1 -1 2 5 -1 -1
182 -1 -1 2 5 2 2
183 3
184 -1 -1 -1 -1 -1 -1
185 -1 -1 -1 -1 -1 -1
186 -1 -1 -1 -1 -1 -1
187 -1 -1 -1 -1 -1 -1
188 -1 -1 -1 -1 -1 -1
189 -1 -1 -1 -1 -1 -1
190 -1 -1 -1 -1 -1 -1
191 -1 -1 -1 -1 -1 -1
192 -1 -1 -1 -1 -1 -1
193 -1 -1 -1 -1 -1 -1
194 -1 0 1 -1 -1 -1
195 -1 1 0 1 0 -1
196 2
197 -1 -1 -1 -1 -1 -1
198 -1 -1 -1 -1 -1 -1
199 -1 -1 -1 -1 -1 -1
200 -1 -1 -1 -1 -1 -1
201 -1 -1 -1 -1 -1 -1
202 -1 -1 -1 -1 -1 -1
203 -1 -1 -1 0 -1 -1
204 -1 -1 -1 0 -1 -1
205 -1 -1 1 3 -1 -1
206 -1 -1 0 0 -1 -1
207 -1 -1 3 1 -1 -1
208 -1 1 3 1 -1 -1
209 2
210 -1 -1 -1 -1 -1 -1
211 -1 -1 -1 -1 -1 -1
212 -1 -1 -1 -1 -1 -1
213 -1 -1 -1 -1 -1 -1
214 -1 -1 -1 -1 -1 -1
215 -1 -1 -1 -1 -1 -1
216 -1 -1 -1 -1 -1 -1
217 -1 -1 -1 -1 -1 -1
218 -1 -1 -1 0 -1 -1
219 -1 -1 3 0 -1 -1
220 -1 3 3 1 -1 -1
221 -1 1 1 0 -1 -1
222 2
223 -1 -1 -1 -1 -1 -1
224 -1 -1 -1 -1 -1 -1
225 -1 -1 -1 -1 -1 -1
226 -1 -1 -1 -1 -1 -1
227 -1 -1 -1 -1 -1 -1
228 -1 -1 -1 -1 -1 -1
229 -1 -1 -1 -1 -1 -1
230 -1 -1 -1 -1 -1 -1
231 -1 -1 -1 -1 -1 -1
232 -1 -1 2 2 -1 -1
233 -1 -1 1 0 0 -1
234 -1 -1 1 2 1 0
235 1
236 -1 -1 -1 -1 -1 -1
237 -1 -1 -1 -1 -1 -1
238 -1 -1 -1 -1 -1 -1
239 0 1 2 -1 -1 -1
240 3 4 5 -1 -1 -1
241 5 5 3 -1 -1 -1
242 3 4 2 -1 -1 -1
243 3 0 0 4 1 -1
244 1 4 1 1 0 -1
245 2 2 0 4 0 -1
246 2 2 3 4 3 -1
247 0 0 1 1 0 -1
248 3
249 -1 -1 -1 -1 -1 -1
250 -1 -1 -1 -1 -1 -1
251 -1 -1 -1 -1 -1 -1
252 -1 -1 -1 -1 -1 -1
253 -1 -1 -1 -1 -1 -1
254 -1 -1 -1 -1 -1 -1
255 -1 -1 -1 -1 -1 -1
256 -1 -1 -1 -1 -1 -1
257 -1 -1 2 -1 -1 -1
258 -1 -1 2 0 -1 -1
259 -1 -1 1 1 2 -1
260 -1 -1 0 1 0 -1
261 2
262 -1 -1 -1 -1 -1 -1
263 -1 -1 -1 -1 -1 -1
264 -1 -1 -1 -1 -1 -1
265 -1 -1 -1 2 -1 -1
266 -1 -1 -1 0 -1 -1
267 -1 -1 -1 0 -1 -1
268 -1 -1 -1 1 -1 -1
269 -1 -1 -1 1 -1 -1
270 -1 -1 -1 0 -1 -1
271 -1 -1 -1 1 -1 -1
272 -1 -1 -1 0 -1 -1
273 -1 2 2 0 2 2
274 3
275 -1 -1 -1 -1 -1 -1
276 -1 -1 -1 -1 -1 -1
277 -1 -1 -1 -1 -1 -1
278 -1 -1 -1 -1 -1 -1
279 -1 -1 -1 -1 -1 -1
280 -1 -1 -1 -1 -1 -1
281 -1 -1 -1 -1 -1 -1
282 -1 -1 -1 -1 -1 -1
283 -1 -1 -1 3 3 -1
284 -1 -1 2 0 3 -1
285 -1 -1 2 1 2 -1
286 -1 1 1 0 0 -1
287 5
288 -1 -1 -1 -1 -1 -1
289 -1 -1 -1 -1 -1 -1
290 -1 -1 -1 -1 -1 -1
291 -1 -1 -1 -1 -1 -1
292 -1 -1 -1 -1 -1 -1
293 -1 -1 -1 -1 -1 -1
294 -1 -1 -1 -1 -1 -1
295 2 2 1 1 2 2
296 0 3 4 5 3 0
297 0 4 3 3 5 0
298 1 4 1 1 5 1
299 0 2 3 3 2 0
300 3
301 -1 -1 -1 -1 -1 -1
302 -1 -1 -1 -1 -1 -1
303 -1 -1 -1 -1 -1 -1
304 -1 -1 -1 -1 -1 -1
305 -1 -1 -1 -1 -1 -1
306 -1 -1 -1 -1 -1 -1
307 2 -1 2 -1 2 -1
308 0 -1 3 -1 0 -1
309 1 -1 3 -1 1 -1
310 0 -1 4 -1 0 -1
311 1 -1 4 -1 4 -1
312 0 2 3 2 0 -1
313 3
314 -1 -1 -1 -1 -1 -1
315 -1 -1 -1 -1 -1 -1
316 -1 -1 -1 -1 -1 -1
317 -1 -1 -1 -1 -1 -1
318 -1 -1 -1 -1 -1 -1
319 -1 -1 -1 -1 -1 -1
320 -1 -1 2 -1 -1 -1
321 -1 -1 3 -1 -1 -1
322 -1 3 1 -1 -1 -1
323 -1 0 0 -1 -1 -1
324 -1 1 2 3 -1 -1
325 -1 0 1 2 -1 -1
326 3
327 -1 -1 -1 -1 -1 -1
328 -1 -1 -1 -1 -1 -1
329 -1 -1 -1 -1 -1 -1
330 -1 -1 -1 -1 -1 -1
331 -1 -1 -1 -1 -1 -1
332 -1 -1 -1 -1 -1 -1
333 -1 -1 -1 -1 -1 -1
334 -1 -1 -1 -1 -1 -1
335 -1 -1 -1 -1 -1 -1
336 -1 -1 0 1 0 -1
337 1 1 0 1 1 0
338 0 2 2 0 2 1
339 1
340 0 2 4 3 1 5
341 0 2 4 3 1 5
342 3 5 1 2 0 4
343 3 5 1 2 0 4
344 2 4 0 5 3 1
345 1 1 2 1 2 2
346 2 4 0 5 3 1
347 2 4 0 5 3 1
348 3 5 1 2 0 4
349 3 5 1 2 0 4
350 0 2 4 3 1 5
351 0 2 4 3 1 5
0 7
1 1
2 -1 -1 -1 -1 -1 -1
3 -1 -1 -1 -1 -1 -1
4 -1 -1 -1 -1 -1 -1
5 -1 -1 -1 -1 -1 -1
6 -1 -1 -1 -1 -1 -1
7 -1 -1 -1 -1 -1 -1
8 -1 -1 -1 -1 -1 -1
9 0 0 3 4 0 0
10 0 0 3 4 0 0
11 3 3 4 3 4 4
12 0 0 3 4 0 0
13 0 0 3 4 0 0
14 2
15 -1 -1 -1 -1 -1 -1
16 -1 -1 -1 -1 -1 -1
17 -1 -1 -1 -1 -1 -1
18 -1 -1 -1 -1 -1 -1
19 -1 -1 -1 -1 -1 -1
20 -1 -1 -1 -1 -1 -1
21 -1 -1 -1 3 -1 -1
22 -1 -1 -1 0 -1 -1
23 -1 2 0 1 -1 -1
24 -1 3 3 0 -1 -1
25 -1 2 1 3 -1 -1
26 -1 2 3 1 -1 -1
27 2
28 -1 -1 -1 -1 -1 -1
29 -1 -1 -1 -1 -1 -1
30 -1 -1 -1 -1 -1 -1
31 -1 -1 -1 -1 -1 -1
32 -1 -1 -1 -1 -1 -1
33 -1 -1 -1 -1 -1 -1
34 -1 -1 -1 -1 -1 -1
35 -1 -1 4 0 -1 -1
36 -1 -1 0 4 3 3
37 -1 -1 4 0 4 4
38 -1 -1 0 4 3 3
39 -1 -1 0 4 3 3
40 2
41 -1 -1 -1 -1 -1 -1
42 -1 -1 -1 -1 -1 -1
43 -1 -1 -1 -1 -1 -1
44 -1 -1 -1 -1 -1 -1
45 -1 -1 -1 -1 -1 -1
46 -1 -1 -1 -1 -1 -1
47 -1 -1 -1 -1 -1 -1
48 -1 -1 -1 5 -1 -1
49 -1 -1 -1 5 -1 -1
50 -1 -1 5 3 -1 -1
51 -1 -1 4 4 -1 -1
52 -1 -1 3 3 4 -1
53 3
54 -1 -1 -1 -1 -1 -1
55 -1 -1 -1 -1 -1 -1
56 -1 -1 -1 -1 -1 -1
57 -1 2 -1 -1 -1 -1
58 -1 3 -1 -1 -1 -1
59 -1 2 0 2 -1 -1
60 -1 2 3 3 -1 -1
61 -1 0 1 0 -1 -1
62 -1 0 2 2 -1 -1
63 -1 3 1 1 -1 -1
64 -1 3 0 0 -1 -1
65 3 0 3 3 -1 -1
66 3
67 -1 -1 -1 -1 -1 -1
68 -1 -1 -1 -1 -1 -1
69 -1 -1 -1 -1 -1 -1
70 -1 -1 -1 -1 -1 -1
71 -1 -1 -1 -1 -1 -1
72 -1 -1 -1 -1 -1 -1
73 -1 -1 -1 -1 -1 -1
74 -1 -1 -1 -1 -1 -1
75 -1 1 -1 -1 -1 -1
76 -1 1 4 -1 -1 -1
77 -1 3 3 1 -1 -1
78 -1 3 4 4 -1 -1
79 2
80 -1 -1 -1 -1 -1 -1
81 -1 -1 -1 -1 -1 -1
82 -1 -1 -1 -1 -1 -1
83 -1 -1 -1 -1 -1 -1
84 -1 -1 -1 -1 -1 -1
85 -1 -1 -1 -1 -1 -1
86 -1 -1 -1 3 -1 -1
87 -1 -1 -1 1 -1 -1
88 -1 -1 1 1 -1 -1
89 -1 -1 4 4 -1 -1
90 -1 4 0 0 -1 -1
91 -1 0 3 3 -1 -1
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
0 #!/bin/sh
1 #
2 # Run Block Attack
3
4 # Function to find the real directory a program resides in.
5 FindPath()
6 {
7 fullpath="`echo $1 | grep /`"
8 if [ "$fullpath" = "" ]; then
9 oIFS="$IFS"
10 IFS=:
11 for path in $PATH
12 do if [ -x "$path/$1" ]; then
13 if [ "$path" = "" ]; then
14 path="."
15 fi
16 fullpath="$path/$1"
17 break
18 fi
19 done
20 IFS="$oIFS"
21 fi
22 if [ "$fullpath" = "" ]; then
23 fullpath="$1"
24 fi
25 # Is the awk/ls magic portable?
26 if [ -L "$fullpath" ]; then
27 fullpath=`ls -l "$fullpath" | awk '{ ORS=" "; i = 11; while ( i fi
28 dirname "$fullpath"
29 }
30
31 # Unfortunate hack until we figure out why TLS glibc breaks us
32 #if [ -d /lib/tls ]; then
33 #LD_ASSUME_KERNEL=2.4.19
34 #export LD_ASSUME_KERNEL
35 #fi
36
37 cd "`FindPath \"$0\"`"
38 LD_LIBRARY_PATH="`pwd`/lib" exec ./blockattack $*
0 #!/bin/sh
1 #
2 # Run Block Attack
3
4 # Function to find the real directory a program resides in.
5 FindPath()
6 {
7 fullpath="`echo $1 | grep /`"
8 if [ "$fullpath" = "" ]; then
9 oIFS="$IFS"
10 IFS=:
11 for path in $PATH
12 do if [ -x "$path/$1" ]; then
13 if [ "$path" = "" ]; then
14 path="."
15 fi
16 fullpath="$path/$1"
17 break
18 fi
19 done
20 IFS="$oIFS"
21 fi
22 if [ "$fullpath" = "" ]; then
23 fullpath="$1"
24 fi
25 # Is the awk/ls magic portable?
26 if [ -L "$fullpath" ]; then
27 fullpath=`ls -l "$fullpath" | awk '{ ORS=" "; i = 11; while ( i fi
28 dirname "$fullpath"
29 }
30
31 # Unfortunate hack until we figure out why TLS glibc breaks us
32 #if [ -d /lib/tls ]; then
33 #LD_ASSUME_KERNEL=2.4.19
34 #export LD_ASSUME_KERNEL
35 #fi
36
37 cd "`FindPath \"$0\"`"
38 #LD_LIBRARY_PATH="`pwd`/lib" exec
39 ./blockattack $*
Binary diff not shown
0 #the things that tells about the system
1 PREF=/usr/local
2 EXECUTEPATH=/usr/local/bin
3 INST=/games/blockattack
4
5 standard:
6 @echo "Removing old files (if they exists)"
7 @rm -f *.o
8 @rm -f ./Game/blockattack
9 @rm -f ./Game/starter
10 @rm -f ./Game/runme.sh
11 @echo "Done deleting files"
12 @echo "Now compiling..."
13 @make -f block.make
14 @g++ starter.cpp -o ./Game/starter
15 @echo "Everything has been compiled!"
16
17 #makeinstall and install doesn't work, gfx dictory doesn't get copied!
18 #makeinstall:
19 # @echo "Removing old files (if they exists)"
20 # @rm -f *.o
21 # @rm -f ./Game/blockattack
22 # @rm -f ./Game/starter
23 # @rm -f ./Game/runme.sh
24 # @echo "Done deleting files"
25 # @echo "Now compiling..."
26 # @make -f block.make
27 # @g++ starter2.cpp -o ./Game/starter
28 # @echo "Everything has been compiled!"
29 # @echo "Creating installation dirs..."
30 # @mkdir -p $(PREF)$(INST)
31 # @echo "Dir has been created"
32 # @echo "Now copying files"
33 # @cp -P -f -r ./Game/* $(PREF)$(INST)
34 # @echo "Files have been copied"
35 # @chmod +r $(PREF)$(INST) -R
36 # @echo "Now creating a runable sh file called runme.sh"
37 # @touch $(PREF)$(INST)/runme.sh
38 # @echo "pushd $(PREF)$(INST)" >> $(PREF)$(INST)/runme.sh
39 # @echo "./blockattack" >> $(PREF)$(INST)/runme.sh
40 # @echo "popd" >> $(PREF)$(INST)/runme.sh
41 # @echo "File created, now setting +x permission to it"
42 # @chmod +x $(PREF)$(INST)/runme.sh
43 # @echo "Mow creating static links to runme.sh"
44 # @ln -fs $(PREF)$(INST)/runme.sh $(PREF)/bin/blockattack
45 # @echo "Links have been created"
46 # @echo "Block Attack - Rise of the Blocks have been installed!"
47 # @echo "Type 'blockattack' to run the game"
48
49 install:
50 @echo "Everything must have been compiled"
51 @echo "Creating installation dirs..."
52 @mkdir -p $(PREF)$(INST)
53 @echo "Dir has been created"
54 @echo "Now copying files"
55 @cp -P -f -r ./Game/* $(PREF)$(INST)
56 @cp -P -f ./blockattack.xpm /usr/share/pixmaps
57 @cp -P -f ./blockattack.desktop /usr/share/applications
58 @echo "Files have been copied, giving all users read permission"
59 @chmod +r $(PREF)$(INST) -R
60 @echo "Now creating a runable sh file called runme.sh"
61 @rm -f $(PREF)$(INST)/runme.sh
62 @touch $(PREF)$(INST)/runme.sh
63 @echo "pushd $(PREF)$(INST)" >> $(PREF)$(INST)/runme.sh
64 @echo "./blockattack" >> $(PREF)$(INST)/runme.sh
65 @echo "popd" >> $(PREF)$(INST)/runme.sh
66 @echo "File created, now setting +x permission to it"
67 @chmod +x $(PREF)$(INST)/runme.sh
68 @echo "Mow creating static links to runme.sh"
69 @ln -fs $(PREF)$(INST)/runme.sh $(PREF)/bin/blockattack
70 @echo "Links have been created"
71 @echo "Block Attack - Rise of the Blocks have been installed!"
72 @echo "Type 'blockattack' to run the game"
73
74 remove:
75 @echo "Removing: Block Attack - Rise of the Blocks"
76 @rm $(PREF)$(INST) -R
77 @echo "Data files has been removed!"
78 @echo "Removing links..."
79 @rm $(PREF)/bin/blockattack
80 @rm /usr/share/pixmaps/blockattack.xpm
81 @rm /usr/share/applications/blockattack.desktop
82 @echo "All installed files has been removed"
0 Thanks for downloading Block Attack - Rise Of the Blocks 1.3.1 for Linux and other Platforms
1
2 Version 1.3.1
3
4 Only small changes to the Linux version. The "-nosound" parameter should be usefull.
5
6 scons must be present on the system to compile.
7
8 The game can be ran by double clicking "starter" in the "Game" directory.
9
10 If it doesn't work (because your distro uses an old stdc++ file, is not Linux or you are running 64 bit you will need to compile)
11
12 To compile:
13 First compile and install enet (can be ignored if you already has it, but its is not likely unless you have installed blockattack before)
14 Go to the "enet" directory and type:
15
16 make
17 make install
18
19 as root
20
21 Then compile blockattack itself by typing:
22
23 scons install blockattack
24 as root
25
26
27 If you get errors you might need certain packages on your system.
28
29 Dependencies:
30 On Ubunut the required packages are to run are: libsdl1.2debian-all, libsdl-image1.2 and libsdl-mixer1.2
31 To compile: build-essential, libsdl1.2-dev, libsdl-image1.2-dev and libsdl-mixer1.2-dev
32
33 By default the game is now placed in: /usr/local/bin/blockattack
34 This means that it can be runned by just typing "blockattack"
35
36 http://blockattack.sf.net
37 Poul Sander poul@poulsander.com
0 Thanks for downloading Block Attack - Rise Of the Blocks 1.3.1 for Linux and other Platforms
1
2 Version 1.3.1
3
4 Only small changes to the Linux version. The "-nosound" parameter should be usefull.
5
6 scons must be present on the system to compile.
7
8 The game can be ran by double clicking "starter" in the "Game" directory.
9
10 If it doesn't work (because your distro uses an old stdc++ file or you are running 64 bit you will need to compile)
11
12 To compile:
13 First compile and install enet (can be ignored if you already has it, but its is not likely unless you have installed blockattack before)
14 Go to the "enet" directory and type:
15
16 make
17 make install
18
19 as root
20
21 Then compile blockattack itself by typing:
22
23 scons install blockattack
24 as root
25
26
27 If you get errors you might need certain packages on your system.
28
29 Dependencies:
30 On Ubunut the required packages are to run are: libsdl1.2debian-all, libsdl-image1.2 and libsdl-mixer1.2
31 To compile: build-essential, libsdl1.2-dev, libsdl-image1.2-dev and libsdl-mixer1.2-dev
32
33 By default the game is now placed in: /usr/local/bin/blockattack
34 This means that it can be runned by just typing "blockattack"
35
36 http://blockattack.sf.net
37 Poul Sander poul@poulsander.com
0 /*
1 ReadKeyboard.cpp
2 Copyright (C) 2005 Poul Sander
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 Poul Sander
19 Rævehøjvej 36, V. 1111
20 2800 Kgs. Lyngby
21 DENMARK
22 poul.sander@tdcadsl.dk
23 */
24
25 #include "ReadKeyboard.h"
26
27 ReadKeyboard::ReadKeyboard(void)
28 {
29 length = 0;
30 maxLength = 16;
31 position = 0;
32 strcpy(textstring," ");
33 }
34
35 ReadKeyboard::~ReadKeyboard(void)
36 {
37 }
38
39 Uint8 ReadKeyboard::CharsBeforeCursor()
40 {
41 return position;
42 }
43
44 ReadKeyboard::ReadKeyboard(char *oldName)
45 {
46 length = 0;
47 maxLength = 16;
48 position = 0;
49 strcpy(textstring," ");
50 strcpy(textstring,oldName);
51 char charecter = textstring[maxLength+1];
52 int i = maxLength+1;
53 while((charecter == ' ') && (i>0))
54 {
55 i--;
56 charecter = textstring[i];
57 }
58 if(i>0)length = i+1;
59 else
60 if(charecter == ' ') length = 0;
61 else length = 1;
62 position = length;
63
64 }
65
66
67 void ReadKeyboard::putchar(char thing)
68 {
69 if(length < maxLength)
70 {
71 for(int i = 28; i>position;i--)
72 {
73 textstring[i]=textstring[i-1];
74 }
75 textstring[position] = thing;
76 length++;
77 position++;
78 }
79 }
80
81
82 void ReadKeyboard::removeChar()
83 {
84 for(int i = position;i<28;i++)
85 {
86 textstring[i]=textstring[i+1];
87 }
88 textstring[28]=' ';
89 if(length>0)length--;
90 }
91
92 bool ReadKeyboard::ReadKey(SDLKey keyPressed)
93 {
94 if (keyPressed == SDLK_SPACE)
95 {
96 ReadKeyboard::putchar(' ');
97 return true;
98 }
99 if (keyPressed == SDLK_DELETE)
100 {
101 if((length>0)&& (position<length))ReadKeyboard::removeChar();
102 return true;
103 }
104 if (keyPressed == SDLK_BACKSPACE)
105 {
106 if(position>0)
107 {
108 position--;
109 ReadKeyboard::removeChar();
110 return true;
111 }
112 return false;
113 }
114 Uint8* keys;
115 keys = SDL_GetKeyState(NULL);
116 if (keyPressed == SDLK_HOME)
117 { position=0; return true;}
118 if (keyPressed == SDLK_END)
119 { position=length; return true;}
120 if ((keyPressed == SDLK_LEFT) && (position>0))
121 { position--; return true; }
122 if ((keyPressed == SDLK_RIGHT) && (position<length))
123 { position++; return true; }
124 char charToPut;
125 switch(keyPressed)
126 {
127 case SDLK_a: charToPut = 'a'; break;
128 case SDLK_b: charToPut = 'b'; break;
129 case SDLK_c: charToPut = 'c'; break;
130 case SDLK_d: charToPut = 'd'; break;
131 case SDLK_e: charToPut = 'e'; break;
132 case SDLK_f: charToPut = 'f'; break;
133 case SDLK_g: charToPut = 'g'; break;
134 case SDLK_h: charToPut = 'h'; break;
135 case SDLK_i: charToPut = 'i'; break;
136 case SDLK_j: charToPut = 'j'; break;
137 case SDLK_k: charToPut = 'k'; break;
138 case SDLK_l: charToPut = 'l'; break;
139 case SDLK_m: charToPut = 'm'; break;
140 case SDLK_n: charToPut = 'n'; break;
141 case SDLK_o: charToPut = 'o'; break;
142 case SDLK_p: charToPut = 'p'; break;
143 case SDLK_q: charToPut = 'q'; break;
144 case SDLK_r: charToPut = 'r'; break;
145 case SDLK_s: charToPut = 's'; break;
146 case SDLK_t: charToPut = 't'; break;
147 case SDLK_u: charToPut = 'u'; break;
148 case SDLK_v: charToPut = 'v'; break;
149 case SDLK_w: charToPut = 'w'; break;
150 case SDLK_x: charToPut = 'x'; break;
151 case SDLK_y: charToPut = 'y'; break;
152 case SDLK_z: charToPut = 'z'; break;
153 case SDLK_0: charToPut = '0'; break;
154 case SDLK_1: charToPut = '1'; break;
155 case SDLK_2: charToPut = '2'; break;
156 case SDLK_3: charToPut = '3'; break;
157 case SDLK_4: charToPut = '4'; break;
158 case SDLK_5: charToPut = '5'; break;
159 case SDLK_6: charToPut = '6'; break;
160 case SDLK_7: charToPut = '7'; break;
161 case SDLK_8: charToPut = '8'; break;
162 case SDLK_9: charToPut = '9'; break;
163 case SDLK_KP0: charToPut = '0'; break;
164 case SDLK_KP1: charToPut = '1'; break;
165 case SDLK_KP2: charToPut = '2'; break;
166 case SDLK_KP3: charToPut = '3'; break;
167 case SDLK_KP4: charToPut = '4'; break;
168 case SDLK_KP5: charToPut = '5'; break;
169 case SDLK_KP6: charToPut = '6'; break;
170 case SDLK_KP7: charToPut = '7'; break;
171 case SDLK_KP8: charToPut = '8'; break;
172 case SDLK_KP9: charToPut = '9'; break;
173 case SDLK_KP_PERIOD:
174 case SDLK_PERIOD: charToPut='.'; break;
175 default: return false;
176 }
177 if((keys[SDLK_LSHIFT]) || (keys[SDLK_RSHIFT]))
178 {
179 switch(charToPut)
180 {
181 case 'a': charToPut = 'A'; break;
182 case 'b': charToPut = 'B'; break;
183 case 'c': charToPut = 'C'; break;
184 case 'd': charToPut = 'D'; break;
185 case 'e': charToPut = 'E'; break;
186 case 'f': charToPut = 'F'; break;
187 case 'g': charToPut = 'G'; break;
188 case 'h': charToPut = 'H'; break;
189 case 'i': charToPut = 'I'; break;
190 case 'j': charToPut = 'J'; break;
191 case 'k': charToPut = 'K'; break;
192 case 'l': charToPut = 'L'; break;
193 case 'm': charToPut = 'M'; break;
194 case 'n': charToPut = 'N'; break;
195 case 'o': charToPut = 'O'; break;
196 case 'p': charToPut = 'P'; break;
197 case 'q': charToPut = 'Q'; break;
198 case 'r': charToPut = 'R'; break;
199 case 's': charToPut = 'S'; break;
200 case 't': charToPut = 'T'; break;
201 case 'u': charToPut = 'U'; break;
202 case 'v': charToPut = 'V'; break;
203 case 'w': charToPut = 'W'; break;
204 case 'x': charToPut = 'X'; break;
205 case 'y': charToPut = 'Y'; break;
206 case 'z': charToPut = 'Z'; break;
207
208 default: charToPut = charToPut;
209 }
210 }
211 ReadKeyboard::putchar(charToPut);
212 return true;
213 }
214
215 char* ReadKeyboard::GetString()
216 {
217 textstring[29]='\0';
218 return &textstring[0];
219 }
0 /*
1 ReadKeyboard.cpp
2 Copyright (C) 2005 Poul Sander
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 Poul Sander
19 Rævehøjvej 36, V. 1111
20 2800 Kgs. Lyngby
21 DENMARK
22 poul.sander@tdcadsl.dk
23 */
24
25 #include "ReadKeyboard.h"
26
27 ReadKeyboard::ReadKeyboard(void)
28 {
29 length = 0;
30 maxLength = 16;
31 position = 0;
32 strcpy(textstring," ");
33 }
34
35 ReadKeyboard::~ReadKeyboard(void)
36 {
37 }
38
39 Uint8 ReadKeyboard::CharsBeforeCursor()
40 {
41 return position;
42 }
43
44 ReadKeyboard::ReadKeyboard(char *oldName)
45 {
46 length = 0;
47 maxLength = 16;
48 position = 0;
49 strcpy(textstring," ");
50 strcpy(textstring,oldName);
51 char charecter = textstring[maxLength+1];
52 int i = maxLength+1;
53 while((charecter == ' ') && (i>0))
54 {
55 i--;
56 charecter = textstring[i];
57 }
58 if(i>0)length = i+1;
59 else
60 if(charecter == ' ') length = 0;
61 else length = 1;
62 position = length;
63
64 }
65
66
67 void ReadKeyboard::putchar(char thing)
68 {
69 if(length < maxLength)
70 {
71 for(int i = 28; i>position;i--)
72 {
73 textstring[i]=textstring[i-1];
74 }
75 textstring[position] = thing;
76 length++;
77 position++;
78 }
79 }
80
81
82 void ReadKeyboard::removeChar()
83 {
84 for(int i = position;i<28;i++)
85 {
86 textstring[i]=textstring[i+1];
87 }
88 textstring[28]=' ';
89 if(length>0)length--;
90 }
91
92 bool ReadKeyboard::ReadKey(SDLKey keyPressed)
93 {
94 if (keyPressed == SDLK_SPACE)
95 {
96 ReadKeyboard::putchar(' ');
97 return true;
98 }
99 if (keyPressed == SDLK_DELETE)
100 {
101 if((length>0)&& (position<length))ReadKeyboard::removeChar();
102 return true;
103 }
104 if (keyPressed == SDLK_BACKSPACE)
105 {
106 if(position>0)
107 {
108 position--;
109 ReadKeyboard::removeChar();
110 return true;
111 }
112 return false;
113 }
114 Uint8* keys;
115 keys = SDL_GetKeyState(NULL);
116 if (keyPressed == SDLK_HOME)
117 { position=0; return true;}
118 if (keyPressed == SDLK_END)
119 { position=length; return true;}
120 if ((keyPressed == SDLK_LEFT) && (position>0))
121 { position--; return true; }
122 if ((keyPressed == SDLK_RIGHT) && (position<length))
123 { position++; return true; }
124 char charToPut;
125 switch(keyPressed)
126 {
127 case SDLK_a: charToPut = 'a'; break;
128 case SDLK_b: charToPut = 'b'; break;
129 case SDLK_c: charToPut = 'c'; break;
130 case SDLK_d: charToPut = 'd'; break;
131 case SDLK_e: charToPut = 'e'; break;
132 case SDLK_f: charToPut = 'f'; break;
133 case SDLK_g: charToPut = 'g'; break;
134 case SDLK_h: charToPut = 'h'; break;
135 case SDLK_i: charToPut = 'i'; break;
136 case SDLK_j: charToPut = 'j'; break;
137 case SDLK_k: charToPut = 'k'; break;
138 case SDLK_l: charToPut = 'l'; break;
139 case SDLK_m: charToPut = 'm'; break;
140 case SDLK_n: charToPut = 'n'; break;
141 case SDLK_o: charToPut = 'o'; break;
142 case SDLK_p: charToPut = 'p'; break;
143 case SDLK_q: charToPut = 'q'; break;
144 case SDLK_r: charToPut = 'r'; break;
145 case SDLK_s: charToPut = 's'; break;
146 case SDLK_t: charToPut = 't'; break;
147 case SDLK_u: charToPut = 'u'; break;
148 case SDLK_v: charToPut = 'v'; break;
149 case SDLK_w: charToPut = 'w'; break;
150 case SDLK_x: charToPut = 'x'; break;
151 case SDLK_y: charToPut = 'y'; break;
152 case SDLK_z: charToPut = 'z'; break;
153 case SDLK_0: charToPut = '0'; break;
154 case SDLK_1: charToPut = '1'; break;
155 case SDLK_2: charToPut = '2'; break;
156 case SDLK_3: charToPut = '3'; break;
157 case SDLK_4: charToPut = '4'; break;
158 case SDLK_5: charToPut = '5'; break;
159 case SDLK_6: charToPut = '6'; break;
160 case SDLK_7: charToPut = '7'; break;
161 case SDLK_8: charToPut = '8'; break;
162 case SDLK_9: charToPut = '9'; break;
163 case SDLK_KP0: charToPut = '0'; break;
164 case SDLK_KP1: charToPut = '1'; break;
165 case SDLK_KP2: charToPut = '2'; break;
166 case SDLK_KP3: charToPut = '3'; break;
167 case SDLK_KP4: charToPut = '4'; break;
168 case SDLK_KP5: charToPut = '5'; break;
169 case SDLK_KP6: charToPut = '6'; break;
170 case SDLK_KP7: charToPut = '7'; break;
171 case SDLK_KP8: charToPut = '8'; break;
172 case SDLK_KP9: charToPut = '9'; break;
173 case SDLK_KP_PERIOD:
174 case SDLK_PERIOD: charToPut='.'; break;
175 default: return false;
176 }
177 if((keys[SDLK_LSHIFT]) || (keys[SDLK_RSHIFT]))
178 {
179 switch(charToPut)
180 {
181 case 'a': charToPut = 'A'; break;
182 case 'b': charToPut = 'B'; break;
183 case 'c': charToPut = 'C'; break;
184 case 'd': charToPut = 'D'; break;
185 case 'e': charToPut = 'E'; break;
186 case 'f': charToPut = 'F'; break;
187 case 'g': charToPut = 'G'; break;
188 case 'h': charToPut = 'H'; break;
189 case 'i': charToPut = 'I'; break;
190 case 'j': charToPut = 'J'; break;
191 case 'k': charToPut = 'K'; break;
192 case 'l': charToPut = 'L'; break;
193 case 'm': charToPut = 'M'; break;
194 case 'n': charToPut = 'N'; break;
195 case 'o': charToPut = 'O'; break;
196 case 'p': charToPut = 'P'; break;
197 case 'q': charToPut = 'Q'; break;
198 case 'r': charToPut = 'R'; break;
199 case 's': charToPut = 'S'; break;
200 case 't': charToPut = 'T'; break;
201 case 'u': charToPut = 'U'; break;
202 case 'v': charToPut = 'V'; break;
203 case 'w': charToPut = 'W'; break;
204 case 'x': charToPut = 'X'; break;
205 case 'y': charToPut = 'Y'; break;
206 case 'z': charToPut = 'Z'; break;
207
208 default: charToPut = charToPut;
209 }
210 }
211 ReadKeyboard::putchar(charToPut);
212 return true;
213 }
214
215 char* ReadKeyboard::GetString()
216 {
217 textstring[29]='\0';
218 return &textstring[0];
219 }
0 /*
1 ReadKeyBoard.h
2 Copyright (C) 2005 Poul Sander
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 Poul Sander
19 Rævehøjvej 36, V. 1111
20 2800 Kgs. Lyngby
21 DENMARK
22 poul.sander@tdcadsl.dk
23 */
24
25 /*
26 Added to project 5/11-2004
27 */
28
29 #include <cstring>
30 #include "SDL.h"
31
32 using namespace std;
33
34 class ReadKeyboard
35 {
36 private:
37 int length, maxLength, position;
38 char textstring[30];
39 void putchar(char);
40 void removeChar();
41 public:
42 ReadKeyboard(void);
43 ~ReadKeyboard(void);
44 ReadKeyboard(char*);
45 Uint8 CharsBeforeCursor(); //Where should the cursor be placed?
46 bool ReadKey(SDLKey); //true if key accepted
47 char* GetString(void);
48 };
0 # Option #
1 opts = Options(ARGUMENTS)
2 opts.Add('destdir', 'Staging area to install BlockAttack to. Useful for packagers.', '')
3 opts.Add('prefix', 'Destination directory', '/usr/local')
4 opts.Add('sharedir', 'Directory to use to store data file', '$prefix/share/blockattack')
5 opts.Add('bindir', 'Directory to use to store data file', '$prefix/bin')
6 opts.Add('mandir', 'Directory to use to store data file', '$prefix/share/man')
7
8 # Sources #
9 src = Split("""main.cpp
10 highscore.cpp
11 SFont.c
12 ReadKeyboard.cpp
13 joypad.cpp
14 listFiles.cpp
15 replay.cpp""")
16
17 # Copy Build Environment #
18 env = Environment(options = opts)
19 Export("env")
20 SConsignFile()
21
22 # Modify Build Environment #
23 env.ParseConfig('sdl-config --cflags --libs')
24 env.Append(CPPDEFINES = [('SHAREDIR', '\\"$sharedir\\"')])
25 env.Append(LIBS = ['SDL', 'enet','SDL_image','SDL_mixer'])
26 env.Append(LIBPATH = ['/usr/lib'])
27
28
29 # Compile Executable #
30 blockattack = env.Program('blockattack', src)
31 Default(blockattack)
32
33 # game materials (sharefiles)
34 SConscript('Game/SConscript')
35
36 # manpage
37 SConscript('man/SConscript')
38 # icons menu
39 env.Install ('$destdir/$prefix/share/pixmaps/',['blockattack32.xpm','blockattack64.xpm'])
40 env.Alias('install', ['$destdir/$prefix/share/pixmaps/'])
41
42 env.Install ('$destdir/$prefix/share/applications/',['blockattack.desktop'])
43 env.Alias('install', ['$destdir/$prefix/share/applications'])
44
45 # Install blockattack itself
46 env.Install('$destdir/$bindir/', blockattack)
47 env.Alias('install', ['$destdir/$bindir/'])
0 # Option #
1 opts = Options(ARGUMENTS)
2 opts.Add('destdir', 'Staging area to install BlockAttack to. Useful for packagers.', '')
3 opts.Add('prefix', 'Destination directory', '/usr/local')
4 opts.Add('sharedir', 'Directory to use to store data file', '$prefix/share/blockattack')
5 opts.Add('bindir', 'Directory to use to store data file', '$prefix/bin')
6 opts.Add('mandir', 'Directory to use to store data file', '$prefix/share/man')
7
8 # Sources #
9 src = Split("""main.cpp
10 highscore.cpp
11 SFont.c
12 ReadKeyboard.cpp
13 joypad.cpp
14 listFiles.cpp
15 replay.cpp""")
16
17 # Copy Build Environment #
18 env = Environment(options = opts)
19 Export("env")
20 SConsignFile()
21
22 # Modify Build Environment #
23 env.ParseConfig('sdl-config --cflags --libs')
24 env.Append(CPPDEFINES = [('SHAREDIR', '\\"$sharedir\\"')])
25 env.Append(LIBS = ['SDL', 'enet','SDL_image','SDL_mixer'])
26 env.Append(LIBPATH = ['/usr/lib'])
27
28
29 # Compile Executable #
30 blockattack = env.Program('blockattack', src)
31 Default(blockattack)
32
33 # game materials (sharefiles)
34 SConscript('Game/SConscript')
35
36 # manpage
37 SConscript('man/SConscript')
38 # icons menu
39 env.Install ('$prefix/share/pixmaps/',['blockattack32.xpm','blockattack64.xpm'])
40 env.Alias('install', ['$prefix/share/pixmaps/'])
41
42 env.Install ('$prefix/share/applications/',['blockattack.desktop'])
43 env.Alias('install', ['$prefix/share/applications'])
44
45 # Install blockattack itself
46 env.Install('$bindir/', blockattack)
47 env.Alias('install', ['$bindir/'])
0 /* SFont: a simple font-library that uses special .pngs as fonts
1 Copyright (C) 2003 Karl Bartel
2
3 License: GPL or LGPL (at your choice)
4 WWW: http://www.linux-games.com/sfont/
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
20 Karl Bartel
21 Cecilienstr. 14
22 12307 Berlin
23 GERMANY
24 karlb@gmx.net
25 */
26 #include <SDL.h>
27
28 #include <assert.h>
29 #include <stdlib.h>
30 #include "SFont.h"
31
32 static long GetPixel(SDL_Surface *Surface, Sint32 X, Sint32 Y)
33 {
34 Uint8 *bits;
35 Uint32 Bpp;
36
37 assert(X>=0);
38 assert(X<Surface->w);
39
40 Bpp = Surface->format->BytesPerPixel;
41 bits = ((Uint8 *)Surface->pixels)+Y*Surface->pitch+X*Bpp;
42
43 // Get the pixel
44 switch(Bpp) {
45 case 1:
46 return *((Uint8 *)Surface->pixels + Y * Surface->pitch + X);
47 break;
48 case 2:
49 return *((Uint16 *)Surface->pixels + Y * Surface->pitch/2 + X);
50 break;
51 case 3: { // Format/endian independent
52 Uint8 r, g, b;
53 r = *((bits)+Surface->format->Rshift/8);
54 g = *((bits)+Surface->format->Gshift/8);
55 b = *((bits)+Surface->format->Bshift/8);
56 return SDL_MapRGB(Surface->format, r, g, b);
57 }
58 break;
59 case 4:
60 return *((Uint32 *)Surface->pixels + Y * Surface->pitch/4 + X);
61 break;
62 }
63
64 return -1;
65 }
66
67 SFont_Font* SFont_InitFont(SDL_Surface* Surface)
68 {
69 int x = 0, i = 0;
70 Uint32 pixel;
71 SFont_Font* Font;
72 Uint32 pink;
73
74 if (Surface == NULL)
75 return NULL;
76
77 Font = (SFont_Font *) malloc(sizeof(SFont_Font));
78 Font->Surface = Surface;
79
80 SDL_LockSurface(Surface);
81
82 pink = SDL_MapRGB(Surface->format, 255, 0, 255);
83 while (x < Surface->w) {
84 if (GetPixel(Surface, x, 0) == pink) {
85 Font->CharPos[i++]=x;
86 while((x < Surface->w) && (GetPixel(Surface, x, 0)== pink))
87 x++;
88 Font->CharPos[i++]=x;
89 }
90 x++;
91 }
92 Font->MaxPos = x-1;
93
94 pixel = GetPixel(Surface, 0, Surface->h-1);
95 SDL_UnlockSurface(Surface);
96 SDL_SetColorKey(Surface, SDL_SRCCOLORKEY, pixel);
97
98 return Font;
99 }
100
101 void SFont_FreeFont(SFont_Font* FontInfo)
102 {
103 SDL_FreeSurface(FontInfo->Surface);
104 free(FontInfo);
105 }
106
107 void SFont_Write(SDL_Surface *Surface, const SFont_Font *Font,
108 int x, int y, const char *text)
109 {
110 const char* c;
111 int charoffset;
112 SDL_Rect srcrect, dstrect;
113
114 if(text == NULL)
115 return;
116
117 // these values won't change in the loop
118 srcrect.y = 1;
119 dstrect.y = y;
120 srcrect.h = dstrect.h = Font->Surface->h - 1;
121
122 for(c = text; *c != '\0' && x <= Surface->w ; c++) {
123 charoffset = ((int) (*c - 33)) * 2 + 1;
124 // skip spaces and nonprintable characters
125 if (*c == ' ' || charoffset < 0 || charoffset > Font->MaxPos) {
126 x += Font->CharPos[2]-Font->CharPos[1];
127 continue;
128 }
129
130 srcrect.w = dstrect.w =
131 (Font->CharPos[charoffset+2] + Font->CharPos[charoffset+1])/2 -
132 (Font->CharPos[charoffset] + Font->CharPos[charoffset-1])/2;
133 srcrect.x = (Font->CharPos[charoffset]+Font->CharPos[charoffset-1])/2;
134 dstrect.x = x - (int)(Font->CharPos[charoffset]
135 - Font->CharPos[charoffset-1])/2;
136
137 SDL_BlitSurface(Font->Surface, &srcrect, Surface, &dstrect);
138
139 x += Font->CharPos[charoffset+1] - Font->CharPos[charoffset];
140 }
141 }
142
143 int SFont_TextWidth(const SFont_Font *Font, const char *text)
144 {
145 const char* c;
146 int charoffset=0;
147 int width = 0;
148
149 if(text == NULL)
150 return 0;
151
152 for(c = text; *c != '\0'; c++) {
153 charoffset = ((int) *c - 33) * 2 + 1;
154 // skip spaces and nonprintable characters
155 if (*c == ' ' || charoffset < 0 || charoffset > Font->MaxPos) {
156 width += Font->CharPos[2]-Font->CharPos[1];
157 continue;
158 }
159
160 width += Font->CharPos[charoffset+1] - Font->CharPos[charoffset];
161 }
162
163 return width;
164 }
165
166 int SFont_TextHeight(const SFont_Font* Font)
167 {
168 return Font->Surface->h - 1;
169 }
170
171 void SFont_WriteCenter(SDL_Surface *Surface, const SFont_Font *Font,
172 int y, const char *text)
173 {
174 SFont_Write(Surface, Font, Surface->w/2 - SFont_TextWidth(Font, text)/2,
175 y, text);
176 }
177
0 /* SFont: a simple font-library that uses special bitmaps as fonts
1 Copyright (C) 2003 Karl Bartel
2
3 License: GPL or LGPL (at your choice)
4 WWW: http://www.linux-games.com/sfont/
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
20 Karl Bartel
21 Cecilienstr. 14
22 12307 Berlin
23 GERMANY
24 karlb@gmx.net
25 */
26
27 /************************************************************************
28 * SFONT - SDL Font Library by Karl Bartel <karlb@gmx.net> *
29 * *
30 * All functions are explained below. For further information, take a *
31 * look at the example files, the links at the SFont web site, or *
32 * contact me, if you problem isn' addressed anywhere. *
33 * *
34 ************************************************************************/
35 #ifndef SFONT_H
36 #define SFONT_H
37
38 #include <SDL.h>
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43
44 // Delcare one variable of this type for each font you are using.
45 // To load the fonts, load the font image into YourFont->Surface
46 // and call InitFont( YourFont );
47 typedef struct {
48 SDL_Surface *Surface;
49 int CharPos[512];
50 int MaxPos;
51 } SFont_Font;
52
53 // Initializes the font
54 // Font: this contains the suface with the font.
55 // The Surface must be loaded before calling this function
56 SFont_Font* SFont_InitFont (SDL_Surface *Font);
57
58 // Frees the font
59 // Font: The font to free
60 // The font must be loaded before using this function.
61 void SFont_FreeFont(SFont_Font* Font);
62
63 // Blits a string to a surface
64 // Destination: the suface you want to blit to
65 // text: a string containing the text you want to blit.
66 void SFont_Write(SDL_Surface *Surface, const SFont_Font *Font, int x, int y,
67 const char *text);
68
69 // Returns the width of "text" in pixels
70 int SFont_TextWidth(const SFont_Font* Font, const char *text);
71 // Returns the height of "text" in pixels (which is always equal to Font->Surface->h)
72 int SFont_TextHeight(const SFont_Font* Font);
73
74 // Blits a string to Surface with centered x position
75 void SFont_WriteCenter(SDL_Surface *Surface, const SFont_Font* Font, int y,
76 const char *text);
77
78 #ifdef __cplusplus
79 }
80 #endif
81
82 #endif /* SFONT_H */
0 Index: blockattack-1.2.2/SConstruct
1 ===================================================================
2 --- blockattack-1.2.2.orig/SConstruct 2006-08-18 18:56:03.000000000 +0200
3 +++ blockattack-1.2.2/SConstruct 2006-08-18 19:24:57.000000000 +0200
4 @@ -1,7 +1,10 @@
5 # Option #
6 opts = Options(ARGUMENTS)
7 +opts.Add('destdir', 'Staging area to install BlockAttack to. Useful for packagers.', '')
8 opts.Add('prefix', 'Destination directory', '/usr/local')
9 opts.Add('sharedir', 'Directory to use to store data file', '$prefix/share/blockattack')
10 +opts.Add('bindir', 'Directory to use to store data file', '$prefix/bin')
11 +opts.Add('mandir', 'Directory to use to store data file', '$prefix/share/man')
12
13 # Sources #
14 src = Split("""main.cpp
15 @@ -34,12 +37,12 @@
16 # manpage
17 SConscript('man/SConscript')
18 # icons menu
19 -env.Install ('$prefix/pixmaps/',['blockattack32.xpm','blockattack64.xpm'])
20 -env.Alias('install', ['$prefix/pixmaps'])
21 +env.Install ('$destdir/$prefix/share/pixmaps/',['blockattack32.xpm','blockattack64.xpm'])
22 +env.Alias('install', ['$destdir/$prefix/share/pixmaps/'])
23
24 -env.Install ('$prefix/applications/',['blockattack.desktop'])
25 -env.Alias('install', ['$prefix/applications'])
26 +env.Install ('$destdir/$prefix/share/applications/',['blockattack.desktop'])
27 +env.Alias('install', ['$destdir/$prefix/share/applications'])
28
29 -# Install #
30 -env.Install('$prefix/games/', blockattack)
31 -env.Alias('install', ['$prefix/games/'])
32 +# Install blockattack itself
33 +env.Install('$destdir/$prefix/$bindir/', blockattack)
34 +env.Alias('install', ['$destdir/$prefix/$bindir/'])
35 Index: blockattack-1.2.2/Game/SConscript
36 ===================================================================
37 --- blockattack-1.2.2.orig/Game/SConscript 2006-08-18 19:01:27.000000000 +0200
38 +++ blockattack-1.2.2/Game/SConscript 2006-08-18 19:21:40.000000000 +0200
39 @@ -3,7 +3,7 @@
40 #-------------#
41 Import('*')
42
43 -env.Install ('$destdir/$sharedir/gfx/garbage/',[
44 +env.Install ('$destdir/$destdir/$sharedir/gfx/garbage/',[
45 'gfx/garbage/garbageB.png',
46 'gfx/garbage/garbageBL.png',
47 'gfx/garbage/garbageBR.png',
48 @@ -16,15 +16,15 @@
49 'gfx/garbage/garbageT.png',
50 'gfx/garbage/garbageTL.png',
51 'gfx/garbage/garbageTR.png'])
52 -env.Alias('install', ['$sharedir/gfx/garbage'])
53 +env.Alias('install', ['$destdir/$sharedir/gfx/garbage'])
54
55 -env.Install ('$sharedir/gfx/counter/',[
56 +env.Install ('$destdir/$sharedir/gfx/counter/',[
57 'gfx/counter/1.png',
58 'gfx/counter/2.png',
59 'gfx/counter/3.png'])
60 -env.Alias('install', ['$sharedir/gfx/counter'])
61 +env.Alias('install', ['$destdir/$sharedir/gfx/counter'])
62
63 -env.Install ('$sharedir/gfx/balls/',[
64 +env.Install ('$destdir/$sharedir/gfx/balls/',[
65 'gfx/balls/ballYellow.png',
66 'gfx/balls/ballTurkish.png',
67 'gfx/balls/ballRed.png',
68 @@ -32,33 +32,33 @@
69 'gfx/balls/ballGreen.png',
70 'gfx/balls/ballGray.png',
71 'gfx/balls/ballBlue.png'])
72 -env.Alias('install', ['$sharedir/gfx/balls'])
73 +env.Alias('install', ['$destdir/$sharedir/gfx/balls'])
74
75 -env.Install ('$sharedir/gfx/animations/bomb/',[
76 +env.Install ('$destdir/$sharedir/gfx/animations/bomb/',[
77 'gfx/animations/bomb/bomb_1.png',
78 'gfx/animations/bomb/bomb_2.png'])
79 -env.Alias('install', ['$sharedir/gfx/animations'])
80 +env.Alias('install', ['$destdir/$sharedir/gfx/animations'])
81
82 -env.Install ('$sharedir/gfx/animations/explosion/',[
83 +env.Install ('$destdir/$sharedir/gfx/animations/explosion/',[
84 'gfx/animations/explosion/3.png',
85 'gfx/animations/explosion/2.png',
86 'gfx/animations/explosion/1.png',
87 'gfx/animations/explosion/0.png'])
88 -env.Alias('install', ['$sharedir/gfx/animations/explosion'])
89 +env.Alias('install', ['$destdir/$sharedir/gfx/animations/explosion'])
90
91
92 -env.Install ('$sharedir/gfx/animations/cursor/',[
93 +env.Install ('$destdir/$sharedir/gfx/animations/cursor/',[
94 'gfx/animations/cursor/2.png',
95 'gfx/animations/cursor/1.png'])
96 -env.Alias('install', ['$sharedir/gfx/animations/cursor'])
97 +env.Alias('install', ['$destdir/$sharedir/gfx/animations/cursor'])
98
99
100 -env.Install ('$sharedir/gfx/animations/ready/',[
101 +env.Install ('$destdir/$sharedir/gfx/animations/ready/',[
102 'gfx/animations/ready/ready_2.png',
103 'gfx/animations/ready/ready_1.png'])
104 -env.Alias('install', ['$sharedir/gfx/animations/ready'])
105 +env.Alias('install', ['$destdir/$sharedir/gfx/animations/ready'])
106
107 -env.Install ('$sharedir/gfx/nyBrikker/',[
108 +env.Install ('$destdir/$sharedir/gfx/nyBrikker/',[
109 'gfx/nyBrikker/yellow.png',
110 'gfx/nyBrikker/turkish.png',
111 'gfx/nyBrikker/red.png',
112 @@ -66,10 +66,10 @@
113 'gfx/nyBrikker/grey.png',
114 'gfx/nyBrikker/green.png',
115 'gfx/nyBrikker/blue.png'])
116 -env.Alias('install', ['$sharedir/gfx/nyBrikker'])
117 +env.Alias('install', ['$destdir/$sharedir/gfx/nyBrikker'])
118
119
120 -env.Install ('$sharedir/gfx/',[
121 +env.Install ('$destdir/$sharedir/gfx/',[
122 'gfx/bSave.png',
123 'gfx/bReplays.png',
124 'gfx/bLoad.png',
125 @@ -137,9 +137,9 @@
126 'gfx/iDraw.png',
127 'gfx/bOff.png',
128 'gfx/mouse.png'])
129 -env.Alias('install', ['$sharedir/gfx'])
130 +env.Alias('install', ['$destdir/$sharedir/gfx'])
131
132 -env.Install ('$sharedir/sound/',[
133 +env.Install ('$destdir/$sharedir/sound/',[
134 'sound/applause.ogg',
135 'sound/whistleblow.ogg',
136 'sound/heartbeat3.ogg',
137 @@ -148,14 +148,14 @@
138 'sound/cameraclick.ogg',
139 'sound/pop.ogg',
140 'sound/counter.ogg'])
141 -env.Alias('install', ['$sharedir/sound'])
142 +env.Alias('install', ['$destdir/$sharedir/sound'])
143
144 -env.Install ('$sharedir/res/',[
145 +env.Install ('$destdir/$sharedir/res/',[
146 'res/testPuzzles',
147 'res/copy',
148 'res/puzzle.levels'])
149 -env.Alias('install', ['$sharedir/res'])
150 +env.Alias('install', ['$destdir/$sharedir/res'])
151
152 -env.Install ('$sharedir/music/',[
153 +env.Install ('$destdir/$sharedir/music/',[
154 'music/bgMusic.ogg'])
155 -env.Alias('install', ['$sharedir/music'])
156 +env.Alias('install', ['$destdir/$sharedir/music'])
157 Index: blockattack-1.2.2/man/SConscript
158 ===================================================================
159 --- blockattack-1.2.2.orig/man/SConscript 2006-08-18 19:04:02.000000000 +0200
160 +++ blockattack-1.2.2/man/SConscript 2006-08-18 19:08:51.000000000 +0200
161 @@ -3,6 +3,6 @@
162 #-------------#
163 Import('*')
164
165 -env.Install ('$prefix/man/man6/','blockattack.6.gz')
166 -env.Alias('install', '$prefix/man/man6/')
167 +env.Install ('$destdir/$prefix/$mandir/man6/','blockattack.6.gz')
168 +env.Alias('install', '$destdir/$prefix/$mandir/man6/')
169
0 Game/bloackattack: main.o highscore.o SFont.o ReadKeyboard.o joypad.o listFiles.o replay.o
1 g++ -O -o Game/blockattack main.o highscore.o SFont.o ReadKeyboard.o joypad.o listFiles.o replay.o `sdl-config --cflags --libs` -lSDL_image -lSDL_mixer enet-1.0/libenet.a
2
3 main.o: main.cpp
4 g++ -c main.cpp `sdl-config --cflags`
5
6 highscore.o: highscore.h highscore.cpp
7 g++ -c highscore.cpp
8
9 SFont.o: SFont.h SFont.c
10 g++ -c SFont.c `sdl-config --cflags`
11
12 ReadKeyboard.o: ReadKeyboard.h ReadKeyboard.cpp
13 g++ -c ReadKeyboard.cpp `sdl-config --cflags`
14
15 joypad.o: joypad.h joypad.cpp
16 g++ -c joypad.cpp `sdl-config --cflags`
17
18 listFiles.o: listFiles.h listFiles.cpp
19 g++ -c listFiles.cpp
20
21 replay.o: replay.h replay.cpp
22 g++ -c replay.cpp `sdl-config --cflags`
0 Game/bloackattack: main.o highscore.o SFont.o ReadKeyboard.o joypad.o listFiles.o replay.o
1 g++ -O -o Game/blockattack main.o highscore.o SFont.o ReadKeyboard.o joypad.o listFiles.o replay.o `sdl-config --cflags --libs` -lSDL_image -lSDL_mixer enet_1.0/libenet.a
2
3 main.o: main.cpp
4 g++ -c main.cpp `sdl-config --cflags`
5
6 highscore.o: highscore.h highscore.cpp
7 g++ -c highscore.cpp
8
9 SFont.o: SFont.h SFont.c
10 g++ -c SFont.c `sdl-config --cflags`
11
12 ReadKeyboard.o: ReadKeyboard.h ReadKeyboard.cpp
13 g++ -c ReadKeyboard.cpp `sdl-config --cflags`
14
15 joypad.o: joypad.h joypad.cpp
16 g++ -c joypad.cpp `sdl-config --cflags`
17
18 listFiles.o: listFiles.h listFiles.cpp
19 g++ -c listFiles.cpp
20
21 replay.o: replay.h replay.cpp
22 g++ -c replay.cpp `sdl-config --cflags`
Binary diff not shown
0 [Desktop Entry]
1 Version=1.0
2 Encoding=UTF-8
3 Name=Block Attack - Rise of the Blocks
4 Comment=Switch blocks so they match
5 Comment[ro_RO]=Ridicarea blocurilor
6 Comment[da_DK]=Byt blokke så de passer sammen
7 Comment[fr_FR]=Empilez les blocks
8 GenericName=Block Attack
9 Exec=blockattack
10 Icon=blockattack32
11 Terminal=false
12 Type=Application
13 Categories=Application;Game;ArcadeGame
0 [Desktop Entry]
1 Version=1.0
2 Encoding=UTF-8
3 Name=Block Attack - Rise of the Blocks
4 Comment=Switch blocks so they match
5 +Comment[ro_RO]=Ridicarea blocurilor
6 +Comment[da_DK]=Byt blokke så de passer sammen
7 +Comment[fr_FR]=Empilez les blocks
8 GenericName=Block Attack
9 Exec=blockattack
10 Icon=/usr/share/pixmaps/blockattack.xpm
11 Terminal=false
12 Type=Application
13 Categories=Application;Game;BlocksGame;
14 GenericName[da_DK]=Block Attack
15 Comment[da_DK]=Byt blokke så de passer sammen
16 Name[da_DK]=Block Attack - Rise of the Blocks
0 /* XPM */
1 static char * blockicon_xpm[] = {
2 "200 200 1409 2",
3 " c None",
4 ". c #5A5A0D",
5 "+ c #6E6E13",
6 "@ c #86861A",
7 "# c #999925",
8 "$ c #A3A335",
9 "% c #A7A740",
10 "& c #AAAA47",
11 "* c #ABAB48",
12 "= c #ABAB49",
13 "- c #ADAD4D",
14 "; c #B1B157",
15 "> c #BCBC6B",
16 ", c #CACA83",
17 "' c #DADA9F",
18 ") c #E7E7B0",
19 "! c #414109",
20 "~ c #4E4E0D",
21 "{ c #646414",
22 "] c #79791C",
23 "^ c #898924",
24 "/ c #919130",
25 "( c #949436",
26 "_ c #96963A",
27 ": c #97973B",
28 "< c #98983E",
29 "[ c #9C9C45",
30 "} c #A6A657",
31 "| c #B4B470",
32 "1 c #C9C993",
33 "2 c #DCDCAB",
34 "3 c #F0F0C0",
35 "4 c #333309",
36 "5 c #43430E",
37 "6 c #6A6A18",
38 "7 c #80801C",
39 "8 c #8D8D1F",
40 "9 c #8D8D21",
41 "0 c #8E8E21",
42 "a c #8E8E22",
43 "b c #8F8F24",
44 "c c #94942F",
45 "d c #9E9E43",
46 "e c #B5B570",
47 "f c #CDCD9B",
48 "g c #E5E5C1",
49 "h c #F1F1C4",
50 "i c #313106",
51 "j c #35350A",
52 "k c #4A4A10",
53 "l c #78781A",
54 "m c #86861D",
55 "n c #8D8D1E",
56 "o c #93932B",
57 "p c #A2A24A",
58 "q c #BBBB7B",
59 "r c #D8D8AF",
60 "s c #EAEABB",
61 "t c #F5F5C3",
62 "u c #2C2C07",
63 "v c #38380B",
64 "w c #535312",
65 "x c #84841D",
66 "y c #8C8C1E",
67 "z c #8B8B1C",
68 "A c #8C8C1D",
69 "B c #92922A",
70 "C c #ABAB5C",
71 "D c #CBCB9A",
72 "E c #E4E4B3",
73 "F c #F0F0BF",
74 "G c #292907",
75 "H c #3B3B0C",
76 "I c #595914",
77 "J c #88881E",
78 "K c #8E8E1F",
79 "L c #A2A24B",
80 "M c #C0C085",
81 "N c #DCDCA6",
82 "O c #EAEAB5",
83 "P c #282806",
84 "Q c #3C3C0C",
85 "R c #5B5B14",
86 "S c #8A8A1E",
87 "T c #B9B979",
88 "U c #D8D89D",
89 "V c #E7E7AE",
90 "W c #3D3D0C",
91 "X c #5C5C14",
92 "Y c #8C8C1F",
93 "Z c #8C8C1C",
94 "` c #9C9C40",
95 " . c #B6B673",
96 ".. c #D6D697",
97 "+. c #E4E4A8",
98 "@. c #8B8B1F",
99 "#. c #9C9C3F",
100 "$. c #B6B672",
101 "%. c #8E8E1E",
102 "&. c #8F8F1E",
103 "*. c #D6D696",
104 "=. c #E4E4A7",
105 "-. c #8F8F1F",
106 ";. c #93931E",
107 ">. c #97971E",
108 ",. c #8B8B1E",
109 "'. c #9A9A1E",
110 "). c #A8A81E",
111 "!. c #B5B51D",
112 "~. c #98981E",
113 "{. c #89891F",
114 "]. c #B5B671",
115 "^. c #D0D592",
116 "/. c #DAE2A1",
117 "(. c #4DC94D",
118 "_. c #4EC94E",
119 ":. c #4FC94F",
120 "<. c #51CA51",
121 "[. c #5ACD5A",
122 "}. c #63D163",
123 "|. c #72DB72",
124 "1. c #82E582",
125 "2. c #8EED8E",
126 "3. c #8A8A1F",
127 "4. c #A5A51E",
128 "5. c #BDBD1D",
129 "6. c #D3D31D",
130 "7. c #A3A31E",
131 "8. c #B5B571",
132 "9. c #CFD492",
133 "0. c #DAE0A1",
134 "a. c #49B049",
135 "b. c #4AB04A",
136 "c. c #4CB14C",
137 "d. c #54B554",
138 "e. c #5DB95D",
139 "f. c #6EC36E",
140 "g. c #80CD80",
141 "h. c #94D794",
142 "i. c #A9E3A9",
143 "j. c #B0EAB0",
144 "k. c #B2B21E",
145 "l. c #D2D21D",
146 "m. c #ECEC1D",
147 "n. c #AFAF1E",
148 "o. c #CFD392",
149 "p. c #D9DFA0",
150 "q. c #449A44",
151 "r. c #469B46",
152 "s. c #4D9F4D",
153 "t. c #57A457",
154 "u. c #69AF69",
155 "v. c #7DBA7D",
156 "w. c #95CA95",
157 "x. c #ABD9AB",
158 "y. c #B3E6B3",
159 "z. c #BFF7BF",
160 "A. c #C0C01E",
161 "B. c #E2E21D",
162 "C. c #F8F81D",
163 "D. c #BABA1E",
164 "E. c #94941E",
165 "F. c #CED291",
166 "G. c #D8DE9F",
167 "H. c #309330",
168 "I. c #319331",
169 "J. c #349534",
170 "K. c #3A983A",
171 "L. c #479F47",
172 "M. c #57A857",
173 "N. c #76B976",
174 "O. c #93C993",
175 "P. c #A9D9A9",
176 "Q. c #C0EAC0",
177 "R. c #C2EFC2",
178 "S. c #CFCF1E",
179 "T. c #F0F01E",
180 "U. c #FEFE1E",
181 "V. c #C6C61E",
182 "W. c #9E9E1E",
183 "X. c #CDD290",
184 "Y. c #D6DE9D",
185 "Z. c #1E8D1E",
186 "`. c #1F8D1F",
187 " + c #218E21",
188 ".+ c #299229",
189 "++ c #359735",
190 "@+ c #79B979",
191 "#+ c #9ECE9E",
192 "$+ c #BFE2BF",
193 "%+ c #C2EAC2",
194 "&+ c #90901E",
195 "*+ c #A0A01E",
196 "=+ c #DCDC1E",
197 "-+ c #F9F91E",
198 ";+ c #D4D41E",
199 ">+ c #ACAC1E",
200 ",+ c #279027",
201 "'+ c #3D9B3D",
202 ")+ c #55A855",
203 "!+ c #83BF83",
204 "~+ c #ADD6AD",
205 "{+ c #B6E3B6",
206 "]+ c #C3F5C3",
207 "^+ c #88881F",
208 "/+ c #96961E",
209 "(+ c #B0B01E",
210 "_+ c #E5E51E",
211 ":+ c #FDFD1E",
212 "<+ c #E1E11E",
213 "[+ c #BCBC1E",
214 "}+ c #1D8C1D",
215 "|+ c #1B8B1B",
216 "1+ c #1C8B1C",
217 "2+ c #269026",
218 "3+ c #369936",
219 "4+ c #6AB26A",
220 "5+ c #9BCB9B",
221 "6+ c #ADDDAD",
222 "7+ c #C0F1C0",
223 "8+ c #87871F",
224 "9+ c #C2C21E",
225 "0+ c #ECEC1E",
226 "a+ c #FFFF1F",
227 "b+ c #EEEE1D",
228 "c+ c #CCCC1D",
229 "d+ c #1E8C1E",
230 "e+ c #1D8B1D",
231 "f+ c #2B932B",
232 "g+ c #5BAA5B",
233 "h+ c #89C289",
234 "i+ c #A0D6A0",
235 "j+ c #B8ECB8",
236 "k+ c #D6D61D",
237 "l+ c #F2F21E",
238 "m+ c #F7F71E",
239 "n+ c #D9D91D",
240 "o+ c #9F9F1E",
241 "p+ c #238E23",
242 "q+ c #4FA44F",
243 "r+ c #7ABA7A",
244 "s+ c #96D196",
245 "t+ c #B1E8B1",
246 "u+ c #B3B31E",
247 "v+ c #E7E71D",
248 "w+ c #E4E41E",
249 "x+ c #AEAE1E",
250 "y+ c #4CA24C",
251 "z+ c #75B675",
252 "A+ c #90CE90",
253 "B+ c #ACE6AC",
254 "C+ c #F6F61E",
255 "D+ c #FCFC1E",
256 "E+ c #EBEB1E",
257 "F+ c #BFBF1E",
258 "G+ c #9D9D1E",
259 "H+ c #1F8C1F",
260 "I+ c #1C8C1C",
261 "J+ c #208E20",
262 "K+ c #49A149",
263 "L+ c #70B470",
264 "M+ c #8CCC8C",
265 "N+ c #A8E4A8",
266 "O+ c #A1A11E",
267 "P+ c #CCCC1E",
268 "Q+ c #F1F11E",
269 "R+ c #A7A71E",
270 "S+ c #1F8B1F",
271 "T+ c #208D20",
272 "U+ c #D8D81E",
273 "V+ c #FFFF1E",
274 "W+ c #E6E61E",
275 "X+ c #49A049",
276 "Y+ c #8BCC8B",
277 "Z+ c #A7E4A7",
278 "`+ c #C1C11E",
279 " @ c #F5F51E",
280 ".@ c #1F8E1F",
281 "+@ c #1F901F",
282 "@@ c #1F921F",
283 "#@ c #D2D21E",
284 "$@ c #EFEF1E",
285 "%@ c #FBFB1E",
286 "&@ c #CBCB1E",
287 "*@ c #1E911E",
288 "=@ c #1E971E",
289 "-@ c #1E9D1E",
290 ";@ c #1EA31E",
291 ">@ c #1E8B1E",
292 ",@ c #A4A41E",
293 "'@ c #E0E01E",
294 ")@ c #F8F81E",
295 "!@ c #D8D81D",
296 "~@ c #1F8A1F",
297 "{@ c #1E891E",
298 "]@ c #1E9A1E",
299 "^@ c #1EAA1E",
300 "/@ c #1DB81D",
301 "(@ c #1DC61D",
302 "_@ c #1EA81E",
303 ":@ c #1E8A1E",
304 "<@ c #EAEA1E",
305 "[@ c #E4E41D",
306 "}@ c #C0C01D",
307 "|@ c #1EA51E",
308 "1@ c #1DBF1D",
309 "2@ c #1CD11C",
310 "3@ c #1CE21C",
311 "4@ c #1DB91D",
312 "5@ c #C4C41E",
313 "6@ c #D1D11D",
314 "7@ c #1DB31D",
315 "8@ c #1CD81C",
316 "9@ c #1BE71B",
317 "0@ c #1BF51B",
318 "a@ c #1CCA1C",
319 "b@ c #1E9E1E",
320 "c@ c #1E931E",
321 "d@ c #84841F",
322 "e@ c #AAAA1E",
323 "f@ c #D6D61E",
324 "g@ c #A2A21E",
325 "h@ c #1E901E",
326 "i@ c #1DC21D",
327 "j@ c #1BEB1B",
328 "k@ c #1BFE1B",
329 "l@ c #1CD91C",
330 "m@ c #92921F",
331 "n@ c #95951F",
332 "o@ c #94941F",
333 "p@ c #93931F",
334 "q@ c #92921E",
335 "r@ c #BBBB1D",
336 "s@ c #B6B61E",
337 "t@ c #90901F",
338 "u@ c #1E981E",
339 "v@ c #1EA91E",
340 "w@ c #1CD21C",
341 "x@ c #1BF91B",
342 "y@ c #1BFC1B",
343 "z@ c #1CE61C",
344 "A@ c #1DCE1D",
345 "B@ c #1EAC1E",
346 "C@ c #B1B11E",
347 "D@ c #F4F41D",
348 "E@ c #F3F31E",
349 "F@ c #D1D11E",
350 "G@ c #BBBB1E",
351 "H@ c #A6A61E",
352 "I@ c #1DC01D",
353 "J@ c #1CE01C",
354 "K@ c #1BFF1B",
355 "L@ c #1BF11B",
356 "M@ c #1CE31C",
357 "N@ c #1DBC1D",
358 "O@ c #1E8E1E",
359 "P@ c #C2C21D",
360 "Q@ c #DEDE1D",
361 "R@ c #EFEF1D",
362 "S@ c #EDED1D",
363 "T@ c #F4F41E",
364 "U@ c #EEEE1E",
365 "V@ c #EBEB1D",
366 "W@ c #E5E51D",
367 "X@ c #BFBF1D",
368 "Y@ c #1DB51D",
369 "Z@ c #1CDB1C",
370 "`@ c #1BED1B",
371 " # c #1BFA1B",
372 ".# c #1CCC1C",
373 "+# c #1EA11E",
374 "@# c #1E941E",
375 "## c #C5C51D",
376 "$# c #F2F21D",
377 "%# c #FAFA1E",
378 "&# c #E1E11D",
379 "*# c #C6C61D",
380 "=# c #A9A91E",
381 "-# c #95951E",
382 ";# c #1E9B1E",
383 "># c #1DC51D",
384 ",# c #1BF61B",
385 "'# c #1BFD1B",
386 ")# c #1DB71D",
387 "!# c #1EA01E",
388 "~# c #C4C41D",
389 "{# c #1F891F",
390 "]# c #1DAD1D",
391 "^# c #1CD51C",
392 "/# c #1BFB1B",
393 "(# c #1CE81C",
394 "_# c #1DD21D",
395 ":# c #1DAF1D",
396 "<# c #B5B51E",
397 "[# c #D5D51D",
398 "}# c #F5F51D",
399 "|# c #F0F01D",
400 "1# c #B3B31D",
401 "2# c #9B9B1E",
402 "3# c #1BF31B",
403 "4# c #1E961E",
404 "5# c #1E8F1E",
405 "6# c #99991E",
406 "7# c #E8E81D",
407 "8# c #E8E81E",
408 "9# c #CECE1D",
409 "0# c #B1B11D",
410 "a# c #1CDE1C",
411 "b# c #1BEF1B",
412 "c# c #1CD01C",
413 "d# c #1DA51D",
414 "e# c #1E951E",
415 "f# c #C8C81D",
416 "g# c #1E921E",
417 "h# c #1E9F1E",
418 "i# c #1CC91C",
419 "j# c #1BF71B",
420 "k# c #B9B91D",
421 "l# c #DCDC1D",
422 "m# c #F1F11D",
423 "n# c #F6F61D",
424 "o# c #DADA1D",
425 "p# c #91911E",
426 "q# c #1DB01D",
427 "r# c #1CD61C",
428 "s# c #B8B81D",
429 "t# c #D4D41D",
430 "u# c #B7B71D",
431 "v# c #1DAB1D",
432 "w# c #1CC81C",
433 "x# c #1BE51B",
434 "y# c #1BF41B",
435 "z# c #1DC31D",
436 "A# c #CFCF1D",
437 "B# c #A3A31D",
438 "C# c #1DBD1D",
439 "D# c #1CD31C",
440 "E# c #1DA81D",
441 "F# c #C3C31E",
442 "G# c #DFDF1D",
443 "H# c #E0E01D",
444 "I# c #C1C11D",
445 "J# c #1BF81B",
446 "K# c #1BE11B",
447 "L# c #1CC01C",
448 "M# c #1DA61D",
449 "N# c #BCBC1D",
450 "O# c #DDDD1D",
451 "P# c #1DB41D",
452 "Q# c #1CDC1C",
453 "R# c #1BDA1B",
454 "S# c #1DB61D",
455 "T# c #AAAA1D",
456 "U# c #D0D01E",
457 "V# c #1DAE1D",
458 "W# c #1CCD1C",
459 "X# c #1BE81B",
460 "Y# c #1CC71C",
461 "Z# c #1F911F",
462 "`# c #ADAD1E",
463 " $ c #1BE61B",
464 ".$ c #1CD71C",
465 "+$ c #E6E61D",
466 "@$ c #DDDD1E",
467 "#$ c #1EA61E",
468 "$$ c #1BE31B",
469 "%$ c #91911F",
470 "&$ c #1CDF1C",
471 "*$ c #1BDD1B",
472 "=$ c #89891E",
473 "-$ c #E7E71E",
474 ";$ c #1DB21D",
475 ">$ c #1BEA1B",
476 ",$ c #CBCB1D",
477 "'$ c #1E991E",
478 ")$ c #1DC41D",
479 "!$ c #1CDA1C",
480 "~$ c #1EAB1E",
481 "{$ c #1CD41C",
482 "]$ c #1DAC1D",
483 "^$ c #1BDF1B",
484 "/$ c #C7C71E",
485 "($ c #1BF01B",
486 "_$ c #1CCF1C",
487 ":$ c #DBDB1E",
488 "<$ c #F3F31D",
489 "[$ c #AFAF1D",
490 "}$ c #B2B21D",
491 "|$ c #1BE91B",
492 "1$ c #1DCD1D",
493 "2$ c #C7C71D",
494 "3$ c #F7F71D",
495 "4$ c #C3C31D",
496 "5$ c #E3E31D",
497 "6$ c #1DC11D",
498 "7$ c #1BF21B",
499 "8$ c #BEBE1D",
500 "9$ c #DBDB1D",
501 "0$ c #1BEE1B",
502 "a$ c #1DA71D",
503 "b$ c #D7D71D",
504 "c$ c #E2E21E",
505 "d$ c #1CCB1C",
506 "e$ c #1BE01B",
507 "f$ c #E9E91E",
508 "g$ c #9C9C1E",
509 "h$ c #1CC41C",
510 "i$ c #1E9C1E",
511 "j$ c #B0B01D",
512 "k$ c #C9C91D",
513 "l$ c #ADAD1D",
514 "m$ c #ABAB1E",
515 "n$ c #CACA1E",
516 "o$ c #1EA41E",
517 "p$ c #1DBE1D",
518 "q$ c #A6A61D",
519 "r$ c #C5C51E",
520 "s$ c #C8C81E",
521 "t$ c #FAFA1D",
522 "u$ c #FEFE1D",
523 "v$ c #D5D51E",
524 "w$ c #1CE71C",
525 "x$ c #1DC81D",
526 "y$ c #E9E91D",
527 "z$ c #CDCD1D",
528 "A$ c #A7A71D",
529 "B$ c #CACA1D",
530 "C$ c #1CC21C",
531 "D$ c #B9B91E",
532 "E$ c #D6DD9D",
533 "F$ c #1DBA1D",
534 "G$ c #1DB11D",
535 "H$ c #1CCE1C",
536 "I$ c #1BEC1B",
537 "J$ c #1CDD1C",
538 "K$ c #B4B471",
539 "L$ c #CCD190",
540 "M$ c #1DAA1D",
541 "N$ c #CCD18E",
542 "O$ c #D7DF9C",
543 "P$ c #3A3A0C",
544 "Q$ c #585813",
545 "R$ c #9D9D40",
546 "S$ c #B4B46F",
547 "T$ c #CBD08B",
548 "U$ c #D6DF97",
549 "V$ c #2B2B06",
550 "W$ c #34340A",
551 "X$ c #4E4E11",
552 "Y$ c #81811C",
553 "Z$ c #8F8F22",
554 "`$ c #9D9D42",
555 " % c #B0B16B",
556 ".% c #C3CD7A",
557 "+% c #CBDD80",
558 "@% c #2F2F07",
559 "#% c #2D2D09",
560 "$% c #41410E",
561 "%% c #717118",
562 "&% c #83831C",
563 "*% c #8D8D20",
564 "=% c #909026",
565 "-% c #ACAE5E",
566 ";% c #B3CA62",
567 ">% c #B7E064",
568 ",% c #383807",
569 "'% c #31310A",
570 ")% c #4F4F11",
571 "!% c #6F6F18",
572 "~% c #87871D",
573 "{% c #8F8F28",
574 "]% c #9B9B37",
575 "^% c #A6AA46",
576 "/% c #96CB40",
577 "(% c #8EEB3E",
578 "_% c #1CC11C",
579 ":% c #B11111",
580 "<% c #BB1313",
581 "[% c #952918",
582 "}% c #5C2D12",
583 "|% c #3A2E0C",
584 "1% c #37360B",
585 "2% c #4D4D11",
586 "3% c #636316",
587 "4% c #707018",
588 "5% c #75751A",
589 "6% c #77771A",
590 "7% c #79791A",
591 "8% c #7A7A1B",
592 "9% c #7D7D1C",
593 "0% c #828221",
594 "a% c #9A932A",
595 "b% c #B9A434",
596 "c% c #C7873F",
597 "d% c #CD7C44",
598 "e% c #BF5041",
599 "f% c #BF5142",
600 "g% c #BF5243",
601 "h% c #C25A4B",
602 "i% c #C36353",
603 "j% c #C17A5E",
604 "k% c #BE9369",
605 "l% c #A0B261",
606 "m% c #81D157",
607 "n% c #52E73B",
608 "o% c #22FC1F",
609 "p% c #1DFE1C",
610 "q% c #690909",
611 "r% c #780A0A",
612 "s% c #8D0E0E",
613 "t% c #9E1111",
614 "u% c #A01F1C",
615 "v% c #77301A",
616 "w% c #4F3011",
617 "x% c #2D250A",
618 "y% c #312D0B",
619 "z% c #3B3A0D",
620 "A% c #4B4A11",
621 "B% c #535212",
622 "C% c #575613",
623 "D% c #585713",
624 "E% c #5A5913",
625 "F% c #5F5E14",
626 "G% c #676516",
627 "H% c #767118",
628 "I% c #9A851F",
629 "J% c #C19526",
630 "K% c #B55F33",
631 "L% c #B14839",
632 "M% c #AE423A",
633 "N% c #AE433B",
634 "O% c #B14A43",
635 "P% c #B4534C",
636 "Q% c #B7695B",
637 "R% c #BB806B",
638 "S% c #B59D76",
639 "T% c #AEBA7E",
640 "U% c #8DD06A",
641 "V% c #6BE655",
642 "W% c #44F239",
643 "X% c #1EFE1D",
644 "Y% c #1BE41B",
645 "Z% c #4A0707",
646 "`% c #5A0707",
647 " & c #660808",
648 ".& c #770B0B",
649 "+& c #880F0F",
650 "@& c #8F1C1B",
651 "#& c #892922",
652 "$& c #762F1F",
653 "%& c #5A3118",
654 "&& c #473010",
655 "*& c #3B310C",
656 "=& c #3A340C",
657 "-& c #3B360B",
658 ";& c #3E390B",
659 ">& c #3E390C",
660 ",& c #3F3A0C",
661 "'& c #4A420F",
662 ")& c #5E4F13",
663 "!& c #81611C",
664 "~& c #985F26",
665 "{& c #A6532E",
666 "]& c #A03F32",
667 "^& c #9D3634",
668 "/& c #9C3434",
669 "(& c #9D3434",
670 "_& c #9D3535",
671 ":& c #A03C3C",
672 "<& c #A44444",
673 "[& c #AE5858",
674 "}& c #B86D6D",
675 "|& c #C88888",
676 "1& c #D8A3A3",
677 "2& c #C5BA97",
678 "3& c #B1D18A",
679 "4& c #6CE757",
680 "5& c #24FC22",
681 "6& c #23FC21",
682 "7& c #3A0505",
683 "8& c #3B0505",
684 "9& c #560707",
685 "0& c #6D0909",
686 "a& c #7D0B0B",
687 "b& c #8C0D0D",
688 "c& c #901313",
689 "d& c #901A18",
690 "e& c #852017",
691 "f& c #6A2C12",
692 "g& c #4F2C0C",
693 "h& c #3A2B09",
694 "i& c #322907",
695 "j& c #322A07",
696 "k& c #332B07",
697 "l& c #342C08",
698 "m& c #41350A",
699 "n& c #5A420E",
700 "o& c #845014",
701 "p& c #944019",
702 "q& c #98231D",
703 "r& c #96201D",
704 "s& c #961E1E",
705 "t& c #961F1F",
706 "u& c #982222",
707 "v& c #9A2727",
708 "w& c #A03535",
709 "x& c #A74444",
710 "y& c #B76565",
711 "z& c #C88686",
712 "A& c #CAA595",
713 "B& c #CBC5A4",
714 "C& c #91DB76",
715 "D& c #56F047",
716 "E& c #55F047",
717 "F& c #1CC51C",
718 "G& c #390505",
719 "H& c #340404",
720 "I& c #320404",
721 "J& c #540707",
722 "K& c #750A0A",
723 "L& c #830B0B",
724 "M& c #900C0C",
725 "N& c #900B0B",
726 "O& c #941515",
727 "P& c #981E1E",
728 "Q& c #A74242",
729 "R& c #B86969",
730 "S& c #CD9191",
731 "T& c #E2B9B9",
732 "U& c #B6CE95",
733 "V& c #87E36D",
734 "W& c #86E36C",
735 "X& c #1EAD1E",
736 "Y& c #1F931F",
737 "Z& c #310505",
738 "`& c #350404",
739 " * c #380404",
740 ".* c #5D0707",
741 "+* c #810B0B",
742 "@* c #890B0B",
743 "#* c #910E0E",
744 "$* c #921111",
745 "%* c #9C2929",
746 "&* c #A84242",
747 "** c #BE7373",
748 "=* c #D6A5A5",
749 "-* c #C2BD99",
750 ";* c #AED48B",
751 ">* c #AED58B",
752 ",* c #1F881F",
753 "'* c #2D0404",
754 ")* c #360505",
755 "!* c #3F0505",
756 "~* c #8C0C0C",
757 "{* c #8E0C0C",
758 "]* c #8E0808",
759 "^* c #8D0606",
760 "/* c #921212",
761 "(* c #B15656",
762 "_* c #CA9191",
763 ":* c #CEAC9C",
764 "<* c #D1C7A6",
765 "[* c #D1C7A5",
766 "}* c #2B0404",
767 "|* c #380505",
768 "1* c #450505",
769 "2* c #6B0808",
770 "3* c #8F0A0A",
771 "4* c #900E0E",
772 "5* c #931414",
773 "6* c #AA4747",
774 "7* c #C17C7C",
775 "8* c #CC9C92",
776 "9* c #D7BCA5",
777 "0* c #2A0404",
778 "a* c #490606",
779 "b* c #6F0909",
780 "c* c #920C0C",
781 "d* c #910C0C",
782 "e* c #8F0B0B",
783 "f* c #A33939",
784 "g* c #B96B6B",
785 "h* c #CB8E87",
786 "i* c #DBB1A4",
787 "j* c #DBB2A5",
788 "k* c #4A0606",
789 "l* c #8F0909",
790 "m* c #A23636",
791 "n* c #B66565",
792 "o* c #C78881",
793 "p* c #D9AD9F",
794 "q* c #DAAEA0",
795 "r* c #1EA21E",
796 "s* c #290303",
797 "t* c #8F0C0C",
798 "u* c #A13333",
799 "v* c #B46060",
800 "w* c #C5847D",
801 "x* c #D7AA9A",
802 "y* c #8E0B0B",
803 "z* c #8D0B0B",
804 "A* c #8D0C0C",
805 "B* c #D7A999",
806 "C* c #C5837C",
807 "D* c #8C0B0B",
808 "E* c #940C0C",
809 "F* c #970D0D",
810 "G* c #990D0D",
811 "H* c #9A0D0D",
812 "I* c #9B0D0D",
813 "J* c #980D0D",
814 "K* c #960C0C",
815 "L* c #930C0C",
816 "M* c #A00E0E",
817 "N* c #A50E0E",
818 "O* c #AA0F0F",
819 "P* c #AD0F0F",
820 "Q* c #AF1010",
821 "R* c #B11010",
822 "S* c #AC0F0F",
823 "T* c #A80F0F",
824 "U* c #A40E0E",
825 "V* c #9E0D0D",
826 "W* c #910B0B",
827 "X* c #1DBB1D",
828 "Y* c #A20E0E",
829 "Z* c #B61111",
830 "`* c #C01212",
831 " = c #C81414",
832 ".= c #CD1414",
833 "+= c #D31515",
834 "@= c #D81515",
835 "#= c #DC1616",
836 "$= c #DE1616",
837 "%= c #DF1616",
838 "&= c #DD1616",
839 "*= c #DB1616",
840 "== c #D61515",
841 "-= c #D11515",
842 ";= c #CC1414",
843 ">= c #C51313",
844 ",= c #BD1212",
845 "'= c #B31010",
846 ")= c #A90F0F",
847 "!= c #9F0E0E",
848 "~= c #960D0D",
849 "{= c #AF0F0F",
850 "]= c #BC1111",
851 "^= c #C91313",
852 "/= c #D51515",
853 "(= c #E11717",
854 "_= c #EA1818",
855 ":= c #EF1919",
856 "<= c #F41919",
857 "[= c #F91919",
858 "}= c #FC1A1A",
859 "|= c #FE1A1A",
860 "1= c #FF1B1B",
861 "2= c #FE1B1B",
862 "3= c #FD1B1B",
863 "4= c #FB1A1A",
864 "5= c #F71A1A",
865 "6= c #F31919",
866 "7= c #EE1818",
867 "8= c #E71717",
868 "9= c #D21515",
869 "0= c #B71111",
870 "a= c #970C0C",
871 "b= c #AE0F0F",
872 "c= c #BF1111",
873 "d= c #CE1414",
874 "e= c #DB1515",
875 "f= c #E41717",
876 "g= c #E91818",
877 "h= c #EE1919",
878 "i= c #F31A1A",
879 "j= c #F81A1A",
880 "k= c #FA1A1A",
881 "l= c #FD1A1A",
882 "m= c #F51A1A",
883 "n= c #F21919",
884 "o= c #ED1919",
885 "p= c #E81818",
886 "q= c #E01717",
887 "r= c #D71616",
888 "s= c #CA1414",
889 "t= c #BA1111",
890 "u= c #AB0F0F",
891 "v= c #9C0D0D",
892 "w= c #D7A899",
893 "x= c #A60E0E",
894 "y= c #B81111",
895 "z= c #CA1313",
896 "A= c #F61A1A",
897 "B= c #D91616",
898 "C= c #C71313",
899 "D= c #B31111",
900 "E= c #C5827C",
901 "F= c #D7A69A",
902 "G= c #980C0C",
903 "H= c #BC1212",
904 "I= c #D01515",
905 "J= c #DF1717",
906 "K= c #EB1818",
907 "L= c #F11919",
908 "M= c #B61010",
909 "N= c #A30E0E",
910 "O= c #C5817C",
911 "P= c #D7A49A",
912 "Q= c #C11212",
913 "R= c #DA1616",
914 "S= c #FC1B1B",
915 "T= c #F91A1A",
916 "U= c #A50F0F",
917 "V= c #C5807C",
918 "W= c #D7A29A",
919 "X= c #E71818",
920 "Y= c #CB1414",
921 "Z= c #B41111",
922 "`= c #D7A19A",
923 " - c #EC1818",
924 ".- c #CF1515",
925 "+- c #B21010",
926 "@- c #C41212",
927 "#- c #F01919",
928 "$- c #FB1B1B",
929 "%- c #BF1212",
930 "&- c #218D21",
931 "*- c #6FB36F",
932 "=- c #8ACB8A",
933 "-- c #A5E4A5",
934 ";- c #C41313",
935 ">- c #E01616",
936 ",- c #F91B1B",
937 "'- c #F21A1A",
938 ")- c #B91111",
939 "!- c #228E22",
940 "~- c #87CA87",
941 "{- c #A0E2A0",
942 "]- c #C61313",
943 "^- c #259025",
944 "/- c #6CB16C",
945 "(- c #7FC97F",
946 "_- c #93E193",
947 ":- c #950C0C",
948 "<- c #C31313",
949 "[- c #FA1B1B",
950 "}- c #F41A1A",
951 "|- c #228F22",
952 "1- c #2A932A",
953 "2- c #4AA04A",
954 "3- c #68AF68",
955 "4- c #74C674",
956 "5- c #82E082",
957 "6- c #BE1212",
958 "7- c #BB1111",
959 "8- c #248F24",
960 "9- c #2C922C",
961 "0- c #439F43",
962 "a- c #57AA58",
963 "b- c #5EB16D",
964 "c- c #65B880",
965 "d- c #4848A9",
966 "e- c #5252AD",
967 "f- c #6262B5",
968 "g- c #7B7BC3",
969 "h- c #9797D4",
970 "i- c #AEAEE3",
971 "j- c #1F8F1F",
972 "k- c #268F26",
973 "l- c #2D912D",
974 "m- c #399D39",
975 "n- c #43A645",
976 "o- c #459F5D",
977 "p- c #479774",
978 "q- c #373795",
979 "r- c #3D3D99",
980 "s- c #49499F",
981 "t- c #5E5EAB",
982 "u- c #8383C0",
983 "v- c #A3A3D5",
984 "w- c #BFBFED",
985 "x- c #9A0C0C",
986 "y- c #D21414",
987 "z- c #E41818",
988 "A- c #AC1010",
989 "B- c #C57F7C",
990 "C- c #D7A099",
991 "D- c #1B7A1B",
992 "E- c #1B7B1B",
993 "F- c #1B7C1B",
994 "G- c #1C7E1C",
995 "H- c #208220",
996 "I- c #238724",
997 "J- c #2B9532",
998 "K- c #2F9F40",
999 "L- c #2E7E5D",
1000 "M- c #2C5D79",
1001 "N- c #1E1E8D",
1002 "O- c #1F1F8D",
1003 "P- c #24248F",
1004 "Q- c #2E2E94",
1005 "R- c #5B5BAA",
1006 "S- c #8C8CC3",
1007 "T- c #BEBEE0",
1008 "U- c #C3C3EE",
1009 "V- c #C57E7C",
1010 "W- c #D79E99",
1011 "X- c #155F15",
1012 "Y- c #156115",
1013 "Z- c #156315",
1014 "`- c #166616",
1015 " ; c #176917",
1016 ".; c #197219",
1017 "+; c #1A7B1B",
1018 "@; c #1B8B2B",
1019 "#; c #1D973D",
1020 "$; c #1E6163",
1021 "%; c #202D87",
1022 "&; c #363698",
1023 "*; c #6262AE",
1024 "=; c #A4A4D0",
1025 "-; c #B7B7E5",
1026 ";; c #C2C2F3",
1027 ">; c #D41515",
1028 ",; c #D79D99",
1029 "'; c #0E470E",
1030 "); c #0D450E",
1031 "!; c #0D450F",
1032 "~; c #0E4510",
1033 "{; c #0E4511",
1034 "]; c #0F4712",
1035 "^; c #0F4913",
1036 "/; c #104F16",
1037 "(; c #12551A",
1038 "_; c #155F26",
1039 ":; c #186733",
1040 "<; c #1A6749",
1041 "[; c #1C635F",
1042 "}; c #1E4375",
1043 "|; c #1F248A",
1044 "1; c #1D1D8C",
1045 "2; c #1B1B8A",
1046 "3; c #4747A1",
1047 "4; c #8B8BC2",
1048 "5; c #AAAADE",
1049 "6; c #BBBBED",
1050 "7; c #E31717",
1051 "8; c #A70E0E",
1052 "9; c #C57D7C",
1053 "0; c #D79B99",
1054 "a; c #072E07",
1055 "b; c #072B09",
1056 "c; c #072B0A",
1057 "d; c #072C0C",
1058 "e; c #082D0F",
1059 "f; c #092D10",
1060 "g; c #092F11",
1061 "h; c #0B3717",
1062 "i; c #0D4120",
1063 "j; c #134C38",
1064 "k; c #175450",
1065 "l; c #1B3E6C",
1066 "m; c #1E2986",
1067 "n; c #1E2489",
1068 "o; c #1E1E8C",
1069 "p; c #383899",
1070 "q; c #7676B7",
1071 "r; c #9D9DD6",
1072 "s; c #B1B1E8",
1073 "t; c #A10E0E",
1074 "u; c #DD1717",
1075 "v; c #930B0B",
1076 "w; c #D69B99",
1077 "x; c #062C06",
1078 "y; c #062908",
1079 "z; c #062909",
1080 "A; c #072A0C",
1081 "B; c #072B0F",
1082 "C; c #082C0F",
1083 "D; c #092D11",
1084 "E; c #0B3618",
1085 "F; c #0D4020",
1086 "G; c #124B39",
1087 "H; c #175352",
1088 "I; c #1B3B6E",
1089 "J; c #1E2588",
1090 "K; c #1E218B",
1091 "L; c #353597",
1092 "M; c #6E6EB3",
1093 "N; c #9595D3",
1094 "O; c #ABABE5",
1095 "P; c #B01010",
1096 "Q; c #C81313",
1097 "R; c #CB8080",
1098 "S; c #E5A3A3",
1099 "T; c #060628",
1100 "U; c #0D0D3E",
1101 "V; c #151561",
1102 "W; c #1F1F8F",
1103 "X; c #1F1F8C",
1104 "Y; c #1F1F8B",
1105 "Z; c #1C1C8C",
1106 "`; c #343497",
1107 " > c #6C6CB1",
1108 ".> c #9393D2",
1109 "+> c #A8A8E4",
1110 "@> c #E51717",
1111 "#> c #D71515",
1112 "$> c #1C1C8B",
1113 "%> c #343496",
1114 "&> c #6B6BB1",
1115 "*> c #9292D2",
1116 "=> c #A7A7E4",
1117 "-> c #1F1F8A",
1118 ";> c #1E1E93",
1119 ">> c #1E1E9C",
1120 ",> c #1E1E9F",
1121 "'> c #1E1E94",
1122 ")> c #1F1F89",
1123 "!> c #AE1010",
1124 "~> c #1F1F8E",
1125 "{> c #1E1E96",
1126 "]> c #1D1DAF",
1127 "^> c #1C1CC3",
1128 "/> c #1C1CD1",
1129 "(> c #1C1CD3",
1130 "_> c #1C1CD4",
1131 ":> c #1D1DC6",
1132 "<> c #1E1E99",
1133 "[> c #1E1E97",
1134 "}> c #1E1EAF",
1135 "|> c #1C1CD8",
1136 "1> c #1B1BF0",
1137 "2> c #1B1BFD",
1138 "3> c #1B1BFE",
1139 "4> c #1B1BFF",
1140 "5> c #1B1BFC",
1141 "6> c #1B1BF4",
1142 "7> c #1C1CD7",
1143 "8> c #1D1DB6",
1144 "9> c #1D1DAE",
1145 "0> c #1C1CDD",
1146 "a> c #1B1BF8",
1147 "b> c #1B1BE1",
1148 "c> c #1D1DA8",
1149 "d> c #1E1E92",
1150 "e> c #DA1515",
1151 "f> c #F61919",
1152 "g> c #D01414",
1153 "h> c #1E1E8B",
1154 "i> c #1E1E95",
1155 "j> c #1D1DBF",
1156 "k> c #1B1BEE",
1157 "l> c #1D1DC0",
1158 "m> c #1F1F88",
1159 "n> c #E61717",
1160 "o> c #1E1E9B",
1161 "p> c #1C1CCA",
1162 "q> c #1B1BF3",
1163 "r> c #1C1CD0",
1164 "s> c #1E1EA3",
1165 "t> c #1F1F87",
1166 "u> c #ED1818",
1167 "v> c #1E1E9D",
1168 "w> c #1C1CCB",
1169 "x> c #1E1EA5",
1170 "y> c #CC1313",
1171 "z> c #D11414",
1172 "A> c #F81919",
1173 "B> c #D91515",
1174 "C> c #EA1919",
1175 "D> c #EB1919",
1176 "E> c #CF1414",
1177 "F> c #A70F0F",
1178 "G> c #A80E0E",
1179 "H> c #9E0E0E",
1180 "I> c #F71919",
1181 "J> c #950D0D",
1182 "K> c #9F0D0D",
1183 "L> c #A60F0F",
1184 "M> c #C31212",
1185 "N> c #E21717",
1186 "O> c #E21616",
1187 "P> c #D31414",
1188 "Q> c #990C0C",
1189 "R> c #D81616",
1190 "S> c #B71010",
1191 "T> c #A10D0D",
1192 "U> c #BE1111",
1193 "V> c #D61616",
1194 "W> c #BB1212",
1195 "X> c #9D0D0D",
1196 "Y> c #C51212",
1197 "Z> c #E11616",
1198 "`> c #BA1212",
1199 " , c #F01A1A",
1200 "., c #C21212",
1201 "+, c #A00D0D",
1202 "@, c #E81717",
1203 "#, c #AB1010",
1204 "$, c #9D0E0E",
1205 "%, c #EC1919",
1206 "&, c #B41010",
1207 "*, c #E61818",
1208 "=, c #C11313",
1209 "-, c #C91414",
1210 ";, c #C71414",
1211 ">, c #C01313",
1212 ",, c #1D1DC2",
1213 "', c #1C1CC4",
1214 "), c #1E1E9E",
1215 "!, c #8B0B0B",
1216 "~, c #B45F5F",
1217 "{, c #1D1DB0",
1218 "], c #1C1CDF",
1219 "^, c #1B1BF6",
1220 "/, c #1B1BDF",
1221 "(, c #1D1DAD",
1222 "_, c #A13232",
1223 ":, c #1E1E9A",
1224 "<, c #1D1DB9",
1225 "[, c #1B1BE5",
1226 "}, c #1B1BFA",
1227 "|, c #1B1BF9",
1228 "1, c #1B1BE3",
1229 "2, c #1C1CC2",
1230 "3, c #480606",
1231 "4, c #6E0909",
1232 "5, c #A03232",
1233 "6, c #B35E5E",
1234 "7, c #CA7E7E",
1235 "8, c #E39F9F",
1236 "9, c #E4A0A0",
1237 "0, c #1E1E8E",
1238 "a, c #1D1DB1",
1239 "b, c #1C1CC6",
1240 "c, c #1C1CD6",
1241 "d, c #1C1CD9",
1242 "e, c #370505",
1243 "f, c #450606",
1244 "g, c #6C0909",
1245 "h, c #B25E5E",
1246 "i, c #C97B7B",
1247 "j, c #E19A9A",
1248 "k, c #E29B9B",
1249 "l, c #1E1EA1",
1250 "m, c #1D1DAB",
1251 "n, c #1D1DAC",
1252 "o, c #1D1DAA",
1253 "p, c #1D1DA3",
1254 "q, c #3D0505",
1255 "r, c #650808",
1256 "s, c #A03434",
1257 "t, c #B05B5B",
1258 "u, c #C77373",
1259 "v, c #E18D8D",
1260 "w, c #2E0404",
1261 "x, c #300404",
1262 "y, c #330404",
1263 "z, c #860B0B",
1264 "A, c #910F0F",
1265 "B, c #941414",
1266 "C, c #A13535",
1267 "D, c #C56969",
1268 "E, c #E07C7C",
1269 "F, c #E17C7C",
1270 "G, c #320505",
1271 "H, c #2B0303",
1272 "I, c #4C0606",
1273 "J, c #6D0808",
1274 "K, c #7E0A0A",
1275 "L, c #900A0A",
1276 "M, c #921010",
1277 "N, c #941616",
1278 "O, c #A02E2E",
1279 "P, c #AC4747",
1280 "Q, c #C35656",
1281 "R, c #E66C6C",
1282 "S, c #0C0C3C",
1283 "T, c #15155F",
1284 "U, c #6B6BB0",
1285 "V, c #8F8FD1",
1286 "W, c #A3A3E3",
1287 "X, c #3A0606",
1288 "Y, c #240303",
1289 "Z, c #3A0404",
1290 "`, c #500606",
1291 " ' c #880B0B",
1292 ".' c #920B0B",
1293 "+' c #931818",
1294 "@' c #9E2525",
1295 "#' c #A93333",
1296 "$' c #C13E3E",
1297 "%' c #F15151",
1298 "&' c #F25252",
1299 "*' c #060629",
1300 "=' c #0B0B38",
1301 "-' c #14145A",
1302 ";' c #6969B0",
1303 ">' c #8888CF",
1304 ",' c #9898E1",
1305 "'' c #2F0404",
1306 ")' c #4F0606",
1307 "!' c #640808",
1308 "~' c #770909",
1309 "{' c #790909",
1310 "]' c #7B0A0A",
1311 "^' c #7C0A0A",
1312 "/' c #7D0A0A",
1313 "(' c #7F0A0A",
1314 "_' c #830D0D",
1315 ":' c #881212",
1316 "<' c #9D1B1B",
1317 "[' c #B62626",
1318 "}' c #C63030",
1319 "|' c #07072D",
1320 "1' c #0A0A30",
1321 "2' c #11114E",
1322 "3' c #1C1C83",
1323 "4' c #23238F",
1324 "5' c #3A3A99",
1325 "6' c #6565AC",
1326 "7' c #7777CC",
1327 "8' c #8181E0",
1328 "9' c #350505",
1329 "0' c #250303",
1330 "a' c #3C0505",
1331 "b' c #570707",
1332 "c' c #5C0707",
1333 "d' c #600808",
1334 "e' c #610808",
1335 "f' c #630808",
1336 "g' c #690808",
1337 "h' c #710909",
1338 "i' c #7A0A0A",
1339 "j' c #9B0F0F",
1340 "k' c #CA1616",
1341 "l' c #060634",
1342 "m' c #08082A",
1343 "n' c #0D0D3C",
1344 "o' c #151562",
1345 "p' c #1B1B7D",
1346 "q' c #26268F",
1347 "r' c #353598",
1348 "s' c #5050A9",
1349 "t' c #5E5ECC",
1350 "u' c #6969E8",
1351 "v' c #340505",
1352 "w' c #420505",
1353 "x' c #470606",
1354 "y' c #500707",
1355 "z' c #580707",
1356 "A' c #7E0B0B",
1357 "B' c #990E0E",
1358 "C' c #07072A",
1359 "D' c #09092F",
1360 "E' c #0E0E40",
1361 "F' c #191975",
1362 "G' c #1B1B80",
1363 "H' c #1C1C81",
1364 "I' c #1D1D82",
1365 "J' c #1D1D83",
1366 "K' c #1D1D84",
1367 "L' c #232387",
1368 "M' c #2C2C94",
1369 "N' c #3838AE",
1370 "O' c #4242CC",
1371 "P' c #2C0404",
1372 "Q' c #2F0505",
1373 "R' c #440606",
1374 "S' c #5E0909",
1375 "T' c #890D0D",
1376 "U' c #070735",
1377 "V' c #07072E",
1378 "W' c #080824",
1379 "X' c #0C0C33",
1380 "Y' c #101044",
1381 "Z' c #131356",
1382 "`' c #15155C",
1383 " ) c #15155E",
1384 ".) c #161664",
1385 "+) c #171767",
1386 "@) c #191972",
1387 "#) c #1A1A8C",
1388 "$) c #1C1CC8",
1389 "%) c #3B0606",
1390 "&) c #2C0303",
1391 "*) c #2D0303",
1392 "=) c #430606",
1393 "-) c #5D0909",
1394 ";) c #8A0D0D",
1395 ">) c #080830",
1396 ",) c #090934",
1397 "') c #0B0B3A",
1398 ")) c #0C0C3D",
1399 "!) c #0C0C3F",
1400 "~) c #0C0C40",
1401 "{) c #0D0D45",
1402 "]) c #0F0F50",
1403 "^) c #12126C",
1404 "/) c #15158D",
1405 "() c #06063B",
1406 "_) c #060630",
1407 ":) c #06062C",
1408 "<) c #06062A",
1409 "[) c #080833",
1410 "}) c #090942",
1411 "|) c #0C0C68",
1412 " ",
1413 " ",
1414 " ",
1415 " ",
1416 " ",
1417 " ",
1418 " ",
1419 " ",
1420 " ",
1421 " ",
1422 " ",
1423 " ",
1424 " ",
1425 " ",
1426 " . + @ # $ % & * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * = - ; > , ' ) ",
1427 " ! ~ { ] ^ / ( _ : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : < [ } | 1 2 3 ",
1428 " 4 5 6 7 8 9 0 0 a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a b c d e f g h ",
1429 " i j k l m 8 8 n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n 0 o p q r s t ",
1430 " u v w x y 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n n z A B C D E F ",
1431 " G H I J K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n n A A 9 L M N O ",
1432 " P Q R S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 y A A d T U V ",
1433 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Y Y Y Y Y 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A Z ` ...+. ",
1434 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Y Y Y @.Y 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.$...+. ",
1435 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Y Y 8 %.&.n Y Y 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.$.*.=. ",
1436 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Y Y -.;.>.&.@.Y 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.$.*.=. ",
1437 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 @.,.'.).!.~.{.Y 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.].^./.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(._.:.<.[.}.|.1.2. ",
1438 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 3.S 4.5.6.7.{.Y Y 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.9.0.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.b.c.d.e.f.g.h.i.j. ",
1439 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 3.,.k.l.m.n.Y Y Y 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.o.p.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.r.s.t.u.v.w.x.y.z. ",
1440 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 @.%.A.B.C.D.E.,.@.8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.F.G.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.I.J.K.L.M.N.O.P.Q.R. ",
1441 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Y Y y E.S.T.U.V.W.S 3.8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.`. +.+++M.@+#+$+%+ ",
1442 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Y 3.&+*+=+-+U.;+>+S 3.8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.`. +,+'+)+!+~+{+]+]+ ",
1443 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Y ^+/+(+_+:+U.<+[+n 3.Y Y 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+|+1+2+3+4+5+6+7+7+ ",
1444 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Y @.8+W.9+0+a+U.b+c+;.y Y Y 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.d+e+e+ +f+g+h+i+j+j+ ",
1445 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Y @.^+).k+l+a+U.m+n+o+&+@.Y 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.d+d+}+}+p+q+r+s+t+t+ ",
1446 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Y ,.n u+v+m+a+U.:+w+x+/+{.Y 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.d+d+}+}+ +y+z+A+B+B+ ",
1447 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 @.y E.A.C+D+a+U.U.E+F+G+8+@.8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.H+H+H+H+H+H+H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+I+J+K+L+M+N+N+ ",
1448 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 3.n O+P+D+U.a+a+a+Q+;+R+^+Y 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.H+H+H+S+S+H+H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+I+T+K+L+M+N+N+ ",
1449 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 3.&.(+U+V+V+a+a+a+m+W+k.y y Y 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.H+H+H+H+H+H+H+H+H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1450 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 3.;.`+_+V+V+a+a+a+D+ @F+;.y @.8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`..@+@@@.@S+H+H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1451 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Y Y Y '.#@$@a+a+a+a+a+U.%@&@*+n 3.8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.H+H+d+*@=@-@;@=@>@S+H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1452 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Y @.&+,@'@)@a+a+a+a+a+V+V+!@n.%.3.8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.H+~@{@]@^@/@(@_@:@S+H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1453 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Y {.~.u+<@:+a+a+a+a+a+V+V+[@}@;.3.8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.H+H+H+~@:@|@1@2@3@4@*@Z.>@H+H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1454 " P W X S K 8 8 8 8 8 Y Y Y @.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.3.8+*+5@T.V+a+a+a+a+a+a+a+$@6@'.Y @.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.Y Y Y 8 8 8 n A z #.8.X.Y.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.H+H+H+S+Z.7@8@9@0@a@b@c@{@~@H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1455 " P W X S K 8 8 8 8 8 Y @.3.3.3.3.3.3.3.3.3.3.3.3.3.3.3.3.3.3.^+d@e@f@ @V+a+a+a+a+a+a+a+-+'@g@K ^+{.3.3.3.3.3.3.3.3.3.3.3.3.3.3.3.3.3.@.Y 8 8 8 n A z #.8.X.Y.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.H+S+>@h@=@i@j@0@k@l@7@b@{@~@H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1456 " P W X S K 8 8 8 Y Y K m@n@n@o@p@p@p@p@p@p@p@p@p@p@p@p@p@p@p@;.q@r@v+-+a+a+a+a+a+a+a+a+D+<@s@G+t@p@p@p@p@p@p@p@p@p@p@p@p@p@p@p@o@n@n@m@8 8 8 8 n A z #.8.X.Y.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.H+~@{@u@v@w@x@y@k@z@A@B@:@~@H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1457 " P W X S K 8 8 8 Y Y &+>.R+n.k.C@C@C@C@C@C@C@C@C@C@C@C@C@C@(+C@k.6.D@D+a+a+a+a+a+a+a+a+V+E@F@G@x+(+C@C@C@C@C@C@C@C@C@C@C@C@C@k.k.C@H@'.n Y 8 8 n A z #.8.X.Y.`.`.`.`.`.`.`.`.`.`.`.`.`.`.H+H+H+~@>@|@I@J@K@K@K@L@M@N@c@O@>@H+H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1458 " P W X S K 8 8 8 Y @.&+'.P@Q@R@S@0+E+E+E+E+E+E+E+E+E+E+E+E+E+E+0+ @:+U.a+a+a+a+a+a+a+a+V+D+T@U@E+E+E+E+E+E+E+E+E+E+E+E+E+E+E+U@V@W@X@O+y @.8 8 n A z #.8.X.Y.`.`.`.`.`.`.`.`.`.`.`.`.`.`.H+H+H+S+O@Y@Z@`@K@K@K@ #0@.#+#@#:@~@H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1459 " P W X S K 8 8 8 Y Y n q@e@##[@$#%@%#%#%#%#%#%#%#%#%#%#%#%#%#%#%@:+a+a+a+a+a+a+a+a+a+a+a+U.D+%@%#%#%#%#%#%#%#%#%#%#%#%#%#%#-+D@&#*#=#-#y Y 8 8 n A z #.8.X.Y.`.`.`.`.`.`.`.`.`.`.`.`.`.`.H+S+>@*@;#>#`@,#K@K@K@k@'#Z@)#!#:@~@H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1460 " P W X S K 8 8 8 8 8 @.3.K g@##B.C+:+U.a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+V+V+D+ @[@~#G+&.3.Y 8 8 8 n A z #.8.X.Y.`.`.`.`.`.`.`.`.`.`.`.`.`.`.H+{#:@]@]#^#/#'#K@K@K@k@k@(#_#:#d+~@H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1461 " P W X S K 8 8 8 8 8 Y Y Y &+>.<#[#}#:+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+V+V+|#!@1#2#n y Y Y 8 8 8 n A z #.8.X.Y.`.`.`.`.`.`.`.`.`.`.`.`.H+H+H+~@d+v@>#M@K@K@K@K@K@K@K@3#z@1@4#5#>@S+H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1462 " P W X S K 8 8 8 8 8 8 Y Y @.{.6#(+6@7#)@:+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+U.-+8#9#0#~.y 3.Y 8 8 8 8 8 n A z #.8.X.Y.`.`.`.`.`.`.`.`.`.`.`.`.H+H+S+S+*@4@a#b#K@K@K@K@K@K@K@y@x@c#d#e#:@~@H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1463 " P W X S K 8 8 8 8 8 8 8 8 Y Y ^+n *+f#V@-+:+V+V+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+U.U.%#0+V.,@{.{.@.8 8 8 8 8 8 8 n A z #.8.X.Y.`.`.`.`.`.`.`.`.`.`.`.`.H+S+>@g#h#i#b#j#K@K@K@K@K@K@K@k@'#a#N@;@>@{#H+H+H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1464 " P W X S K 8 8 8 8 8 8 8 8 Y Y @.y &.O+k#l#m#V+V+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+D+n#o#[+o+p#@.@.Y 8 8 8 8 8 8 8 n A z #.8.X.Y.`.`.`.`.`.`.`.`.`.`.`.`.H+{#:@;#q#l@y@'#K@K@K@K@K@K@K@k@k@j@r#7@Z.{#S+H+H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1465 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 @.{.n 6#s#t#b+-+U.a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+V+V+)@0+!@u#'.y 3.Y Y 8 8 8 8 8 8 8 8 n A z #.8.X.Y.`.`.`.`.`.`.`.`.`.`.H+H+H+~@O@v#w#x#K@K@K@K@K@K@K@K@K@K@K@y#(#z#]@5#>@S+H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1466 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 Y Y ,.,.n ).c+R@U.a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+V+V+m.A#B#p#J ,.Y Y Y 8 8 8 8 8 8 8 8 n A z #.8.X.Y.`.`.`.`.`.`.`.`.`.`.H+H+S+S+c@C#3@L@K@K@K@K@K@K@K@K@K@K@K@y@ #D#E#=@:@~@H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1467 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 Y @.@.E.,@F#G#C.D+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+V+V+T@H#I#H@q@y 3.Y 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.`.`.`.`.`.`.`.`.`.`.H+~@>@@#;@.#L@J#K@K@K@K@K@K@K@K@K@K@K@k@'#K#L#M#Z.{#H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1468 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Y Y 3.S G+N#&#T.%#U.V+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+U.D+E@O#N#W.@.3.@.8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.`.`.`.`.`.`.`.`.`.`.H+{#>@-@P#Q#k@k@K@K@K@K@K@K@K@K@K@K@K@k@k@`@R#S#5#{#H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1469 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Y Y Y ,.y >.T#l.b+:+V+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+%@E@U#n.q@n @.Y Y 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.`.`.`.`.`.`.`.`.H+H+S+{#5#V#W#X#K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@0@j@Y#-@Z#S+S+H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1470 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Y 3.y q@`#c+m#%#a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+U.U.0+S.`#/+S @.Y Y 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.`.`.`.`.`.`.`.`.H+H+>@:@@#I@ $3#K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@'#y@.$B@u@>@{#H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1471 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 @.^+8 >++$C+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+U.U.@$>+p#8+Y 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.`.`.`.`.`.`.`.`.H+~@>@e##$c#3#x@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@k@'#$$>#v@O@{#H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1472 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 @.{.%$k.b+%#a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+U.U.'@k.E.^+Y 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.`.`.`.`.`.`.H+H+H+{#d+!#/@&$K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@b#*$4@g#:@d+H+H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1473 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 @.=$6#[+T@D+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+-$P@'.{.Y 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.`.`.`.`.`.`.H+H+S+~@g#;$2@>$K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@j#`@a@+#g#d+S+H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1474 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 3.J 4.,$%@V+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+T.!@g@S y Y 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.`.`.`.`.`.`.H+H+>@d+'$)$X#y#K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@'#y@!$q#;#Z.~@H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1475 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 3.=$1#o#D+V+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+m+7#`#&.,.Y 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.`.`.`.`.`.`.H+~@d+=@~${$y# #K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@k@'# $i#]$h@~@H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1476 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Y Y @.n P@7#:+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+D+E@D.>.=$@.8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.`.`.`.`.H+H+S+{#O@;@C#3@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@L@^$C#e#>@d+H+H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1477 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Y @.8 E.U#T@U.a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+U.%#/$g@J 3.8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.`.`.`.`.H+H+S+~@@#S#^#`@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@J#($_$d#c@d+~@H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1478 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Y 3.q@g@:$%#U.a+a+a+a+a+a+a+U.%@m+<$%#V+V+a+a+a+a+a+a+V+%@k+[$J 3.8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.`.`.`.`.H+S+d+O@-@w#>$0@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@k@'#a#S#b@Z.{#H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1479 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Y {.>.}$w+V+V+a+a+a+a+V+V+:+-+0+&#!@V@-+U.V+a+a+a+a+a+a+:+[@5.S @.Y Y 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.`.`.`.`.H+~@Z.'$V#.$,#/#K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@k@k@|$1$:#*@{#H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1480 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Y ^+W.2$E+V+V+a+a+a+a+V+V+3$7#I#=#W.4$5$D+V+a+a+a+a+a+a+:+|#c+p#Y @.Y 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.`.`.H+H+S+{#5##$6$x#K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@7$3@6$'$d+d+H+H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1481 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Y Y 3.).o#l+a+a+a+a+a+V+D+R@n+8$O+q@y 7.5.9$$@D+U.a+a+a+a+U.C.!@G+&+3.Y 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.`.`.H+H+S+~@4#4@8@0$K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@x@7$w@a$@#d+~@H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1482 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Y y %.u+m.)@a+a+a+U.U.D+<$b$1#-.3.{.@.{.E.n.f@E@%@U.a+a+a+U.U.c$`#-#{.Y 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.`.`.H+S+d+5#+#d$j@,#K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@k@y@e$4@!#O@{#H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1483 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 @.,.~.F+3$D+a+a+a+U.%@w+/$)./+Y @.@.Y @.n ;.=###v+m+a+a+a+U.U.f$`+g$^+Y 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.`.`.H+{#Z.;#;$Z@j#y@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@k@k@j@2@7@c@{#H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1484 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 3.,.7.P+:+U.a+a+%@l+'@9+,@&.3.@.Y 8 Y Y @.^+p#g@4$O#Q+%@V+a+a+T.[#4.{.Y Y 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.H+H+S+{#*@^@(@X#K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@y#x#h$i$Z.d+H+H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1485 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 {.y k.U+U.U.a+a+D@l#j$/+J S Y Y Y 8 Y Y Y Y =$S q@u+n+}#V+a+a+m+7#n.Y Y Y 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.H+H+S+~@u@C#Q#L@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@ #0@r#v#4#d+~@H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1486 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Y Y 3.&+P@W@V+V+m+v+k$l$>.%.3.Y Y 8 8 8 8 8 8 8 @.@.Y ~.m$n$_+D+U.%@}#[+E.,.@.8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.H+S+d+*@o$_$`@J#K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@k@'#$$p$;@5#{#S+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1487 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Y @.n ~.l.m#:+T@B.*#q$%.=$3.8 8 8 8 8 8 8 8 8 8 8 Y @.{.n 4.r$-$T@%@:+s$o+,.3.8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.S+{#O@i$Y@a#x@y@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@k@k@`@{$S#e#{#S+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1488 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Y 3.p#g@H#t$%@n+u#/+%.,.y Y 8 8 8 8 8 8 8 8 8 8 8 Y Y Y ,.y 2#1#9$<$u$v$x+,.{.8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.S+{#c@]#i#>$K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@0@w$x$!#O@d+H+H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1489 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Y {.6#!.[@y$U#k.2#y @.@.Y 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Y Y 3.%.>.}$9#m.O#}@&+3.Y Y 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.H+~@;#6$&$7$K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@/#j#!$V#=@O@~@H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1490 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Y ^+O+4$l#z$7.&+^+@.Y 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 3.J &.A$A#o#B$/+Y Y Y 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.Z.c@_@w@b#x@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@k@'# $C$a$g#{#S+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1491 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Y @.*+D$k.7.%.y @.Y Y 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Y ,.y q@G+!.s#'.t@@.Y 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.E$5#h#4@3@/#'#K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@k@k@b#8@F$=@{#S+`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1492 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Y Y ~.,@6#t@{.@.8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Y @.@.@.g$g@/+-.Y Y 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.E$e#G$H$I$K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@,#|$.#;@5#d+S+H+`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1493 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Y 3.3.@.8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Y Y 3.3.8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.8.X.Y.-@>#$$y#K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@y@J#J$;$'$O@{#S+`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1494 " P W X S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Y Y Y Y 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Y Y Y Y 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.K$L$Y.]$r#L@x@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@k@'#X#(@M$c@{#S+`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1495 " P Q R S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A z #.| N$O$N@x#y@k@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@k@k@L@Q#p$'${#S+`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1496 " P P$Q$S K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n A A R$S$T$U$2@0$K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@J#I$c##$*@Z.S+H+`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1497 " V$W$X$Y$y K 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 y y Z$`$ %.%+% $,#K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@'#/#K#S#]@O@{#S+`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1498 " @%#%$%%%&%8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 n *%=%R$-%;%>%3# #K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@k@k@j@a@]#@#{#S+`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1499 " ,%G '%)%!%~%%.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.K 0 {%]%^%/%(%k@k@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@k@k@3#^$_%;#{#S+`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1500 " :%<%[%}%|%1%2%3%4%5%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%6%l 7%8%9%0%a%b%c%d%e%f%g%h%i%j%k%l%m%n%o%p%K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@J#0$D#M$g#Z.S+H+`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1501 " q%r%s%t%u%v%w%x%y%z%A%B%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%C%D%E%F%G%H%I%J%K%L%M%N%N%O%P%Q%R%S%T%U%V%W%X%X%K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@k@y@Y%4@i$5#{#S+`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1502 " Z%`% &.&+&@&#&$&%&&&*&=&-&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&;&>&,&'&)&!&~&{&]&^&/&(&_&:&<&[&}&|&1&2&3&4&5&6&K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@k@'#`@W#q#4#{#S+`.`.`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1503 " 7&8&9&0&a&b&c&d&e&f&g&h&i&j&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&k&l&l&m&n&o&p&q&r&s&s&s&t&u&v&w&x&y&z&A&B&C&D&E&K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@0@K#F&b@{#S+H+H+`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1504 " G&H&I&J&K&L&M&M&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&M&O&P&Q&R&S&T&U&V&W&K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@x@($.$X&Y&`.~@H+`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1505 " Z&`& *.*+*@*M&M&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&N&#*$*%*&***=*-*;*>*K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@k@'#X#C#h#h@,*S+`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1506 " '*)*!* &~*{*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&N&N&]*^*/*P&(*_*:*<*[*K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@k@k@b#2@P#u@,*S+`.`.`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1507 " }*|*1*2*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&N&N&3*]*4*5*6*7*8*9*9*K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@,#Y%i#+#:@>@H+H+`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1508 " 0*7&a*b*c*d*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&e*e*3*3*f*g*h*i*j*K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@/#7$Z@G$e#O@S+H+`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1509 " 0*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&e*e*3*l*m*n*o*p*q*K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@k@'#j@_%r*g#{#S+`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1510 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&t*t*t*t*e*e*e*e*e*e*t*t*t*t*t*t*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&N&N&3*l*u*v*w*x*x*K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@k@k@L@^#/@;#{#S+`.`.`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1511 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&t*t*{*{*y*z*z*z*z*z*A*{*{*t*t*t*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&N&N&3*l*u*v*w*B*x*K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@j#9@W#d#>@d+H+H+`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1512 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&t*t*e*e*e*e*e*e*t*t*t*t*t*e*y*e*y*{*{*t*t*t*e*e*e*e*e*e*t*t*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&N&N&3*l*u*v*C*B*B*K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@/#y#^$P#4#5#~@S+`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1513 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&t*t*y*z*D*D*D*z*t*d*E*F*G*H*I*I*I*H*J*K*L*M&y*z*D*D*D*y*t*t*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&N&N&3*l*u*v*C*B*B*K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@k@'#`@F&d#c@,*S+`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1514 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&t*t*e*e*e*e*e*e*e*d*E*F*I*M*N*O*P*Q*R*R*R*Q*S*T*U*V*H*K*L*W*e*t*t*e*e*e*t*t*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&N&N&3*l*u*v*C*B*B*K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@k@k@3#.$X*i$,*~@`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1515 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&t*t*y*z*D*y*d*G*Y*S*Z*`* =.=+=@=#=$=%=%=%=&=*===-=;=>=,='=)=!=~=M&z*D*z*{*t*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&N&N&3*l*u*v*C*B*B*K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@J#X#c#E#Z.d+H+H+`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1516 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&e*e*e*e*e*N&L*G*Y*{=]=^=/=(=_=:=<=[=}=|=1=1=2=3=4=5=6=7=8=$=9=>=0=O*!=a=c*M&t*y*e*e*t*t*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&N&N&3*l*u*v*C*B*B*K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@K@y@j#Y%X*;#*@~@S+`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1517 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&e*z*z*e*E*M*b=c=d=e=f=g=h=i=5=j=k=}=l=|=1=1=2=2=l=}=k=j=m=n=o=p=q=r=s=t=u=v=L*z*D*y*t*t*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&N&N&3*l*u*v*C*w=w=3#3#3#3#3#3#3#3#3#3#3#3#3#3#3#3#3#3#3#3#3#3#3#3#3#3#3#3#3#3#3#3#3#3#3#3#3#3#3#3#3#3#3# $i@o$@#{#S+`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1518 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&t*t*e*e*y*e*c*I*x=y=z=$=7=j=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=4=A=_=B=C=D=U*a=d*t*t*t*t*t*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&N&N&3*l*u*v*E=F=F=!$!$!$!$!$!$!$!$!$!$!$!$!$!$!$!$!$!$!$!$!$!$!$!$!$!$!$!$!$!$!$!$!$!$!$!$!$!$!$!$!$Z@Z@D#C#_@4#{#S+`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1519 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&t*t*y*D*y*G=x=H=I=J=K=n=j=}=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=l=4=5=L=p=&=;=M=N=L*{*A*{*t*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&N&N&3*l*u*v*O=P=P=X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*/@X&r*@#~@S+`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1520 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&t*t*e*y*e*c*G*S*Q=R=h=j=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=S=T=g=+=H=U=J*d*t*e*e*e*M&M&M&M&M&M&M&M&M&M&M&M&M&M&N&N&3*l*u*v*V=W=W=e#e#e#e#e#e#e#e#e#e#e#e#e#e#e#e#e#e#e#e#e#e#e#e#e#e#e#e#e#e#e#e#e#e#e#e#e#e#e#e#e#e#e#e#c@*@O@H+H+`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1521 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&t*t*y*z*W*N=y=9=X=L=T=S=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=2=}=5=:=J=Y=Z=I*d*z*z*e*M&M&M&M&M&M&M&M&M&M&M&M&M&M&N&N&3*l*u*v*V=`=`=,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*{#S+H+`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1522 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&M&M&M&M&t*t*t*{*t*K*Y*H=/= -3=2=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=m=X=.-+-M*c*y*y*e*e*M&M&M&M&M&M&M&M&M&M&M&M&N&N&3*l*u*v*V=`=`=S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+H+H+H+`.`.`.`.Z.Z.}+1+T+X+L+Y+Z+Z+ ",
1523 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&M&M&M&M&t*t*{*{*L*S*@-#=#-j=2=2=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=$-5=_=R=%-M*L*z*z*e*M&M&M&M&M&M&M&M&M&M&M&M&N&N&3*l*u*v*V=`=`=`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+}+&-X+*-=----- ",
1524 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&M&M&t*t*e*y*t*F*U=;->-n=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=,-'-B=)-U*L*e*e*e*e*M&M&M&M&M&M&M&M&M&M&N&N&3*l*u*v*V=`=`=`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.Z.Z.}+}+!-K+*-~-{-{- ",
1525 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&M&M&t*t*y*z*c*S*]-q=m=k=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=3=$-h=$=Q=!=L*y*y*e*M&M&M&M&M&M&M&M&M&M&N&N&3*l*u*v*V=`=`=`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.d+d+d+T+^-K+/-(-_-_- ",
1526 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&M&M&e*y*e*:-Y*<-(=n=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=[-}-B=y=Y*W*y*e*t*t*M&M&M&M&M&M&M&M&N&N&3*l*u*v*V=`=`=`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.d+d+d+|-1-2-3-4-5-5- ",
1527 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&M&M&e*z*e*N*6-&=m=4=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=3=$-o=*=7-G=e*y*t*t*M&M&M&M&M&M&M&M&N&N&3*l*u*v*V=`=`=.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@`.`.8-9-0-a-b-c-c-d-d-d-d-d-d-d-d-d-d-e-f-g-h-i- ",
1528 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&e*y*y*W*G*t=B=h=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=j=#--=u=H*t*y*e*M&M&M&M&M&M&M&M&N&N&3*l*u*v*V=`=`=j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-j-J+k-l-m-n-o-p-p-q-q-q-q-q-q-q-q-q-q-r-s-t-u-v-w- ",
1529 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&e*z*z*x-S*y-n=T=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=3=[-z- =A-M&D*e*M&M&M&M&M&M&M&M&N&N&3*l*u*v*B-C-C-D-D-D-D-D-D-D-D-D-D-D-D-D-D-D-D-D-D-D-D-D-D-D-D-D-D-D-D-D-D-D-D-D-D-D-D-D-D-D-D-D-D-D-D-D-D-D-D-D-D-E-E-F-G-H-I-J-K-L-M-M-N-N-N-N-N-N-N-N-N-N-O-P-Q-R-S-T-U- ",
1530 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&t*t*e*z*N&)=@-f=3=2=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=L=q=`*H*d*y*e*e*M&M&M&M&M&M&N&N&3*l*u*v*V-W-W-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-Y-Z-`- ;.;+;@;#;$;%;%;N-N-N-N-N-N-N-N-N-N-N-N-O-&;*;=;-;;; ",
1531 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&t*t*e*e*:-,=>-L=2=2=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=k=m=>;u=G*y*z*e*M&M&M&M&M&M&N&N&3*l*u*v*V-,;,;';';';';';);!;~;{;{;{;{;{;{;{;{;{;{;{;{;{;{;{;{;{;{;{;{;{;{;{;{;{;{;{;{;{;{;{;{;{;{;{;{;{;{;{;{;{;{;];^;/;(;_;:;<;[;};|;|;O-O-O-O-O-O-O-O-O-O-N-1;2;P-3;4;5;6; ",
1532 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&e*y*y*~=U*d=L=j=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=2=3=7;Q=8;e*z*e*M&M&M&M&M&M&N&N&3*l*u*v*9;0;0;a;a;a;a;a;b;c;d;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;f;g;h;i;j;k;l;m;n;O-O-O-O-O-O-O-O-O-O-O-O-O-o;o;1;p;q;r;s; ",
1533 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&e*z*y*t;y=u;$-3=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=2=2=:=*=y=v;y*e*M&M&M&M&M&M&N&N&3*l*u*v*9;w;w;x;x;x;x;x;y;z;A;B;B;B;B;B;B;B;B;B;B;B;B;B;B;B;B;B;B;B;B;B;B;B;B;B;B;B;B;B;B;B;B;B;B;B;B;B;B;B;B;B;C;C;D;E;F;G;H;I;J;K;O-O-O-O-O-O-O-O-O-O-O-O-O-o;o;1;L;M;N;O; ",
1534 " s*7&k*b*c*d*M&M&M&M&M&M&t*t*e*z*d*P;d=g=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=A= -Q;V*L*y*e*e*M&M&M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-O-O-O-O-X;X;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;X;O-O-O-O-O-O-N-N-Z;`; >.>+> ",
1535 " s*7&k*b*c*d*M&M&M&M&M&M&t*t*e*e*:-`*@>6=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=}=k=#>A-H*z*z*e*M&M&M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-O-O-O-X;X;X;o;o;N-N-N-N-N-N-N-N-N-N-N-N-N-N-N-N-N-N-N-N-N-N-N-N-N-N-N-N-N-N-N-N-N-N-N-N-N-N-N-N-N-N-N-o;X;X;X;O-O-O-O-N-N-$>%>&>*>=> ",
1536 " s*7&k*b*c*d*M&M&M&M&M&M&e*y*y*E*t;.=n=T=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=2=2=(=6-U=y*D*e*M&M&M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-O-O-O-Y;->Y;;>>>,>,>,>,>,>,>,>,>,>,>,>,>,>,>,>,>,>,>,>,>,>,>,>,>,>,>,>,>,>,>,>,>,>,>,>,>,>,>,>,>,>,>>>'>O-)>X;O-O-O-O-N-N-$>%>&>*>=> ",
1537 " s*7&k*b*c*d*M&M&M&M&M&M&e*z*z*I*!>B=S=3=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=2=2=_=-=R*e*D*e*M&M&M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-O-X;Y;~>{>]>^>/>(>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>/>:>]><>o;Y;O-O-O-N-N-$>%>&>*>=> ",
1538 " s*7&k*b*c*d*M&M&M&M&M&M&e*D*z*U*,=(=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=L=q=H=E*y*e*t*t*M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-X;X;Y;[>}>|>1>2>3>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>5>6>7>8>;>o;X;X;O-N-N-$>%>&>*>=> ",
1539 " s*7&k*b*c*d*M&M&M&M&M&M&e*D*y*b=.=p=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=5=7=C=H*d*t*t*t*M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-X;X;X;9>0>6>2>3>3>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>3>2>a>b>c>d>->X;O-N-N-$>%>&>*>=> ",
1540 " s*7&k*b*c*d*M&M&M&M&M&M&e*z*d*0=e>h=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=4=f>g>Y*:-y*y*e*M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>i>j>6>5>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>3>k>l>>>m>X;O-N-N-$>%>&>*>=> ",
1541 " s*7&k*b*c*d*M&M&M&M&M&M&e*e*E*`*n><=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=|=l=@=u=H*z*z*e*M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>o>p>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>q>r>s>t>X;O-N-N-$>%>&>*>=> ",
1542 " s*7&k*b*c*d*M&M&M&M&t*t*t*d*G*]-u>5=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=2=2=#='=V*z*z*e*M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1543 " s*7&k*b*c*d*M&M&M&M&t*{*{*L*V*y>6=T=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=2=2=>-7-N=y*z*e*M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1544 " s*7&k*b*c*d*M&M&M&M&e*y*y*K*N=z>A>}=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=f=<-T*z*D*e*M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1545 " s*7&k*b*c*d*M&M&M&M&e*z*z*J*)===l=|=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=X=Y=A-z*D*e*M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1546 " s*7&k*b*c*d*M&M&M&M&e*z*z*G*O*@=2=2=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=g=.-!>z*D*e*M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1547 " s*7&k*b*c*d*M&M&M&M&e*z*z*H*S*B>2=2=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=C>-=P;z*D*e*M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1548 " s*7&k*b*c*d*M&M&M&M&e*z*z*H*S*B>1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=D>9=R*z*D*e*M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1549 " s*7&k*b*c*d*M&M&M&M&e*z*z*H*S*B>1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=D>+=R*y*D*e*M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1550 " s*7&k*b*c*d*M&M&M&M&e*z*z*H*u=B>1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=_=-=P;z*D*e*M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1551 " s*7&k*b*c*d*M&M&M&M&e*z*z*H*u=@=|=|=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=g=E>Q*z*D*e*M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1552 " s*7&k*b*c*d*M&M&M&M&e*y*z*J*F>/=}=l=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=X=z=S*z*D*e*M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1553 " s*7&k*b*c*d*M&M&M&M&t*{*{*~=N=z>T=}=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=f=@-G>z*D*e*M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1554 " s*7&k*b*c*d*M&M&M&M&t*{*{*L*H>;=6=T=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=q=7-N=z*D*e*M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1555 " s*7&k*b*c*d*M&M&M&M&t*t*t*d*J*>=u>I>1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=|=|=#=+-V*z*z*e*M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1556 " s*7&k*b*c*d*M&M&M&M&t*t*e*y*E*6-f=6=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=l=4===O*G*z*z*e*M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1557 " s*7&k*b*c*d*M&M&M&M&M&M&e*z*N&Z*R=h=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=4=f>g>Y*J>{*{*t*M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1558 " s*7&k*b*c*d*M&M&M&M&M&M&e*D*y*P*Y=X=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=A= -]-H*d*t*t*t*M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1559 " s*7&k*b*c*d*M&M&M&M&M&M&e*D*z*N=H=q=2=2=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=L=>-7-v;y*e*M&M&M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1560 " s*7&k*b*c*d*M&M&M&M&M&M&e*z*z*I*P*#>k=l=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=g=d=Q*N&z*e*M&M&M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1561 " s*7&k*b*c*d*M&M&M&M&M&M&t*{*{*L*K>;=6=T=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=2=3=q=H=U*y*D*e*M&M&M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1562 " s*7&k*b*c*d*M&M&M&M&M&M&t*t*y*e*K*,=(=L=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=4=5=/=u=H*y*y*e*M&M&M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1563 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&e*D*e*Q*.=p=2=2=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=I>u>C=v=d*{*t*t*M&M&M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1564 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&e*z*y*t;Z*#=4=l=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=o===Z*E*y*e*t*t*M&M&M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1565 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&e*y*y*:-N=d=n=T=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=3=S=(=`*L>y*D*e*M&M&M&M&M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1566 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&e*e*e*N&a=t=e=:=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=T=6=z>)=G*y*y*e*M&M&M&M&M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1567 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&e*D*e*T*M>N>[-3=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=2=2=n=O>%-G=e*y*t*t*M&M&M&M&M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1568 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&e*y*y*G*)=E>h=j=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=2=3=f=M>)=W*y*e*t*t*M&M&M&M&M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1569 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&t*t*y*e*a=t=R=o=S=3=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=j=#-z>O*G*y*z*e*M&M&M&M&M&M&M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1570 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&t*t*e*y*W*N=y=R=m=[-1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1= -P>M=Q>N&y*e*e*M&M&M&M&M&M&M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1571 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&M&M&e*y*y*E*M*M>N>L=S=3=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=T='-R>S>T>e*z*e*M&M&M&M&M&M&M&M&M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1572 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&M&M&e*e*e*e*E*G>U>$=A=$-1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=h=V>W>X>L*e*e*e*M&M&M&M&M&M&M&M&M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1573 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&M&M&M&M&e*z*y*K*U*Y>Z>:=[-3=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=2=3=j=#-R>`>N=N&z*e*M&M&M&M&M&M&M&M&M&M&M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1574 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&M&M&M&M&e*e*e*N&:-x=7-R> ,,-1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=3=$-_=-=y=V*L*y*y*e*M&M&M&M&M&M&M&M&M&M&M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1575 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&e*z*z*E*t;,=r=X=m=4=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=3=k=n=X=I=Z=M*e*D*y*t*t*M&M&M&M&M&M&M&M&M&M&M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1576 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&e*e*y*e*c*V*Q*z=N>6=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=T=L=#=.,S*G*d*y*y*e*t*t*M&M&M&M&M&M&M&M&M&M&M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1577 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&e*z*z*N&Q>{=>=B>_=n=j=}=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=3=4=A=#-f=/=`*8;G=z*D*y*t*t*M&M&M&M&M&M&M&M&M&M&M&M&M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1578 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&e*e*y*y*M&K*+,+->=*=o=j=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=1=$-f>@,/=Q=#,$,L*N&y*e*e*t*t*M&M&M&M&M&M&M&M&M&M&M&M&M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1579 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&t*{*z*z*N&I*)=H=d=&=p=h=6=j=4=l=1=1=1=1=1=1=1=1=1=1=1=1=1=1=2=l=k=5='-%,f=e>z=0=L>~=t*z*z*e*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1580 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&t*t*e*e*e*N&c*G*N='=.,y-Z>u>f>4=1=1=1=1=1=1=1=1=1=1=1=1=1=1=3=k=<=_=&=d=6-!>t;a=c*t*{*e*e*e*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1581 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&e*z*D*z*c*v=8;&,Q=;===$=f=X=g=%,h=:=:=:=:=:=o=D>g=*,N>#=>;z=6-P;U*J*d*D*D*y*t*t*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1582 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&e*e*e*e*e*N&W*:-G*M*T*R*`>=,-,E>>;==r=r=#>==+=d=;,>,y=Q*F>H>J*L*d*M&t*y*e*e*t*t*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>w>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>_>x>t>X;O-N-N-$>%>&>*>=> ",
1583 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&t*t*y*z*D*D*z*d*:-I*t;L>S*R*Z=Z*0=0=0=Z*&,P;u=U=!=G*E*M&z*D*D*y*t*t*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>v>p>3>3>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>6>(>x>t>X;O-N-N-$>%>&>*>=> ",
1584 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&t*t*e*e*e*e*e*t*t*e*N&N&d*c*c*c*L*L*L*c*c*c*d*N&N&t*t*t*e*e*e*e*t*t*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&N&N&3*l*u*v*R;S;S; T;U;V;W;O-O-O-O-Y;h>{>,,a>2>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>1>',),m>X;O-N-N-$>%>&>*>=> ",
1585 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&t*t*y*z*z*D*D*!,!,!,!,!,!,!,!,D*D*D*z*z*{*t*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&N&N&3*l*u*~,R;S;S; T;U;V;W;O-O-O-O-X;X;W;{,],^,3>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>4>^,/,(,i>->X;O-N-N-$>%>&>*>=> ",
1586 " s*7&k*b*c*d*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&t*t*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*t*t*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&N&N&3*l*_,~,R;S;S; T;U;V;W;O-O-O-O-O-X;)>:,<,[,^,},},},},},},},},},},},},},},},},},},},},},},},},},},},},},},},},},},},},},},},},},},},|,a>1,2,'>X;X;X;O-N-N-$>%>&>*>=> ",
1587 " 0*G&3,4,c*d*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&N&N&3*l*5,6,7,8,9, T;U;V;W;O-O-O-O-O-X;X;0,{>a,b,c,|>d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,c,p>a,:,N-X;X;X;O-N-N-$>%>&>*>=> ",
1588 " 0*e,f,g,c*d*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&N&N&3*l*5,h,i,j,k, T;U;V;W;O-O-O-O-O-O-O-Y;h>i>l,m,n,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,o,p,{>X;X;X;O-O-O-N-N-$>%>&>*>=> ",
1589 " }*H&q,r,z*e*c*d*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&e*3*M&#*s,t,u,v,v, T;U;V;W;O-O-O-O-O-O-O-O-X;->m>t>t>t>t>t>t>t>t>t>t>t>t>t>t>t>t>t>t>t>t>t>t>t>t>t>t>t>t>t>t>t>t>t>t>t>t>t>t>t>t>t>t>t>t>t>->X;X;O-O-O-O-N-N-$>%>&>*>=> ",
1590 " w,x,y,.*z,z*L*d*M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&M&e*3*A,B,C,[&D,E,F, T;U;V;W;O-O-O-O-O-O-O-O-X;X;X;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;Y;X;X;X;O-O-O-O-N-N-$>%>&>*>=> ",
1591 " G,w,H,I,J,K,y*e*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*N&L,M,N,O,P,Q,R,R, T;S,T,W;~>O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-N-N-1;`;U,V,W, ",
1592 " X,}*Y,Z,`,J, 'z*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*.'W*$*+'@'#'$'%'&' *'='-'O-~>O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-o;o;O-&;;'>',' ",
1593 " ''0*I&Z,)'!'4,~'{']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']']'^'^'/'('_':'<'['}' |'1'2'3'o;~>O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-O-o;o;4'5'6'7'8' ",
1594 " 9'}*0'x,a'k*b'c'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'd'e'f' &g'h'i'j'k' l'm'n'o'p'h>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>~>O-q'r's't'u' ",
1595 " ''}*''v'8&w'1*x'3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,a*k*y'z'q%A'B' C'D'E'V;F'G'H'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'I'J'J'K'L'M'N'O' ",
1596 " X,G,w,P'P''*w,w,''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''Q'|*R'S'T' U'V'W'X'Y'Z'`' ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) )V;.)+)@)#)$) ",
1597 " %)G,'*P'H,&)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)*)'*'*e,=)-);) V'>),)')))!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)~){)])^)/) ",
1598 " ()_):)<):):):):):):):):):):):):):):):):):):):):):):):):):):):):):):):):):):):):):):):):):):):):):):):):):):):):):):):):):):):)|'[)})|) ",
1599 " ",
1600 " ",
1601 " ",
1602 " ",
1603 " ",
1604 " ",
1605 " ",
1606 " ",
1607 " ",
1608 " ",
1609 " ",
1610 " ",
1611 " "};
0 /* XPM */
1 static char * blockattack32_xpm[] = {
2 "32 32 185 2",
3 " c None",
4 ". c #646415",
5 "+ c #95952C",
6 "@ c #96962E",
7 "# c #A4A449",
8 "$ c #8D8D1F",
9 "% c #8E8E1F",
10 "& c #8E8E21",
11 "* c #CBCB89",
12 "= c #B6B61E",
13 "- c #8E8E20",
14 "; c #84B55F",
15 "> c #36A036",
16 ", c #37A037",
17 "' c #6FBD6F",
18 ") c #A0A01E",
19 "! c #E6E61E",
20 "~ c #7AAC55",
21 "{ c #1F8D1F",
22 "] c #1F8C1F",
23 "^ c #2F942F",
24 "/ c #A1DBA1",
25 "( c #8C8C1F",
26 "_ c #C2C21E",
27 ": c #FCFC1F",
28 "< c #9C9C1E",
29 "[ c #1F8E1F",
30 "} c #1EAC1E",
31 "| c #2B922B",
32 "1 c #97D797",
33 "2 c #C0C01E",
34 "3 c #D9D91E",
35 "4 c #F2F21F",
36 "5 c #FFFF1F",
37 "6 c #E5E51E",
38 "7 c #D7D71E",
39 "8 c #A7A71E",
40 "9 c #1EAB1E",
41 "0 c #1BF31B",
42 "a c #1E981E",
43 "b c #91911F",
44 "c c #D0D01E",
45 "d c #FEFE1F",
46 "e c #F6F61F",
47 "f c #B2B21E",
48 "g c #1CE41C",
49 "h c #1BFF1B",
50 "i c #1CCA1C",
51 "j c #CECE1E",
52 "k c #FDFD1F",
53 "l c #A8A81E",
54 "m c #1EB01E",
55 "n c #1BFE1B",
56 "o c #1BF81B",
57 "p c #1E9B1E",
58 "q c #DCDC1E",
59 "r c #F5F51E",
60 "s c #B4B41E",
61 "t c #1F901F",
62 "u c #1CE81C",
63 "v c #1CD01C",
64 "w c #94941E",
65 "x c #F2F21E",
66 "y c #BBBB1E",
67 "z c #95951F",
68 "A c #D8D81E",
69 "B c #D5D51E",
70 "C c #1DB61D",
71 "D c #1BF91B",
72 "E c #1E9F1E",
73 "F c #A2A21E",
74 "G c #A5A51E",
75 "H c #8F8F1F",
76 "I c #7AB255",
77 "J c #1BEC1B",
78 "K c #1CD61C",
79 "L c #5F5F14",
80 "M c #74D24C",
81 "N c #1BFA1B",
82 "O c #1EA41E",
83 "P c #660909",
84 "Q c #702410",
85 "R c #663E10",
86 "S c #664010",
87 "T c #734713",
88 "U c #9C4526",
89 "V c #9E6245",
90 "W c #5FE44D",
91 "X c #1CDA1C",
92 "Y c #640808",
93 "Z c #900C0C",
94 "` c #A2A16B",
95 " . c #1BFC1B",
96 ".. c #1EA81E",
97 "+. c #660808",
98 "@. c #990D0D",
99 "#. c #B61010",
100 "$. c #C91313",
101 "%. c #C61313",
102 "&. c #AE1010",
103 "*. c #940C0C",
104 "=. c #900B0B",
105 "-. c #A09562",
106 ";. c #1CDD1C",
107 ">. c #BA1111",
108 ",. c #F41A1A",
109 "'. c #FF1B1B",
110 "). c #FE1B1B",
111 "!. c #E91818",
112 "~. c #A60F0F",
113 "{. c #A18063",
114 "]. c #1E9E1E",
115 "^. c #1E9D1E",
116 "/. c #96D696",
117 "(. c #BD1212",
118 "_. c #FC1B1B",
119 ":. c #F51A1A",
120 "<. c #A50E0E",
121 "[. c #A17A62",
122 "}. c #1D851D",
123 "|. c #288E29",
124 "1. c #4D7F81",
125 "2. c #303097",
126 "3. c #5656AB",
127 "4. c #9C0D0D",
128 "5. c #F71A1A",
129 "6. c #E31717",
130 "7. c #910C0C",
131 "8. c #AF6F69",
132 "9. c #0B2C18",
133 "0. c #142B4A",
134 "a. c #142C4C",
135 "b. c #142C4E",
136 "c. c #193662",
137 "d. c #1E228D",
138 "e. c #1F1F8D",
139 "f. c #262690",
140 "g. c #C01212",
141 "h. c #A40E0E",
142 "i. c #C87878",
143 "j. c #1E1E8A",
144 "k. c #1D1DBF",
145 "l. c #1B1BF8",
146 "m. c #1D1DC4",
147 "n. c #252590",
148 "o. c #8F0C0C",
149 "p. c #D41515",
150 "q. c #B41111",
151 "r. c #1C1CD0",
152 "s. c #1B1BFF",
153 "t. c #1C1CD5",
154 "u. c #D31515",
155 "v. c #B21010",
156 "w. c #BA1212",
157 "x. c #FA1A1A",
158 "y. c #A00E0E",
159 "z. c #970C0C",
160 "A. c #F21919",
161 "B. c #DA1616",
162 "C. c #B01010",
163 "D. c #F91A1A",
164 "E. c #ED1818",
165 "F. c #AA0F0F",
166 "G. c #E71818",
167 "H. c #FD1B1B",
168 "I. c #D81616",
169 "J. c #920C0C",
170 "K. c #B31111",
171 "L. c #B11010",
172 "M. c #9E0E0E",
173 "N. c #1C1CC9",
174 "O. c #1B1BFE",
175 "P. c #1C1CCE",
176 "Q. c #590707",
177 "R. c #900D0D",
178 "S. c #C66060",
179 "T. c #1F1F90",
180 "U. c #1E1E9D",
181 "V. c #1F1F91",
182 "W. c #460505",
183 "X. c #4A0606",
184 "Y. c #5C0808",
185 "Z. c #121258",
186 "`. c #151565",
187 " + c #1A1A73",
188 " ",
189 " ",
190 " . + @ @ @ @ @ @ @ @ @ # ",
191 " . $ $ $ $ $ % $ $ $ $ & * ",
192 " . $ $ $ $ $ = $ $ $ $ - ; > > > > > > > > > , ' ",
193 " . $ $ $ $ ) ! % $ $ $ - ~ { { { ] { { { { { { ^ / ",
194 " . $ ( ( ( _ : < ( ( ( - ~ { { [ } { { { { { { | 1 ",
195 " . % 2 3 3 4 5 6 3 7 8 - ~ { { 9 0 a { { { { { | 1 ",
196 " . $ b c d 5 5 5 e f $ - ~ { [ g h i ] { { { { | 1 ",
197 " . $ $ % j 5 5 k l $ $ - ~ { m n h o p { { { { | 1 ",
198 " . $ $ $ q d r 5 s $ $ - ~ t u h h h v { { { { | 1 ",
199 " . $ $ w x y z A B ( $ - ~ C n h h h D E { { { | 1 ",
200 " . $ $ F G $ $ % = H $ - I J h h h h h K { { { | 1 ",
201 " L $ $ $ $ $ $ $ $ $ $ & M n h h h h h N O { { | 1 ",
202 " P Q R S S S S S S S S S T U V W h h h h h X [ { | 1 ",
203 " Y Z Z Z Z Z Z Z Z Z Z Z Z Z Z ` h h h h h ...{ | 1 ",
204 " +.Z Z Z Z @.#.$.%.&.*.Z Z Z =.-. . . . . . .;.[ | 1 ",
205 " +.Z Z Z >.,.'.'.'.).!.~.Z Z =.{.].].].].].].^.[ | /. ",
206 " +.Z Z (._.'.'.'.'.'.'.:.<.Z =.[.}.}.}.}.}.}.}.}.|.1.2.3. ",
207 " +.Z 4.5.'.'.'.'.'.'.'.'.6.7.=.8.9.0.a.b.b.b.b.b.c.d.e.f. ",
208 " +.Z g.'.'.'.'.'.'.'.'.'._.h.=.i. j.k.l.l.l.l.l.l.l.m.n. ",
209 " +.o.p.'.'.'.'.'.'.'.'.'.'.q.=.i. j.r.s.s.s.s.s.s.s.t.n. ",
210 " +.o.u.'.'.'.'.'.'.'.'.'.'.v.=.i. j.r.s.s.s.s.s.s.s.t.n. ",
211 " +.Z w.'.'.'.'.'.'.'.'.'.x.y.=.i. j.r.s.s.s.s.s.s.s.t.n. ",
212 " +.Z z.A.'.'.'.'.'.'.'.'.B.Z =.i. j.r.s.s.s.s.s.s.s.t.n. ",
213 " +.Z Z C.D.'.'.'.'.'.'.E.4.Z =.i. j.r.s.s.s.s.s.s.s.t.n. ",
214 " +.Z Z Z F.G.H.'.'.x.I.4.Z Z =.i. j.r.s.s.s.s.s.s.s.t.n. ",
215 " +.Z Z Z Z J.h.K.L.M.Z Z Z Z =.i. j.N.O.O.O.O.O.O.O.P.n. ",
216 " Q.o.Z Z Z Z Z Z Z Z Z Z Z Z R.S. j.T.U.U.U.U.U.U.U.V.n. ",
217 " W.X.X.X.X.X.X.X.X.X.X.X.X.Y. Z.`.`.`.`.`.`.`.`.`. + ",
218 " ",
219 " "};
0 /* XPM */
1 static char * blockattack64_xpm[] = {
2 "64 64 398 2",
3 " c None",
4 ". c #797919",
5 "+ c #9E9E39",
6 "@ c #A3A343",
7 "# c #A8A84D",
8 "$ c #CACA89",
9 "% c #3A3A0B",
10 "& c #7A7A1B",
11 "* c #8E8E22",
12 "= c #8F8F23",
13 "- c #8F8F24",
14 "; c #A3A34B",
15 "> c #DFDFAF",
16 ", c #3C3C0C",
17 "' c #86861D",
18 ") c #8D8D1F",
19 "! c #CACA8A",
20 "~ c #8C8C1F",
21 "{ c #8F8F1F",
22 "] c #C5C580",
23 "^ c #8B8B1F",
24 "/ c #BCBC1D",
25 "( c #92921F",
26 "_ c #C1C47D",
27 ": c #59B652",
28 "< c #48B048",
29 "[ c #4EB24E",
30 "} c #72C672",
31 "| c #A6E1A6",
32 "1 c #90901E",
33 "2 c #E8E81E",
34 "3 c #A4A41E",
35 "4 c #BFC27C",
36 "5 c #399832",
37 "6 c #238F23",
38 "7 c #248F24",
39 "8 c #349734",
40 "9 c #81C081",
41 "0 c #BDEABD",
42 "a c #A5A51E",
43 "b c #F8F81E",
44 "c c #C2C21E",
45 "d c #35972E",
46 "e c #1F8D1F",
47 "f c #1E8C1E",
48 "g c #46A046",
49 "h c #A7DDA7",
50 "i c #C5C51E",
51 "j c #FEFE1E",
52 "k c #E0E01E",
53 "l c #90901F",
54 "m c #1F8C1F",
55 "n c #1D8C1D",
56 "o c #3A9A3A",
57 "p c #97D597",
58 "q c #E3E31E",
59 "r c #FFFF1F",
60 "s c #F7F71E",
61 "t c #9F9F1E",
62 "u c #1E991E",
63 "v c #1F911F",
64 "w c #399939",
65 "x c #95D595",
66 "y c #9E9E1E",
67 "z c #F6F61E",
68 "A c #FDFD1F",
69 "B c #BBBB1E",
70 "C c #1E921E",
71 "D c #1CD41C",
72 "E c #1DB01D",
73 "F c #AFAF1E",
74 "G c #B5B51E",
75 "H c #B4B41E",
76 "I c #CECE1E",
77 "J c #97971E",
78 "K c #1F8B1F",
79 "L c #1BF81B",
80 "M c #1CDE1C",
81 "N c #AEAE1E",
82 "O c #ECEC1E",
83 "P c #FCFC1E",
84 "Q c #FEFE1F",
85 "R c #FDFD1E",
86 "S c #C0C01D",
87 "T c #1E941E",
88 "U c #1CDD1C",
89 "V c #1BFE1B",
90 "W c #1DB41D",
91 "X c #DFDF1E",
92 "Y c #EFEF1E",
93 "Z c #1BF91B",
94 "` c #1BFF1B",
95 " . c #1CE21C",
96 ".. c #1E951E",
97 "+. c #95951E",
98 "@. c #FAFA1E",
99 "#. c #1BFB1B",
100 "$. c #1DB81D",
101 "%. c #8F8F1E",
102 "&. c #D1D11E",
103 "*. c #1DB91D",
104 "=. c #1BFA1B",
105 "-. c #1BE71B",
106 ";. c #1E961E",
107 ">. c #F0F01E",
108 ",. c #FAFA1F",
109 "'. c #ACAC1E",
110 "). c #1E981E",
111 "!. c #1CE51C",
112 "~. c #1DBD1D",
113 "{. c #FBFB1E",
114 "]. c #CBCB1E",
115 "^. c #1BFC1B",
116 "/. c #1BE81B",
117 "(. c #1E9B1E",
118 "_. c #CACA1E",
119 ":. c #E6E61E",
120 "<. c #91911E",
121 "[. c #1BEA1B",
122 "}. c #1BFD1B",
123 "|. c #1DC11D",
124 "1. c #93931E",
125 "2. c #BEBE1E",
126 "3. c #91911F",
127 "4. c #EBEB1E",
128 "5. c #A2A21E",
129 "6. c #35962E",
130 "7. c #1DC21D",
131 "8. c #1BEB1B",
132 "9. c #1E9D1E",
133 "0. c #ABAB1E",
134 "a. c #9C9C1E",
135 "b. c #DBDB1E",
136 "c. c #C1C11E",
137 "d. c #1CC61C",
138 "e. c #1F8E1F",
139 "f. c #DADA1E",
140 "g. c #9B9B1E",
141 "h. c #92921E",
142 "i. c #C7C71E",
143 "j. c #D8D81D",
144 "k. c #1BED1B",
145 "l. c #1EA11E",
146 "m. c #8E8E1F",
147 "n. c #8E8E1E",
148 "o. c #93931F",
149 "p. c #34AB2D",
150 "q. c #1BEE1B",
151 "r. c #1CCB1C",
152 "s. c #BFC27B",
153 "t. c #32D42B",
154 "u. c #1BEF1B",
155 "v. c #1EA51E",
156 "w. c #35350A",
157 "x. c #7A7A1A",
158 "y. c #909025",
159 "z. c #B2C063",
160 "A. c #2FF225",
161 "B. c #1CCF1C",
162 "C. c #1E901E",
163 "D. c #880D0D",
164 "E. c #742715",
165 "F. c #483F10",
166 "G. c #615F15",
167 "H. c #656416",
168 "I. c #676516",
169 "J. c #7C741D",
170 "K. c #AF8034",
171 "L. c #9B6437",
172 "M. c #9D7245",
173 "N. c #99AD63",
174 "O. c #53EA43",
175 "P. c #1DFE1C",
176 "Q. c #1BF21B",
177 "R. c #1DA71D",
178 "S. c #3C0505",
179 "T. c #760A0A",
180 "U. c #8E1210",
181 "V. c #771A0D",
182 "W. c #681A0A",
183 "X. c #681B0A",
184 "Y. c #691C0A",
185 "Z. c #80260E",
186 "`. c #941B15",
187 " + c #931616",
188 ".+ c #961D1D",
189 "++ c #AD4E4E",
190 "@+ c #BCB891",
191 "#+ c #51F044",
192 "$+ c #1F901F",
193 "%+ c #3E0505",
194 "&+ c #870B0B",
195 "*+ c #900C0C",
196 "=+ c #900B0B",
197 "-+ c #911010",
198 ";+ c #BF7C77",
199 ">+ c #89D86D",
200 ",+ c #1BF41B",
201 "'+ c #1DAB1D",
202 ")+ c #410505",
203 "!+ c #8A0B0B",
204 "~+ c #8F0C0C",
205 "{+ c #8F0B0B",
206 "]+ c #8F0A0A",
207 "^+ c #B5625F",
208 "/+ c #8CCD68",
209 "(+ c #1CD81C",
210 "_+ c #1E911E",
211 ":+ c #950C0C",
212 "<+ c #9D0D0D",
213 "[+ c #A10E0E",
214 "}+ c #9F0E0E",
215 "|+ c #980D0D",
216 "1+ c #920C0C",
217 "2+ c #B5605D",
218 "3+ c #8CCB67",
219 "4+ c #1BF71B",
220 "5+ c #1DAF1D",
221 "6+ c #960C0C",
222 "7+ c #AF1010",
223 "8+ c #CE1414",
224 "9+ c #E51717",
225 "0+ c #F11919",
226 "a+ c #F61919",
227 "b+ c #F41919",
228 "c+ c #EB1818",
229 "d+ c #D91616",
230 "e+ c #BC1212",
231 "f+ c #8CC867",
232 "g+ c #910C0C",
233 "h+ c #AB0F0F",
234 "i+ c #DB1616",
235 "j+ c #F61A1A",
236 "k+ c #FF1B1B",
237 "l+ c #FC1A1A",
238 "m+ c #EA1818",
239 "n+ c #C01212",
240 "o+ c #970D0D",
241 "p+ c #B55F5D",
242 "q+ c #8DA968",
243 "r+ c #1DAC1D",
244 "s+ c #BC1111",
245 "t+ c #FE1B1B",
246 "u+ c #FA1A1A",
247 "v+ c #D61616",
248 "w+ c #9E0D0D",
249 "x+ c #B55E5D",
250 "y+ c #8D9869",
251 "z+ c #94D494",
252 "A+ c #BE1212",
253 "B+ c #F51A1A",
254 "C+ c #FD1B1B",
255 "D+ c #DD1616",
256 "E+ c #8D9969",
257 "F+ c #1E8D1E",
258 "G+ c #3B9A3B",
259 "H+ c #7CCB80",
260 "I+ c #8E0B0B",
261 "J+ c #B01010",
262 "K+ c #F41A1A",
263 "L+ c #FC1B1B",
264 "M+ c #D21515",
265 "N+ c #8C9267",
266 "O+ c #1B7D1B",
267 "P+ c #1C801C",
268 "Q+ c #2A902E",
269 "R+ c #387F6A",
270 "S+ c #2D3390",
271 "T+ c #2B2B93",
272 "U+ c #313196",
273 "V+ c #6F6FB7",
274 "W+ c #980C0C",
275 "X+ c #E41717",
276 "Y+ c #F81A1A",
277 "Z+ c #B51111",
278 "`+ c #B55D5D",
279 " @ c #857460",
280 ".@ c #0A390A",
281 "+@ c #0A380C",
282 "@@ c #0B3810",
283 "#@ c #0B3910",
284 "$@ c #0E451B",
285 "%@ c #19534F",
286 "&@ c #1E2C84",
287 "*@ c #1F1F8D",
288 "=@ c #1E1E8D",
289 "-@ c #9E9ED7",
290 ";@ c #BB1111",
291 ">@ c #E01717",
292 ",@ c #970C0C",
293 "'@ c #B75E5E",
294 ")@ c #DFA09F",
295 "!@ c #0C0D3A",
296 "~@ c #1D1E82",
297 "{@ c #1E1F88",
298 "]@ c #1E1F87",
299 "^@ c #1D1F8D",
300 "/@ c #1E1F8E",
301 "(@ c #1E2090",
302 "_@ c #1E1E92",
303 ":@ c #2B2B92",
304 "<@ c #8F8FD0",
305 "[@ c #940C0C",
306 "}@ c #AD0F0F",
307 "|@ c #B75F5F",
308 "1@ c #E5A3A3",
309 "2@ c #0C0C3C",
310 "3@ c #1D1D87",
311 "4@ c #1F1F91",
312 "5@ c #1C1CCF",
313 "6@ c #1B1BF0",
314 "7@ c #1B1BF1",
315 "8@ c #1C1CD7",
316 "9@ c #1E1E93",
317 "0@ c #C31212",
318 "a@ c #1E1EA1",
319 "b@ c #1B1BFC",
320 "c@ c #1B1BFF",
321 "d@ c #1B1BFB",
322 "e@ c #1E1EAA",
323 "f@ c #D31515",
324 "g@ c #1E1EA3",
325 "h@ c #1B1BFD",
326 "i@ c #1E1EAE",
327 "j@ c #DA1616",
328 "k@ c #FD1A1A",
329 "l@ c #A70F0F",
330 "m@ c #9A0D0D",
331 "n@ c #F01919",
332 "o@ c #A40E0E",
333 "p@ c #AC0F0F",
334 "q@ c #920B0B",
335 "r@ c #D41515",
336 "s@ c #A60E0E",
337 "t@ c #E61818",
338 "u@ c #910B0B",
339 "v@ c #A90F0F",
340 "w@ c #E81818",
341 "x@ c #C51313",
342 "y@ c #930C0C",
343 "z@ c #A50E0E",
344 "A@ c #DC1616",
345 "B@ c #FB1A1A",
346 "C@ c #EF1919",
347 "D@ c #990C0C",
348 "E@ c #BD1212",
349 "F@ c #F71A1A",
350 "G@ c #EE1919",
351 "H@ c #D11414",
352 "I@ c #A50F0F",
353 "J@ c #AE1010",
354 "K@ c #D71515",
355 "L@ c #CC1414",
356 "M@ c #B91111",
357 "N@ c #A20E0E",
358 "O@ c #1E1E97",
359 "P@ c #1B1BEC",
360 "Q@ c #1E1E9C",
361 "R@ c #890B0B",
362 "S@ c #B55B5B",
363 "T@ c #E29797",
364 "U@ c #1E1E99",
365 "V@ c #1D1DAD",
366 "W@ c #1D1DAE",
367 "X@ c #1E1E9D",
368 "Y@ c #310404",
369 "Z@ c #6C0808",
370 "`@ c #8D0B0B",
371 " # c #B24141",
372 ".# c #E86868",
373 "+# c #0B0B3A",
374 "@# c #1D1D86",
375 "## c #1F1F8C",
376 "$# c #8989CE",
377 "%# c #340404",
378 "&# c #4E0606",
379 "*# c #580707",
380 "=# c #590707",
381 "-# c #5B0808",
382 ";# c #710A0A",
383 "># c #AE1A1A",
384 ",# c #090931",
385 "'# c #151562",
386 ")# c #1D1D83",
387 "!# c #1D1D84",
388 "~# c #1D1D85",
389 "{# c #28288F",
390 "]# c #5A5AC8",
391 "^# c #2C0404",
392 "/# c #2D0303",
393 "(# c #2E0303",
394 "_# c #300404",
395 ":# c #620909",
396 "<# c #080831",
397 "[# c #0B0B3C",
398 "}# c #0C0C3F",
399 "|# c #0D0D42",
400 "1# c #12126C",
401 " ",
402 " ",
403 " ",
404 " ",
405 " . + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # $ ",
406 " % & * = = = = = = = = = = = = = = = = = = = - ; > ",
407 " , ' ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) - ! ",
408 " , ' ) ) ) ) ) ) ) ) ) ~ { ) ) ) ) ) ) ) ) ) ) * ] ",
409 " , ' ) ) ) ) ) ) ) ) ) ^ / ( ) ) ) ) ) ) ) ) ) * _ : < < < < < < < < < < < < < < < < < < < [ } | ",
410 " , ' ) ) ) ) ) ) ) ) ) 1 2 3 ~ ) ) ) ) ) ) ) ) * 4 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 8 9 0 ",
411 " , ' ) ) ) ) ) ) ) ) ~ a b c ~ ) ) ) ) ) ) ) ) * 4 d e e e e e e e e e e e e e e e e e e e e f g h ",
412 " , ' ) ) ) ) ) ) ) ) ~ i j k l ) ) ) ) ) ) ) ) * 4 d e e e e e e m m e e e e e e e e e e e e n o p ",
413 " , ' ) ) ) ) ) ) ) ) { q r s t ) ) ) ) ) ) ) ) * 4 d e e e e e e u v e e e e e e e e e e e e n w x ",
414 " , ' ) ) ~ ~ ~ ~ ~ ^ y z r A B ^ ~ ~ ~ ~ ~ ~ ) * 4 d e e e e m C D E m e e e e e e e e e e e n w x ",
415 " , ' ) l F G G G G H I A r r q G G G G G H J ) * 4 d e e e e K E L M C m e e e e e e e e e e n w x ",
416 " , ' ) ) N O P A A A Q r r r Q A A A R z S 1 ) * 4 d e e e m T U V L W m e e e e e e e e e e n w x ",
417 " , ' ) ) ~ y X R r r r r r r r r r Q Y N ) ) ) * 4 d e e e m W Z ` ` ...m e e e e e e e e e n w x ",
418 " , ' ) ) ) ~ +.I @.r r r r r r r A k t ~ ) ) ) * 4 d e e m .. .` ` ` #.$.K e e e e e e e e e n w x ",
419 " , ' ) ) ) ) ) %.B b r r r r r A &.+.~ ) ) ) ) * 4 d e e m *.=.` ` ` ` -.;.m e e e e e e e e n w x ",
420 " , ' ) ) ) ) ) ) J >.r r r r r ,.'.~ ) ) ) ) ) * 4 d e m ).!.` ` ` ` ` =.~.e e e e e e e e e n w x ",
421 " , ' ) ) ) ) ) ~ '.{.r r r r r Q ].~ ) ) ) ) ) * 4 d e m ~.^.` ` ` ` ` ` /.(.m e e e e e e e n w x ",
422 " , ' ) ) ) ) ) ) _.r r P k z r r :.<.) ) ) ) ) * 4 d m u [.` ` ` ` ` ` ` }.|.e e e e e e e e n w x ",
423 " , ' ) ) ) ) ) 1.2 r z 2.3.'.4.Q s 5.~ ) ) ) ) * 4 6.e 7.#.` ` ` ` ` ` ` ` 8.9.m e e e e e e n w x ",
424 " , ' ) ) ) ) ~ 3 s 4.0.) ~ ~ a.b.{.c.~ ) ) ) ) * 4 6.9.8.` ` ` ` ` ` ` ` ` ^.d.e.e e e e e e n w x ",
425 " , ' ) ) ) ) ~ S f.g.~ ) ) ) ~ h.i.j.{ ) ) ) ) * 4 d d.}.` ` ` ` ` ` ` ` ` ` k.l.m e e e e e n w x ",
426 " , ' ) ) ) ) m.'.h.~ ) ) ) ) ) ) n.0.o.) ) ) ) * 4 p.q.` ` ` ` ` ` ` ` ` ` ` }.r.e.e e e e e n w x ",
427 " , ' ) ) ) ) ) ~ ) ) ) ) ) ) ) ) ) ~ ) ) ) ) ) * s.t.^.` ` ` ` ` ` ` ` ` ` ` ` u.v.m e e e e n w x ",
428 " w.x.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) y.z.A.` ` ` ` ` ` ` ` ` ` ` ` ` }.B.C.e e e e n w x ",
429 " D.E.F.G.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.I.J.K.L.M.N.O.P.` ` ` ` ` ` ` ` ` ` Q.R.m e e e n w x ",
430 " S.T.U.V.W.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.Y.Z.`. +.+++@+#+` ` ` ` ` ` ` ` ` ` }.D $+e e e n w x ",
431 " %+&+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+=+-+;+>+` ` ` ` ` ` ` ` ` ` ` ,+'+m e e n w x ",
432 " )+!+*+*+*+*+*+*+*+*+*+*+*+*+~+{+~+~+*+*+*+*+*+*+*+*+*+*+*+]+^+/+` ` ` ` ` ` ` ` ` ` ` V (+_+e e n w x ",
433 " )+!+*+*+*+*+*+*+*+*+~+{+=+:+<+[+}+|+1+{+~+*+*+*+*+*+*+*+*+]+2+3+` ` ` ` ` ` ` ` ` ` ` ` 4+5+K e n w x ",
434 " )+!+*+*+*+*+*+*+*+{+6+7+8+9+0+a+b+c+d+e+}+*+~+*+*+*+*+*+*+]+2+f+L L L L L L L L L L L L 4+(+C e n w x ",
435 " )+!+*+*+*+*+*+~+g+h+i+j+k+k+k+k+k+k+k+l+m+n+o+~+*+*+*+*+*+]+p+q+E E E E E E E E E E E E E r+C e n w x ",
436 " )+!+*+*+*+*+~+1+s+0+t+k+k+k+k+k+k+k+k+k+k+u+v+w+{+*+*+*+*+]+x+y+K K K K K K K K K K K K K m e e n w z+ ",
437 " )+!+*+*+*+*+g+A+B+k+k+k+k+k+k+k+k+k+k+k+k+k+C+D+<+{+*+*+*+]+x+E+e e e e e e e e e e e e e e e e F+G+H+ ",
438 " )+!+*+*+*+I+J+K+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+L+M+:+*+*+*+]+x+N+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+P+Q+R+S+T+T+U+V+ ",
439 " )+!+*+*+~+W+X+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+Y+Z+{+*+*+]+`+ @.@+@@@@@@@@@@@@@@@@@@@@@@@@@@@#@$@%@&@*@*@*@=@U+-@ ",
440 " )+!+*+*+{+;@u+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+t+>@,@~+*+]+'@)@ !@~@{@{@]@^@^@^@^@^@^@^@^@^@^@/@(@_@_@*@*@*@:@<@ ",
441 " )+!+*+*+[@D+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+j+}@~+*+]+|@1@ 2@3@*@4@5@6@7@7@7@7@7@7@7@7@7@7@7@7@7@8@9@*@:@<@ ",
442 " )+!+*+~+}+0+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+t+0@{+*+]+|@1@ 2@3@*@a@b@c@c@c@c@c@c@c@c@c@c@c@c@c@c@d@e@*@:@<@ ",
443 " )+!+*+I+h+u+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+f@g+*+]+|@1@ 2@3@*@g@h@c@c@c@c@c@c@c@c@c@c@c@c@c@c@b@i@*@:@<@ ",
444 " )+!+*+I+J+C+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+j@g+*+]+|@1@ 2@3@*@g@h@c@c@c@c@c@c@c@c@c@c@c@c@c@c@b@i@*@:@<@ ",
445 " )+!+*+I+7+k@k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+d+g+*+]+|@1@ 2@3@*@g@h@c@c@c@c@c@c@c@c@c@c@c@c@c@c@b@i@*@:@<@ ",
446 " )+!+*+~+l@Y+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+8+=+*+]+|@1@ 2@3@*@g@h@c@c@c@c@c@c@c@c@c@c@c@c@c@c@b@i@*@:@<@ ",
447 " )+!+*+*+m@c+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+l+e+~+*+]+|@1@ 2@3@*@g@h@c@c@c@c@c@c@c@c@c@c@c@c@c@c@b@i@*@:@<@ ",
448 " )+!+*+*+g+f@t+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+n@o@~+*+]+|@1@ 2@3@*@g@h@c@c@c@c@c@c@c@c@c@c@c@c@c@c@b@i@*@:@<@ ",
449 " )+!+*+*+{+p@j+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+t+f@1+*+*+]+|@1@ 2@3@*@g@h@c@c@c@c@c@c@c@c@c@c@c@c@c@c@b@i@*@:@<@ ",
450 " )+!+*+*+*+q@r@t+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+k+n@s@{+*+*+]+|@1@ 2@3@*@g@h@c@c@c@c@c@c@c@c@c@c@c@c@c@c@b@i@*@:@<@ ",
451 " )+!+*+*+*+~+[+t@t+k+k+k+k+k+k+k+k+k+k+k+k+k+k+Y+A+u@*+*+*+]+|@1@ 2@3@*@g@h@c@c@c@c@c@c@c@c@c@c@c@c@c@c@b@i@*@:@<@ ",
452 " )+!+*+*+*+*+{+v@w@t+k+k+k+k+k+k+k+k+k+k+k+k+Y+x@y@*+*+*+*+]+|@1@ 2@3@*@g@h@c@c@c@c@c@c@c@c@c@c@c@c@c@c@b@i@*@:@<@ ",
453 " )+!+*+*+*+*+*+{+z@A@B@k+k+k+k+k+k+k+k+k+C+C@e+y@~+*+*+*+*+]+|@1@ 2@3@*@g@h@c@c@c@c@c@c@c@c@c@c@c@c@c@c@b@i@*@:@<@ ",
454 " )+!+*+*+*+*+*+*+~+D@E@9+F@t+k+k+k+k+B@G@H@I@=+~+*+*+*+*+*+]+|@1@ 2@3@*@g@h@c@c@c@c@c@c@c@c@c@c@c@c@c@c@b@i@*@:@<@ ",
455 " )+!+*+*+*+*+*+*+*+*+{+m@J@x@r@d+K@L@M@N@1+~+*+*+*+*+*+*+*+]+|@1@ 2@3@*@g@h@c@c@c@c@c@c@c@c@c@c@c@c@c@c@b@i@*@:@<@ ",
456 " )+!+*+*+*+*+*+*+*+*+*+*+~+{+*+*+*+=+~+~+*+*+*+*+*+*+*+*+*+]+'@1@ 2@3@*@O@P@h@h@h@h@h@h@h@h@h@h@h@h@h@h@7@Q@*@:@<@ ",
457 " %+R@*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+=+S@T@ 2@3@*@*@U@V@W@W@W@W@W@W@W@W@W@W@W@W@V@X@*@*@:@<@ ",
458 " Y@Z@`@~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+-+ #.# +#@#*@*@*@############################*@*@*@T+$# ",
459 " %#&#*#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#-#;#># ,#'#)#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#~#{#]# ",
460 " ^#/#(#(#(#(#(#(#(#(#(#(#(#(#(#(#(#(#(#(#(#(#(#(#(#(#_#:# <#[#}#}#}#}#}#}#}#}#}#}#}#}#}#}#}#}#}#}#|#1# ",
461 " ",
462 " ",
463 " ",
464 " "};
0 New things in version 1.1.2:
1
2 Fixed:
3 Many instances there the CPU got stuck
4
5 New:
6 There are new versual feedback then chaining (this is an extreme help)
7 Vs. Mode for single player with 7 difficulties
8 "make install" now works
9 "make remove" added, it removes everything installed by "make install"
10 There is an icon in xpm format
11
12 Changed:
13 New graphics for garbage blocks
14 Screenshots are now saved to ~/.gamesaves/blockattack/screenshots on UNIX systems
15 Combos give a little more points
16
17 Bugs (all known bugs):
18 If you have solved a puzzle and restart it by pushing "Push", then fail it you will still see "Winner"
19 If a puzzle file is extended the new puzzles will appear solved (it has always been like that)
20 Windows 9x compatibility is broken, I don't know why. It shouldn't happen!
21 There is a possible bufferoverflow if your home dictory "~/" has an extremly long path, ie if the whole path get to more than 254 charecters
22 The menu is not always redrawed correctly
0 Changes in 1.2.0:
1 A little code clean up
2 Now remembers time for last game
3 Now adds icon to menu in gnome with "make install"
4 FPS and AIstatus removed from the game when DEBUG ain't defined
5 Replay function added, they can be saved, but only up to 5 minutes and in some gametypes (puzzle and stage clear) some things ain't saved
6 Network play, uses enet, can be removed
7 SHAREDIR is now better, but not perfect, integrated
8 Two new icons 32x32 and 64x64 (sam icon just rezised)
0 Changes in 1.2.1 (Unix specific):
1 Now uses scons for compiling and installing
2 Install using: "scons install blockattack" as root
3
4 Changes in 1.2.2 (Unix specific):
5 Now creates "~/.gamesaves/blockattack/puzzles" at startup
6 Now looks in "~/.gamesaves/blockattack/puzzles" after puzzle files before looking in "/usr/local/share/blockattack/res" (or there the shared gamefiles are installed)
7
0 New in version 1.3.0:
1 You can now make .'s in the game sever name, making it easier to type IP addresses
2 Default *Ip is now 192.168.0.2 to better reflect most home networks
3 Added smileys on big garbage blocks
4 Now uses the grey blocks in Vs. mode
5 Now uses identical seed for both players in Vs. mode
6 Breaks network compatibility with pre 1.3.0 versions because of the grey blocks and random seeds.
7 Can take a special paremeter "-SP X /path/to/levels" to run a given level.
8 The scons install now places the game in /usr/local/bin by default making it easier to start
9 Further changes to the scons scripts to help package maintainers. (Provided by Gonéri Le Bouder)
0 New in version 1.3.0:
1 You can now make .'s in the game sever name, making it easier to type IP addresses
2 Default *Ip is now 192.168.0.2 to better reflect most home networks
3 Added smileys on big garbage blocks
4 Now uses the grey blocks in Vs. mode
5 Now uses identical seed for both players in Vs. mode
6 Breaks network compatibility with pre 1.3.0 versions because of the grey blocks and random seeds.
7 Can take a special paremeter "-SP X /path/to/levels" to run a given level.
8 The scons install now places the game in /usr/local/bin by default making it easier to start
0 New in version 1.3.1:
1 Fixed bug in the way Gray Garbage blocks are created.
2 Added license information to the files that missed the information
3 Added "-nosound" parameter that disables the sound completely (to prevent a crash on some systems without sound hardware)
4 Improved the way the game behave if sound failed to load. (Automatically adds the "-nosound" parameter above)
5 Saved Games are now stored in "My Documents\My Games\blockattack" instead of "Application Data\gamesaves\blockattack"(Windows only)*
6 Saved screen shots are now saved to: "My Documents\My Games\blockattack\screenshots"
7 Missing folders are now created more nicely (Windows only)
8 Fixed crash when trying to go to puzzle mode (Windows only) (By adding missing '#ifdef __unix__')
9 Windows 9x know works again! (Windows only)
10 Improved the way "My Documents" are found and the way folders are created (Windows only)
11
12
13 *To keep old records and replays you must copy the files from the old location to the new
0 New in version 1.3.1:
1 Fixed bug in the way Gray Garbage blocks are created.
2 Added license information to the files that missed the information
3 Added "-nosound" parameter that disables the sound completely (to prevent a crash on some systems without sound hardware)
4 Improved the way the game behave if sound failed to load. (Automatically adds the "-nosound" parameter above)
5 Saved Games are now stored in "My Documents\My Games\blockattack" instead of "Application Data\gamesaves\blockattack"(Windows only)*
6 Saved screen shots are now saved to: "My Documents\My Games\blockattack\screenshots"
7 Missing folders are now created more nicely (Windows only)
8 Fixed crash when trying to go to puzzle mode (Windows only) (By adding missing #ifdef __unix__)
9 Windows 9x know works again! (Windows only)
10 Improved the way "My Documents" are found and the way folders are created (Windows only)
11
12
13 *To keep old records and replays you must copy the files from the old location to the new
0 Block Attack - Rise of the Blocks
1 A SDL based game inspired by Tetris Attack. It has both single player and two player split screen.
2 Single player modes:
3 Endless
4 Time Trial
5 Stage Clear
6 Puzzle
7 Vs. Mode
8 Two player modes:
9 Time Trial
10 Vs. Mode
0 Thanks for downloading Block Attack - Rise Of the Blocks 1.2.3 for *nix-systems
1
2 Enjoy and read the files in the parent folder to get install information
3
4 http://blockattack.sf.net
5 Poul Sander poul@poulsander.com
0 Thanks for downloading Block Attack - Rise Of the Blocks 1.1.2 for Linux
1
2 The game is precompiled in the Game folder. It can be runned be double clicking the "starter" file. If you want to run it from an alternative location, you must make a script that changes to the Game dictory, before running it. You can then create a shortcut to that file.
3
4 The game is compiled under Ubuntu 5.10, there might be problems on some distros. If you have problems you should recompile the game from source
5
6 To compile the game, you must be in folder with the "Makefile" file and run "make -f block.make" this will recompile the parts of the program that you made changes to or the whole program if "Game/blockattack" was deleted.
7
8 By typing "make" the game will be recompiled even if files havn't been changed. This is recommended if you use an older version of the chared C++ libary (The precompiled files uses a new version, that is used by newer versions of Ubuntu and Mandriva)
9
10 You can use "make install" as root to install the game to the harddisk. You can use "make remove" as root to remove the game again. You can change paths in the first lines in the "Makefile". If you install the game and change the paths when make remove will fail.
11
12 After a "make install" as root, the game can be runned by typing "blockattack"
13
14 http://blockattack.sf.net
15 Poul Sander poul@poulsander.com
0 /Makefile.am/1.1/Mon Nov 3 16:12:16 2003//
1 /list.h/1.2/Sat Mar 8 23:57:25 2003//
2 /memory.h/1.2/Sat Mar 8 23:57:25 2003//
3 /protocol.h/1.8/Thu Oct 30 15:55:32 2003//
4 /time.h/1.2/Sat Mar 8 23:57:25 2003//
5 /types.h/1.4/Sun Mar 9 01:19:28 2003//
6 /unix.h/1.2/Sat Mar 8 23:57:25 2003//
7 /utility.h/1.2/Sat Mar 8 23:57:25 2003//
8 /win32.h/1.2/Sat Mar 8 23:57:25 2003//
9 /enet.h/1.19/Tue Jan 6 01:54:11 2004//
10 D
0 enet/include/enet
0 :pserver:anoncvs@sferik.cubik.org:/home/enet/cvsroot
0 # Makefile.in generated by automake 1.9.3 from Makefile.am.
1 # include/enet/Makefile. Generated from Makefile.in by configure.
2
3 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
4 # 2003, 2004 Free Software Foundation, Inc.
5 # This Makefile.in is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12 # PARTICULAR PURPOSE.
13
14
15
16 srcdir = .
17 top_srcdir = ../..
18
19 pkgdatadir = $(datadir)/libenet.a
20 pkglibdir = $(libdir)/libenet.a
21 pkgincludedir = $(includedir)/libenet.a
22 top_builddir = ../..
23 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
24 INSTALL = /usr/bin/install -c
25 install_sh_DATA = $(install_sh) -c -m 644
26 install_sh_PROGRAM = $(install_sh) -c
27 install_sh_SCRIPT = $(install_sh) -c
28 INSTALL_HEADER = $(INSTALL_DATA)
29 transform = $(program_transform_name)
30 NORMAL_INSTALL = :
31 PRE_INSTALL = :
32 POST_INSTALL = :
33 NORMAL_UNINSTALL = :
34 PRE_UNINSTALL = :
35 POST_UNINSTALL = :
36 subdir = include/enet
37 DIST_COMMON = $(libenetinclude_HEADERS) $(srcdir)/Makefile.am \
38 $(srcdir)/Makefile.in
39 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
40 am__aclocal_m4_deps = $(top_srcdir)/configure.in
41 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
42 $(ACLOCAL_M4)
43 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
44 CONFIG_CLEAN_FILES =
45 SOURCES =
46 DIST_SOURCES =
47 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
48 am__vpath_adj = case $$p in \
49 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
50 *) f=$$p;; \
51 esac;
52 am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
53 am__installdirs = "$(DESTDIR)$(libenetincludedir)"
54 libenetincludeHEADERS_INSTALL = $(INSTALL_HEADER)
55 HEADERS = $(libenetinclude_HEADERS)
56 ETAGS = etags
57 CTAGS = ctags
58 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
59 ACLOCAL = aclocal-1.9
60 AMDEP_FALSE = #
61 AMDEP_TRUE =
62 AMTAR = tar
63 AUTOCONF = autoconf
64 AUTOHEADER = autoheader
65 AUTOMAKE = automake-1.9
66 AWK = gawk
67 CC = gcc
68 CCDEPMODE = depmode=gcc3
69 CFLAGS = -g -O2
70 CPP = gcc -E
71 CPPFLAGS =
72 CYGPATH_W = echo
73 DEFS = -DPACKAGE_NAME=\"libenet\" -DPACKAGE_TARNAME=\"libenet\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"libenet\ 1.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"libenet.a\" -DVERSION=\"1.0\" -DHAS_GETHOSTBYADDR_R=1 -DHAS_GETHOSTBYNAME_R=1 -DHAS_POLL=1 -DHAS_FCNTL=1 -DHAS_INET_PTON=1 -DHAS_INET_NTOP=1 -DHAS_MSGHDR_FLAGS=1 -DHAS_SOCKLEN_T=1
74 DEPDIR = .deps
75 ECHO_C =
76 ECHO_N = -n
77 ECHO_T =
78 EGREP = grep -E
79 EXEEXT =
80 INSTALL_DATA = ${INSTALL} -m 644
81 INSTALL_PROGRAM = ${INSTALL}
82 INSTALL_SCRIPT = ${INSTALL}
83 INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s
84 LDFLAGS =
85 LIBOBJS =
86 LIBS =
87 LTLIBOBJS =
88 MAKEINFO = makeinfo
89 OBJEXT = o
90 PACKAGE = libenet.a
91 PACKAGE_BUGREPORT =
92 PACKAGE_NAME = libenet
93 PACKAGE_STRING = libenet 1.0
94 PACKAGE_TARNAME = libenet
95 PACKAGE_VERSION = 1.0
96 PATH_SEPARATOR = :
97 RANLIB = ranlib
98 SET_MAKE =
99 SHELL = /bin/sh
100 STRIP =
101 VERSION = 1.0
102 ac_ct_CC = gcc
103 ac_ct_RANLIB = ranlib
104 ac_ct_STRIP =
105 am__fastdepCC_FALSE = #
106 am__fastdepCC_TRUE =
107 am__include = include
108 am__leading_dot = .
109 am__quote =
110 am__tar = ${AMTAR} chof - "$$tardir"
111 am__untar = ${AMTAR} xf -
112 bindir = ${exec_prefix}/bin
113 build_alias =
114 datadir = ${prefix}/share
115 exec_prefix = ${prefix}
116 host_alias =
117 includedir = ${prefix}/include
118 infodir = ${prefix}/info
119 install_sh = /home/poul/blockattack-1.3.0/enet-1.0/install-sh
120 libdir = ${exec_prefix}/lib
121 libexecdir = ${exec_prefix}/libexec
122 localstatedir = ${prefix}/var
123 mandir = ${prefix}/man
124 mkdir_p = mkdir -p --
125 oldincludedir = /usr/include
126 prefix = /usr/local
127 program_transform_name = s,x,x,
128 sbindir = ${exec_prefix}/sbin
129 sharedstatedir = ${prefix}/com
130 sysconfdir = ${prefix}/etc
131 target_alias =
132 libenetincludedir = $(includedir)/enet
133 libenetinclude_HEADERS = \
134 types.h \
135 list.h \
136 utility.h \
137 time.h \
138 callbacks.h \
139 unix.h \
140 win32.h \
141 protocol.h \
142 enet.h
143
144 all: all-am
145
146 .SUFFIXES:
147 $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
148 @for dep in $?; do \
149 case '$(am__configure_deps)' in \
150 *$$dep*) \
151 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
152 && exit 0; \
153 exit 1;; \
154 esac; \
155 done; \
156 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/enet/Makefile'; \
157 cd $(top_srcdir) && \
158 $(AUTOMAKE) --foreign include/enet/Makefile
159 .PRECIOUS: Makefile
160 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
161 @case '$?' in \
162 *config.status*) \
163 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
164 *) \
165 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
166 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
167 esac;
168
169 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
170 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
171
172 $(top_srcdir)/configure: $(am__configure_deps)
173 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
174 $(ACLOCAL_M4): $(am__aclocal_m4_deps)
175 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
176 uninstall-info-am:
177 install-libenetincludeHEADERS: $(libenetinclude_HEADERS)
178 @$(NORMAL_INSTALL)
179 test -z "$(libenetincludedir)" || $(mkdir_p) "$(DESTDIR)$(libenetincludedir)"
180 @list='$(libenetinclude_HEADERS)'; for p in $$list; do \
181 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
182 f=$(am__strip_dir) \
183 echo " $(libenetincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(libenetincludedir)/$$f'"; \
184 $(libenetincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(libenetincludedir)/$$f"; \
185 done
186
187 uninstall-libenetincludeHEADERS:
188 @$(NORMAL_UNINSTALL)
189 @list='$(libenetinclude_HEADERS)'; for p in $$list; do \
190 f=$(am__strip_dir) \
191 echo " rm -f '$(DESTDIR)$(libenetincludedir)/$$f'"; \
192 rm -f "$(DESTDIR)$(libenetincludedir)/$$f"; \
193 done
194
195 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
196 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
197 unique=`for i in $$list; do \
198 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
199 done | \
200 $(AWK) ' { files[$$0] = 1; } \
201 END { for (i in files) print i; }'`; \
202 mkid -fID $$unique
203 tags: TAGS
204
205 TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
206 $(TAGS_FILES) $(LISP)
207 tags=; \
208 here=`pwd`; \
209 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
210 unique=`for i in $$list; do \
211 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
212 done | \
213 $(AWK) ' { files[$$0] = 1; } \
214 END { for (i in files) print i; }'`; \
215 if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
216 test -n "$$unique" || unique=$$empty_fix; \
217 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
218 $$tags $$unique; \
219 fi
220 ctags: CTAGS
221 CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
222 $(TAGS_FILES) $(LISP)
223 tags=; \
224 here=`pwd`; \
225 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
226 unique=`for i in $$list; do \
227 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
228 done | \
229 $(AWK) ' { files[$$0] = 1; } \
230 END { for (i in files) print i; }'`; \
231 test -z "$(CTAGS_ARGS)$$tags$$unique" \
232 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
233 $$tags $$unique
234
235 GTAGS:
236 here=`$(am__cd) $(top_builddir) && pwd` \
237 && cd $(top_srcdir) \
238 && gtags -i $(GTAGS_ARGS) $$here
239
240 distclean-tags:
241 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
242
243 distdir: $(DISTFILES)
244 @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
245 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
246 list='$(DISTFILES)'; for file in $$list; do \
247 case $$file in \
248 $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
249 $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
250 esac; \
251 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
252 dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
253 if test "$$dir" != "$$file" && test "$$dir" != "."; then \
254 dir="/$$dir"; \
255 $(mkdir_p) "$(distdir)$$dir"; \
256 else \
257 dir=''; \
258 fi; \
259 if test -d $$d/$$file; then \
260 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
261 cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
262 fi; \
263 cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
264 else \
265 test -f $(distdir)/$$file \
266 || cp -p $$d/$$file $(distdir)/$$file \
267 || exit 1; \
268 fi; \
269 done
270 check-am: all-am
271 check: check-am
272 all-am: Makefile $(HEADERS)
273 installdirs:
274 for dir in "$(DESTDIR)$(libenetincludedir)"; do \
275 test -z "$$dir" || $(mkdir_p) "$$dir"; \
276 done
277 install: install-am
278 install-exec: install-exec-am
279 install-data: install-data-am
280 uninstall: uninstall-am
281
282 install-am: all-am
283 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
284
285 installcheck: installcheck-am
286 install-strip:
287 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
288 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
289 `test -z '$(STRIP)' || \
290 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
291 mostlyclean-generic:
292
293 clean-generic:
294
295 distclean-generic:
296 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
297
298 maintainer-clean-generic:
299 @echo "This command is intended for maintainers to use"
300 @echo "it deletes files that may require special tools to rebuild."
301 clean: clean-am
302
303 clean-am: clean-generic mostlyclean-am
304
305 distclean: distclean-am
306 -rm -f Makefile
307 distclean-am: clean-am distclean-generic distclean-tags
308
309 dvi: dvi-am
310
311 dvi-am:
312
313 html: html-am
314
315 info: info-am
316
317 info-am:
318
319 install-data-am: install-libenetincludeHEADERS
320
321 install-exec-am:
322
323 install-info: install-info-am
324
325 install-man:
326
327 installcheck-am:
328
329 maintainer-clean: maintainer-clean-am
330 -rm -f Makefile
331 maintainer-clean-am: distclean-am maintainer-clean-generic
332
333 mostlyclean: mostlyclean-am
334
335 mostlyclean-am: mostlyclean-generic
336
337 pdf: pdf-am
338
339 pdf-am:
340
341 ps: ps-am
342
343 ps-am:
344
345 uninstall-am: uninstall-info-am uninstall-libenetincludeHEADERS
346
347 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
348 ctags distclean distclean-generic distclean-tags distdir dvi \
349 dvi-am html html-am info info-am install install-am \
350 install-data install-data-am install-exec install-exec-am \
351 install-info install-info-am install-libenetincludeHEADERS \
352 install-man install-strip installcheck installcheck-am \
353 installdirs maintainer-clean maintainer-clean-generic \
354 mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
355 uninstall uninstall-am uninstall-info-am \
356 uninstall-libenetincludeHEADERS
357
358 # Tell versions [3.59,3.63) of GNU make to not export all variables.
359 # Otherwise a system limit (for SysV at least) may be exceeded.
360 .NOEXPORT:
0 libenetincludedir = $(includedir)/enet
1 libenetinclude_HEADERS = \
2 types.h \
3 list.h \
4 utility.h \
5 time.h \
6 callbacks.h \
7 unix.h \
8 win32.h \
9 protocol.h \
10 enet.h
11
0 # Makefile.in generated by automake 1.9.3 from Makefile.am.
1 # @configure_input@
2
3 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
4 # 2003, 2004 Free Software Foundation, Inc.
5 # This Makefile.in is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12 # PARTICULAR PURPOSE.
13
14 @SET_MAKE@
15
16 srcdir = @srcdir@
17 top_srcdir = @top_srcdir@
18 VPATH = @srcdir@
19 pkgdatadir = $(datadir)/@PACKAGE@
20 pkglibdir = $(libdir)/@PACKAGE@
21 pkgincludedir = $(includedir)/@PACKAGE@
22 top_builddir = ../..
23 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
24 INSTALL = @INSTALL@
25 install_sh_DATA = $(install_sh) -c -m 644
26 install_sh_PROGRAM = $(install_sh) -c
27 install_sh_SCRIPT = $(install_sh) -c
28 INSTALL_HEADER = $(INSTALL_DATA)
29 transform = $(program_transform_name)
30 NORMAL_INSTALL = :
31 PRE_INSTALL = :
32 POST_INSTALL = :
33 NORMAL_UNINSTALL = :
34 PRE_UNINSTALL = :
35 POST_UNINSTALL = :
36 subdir = include/enet
37 DIST_COMMON = $(libenetinclude_HEADERS) $(srcdir)/Makefile.am \
38 $(srcdir)/Makefile.in
39 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
40 am__aclocal_m4_deps = $(top_srcdir)/configure.in
41 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
42 $(ACLOCAL_M4)
43 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
44 CONFIG_CLEAN_FILES =
45 SOURCES =
46 DIST_SOURCES =
47 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
48 am__vpath_adj = case $$p in \
49 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
50 *) f=$$p;; \
51 esac;
52 am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
53 am__installdirs = "$(DESTDIR)$(libenetincludedir)"
54 libenetincludeHEADERS_INSTALL = $(INSTALL_HEADER)
55 HEADERS = $(libenetinclude_HEADERS)
56 ETAGS = etags
57 CTAGS = ctags
58 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
59 ACLOCAL = @ACLOCAL@
60 AMDEP_FALSE = @AMDEP_FALSE@
61 AMDEP_TRUE = @AMDEP_TRUE@
62 AMTAR = @AMTAR@
63 AUTOCONF = @AUTOCONF@
64 AUTOHEADER = @AUTOHEADER@
65 AUTOMAKE = @AUTOMAKE@
66 AWK = @AWK@
67 CC = @CC@
68 CCDEPMODE = @CCDEPMODE@
69 CFLAGS = @CFLAGS@
70 CPP = @CPP@
71 CPPFLAGS = @CPPFLAGS@
72 CYGPATH_W = @CYGPATH_W@
73 DEFS = @DEFS@
74 DEPDIR = @DEPDIR@
75 ECHO_C = @ECHO_C@
76 ECHO_N = @ECHO_N@
77 ECHO_T = @ECHO_T@
78 EGREP = @EGREP@
79 EXEEXT = @EXEEXT@
80 INSTALL_DATA = @INSTALL_DATA@
81 INSTALL_PROGRAM = @INSTALL_PROGRAM@
82 INSTALL_SCRIPT = @INSTALL_SCRIPT@
83 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
84 LDFLAGS = @LDFLAGS@
85 LIBOBJS = @LIBOBJS@
86 LIBS = @LIBS@
87 LTLIBOBJS = @LTLIBOBJS@
88 MAKEINFO = @MAKEINFO@
89 OBJEXT = @OBJEXT@
90 PACKAGE = @PACKAGE@
91 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
92 PACKAGE_NAME = @PACKAGE_NAME@
93 PACKAGE_STRING = @PACKAGE_STRING@
94 PACKAGE_TARNAME = @PACKAGE_TARNAME@
95 PACKAGE_VERSION = @PACKAGE_VERSION@
96 PATH_SEPARATOR = @PATH_SEPARATOR@
97 RANLIB = @RANLIB@
98 SET_MAKE = @SET_MAKE@
99 SHELL = @SHELL@
100 STRIP = @STRIP@
101 VERSION = @VERSION@
102 ac_ct_CC = @ac_ct_CC@
103 ac_ct_RANLIB = @ac_ct_RANLIB@
104 ac_ct_STRIP = @ac_ct_STRIP@
105 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
106 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
107 am__include = @am__include@
108 am__leading_dot = @am__leading_dot@
109 am__quote = @am__quote@
110 am__tar = @am__tar@
111 am__untar = @am__untar@
112 bindir = @bindir@
113 build_alias = @build_alias@
114 datadir = @datadir@
115 exec_prefix = @exec_prefix@
116 host_alias = @host_alias@
117 includedir = @includedir@
118 infodir = @infodir@
119 install_sh = @install_sh@
120 libdir = @libdir@
121 libexecdir = @libexecdir@
122 localstatedir = @localstatedir@
123 mandir = @mandir@
124 mkdir_p = @mkdir_p@
125 oldincludedir = @oldincludedir@
126 prefix = @prefix@
127 program_transform_name = @program_transform_name@
128 sbindir = @sbindir@
129 sharedstatedir = @sharedstatedir@
130 sysconfdir = @sysconfdir@
131 target_alias = @target_alias@
132 libenetincludedir = $(includedir)/enet
133 libenetinclude_HEADERS = \
134 types.h \
135 list.h \
136 utility.h \
137 time.h \
138 callbacks.h \
139 unix.h \
140 win32.h \
141 protocol.h \
142 enet.h
143
144 all: all-am
145
146 .SUFFIXES:
147 $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
148 @for dep in $?; do \
149 case '$(am__configure_deps)' in \
150 *$$dep*) \
151 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
152 && exit 0; \
153 exit 1;; \
154 esac; \
155 done; \
156 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/enet/Makefile'; \
157 cd $(top_srcdir) && \
158 $(AUTOMAKE) --foreign include/enet/Makefile
159 .PRECIOUS: Makefile
160 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
161 @case '$?' in \
162 *config.status*) \
163 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
164 *) \
165 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
166 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
167 esac;
168
169 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
170 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
171
172 $(top_srcdir)/configure: $(am__configure_deps)
173 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
174 $(ACLOCAL_M4): $(am__aclocal_m4_deps)
175 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
176 uninstall-info-am:
177 install-libenetincludeHEADERS: $(libenetinclude_HEADERS)
178 @$(NORMAL_INSTALL)
179 test -z "$(libenetincludedir)" || $(mkdir_p) "$(DESTDIR)$(libenetincludedir)"
180 @list='$(libenetinclude_HEADERS)'; for p in $$list; do \
181 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
182 f=$(am__strip_dir) \
183 echo " $(libenetincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(libenetincludedir)/$$f'"; \
184 $(libenetincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(libenetincludedir)/$$f"; \
185 done
186
187 uninstall-libenetincludeHEADERS:
188 @$(NORMAL_UNINSTALL)
189 @list='$(libenetinclude_HEADERS)'; for p in $$list; do \
190 f=$(am__strip_dir) \
191 echo " rm -f '$(DESTDIR)$(libenetincludedir)/$$f'"; \
192 rm -f "$(DESTDIR)$(libenetincludedir)/$$f"; \
193 done
194
195 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
196 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
197 unique=`for i in $$list; do \
198 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
199 done | \
200 $(AWK) ' { files[$$0] = 1; } \
201 END { for (i in files) print i; }'`; \
202 mkid -fID $$unique
203 tags: TAGS
204
205 TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
206 $(TAGS_FILES) $(LISP)
207 tags=; \
208 here=`pwd`; \
209 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
210 unique=`for i in $$list; do \
211 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
212 done | \
213 $(AWK) ' { files[$$0] = 1; } \
214 END { for (i in files) print i; }'`; \
215 if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
216 test -n "$$unique" || unique=$$empty_fix; \
217 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
218 $$tags $$unique; \
219 fi
220 ctags: CTAGS
221 CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
222 $(TAGS_FILES) $(LISP)
223 tags=; \
224 here=`pwd`; \
225 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
226 unique=`for i in $$list; do \
227 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
228 done | \
229 $(AWK) ' { files[$$0] = 1; } \
230 END { for (i in files) print i; }'`; \
231 test -z "$(CTAGS_ARGS)$$tags$$unique" \
232 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
233 $$tags $$unique
234
235 GTAGS:
236 here=`$(am__cd) $(top_builddir) && pwd` \
237 && cd $(top_srcdir) \
238 && gtags -i $(GTAGS_ARGS) $$here
239
240 distclean-tags:
241 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
242
243 distdir: $(DISTFILES)
244 @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
245 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
246 list='$(DISTFILES)'; for file in $$list; do \
247 case $$file in \
248 $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
249 $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
250 esac; \
251 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
252 dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
253 if test "$$dir" != "$$file" && test "$$dir" != "."; then \
254 dir="/$$dir"; \
255 $(mkdir_p) "$(distdir)$$dir"; \
256 else \
257 dir=''; \
258 fi; \
259 if test -d $$d/$$file; then \
260 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
261 cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
262 fi; \
263 cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
264 else \
265 test -f $(distdir)/$$file \
266 || cp -p $$d/$$file $(distdir)/$$file \
267 || exit 1; \
268 fi; \
269 done
270 check-am: all-am
271 check: check-am
272 all-am: Makefile $(HEADERS)
273 installdirs:
274 for dir in "$(DESTDIR)$(libenetincludedir)"; do \
275 test -z "$$dir" || $(mkdir_p) "$$dir"; \
276 done
277 install: install-am
278 install-exec: install-exec-am
279 install-data: install-data-am
280 uninstall: uninstall-am
281
282 install-am: all-am
283 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
284
285 installcheck: installcheck-am
286 install-strip:
287 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
288 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
289 `test -z '$(STRIP)' || \
290 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
291 mostlyclean-generic:
292
293 clean-generic:
294
295 distclean-generic:
296 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
297
298 maintainer-clean-generic:
299 @echo "This command is intended for maintainers to use"
300 @echo "it deletes files that may require special tools to rebuild."
301 clean: clean-am
302
303 clean-am: clean-generic mostlyclean-am
304
305 distclean: distclean-am
306 -rm -f Makefile
307 distclean-am: clean-am distclean-generic distclean-tags
308
309 dvi: dvi-am
310
311 dvi-am:
312
313 html: html-am
314
315 info: info-am
316
317 info-am:
318
319 install-data-am: install-libenetincludeHEADERS
320
321 install-exec-am:
322
323 install-info: install-info-am
324
325 install-man:
326
327 installcheck-am:
328
329 maintainer-clean: maintainer-clean-am
330 -rm -f Makefile
331 maintainer-clean-am: distclean-am maintainer-clean-generic
332
333 mostlyclean: mostlyclean-am
334
335 mostlyclean-am: mostlyclean-generic
336
337 pdf: pdf-am
338
339 pdf-am:
340
341 ps: ps-am
342
343 ps-am:
344
345 uninstall-am: uninstall-info-am uninstall-libenetincludeHEADERS
346
347 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
348 ctags distclean distclean-generic distclean-tags distdir dvi \
349 dvi-am html html-am info info-am install install-am \
350 install-data install-data-am install-exec install-exec-am \
351 install-info install-info-am install-libenetincludeHEADERS \
352 install-man install-strip installcheck installcheck-am \
353 installdirs maintainer-clean maintainer-clean-generic \
354 mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
355 uninstall uninstall-am uninstall-info-am \
356 uninstall-libenetincludeHEADERS
357
358 # Tell versions [3.59,3.63) of GNU make to not export all variables.
359 # Otherwise a system limit (for SysV at least) may be exceeded.
360 .NOEXPORT:
0 /**
1 @file callbacks.h
2 @brief ENet callbacks
3 */
4 #ifndef __ENET_CALLBACKS_H__
5 #define __ENET_CALLBACKS_H__
6
7 #include <stdlib.h>
8
9 typedef struct
10 {
11 void * (ENET_CALLBACK * malloc) (size_t size);
12 void (ENET_CALLBACK * free) (void * memory);
13 int (ENET_CALLBACK * rand) (void);
14 } ENetCallbacks;
15
16 /** @defgroup callbacks ENet internal callbacks
17 @{
18 @ingroup private
19 */
20 extern void * enet_malloc (size_t);
21 extern void enet_free (void *);
22 extern int enet_rand (void);
23
24 /** @} */
25
26 #endif /* __ENET_CALLBACKS_H__ */
27
0 /**
1 @file enet.h
2 @brief ENet public header file
3 */
4 #ifndef __ENET_ENET_H__
5 #define __ENET_ENET_H__
6
7 #ifdef __cplusplus
8 extern "C"
9 {
10 #endif
11
12 #include <stdlib.h>
13
14 #ifdef WIN32
15 #include "enet/win32.h"
16 #else
17 #include "enet/unix.h"
18 #endif
19
20 #include "enet/types.h"
21 #include "enet/protocol.h"
22 #include "enet/list.h"
23 #include "enet/callbacks.h"
24
25 typedef enum
26 {
27 ENET_VERSION = 1
28 } ENetVersion;
29
30 typedef enum
31 {
32 ENET_SOCKET_TYPE_STREAM = 1,
33 ENET_SOCKET_TYPE_DATAGRAM = 2
34 } ENetSocketType;
35
36 typedef enum
37 {
38 ENET_SOCKET_WAIT_NONE = 0,
39 ENET_SOCKET_WAIT_SEND = (1 << 0),
40 ENET_SOCKET_WAIT_RECEIVE = (1 << 1)
41 } ENetSocketWait;
42
43 enum
44 {
45 ENET_HOST_ANY = 0, /**< specifies the default server host */
46 ENET_HOST_BROADCAST = 0xFFFFFFFF /**< specifies a subnet-wide broadcast */
47 };
48
49 /**
50 * Portable internet address structure.
51 *
52 * The host must be specified in network byte-order, and the port must be in host
53 * byte-order. The constant ENET_HOST_ANY may be used to specify the default
54 * server host. The constant ENET_HOST_BROADCAST may be used to specify the
55 * broadcast address (255.255.255.255). This makes sense for enet_host_connect,
56 * but not for enet_host_create. Once a server responds to a broadcast, the
57 * address is updated from ENET_HOST_BROADCAST to the server's actual IP address.
58 */
59 typedef struct _ENetAddress
60 {
61 enet_uint32 host;
62 enet_uint16 port;
63 } ENetAddress;
64
65 /**
66 * Packet flag bit constants.
67 *
68 * The host must be specified in network byte-order, and the port must be in
69 * host byte-order. The constant ENET_HOST_ANY may be used to specify the
70 * default server host.
71
72 @sa ENetPacket
73 */
74 typedef enum
75 {
76 /** packet must be received by the target peer and resend attempts should be
77 * made until the packet is delivered */
78 ENET_PACKET_FLAG_RELIABLE = (1 << 0),
79 /** packet will not be sequenced with other packets
80 * not supported for reliable packets
81 */
82 ENET_PACKET_FLAG_UNSEQUENCED = (1 << 1)
83 } ENetPacketFlag;
84
85 /**
86 * ENet packet structure.
87 *
88 * An ENet data packet that may be sent to or received from a peer. The shown
89 * fields should only be read and never modified. The data field contains the
90 * allocated data for the packet. The dataLength fields specifies the length
91 * of the allocated data. The flags field is either 0 (specifying no flags),
92 * or a bitwise-or of any combination of the following flags:
93 *
94 * ENET_PACKET_FLAG_RELIABLE - packet must be received by the target peer
95 * and resend attempts should be made until the packet is delivered
96
97 @sa ENetPacketFlag
98 */
99 typedef struct _ENetPacket
100 {
101 size_t referenceCount; /**< internal use only */
102 enet_uint32 flags; /**< bitwise or of ENetPacketFlag constants */
103 enet_uint8 * data; /**< allocated data for packet */
104 size_t dataLength; /**< length of data */
105 } ENetPacket;
106
107 typedef struct _ENetAcknowledgement
108 {
109 ENetListNode acknowledgementList;
110 enet_uint32 sentTime;
111 ENetProtocol command;
112 } ENetAcknowledgement;
113
114 typedef struct _ENetOutgoingCommand
115 {
116 ENetListNode outgoingCommandList;
117 enet_uint32 reliableSequenceNumber;
118 enet_uint32 unreliableSequenceNumber;
119 enet_uint32 sentTime;
120 enet_uint32 roundTripTimeout;
121 enet_uint32 roundTripTimeoutLimit;
122 enet_uint32 fragmentOffset;
123 enet_uint16 fragmentLength;
124 ENetProtocol command;
125 ENetPacket * packet;
126 } ENetOutgoingCommand;
127
128 typedef struct _ENetIncomingCommand
129 {
130 ENetListNode incomingCommandList;
131 enet_uint32 reliableSequenceNumber;
132 enet_uint32 unreliableSequenceNumber;
133 ENetProtocol command;
134 enet_uint32 fragmentCount;
135 enet_uint32 fragmentsRemaining;
136 enet_uint32 * fragments;
137 ENetPacket * packet;
138 } ENetIncomingCommand;
139
140 typedef enum
141 {
142 ENET_PEER_STATE_DISCONNECTED = 0,
143 ENET_PEER_STATE_CONNECTING = 1,
144 ENET_PEER_STATE_ACKNOWLEDGING_CONNECT = 2,
145 ENET_PEER_STATE_CONNECTION_PENDING = 3,
146 ENET_PEER_STATE_CONNECTED = 4,
147 ENET_PEER_STATE_DISCONNECTING = 5,
148 ENET_PEER_STATE_ACKNOWLEDGING_DISCONNECT = 6,
149 ENET_PEER_STATE_ZOMBIE = 7
150 } ENetPeerState;
151
152 #ifndef ENET_BUFFER_MAXIMUM
153 #define ENET_BUFFER_MAXIMUM (1 + 2 * ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS)
154 #endif
155
156 enum
157 {
158 ENET_HOST_RECEIVE_BUFFER_SIZE = 256 * 1024,
159 ENET_HOST_BANDWIDTH_THROTTLE_INTERVAL = 1000,
160 ENET_HOST_DEFAULT_MTU = 1400,
161
162 ENET_PEER_DEFAULT_ROUND_TRIP_TIME = 500,
163 ENET_PEER_DEFAULT_PACKET_THROTTLE = 32,
164 ENET_PEER_PACKET_THROTTLE_SCALE = 32,
165 ENET_PEER_PACKET_THROTTLE_COUNTER = 7,
166 ENET_PEER_PACKET_THROTTLE_ACCELERATION = 2,
167 ENET_PEER_PACKET_THROTTLE_DECELERATION = 2,
168 ENET_PEER_PACKET_THROTTLE_INTERVAL = 5000,
169 ENET_PEER_PACKET_LOSS_SCALE = (1 << 16),
170 ENET_PEER_PACKET_LOSS_INTERVAL = 10000,
171 ENET_PEER_WINDOW_SIZE_SCALE = 64 * 1024,
172 ENET_PEER_TIMEOUT_LIMIT = 32,
173 ENET_PEER_TIMEOUT_MINIMUM = 5000,
174 ENET_PEER_TIMEOUT_MAXIMUM = 30000,
175 ENET_PEER_PING_INTERVAL = 500,
176 ENET_PEER_UNSEQUENCED_WINDOW_SIZE = 4 * 32,
177 };
178
179 typedef struct _ENetChannel
180 {
181 enet_uint32 outgoingReliableSequenceNumber;
182 enet_uint32 outgoingUnreliableSequenceNumber;
183 enet_uint32 incomingReliableSequenceNumber;
184 enet_uint32 incomingUnreliableSequenceNumber;
185 ENetList incomingReliableCommands;
186 ENetList incomingUnreliableCommands;
187 } ENetChannel;
188
189 /**
190 * An ENet peer which data packets may be sent or received from.
191 *
192 * No fields should be modified unless otherwise specified.
193 */
194 typedef struct _ENetPeer
195 {
196 struct _ENetHost * host;
197 enet_uint16 outgoingPeerID;
198 enet_uint16 incomingPeerID;
199 enet_uint32 challenge;
200 ENetAddress address; /**< Internet address of the peer */
201 void * data; /**< Application private data, may be freely modified */
202 ENetPeerState state;
203 ENetChannel * channels;
204 size_t channelCount; /**< Number of channels allocated for communication with peer */
205 enet_uint32 incomingBandwidth; /**< Downstream bandwidth of the client in bytes/second */
206 enet_uint32 outgoingBandwidth; /**< Upstream bandwidth of the client in bytes/second */
207 enet_uint32 incomingBandwidthThrottleEpoch;
208 enet_uint32 outgoingBandwidthThrottleEpoch;
209 enet_uint32 incomingDataTotal;
210 enet_uint32 outgoingDataTotal;
211 enet_uint32 lastSendTime;
212 enet_uint32 lastReceiveTime;
213 enet_uint32 nextTimeout;
214 enet_uint32 earliestTimeout;
215 enet_uint32 packetLossEpoch;
216 enet_uint32 packetsSent;
217 enet_uint32 packetsLost;
218 enet_uint32 packetLoss; /**< mean packet loss of reliable packets as a ratio with respect to the constant ENET_PEER_PACKET_LOSS_SCALE */
219 enet_uint32 packetLossVariance;
220 enet_uint32 packetThrottle;
221 enet_uint32 packetThrottleLimit;
222 enet_uint32 packetThrottleCounter;
223 enet_uint32 packetThrottleEpoch;
224 enet_uint32 packetThrottleAcceleration;
225 enet_uint32 packetThrottleDeceleration;
226 enet_uint32 packetThrottleInterval;
227 enet_uint32 lastRoundTripTime;
228 enet_uint32 lowestRoundTripTime;
229 enet_uint32 lastRoundTripTimeVariance;
230 enet_uint32 highestRoundTripTimeVariance;
231 enet_uint32 roundTripTime; /**< mean round trip time (RTT), in milliseconds, between sending a reliable packet and receiving its acknowledgement */
232 enet_uint32 roundTripTimeVariance;
233 enet_uint16 mtu;
234 enet_uint32 windowSize;
235 enet_uint32 reliableDataInTransit;
236 enet_uint32 outgoingReliableSequenceNumber;
237 ENetList acknowledgements;
238 ENetList sentReliableCommands;
239 ENetList sentUnreliableCommands;
240 ENetList outgoingReliableCommands;
241 ENetList outgoingUnreliableCommands;
242 enet_uint32 incomingUnsequencedGroup;
243 enet_uint32 outgoingUnsequencedGroup;
244 enet_uint32 unsequencedWindow [ENET_PEER_UNSEQUENCED_WINDOW_SIZE / 32];
245 enet_uint32 disconnectData;
246 } ENetPeer;
247
248 /** An ENet host for communicating with peers.
249 *
250 * No fields should be modified.
251
252 @sa enet_host_create()
253 @sa enet_host_destroy()
254 @sa enet_host_connect()
255 @sa enet_host_service()
256 @sa enet_host_flush()
257 @sa enet_host_broadcast()
258 @sa enet_host_bandwidth_limit()
259 @sa enet_host_bandwidth_throttle()
260 */
261 typedef struct _ENetHost
262 {
263 ENetSocket socket;
264 ENetAddress address; /**< Internet address of the host */
265 enet_uint32 incomingBandwidth; /**< downstream bandwidth of the host */
266 enet_uint32 outgoingBandwidth; /**< upstream bandwidth of the host */
267 enet_uint32 bandwidthThrottleEpoch;
268 enet_uint32 mtu;
269 int recalculateBandwidthLimits;
270 ENetPeer * peers; /**< array of peers allocated for this host */
271 size_t peerCount; /**< number of peers allocated for this host */
272 ENetPeer * lastServicedPeer;
273 size_t packetSize;
274 ENetProtocol commands [ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS];
275 size_t commandCount;
276 ENetBuffer buffers [ENET_BUFFER_MAXIMUM];
277 size_t bufferCount;
278 ENetAddress receivedAddress;
279 enet_uint8 receivedData [ENET_PROTOCOL_MAXIMUM_MTU];
280 size_t receivedDataLength;
281 } ENetHost;
282
283 /**
284 * An ENet event type, as specified in @ref ENetEvent.
285 */
286 typedef enum
287 {
288 /** no event occurred within the specified time limit */
289 ENET_EVENT_TYPE_NONE = 0,
290
291 /** a connection request initiated by enet_host_connect has completed.
292 * The peer field contains the peer which successfully connected.
293 */
294 ENET_EVENT_TYPE_CONNECT = 1,
295
296 /** a peer has disconnected. This event is generated on a successful
297 * completion of a disconnect initiated by enet_pper_disconnect, if
298 * a peer has timed out, or if a connection request intialized by
299 * enet_host_connect has timed out. The peer field contains the peer
300 * which disconnected. The data field contains user supplied data
301 * describing the disconnection, or 0, if none is available.
302 */
303 ENET_EVENT_TYPE_DISCONNECT = 2,
304
305 /** a packet has been received from a peer. The peer field specifies the
306 * peer which sent the packet. The channelID field specifies the channel
307 * number upon which the packet was received. The packet field contains
308 * the packet that was received; this packet must be destroyed with
309 * enet_packet_destroy after use.
310 */
311 ENET_EVENT_TYPE_RECEIVE = 3
312 } ENetEventType;
313
314 /**
315 * An ENet event as returned by enet_host_service().
316
317 @sa enet_host_service
318 */
319 typedef struct _ENetEvent
320 {
321 ENetEventType type; /**< type of the event */
322 ENetPeer * peer; /**< peer that generated a connect, disconnect or receive event */
323 enet_uint8 channelID; /**< channel on the peer that generated the event, if appropriate */
324 enet_uint32 data; /**< data associated with the event, if appropriate */
325 ENetPacket * packet; /**< packet associated with the event, if appropriate */
326 } ENetEvent;
327
328 /** @defgroup global ENet global functions
329 @{
330 */
331
332 /**
333 Initializes ENet globally. Must be called prior to using any functions in
334 ENet.
335 @returns 0 on success, < 0 on failure
336 */
337 ENET_API int enet_initialize (void);
338
339 ENET_API int enet_initialize_with_callbacks (ENetVersion version, const ENetCallbacks * inits);
340
341 /**
342 Shuts down ENet globally. Should be called when a program that has
343 initialized ENet exits.
344 */
345 ENET_API void enet_deinitialize (void);
346
347 /** @} */
348
349 /** @defgroup private ENet private implementation functions */
350
351 /**
352 Returns the wall-time in milliseconds. Its initial value is unspecified
353 unless otherwise set.
354 */
355 ENET_API enet_uint32 enet_time_get (void);
356 /**
357 Sets the current wall-time in milliseconds.
358 */
359 ENET_API void enet_time_set (enet_uint32);
360
361 /** @defgroup socket ENet socket functions
362 @{
363 @ingroup private
364 */
365 extern ENetSocket enet_socket_create (ENetSocketType, const ENetAddress *);
366 extern ENetSocket enet_socket_accept (ENetSocket, ENetAddress *);
367 extern int enet_socket_connect (ENetSocket, const ENetAddress *);
368 extern int enet_socket_send (ENetSocket, const ENetAddress *, const ENetBuffer *, size_t);
369 extern int enet_socket_receive (ENetSocket, ENetAddress *, ENetBuffer *, size_t);
370 extern int enet_socket_wait (ENetSocket, enet_uint32 *, enet_uint32);
371 extern void enet_socket_destroy (ENetSocket);
372
373 /** @} */
374
375 /** @defgroup Address ENet address functions
376 @{
377 */
378 /** Attempts to resolve the host named by the parameter hostName and sets
379 the host field in the address parameter if successful.
380 @param address destination to store resolved address
381 @param hostName host name to lookup
382 @retval 0 on success
383 @retval < 0 on failure
384 @returns the address of the given hostName in address on success
385 */
386 ENET_API int enet_address_set_host (ENetAddress *address, const char *hostName );
387
388 /** Attempts to do a reserve lookup of the host field in the address parameter.
389 @param address address used for reverse lookup
390 @param hostName destination for name, must not be NULL
391 @param nameLength maximum length of hostName.
392 @returns the null-terminated name of the host in hostName on success
393 @retval 0 on success
394 @retval < 0 on failure
395 */
396 ENET_API int enet_address_get_host (const ENetAddress *address, char *hostName, size_t nameLength );
397
398 /** @} */
399
400 ENET_API ENetPacket * enet_packet_create (const void *dataContents, size_t dataLength, enet_uint32 flags);
401 ENET_API void enet_packet_destroy (ENetPacket *packet );
402 ENET_API int enet_packet_resize (ENetPacket *packet, size_t dataLength );
403
404 ENET_API ENetHost * enet_host_create (const ENetAddress *address, size_t peerCount, enet_uint32 incomingBandwidth, enet_uint32 outgoingBandwidth );
405 ENET_API void enet_host_destroy (ENetHost *host );
406 ENET_API ENetPeer * enet_host_connect (ENetHost *host, const ENetAddress *address, size_t channelCount );
407 ENET_API int enet_host_service (ENetHost *, ENetEvent *, enet_uint32);
408 ENET_API void enet_host_flush (ENetHost *);
409 ENET_API void enet_host_broadcast (ENetHost *, enet_uint8, ENetPacket *);
410 ENET_API void enet_host_bandwidth_limit (ENetHost *, enet_uint32, enet_uint32);
411 extern void enet_host_bandwidth_throttle (ENetHost *);
412
413 ENET_API int enet_peer_send (ENetPeer *, enet_uint8, ENetPacket *);
414 ENET_API ENetPacket * enet_peer_receive (ENetPeer *, enet_uint8);
415 ENET_API void enet_peer_ping (ENetPeer *);
416 ENET_API void enet_peer_reset (ENetPeer *);
417 ENET_API void enet_peer_disconnect (ENetPeer *, enet_uint32);
418 ENET_API void enet_peer_disconnect_now (ENetPeer *, enet_uint32);
419 ENET_API void enet_peer_throttle_configure (ENetPeer *, enet_uint32, enet_uint32, enet_uint32);
420 extern int enet_peer_throttle (ENetPeer *, enet_uint32);
421 extern void enet_peer_reset_queues (ENetPeer *);
422 extern ENetOutgoingCommand * enet_peer_queue_outgoing_command (ENetPeer *, const ENetProtocol *, ENetPacket *, enet_uint32, enet_uint16);
423 extern ENetIncomingCommand * enet_peer_queue_incoming_command (ENetPeer *, const ENetProtocol *, ENetPacket *, enet_uint32);
424 extern ENetAcknowledgement * enet_peer_queue_acknowledgement (ENetPeer *, const ENetProtocol *, enet_uint32);
425
426 #ifdef __cplusplus
427 }
428 #endif
429
430 #endif /* __ENET_ENET_H__ */
431
0 /**
1 @file enet.h
2 @brief ENet public header file
3 */
4 #ifndef __ENET_ENET_H__
5 #define __ENET_ENET_H__
6
7 #ifdef __cplusplus
8 extern "C"
9 {
10 #endif
11
12 #include <stdlib.h>
13
14 #include "types.h"
15 #include "protocol.h"
16 #include "list.h"
17
18 #ifdef WIN32
19 #include "enet/win32.h"
20 #else
21 #include "enet/unix.h"
22 #endif
23
24 #ifdef ENET_API
25 #undef ENET_API
26 #endif
27
28 #if defined WIN32
29 #if defined ENET_DLL
30 #if defined ENET_BUILDING_LIB
31 #define ENET_API __declspec( dllexport )
32 #else
33 #define ENET_API __declspec( dllimport )
34 #endif /* ENET_BUILDING_LIB */
35 #endif /* ENET_DLL */
36 #endif /* WIN32 */
37
38 #ifndef ENET_API
39 #define ENET_API extern
40 #endif
41
42 typedef enum
43 {
44 ENET_SOCKET_TYPE_STREAM = 1,
45 ENET_SOCKET_TYPE_DATAGRAM = 2
46 } ENetSocketType;
47
48 typedef enum
49 {
50 ENET_SOCKET_WAIT_NONE = 0,
51 ENET_SOCKET_WAIT_SEND = (1 << 0),
52 ENET_SOCKET_WAIT_RECEIVE = (1 << 1)
53 } ENetSocketWait;
54
55 enum
56 {
57 ENET_HOST_ANY = 0
58 };
59
60 /**
61 * Portable internet address structure.
62 *
63 * The host must be specified in network byte-order, and the port must be in host
64 * byte-order. The constant ENET_HOST_ANY may be used to specify the default
65 * server host.
66 */
67 typedef struct _ENetAddress
68 {
69 enet_uint32 host; /**< may use ENET_HOST_ANY to specify default server host */
70 enet_uint16 port;
71 } ENetAddress;
72
73 /**
74 * Packet flag bit constants.
75 *
76 * The host must be specified in network byte-order, and the port must be in
77 * host byte-order. The constant ENET_HOST_ANY may be used to specify the
78 * default server host.
79
80 @sa ENetPacket
81 */
82 typedef enum
83 {
84 /** packet must be received by the target peer and resend attempts should be
85 * made until the packet is delivered */
86 ENET_PACKET_FLAG_RELIABLE = (1 << 0)
87 } ENetPacketFlag;
88
89 /**
90 * ENet packet structure.
91 *
92 * An ENet data packet that may be sent to or received from a peer. The shown
93 * fields should only be read and never modified. The data field contains the
94 * allocated data for the packet. The dataLength fields specifies the length
95 * of the allocated data. The flags field is either 0 (specifying no flags),
96 * or a bitwise-or of any combination of the following flags:
97 *
98 * ENET_PACKET_FLAG_RELIABLE - packet must be received by the ta
99
100 @sa ENetPacketFlag
101 */
102 typedef struct _ENetPacket
103 {
104 size_t referenceCount; /**< internal use only */
105 enet_uint32 flags; /**< bitwise or of ENetPacketFlag constants */
106 enet_uint8 * data; /**< allocated data for packet */
107 size_t dataLength; /**< length of data */
108 } ENetPacket;
109
110 typedef struct _ENetAcknowledgement
111 {
112 ENetListNode acknowledgementList;
113 enet_uint32 sentTime;
114 ENetProtocol command;
115 } ENetAcknowledgement;
116
117 typedef struct _ENetOutgoingCommand
118 {
119 ENetListNode outgoingCommandList;
120 enet_uint32 reliableSequenceNumber;
121 enet_uint32 unreliableSequenceNumber;
122 enet_uint32 sentTime;
123 enet_uint32 roundTripTimeout;
124 enet_uint32 roundTripTimeoutLimit;
125 enet_uint32 fragmentOffset;
126 enet_uint16 fragmentLength;
127 ENetProtocol command;
128 ENetPacket * packet;
129 } ENetOutgoingCommand;
130
131 typedef struct _ENetIncomingCommand
132 {
133 ENetListNode incomingCommandList;
134 enet_uint32 reliableSequenceNumber;
135 enet_uint32 unreliableSequenceNumber;
136 ENetProtocol command;
137 enet_uint32 fragmentCount;
138 enet_uint32 fragmentsRemaining;
139 enet_uint32 * fragments;
140 ENetPacket * packet;
141 } ENetIncomingCommand;
142
143 typedef enum
144 {
145 ENET_PEER_STATE_DISCONNECTED = 0,
146 ENET_PEER_STATE_CONNECTING = 1,
147 ENET_PEER_STATE_ACKNOWLEDGING_CONNECT = 2,
148 ENET_PEER_STATE_CONNECTED = 3,
149 ENET_PEER_STATE_DISCONNECTING = 4,
150 ENET_PEER_STATE_ACKNOWLEDGING_DISCONNECT = 5,
151 ENET_PEER_STATE_ZOMBIE = 6
152 } ENetPeerState;
153
154 #ifndef ENET_BUFFER_MAXIMUM
155 #define ENET_BUFFER_MAXIMUM (1 + 2 * ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS)
156 #endif
157
158 enum
159 {
160 ENET_HOST_RECEIVE_BUFFER_SIZE = 256 * 1024,
161 ENET_HOST_BANDWIDTH_THROTTLE_INTERVAL = 1000,
162 ENET_HOST_DEFAULT_MTU = 1400,
163
164 ENET_PEER_DEFAULT_ROUND_TRIP_TIME = 500,
165 ENET_PEER_DEFAULT_PACKET_THROTTLE = 32,
166 ENET_PEER_PACKET_THROTTLE_SCALE = 32,
167 ENET_PEER_PACKET_THROTTLE_COUNTER = 7,
168 ENET_PEER_PACKET_THROTTLE_ACCELERATION = 2,
169 ENET_PEER_PACKET_THROTTLE_DECELERATION = 2,
170 ENET_PEER_PACKET_THROTTLE_INTERVAL = 5000,
171 ENET_PEER_PACKET_LOSS_SCALE = (1 << 16),
172 ENET_PEER_PACKET_LOSS_INTERVAL = 10000,
173 ENET_PEER_WINDOW_SIZE_SCALE = 64 * 1024,
174 ENET_PEER_TIMEOUT_LIMIT = 32,
175 ENET_PEER_PING_INTERVAL = 500
176 };
177
178 typedef struct _ENetChannel
179 {
180 enet_uint32 outgoingReliableSequenceNumber;
181 enet_uint32 outgoingUnreliableSequenceNumber;
182 enet_uint32 incomingReliableSequenceNumber;
183 enet_uint32 incomingUnreliableSequenceNumber;
184 ENetList incomingReliableCommands;
185 ENetList incomingUnreliableCommands;
186 } ENetChannel;
187
188 /**
189 * An ENet peer which data packets may be sent or received from.
190 *
191 * No fields should be modified unless otherwise specified.
192 */
193 typedef struct _ENetPeer
194 {
195 struct _ENetHost * host;
196 enet_uint16 outgoingPeerID;
197 enet_uint16 incomingPeerID;
198 enet_uint32 challenge;
199 ENetAddress address; /**< Internet address of the peer */
200 void * data; /**< Application private data, may be freely modified */
201 ENetPeerState state;
202 ENetChannel * channels;
203 size_t channelCount; /**< Number of channels allocated for communication with peer */
204 enet_uint32 incomingBandwidth; /**< Downstream bandwidth of the client in bytes/second */
205 enet_uint32 outgoingBandwidth; /**< Upstream bandwidth of the client in bytes/second */
206 enet_uint32 incomingBandwidthThrottleEpoch;
207 enet_uint32 outgoingBandwidthThrottleEpoch;
208 enet_uint32 incomingDataTotal;
209 enet_uint32 outgoingDataTotal;
210 enet_uint32 lastSendTime;
211 enet_uint32 lastReceiveTime;
212 enet_uint32 nextTimeout;
213 enet_uint32 packetLossEpoch;
214 enet_uint32 packetsSent;
215 enet_uint32 packetsLost;
216 enet_uint32 packetLoss; /**< mean packet loss of reliable packets as a ratio with respect to the constant ENET_PEER_PACKET_LOSS_SCALE */
217 enet_uint32 packetLossVariance;
218 enet_uint32 packetThrottle;
219 enet_uint32 packetThrottleLimit;
220 enet_uint32 packetThrottleCounter;
221 enet_uint32 packetThrottleEpoch;
222 enet_uint32 packetThrottleAcceleration;
223 enet_uint32 packetThrottleDeceleration;
224 enet_uint32 packetThrottleInterval;
225 enet_uint32 lastRoundTripTime;
226 enet_uint32 lowestRoundTripTime;
227 enet_uint32 lastRoundTripTimeVariance;
228 enet_uint32 highestRoundTripTimeVariance;
229 enet_uint32 roundTripTime; /**< mean round trip time (RTT), in milliseconds, between sending a reliable packet and receiving its acknowledgement */
230 enet_uint32 roundTripTimeVariance;
231 enet_uint16 mtu;
232 enet_uint32 windowSize;
233 enet_uint32 reliableDataInTransit;
234 enet_uint32 outgoingReliableSequenceNumber;
235 ENetList acknowledgements;
236 ENetList sentReliableCommands;
237 ENetList sentUnreliableCommands;
238 ENetList outgoingReliableCommands;
239 ENetList outgoingUnreliableCommands;
240 } ENetPeer;
241
242 /** An ENet host for communicating with peers.
243 *
244 * No fields should be modified.
245
246 @sa enet_host_create()
247 @sa enet_host_destroy()
248 @sa enet_host_connect()
249 @sa enet_host_service()
250 @sa enet_host_flush()
251 @sa enet_host_broadcast()
252 @sa enet_host_bandwidth_limit()
253 @sa enet_host_bandwidth_throttle()
254 */
255 typedef struct _ENetHost
256 {
257 ENetSocket socket;
258 ENetAddress address; /**< Internet address of the host */
259 enet_uint32 incomingBandwidth; /**< downstream bandwidth of the host */
260 enet_uint32 outgoingBandwidth; /**< upstream bandwidth of the host */
261 enet_uint32 bandwidthThrottleEpoch;
262 enet_uint32 mtu;
263 int recalculateBandwidthLimits;
264 ENetPeer * peers; /**< array of peers allocated for this host */
265 size_t peerCount; /**< number of peers allocated for this host */
266 ENetPeer * lastServicedPeer;
267 size_t packetSize;
268 ENetProtocol commands [ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS];
269 size_t commandCount;
270 ENetBuffer buffers [ENET_BUFFER_MAXIMUM];
271 size_t bufferCount;
272 ENetAddress receivedAddress;
273 enet_uint8 receivedData [ENET_PROTOCOL_MAXIMUM_MTU];
274 size_t receivedDataLength;
275 } ENetHost;
276
277 /**
278 * An ENet event type, as specified in @ref ENetEvent.
279 */
280 typedef enum
281 {
282 /** no event occurred within the specified time limit */
283 ENET_EVENT_TYPE_NONE = 0,
284
285 /** a connection request initiated by enet_host_connect has completed.
286 * The peer field contains the peer which successfully connected.
287 */
288 ENET_EVENT_TYPE_CONNECT = 1,
289
290 /** a peer has disconnected. This event is generated on a successful
291 * completion of a disconnect initiated by enet_pper_disconnect, if
292 * a peer has timed out, or if a connection request intialized by
293 * enet_host_connect has timed out. The peer field contains the peer
294 * which disconnected.
295 */
296 ENET_EVENT_TYPE_DISCONNECT = 2,
297
298 /** a packet has been received from a peer. The peer field specifies the
299 * peer which sent the packet. The channelID field specifies the channel
300 * number upon which the packet was received. The packet field contains
301 * the packet that was received; this packet must be destroyed with
302 * enet_packet_destroy after use.
303 */
304 ENET_EVENT_TYPE_RECEIVE = 3
305 } ENetEventType;
306
307 /**
308 * An ENet event as returned by enet_host_service().
309
310 @sa enet_host_service
311 */
312 typedef struct _ENetEvent
313 {
314 ENetEventType type; /**< type of the event */
315 ENetPeer * peer; /**< peer that generated a connect, disconnect or receive event */
316 enet_uint8 channelID;
317 ENetPacket * packet;
318 } ENetEvent;
319
320 /** @defgroup global ENet global functions
321 @{
322 */
323
324 /**
325 Initializes ENet globally. Must be called prior to using any functions in
326 ENet.
327 @returns 0 on success, < 0 on failure
328 */
329 ENET_API int enet_initialize (void);
330
331 /**
332 Shuts down ENet globally. Should be called when a program that has
333 initialized ENet exits.
334 */
335 ENET_API void enet_deinitialize (void);
336
337 /** @} */
338
339 /** @defgroup private ENet private implementation functions */
340
341 /**
342 Returns the wall-time in milliseconds. Its initial value is unspecified
343 unless otherwise set.
344 */
345 ENET_API enet_uint32 enet_time_get (void);
346 /**
347 Sets the current wall-time in milliseconds.
348 */
349 ENET_API void enet_time_set (enet_uint32);
350
351 /** @defgroup socket ENet socket functions
352 @{
353 @ingroup private
354 */
355 extern ENetSocket enet_socket_create (ENetSocketType, const ENetAddress *);
356 extern ENetSocket enet_socket_accept (ENetSocket, ENetAddress *);
357 extern int enet_socket_connect (ENetSocket, const ENetAddress *);
358 extern int enet_socket_send (ENetSocket, const ENetAddress *, const ENetBuffer *, size_t);
359 extern int enet_socket_receive (ENetSocket, ENetAddress *, ENetBuffer *, size_t);
360 extern int enet_socket_wait (ENetSocket, enet_uint32 *, enet_uint32);
361 extern void enet_socket_destroy (ENetSocket);
362
363 /** @} */
364
365 /** @defgroup Address ENet address functions
366 @{
367 */
368 /** Attempts to resolve the host named by the parameter hostName and sets
369 the host field in the address parameter if successful.
370 @param address destination to store resolved address
371 @param hostName host name to lookup
372 @retval 0 on success
373 @retval < 0 on failure
374 @returns the address of the given hostName in address on success
375 */
376 extern int enet_address_set_host (ENetAddress *address, const char *hostName );
377
378 /** Attempts to do a reserve lookup of the host field in the address parameter.
379 @param address address used for reverse lookup
380 @param hostName destination for name, must not be NULL
381 @param nameLength maximum length of hostName.
382 @returns the null-terminated name of the host in hostName on success
383 @retval 0 on success
384 @retval < 0 on failure
385 */
386 extern int enet_address_get_host (const ENetAddress *address, char *hostName, size_t nameLength );
387
388 /** @} */
389
390 ENET_API ENetPacket * enet_packet_create (const void *dataContents, size_t dataLength, enet_uint32 flags);
391 ENET_API void enet_packet_destroy (ENetPacket *packet );
392 ENET_API int enet_packet_resize (ENetPacket *packet, size_t dataLength );
393
394 ENET_API ENetHost * enet_host_create (const ENetAddress *address, size_t peerCount, enet_uint32 incomingBandwidth, enet_uint32 outgoingBandwidth );
395 ENET_API void enet_host_destroy (ENetHost *host );
396 ENET_API ENetPeer * enet_host_connect (ENetHost *host, const ENetAddress *address, size_t channelCount );
397 ENET_API int enet_host_service (ENetHost *, ENetEvent *, enet_uint32);
398 ENET_API void enet_host_flush (ENetHost *);
399 ENET_API void enet_host_broadcast (ENetHost *, enet_uint8, ENetPacket *);
400 ENET_API void enet_host_bandwidth_limit (ENetHost *, enet_uint32, enet_uint32);
401 extern void enet_host_bandwidth_throttle (ENetHost *);
402
403 ENET_API int enet_peer_send (ENetPeer *, enet_uint8, ENetPacket *);
404 ENET_API ENetPacket * enet_peer_receive (ENetPeer *, enet_uint8);
405 ENET_API void enet_peer_ping (ENetPeer *);
406 ENET_API void enet_peer_reset (ENetPeer *);
407 ENET_API void enet_peer_disconnect (ENetPeer *);
408 ENET_API void enet_peer_disconnect_now (ENetPeer *);
409 ENET_API void enet_peer_throttle_configure (ENetPeer *, enet_uint32, enet_uint32, enet_uint32);
410 extern int enet_peer_throttle (ENetPeer *, enet_uint32);
411 extern void enet_peer_reset_queues (ENetPeer *);
412 extern ENetOutgoingCommand * enet_peer_queue_outgoing_command (ENetPeer *, const ENetProtocol *, ENetPacket *, enet_uint32, enet_uint16);
413 extern ENetIncomingCommand * enet_peer_queue_incoming_command (ENetPeer *, const ENetProtocol *, ENetPacket *, enet_uint32);
414 extern ENetAcknowledgement * enet_peer_queue_acknowledgement (ENetPeer *, const ENetProtocol *, enet_uint32);
415
416 #ifdef __cplusplus
417 }
418 #endif
419
420 #endif /* __ENET_ENET_H__ */
421
0 /**
1 @file list.h
2 @brief ENet list management
3 */
4 #ifndef __ENET_LIST_H__
5 #define __ENET_LIST_H__
6
7 #include <stdlib.h>
8
9 typedef struct _ENetListNode
10 {
11 struct _ENetListNode * next;
12 struct _ENetListNode * previous;
13 } ENetListNode;
14
15 typedef ENetListNode * ENetListIterator;
16
17 typedef struct _ENetList
18 {
19 ENetListNode sentinel;
20 } ENetList;
21
22 extern void enet_list_clear (ENetList *);
23
24 extern ENetListIterator enet_list_insert (ENetListIterator, void *);
25 extern void * enet_list_remove (ENetListIterator);
26
27 extern size_t enet_list_size (ENetList *);
28
29 #define enet_list_begin(list) ((list) -> sentinel.next)
30 #define enet_list_end(list) (& (list) -> sentinel)
31
32 #define enet_list_empty(list) (enet_list_begin (list) == enet_list_end (list))
33
34 #define enet_list_next(iterator) ((iterator) -> next)
35 #define enet_list_previous(iterator) ((iterator) -> previous)
36
37 #define enet_list_front(list) ((void *) (list) -> sentinel.next)
38 #define enet_list_back(list) ((void *) (list) -> sentinel.previous)
39
40 #endif /* __ENET_LIST_H__ */
41
0 /**
1 @file memory.h
2 @brief ENet memory management
3 */
4 #ifndef __ENET_MEMORY_H__
5 #define __ENET_MEMORY_H__
6
7 #include <stdlib.h>
8
9 /** @defgroup memory ENet internal memory management
10 @{
11 @ingroup private
12 */
13 extern void * enet_malloc (size_t);
14 extern void * enet_realloc (void *, size_t);
15 extern void * enet_calloc (size_t, size_t);
16 extern void enet_free (void *);
17
18 /** @} */
19
20 #endif /* __ENET_MEMORY_H__ */
21
0 /**
1 @file protocol.h
2 @brief ENet protocol
3 */
4 #ifndef __ENET_PROTOCOL_H__
5 #define __ENET_PROTOCOL_H__
6
7 #include "enet/types.h"
8
9 enum
10 {
11 ENET_PROTOCOL_MINIMUM_MTU = 576,
12 ENET_PROTOCOL_MAXIMUM_MTU = 4096,
13 ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS = 32,
14 ENET_PROTOCOL_MINIMUM_WINDOW_SIZE = 4096,
15 ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE = 32768,
16 ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT = 1,
17 ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT = 255
18 };
19
20 typedef enum
21 {
22 ENET_PROTOCOL_COMMAND_NONE = 0,
23 ENET_PROTOCOL_COMMAND_ACKNOWLEDGE = 1,
24 ENET_PROTOCOL_COMMAND_CONNECT = 2,
25 ENET_PROTOCOL_COMMAND_VERIFY_CONNECT = 3,
26 ENET_PROTOCOL_COMMAND_DISCONNECT = 4,
27 ENET_PROTOCOL_COMMAND_PING = 5,
28 ENET_PROTOCOL_COMMAND_SEND_RELIABLE = 6,
29 ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE = 7,
30 ENET_PROTOCOL_COMMAND_SEND_FRAGMENT = 8,
31 ENET_PROTOCOL_COMMAND_BANDWIDTH_LIMIT = 9,
32 ENET_PROTOCOL_COMMAND_THROTTLE_CONFIGURE = 10,
33 ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED = 11
34 } ENetProtocolCommand;
35
36 typedef enum
37 {
38 ENET_PROTOCOL_FLAG_ACKNOWLEDGE = (1 << 0),
39 ENET_PROTOCOL_FLAG_UNSEQUENCED = (1 << 1)
40 } ENetProtocolFlag;
41
42 typedef struct
43 {
44 enet_uint16 peerID;
45 enet_uint8 flags;
46 enet_uint8 commandCount;
47 enet_uint32 sentTime;
48 enet_uint32 challenge;
49 } ENetProtocolHeader;
50
51 typedef struct
52 {
53 enet_uint8 command;
54 enet_uint8 channelID;
55 enet_uint8 flags;
56 enet_uint8 reserved;
57 enet_uint32 commandLength;
58 enet_uint32 reliableSequenceNumber;
59 } ENetProtocolCommandHeader;
60
61 typedef struct
62 {
63 ENetProtocolCommandHeader header;
64 enet_uint32 receivedReliableSequenceNumber;
65 enet_uint32 receivedSentTime;
66 } ENetProtocolAcknowledge;
67
68 typedef struct
69 {
70 ENetProtocolCommandHeader header;
71 enet_uint16 outgoingPeerID;
72 enet_uint16 mtu;
73 enet_uint32 windowSize;
74 enet_uint32 channelCount;
75 enet_uint32 incomingBandwidth;
76 enet_uint32 outgoingBandwidth;
77 enet_uint32 packetThrottleInterval;
78 enet_uint32 packetThrottleAcceleration;
79 enet_uint32 packetThrottleDeceleration;
80 } ENetProtocolConnect;
81
82 typedef struct
83 {
84 ENetProtocolCommandHeader header;
85 enet_uint16 outgoingPeerID;
86 enet_uint16 mtu;
87 enet_uint32 windowSize;
88 enet_uint32 channelCount;
89 enet_uint32 incomingBandwidth;
90 enet_uint32 outgoingBandwidth;
91 enet_uint32 packetThrottleInterval;
92 enet_uint32 packetThrottleAcceleration;
93 enet_uint32 packetThrottleDeceleration;
94 } ENetProtocolVerifyConnect;
95
96 typedef struct
97 {
98 ENetProtocolCommandHeader header;
99 enet_uint32 incomingBandwidth;
100 enet_uint32 outgoingBandwidth;
101 } ENetProtocolBandwidthLimit;
102
103 typedef struct
104 {
105 ENetProtocolCommandHeader header;
106 enet_uint32 packetThrottleInterval;
107 enet_uint32 packetThrottleAcceleration;
108 enet_uint32 packetThrottleDeceleration;
109 } ENetProtocolThrottleConfigure;
110
111 typedef struct
112 {
113 ENetProtocolCommandHeader header;
114 enet_uint32 data;
115 } ENetProtocolDisconnect;
116
117 typedef struct
118 {
119 ENetProtocolCommandHeader header;
120 } ENetProtocolPing;
121
122 typedef struct
123 {
124 ENetProtocolCommandHeader header;
125 } ENetProtocolSendReliable;
126
127 typedef struct
128 {
129 ENetProtocolCommandHeader header;
130 enet_uint32 unreliableSequenceNumber;
131 } ENetProtocolSendUnreliable;
132
133 typedef struct
134 {
135 ENetProtocolCommandHeader header;
136 enet_uint32 unsequencedGroup;
137 } ENetProtocolSendUnsequenced;
138
139 typedef struct
140 {
141 ENetProtocolCommandHeader header;
142 enet_uint32 startSequenceNumber;
143 enet_uint32 fragmentCount;
144 enet_uint32 fragmentNumber;
145 enet_uint32 totalLength;
146 enet_uint32 fragmentOffset;
147 } ENetProtocolSendFragment;
148
149 typedef union
150 {
151 ENetProtocolCommandHeader header;
152 ENetProtocolAcknowledge acknowledge;
153 ENetProtocolConnect connect;
154 ENetProtocolVerifyConnect verifyConnect;
155 ENetProtocolDisconnect disconnect;
156 ENetProtocolPing ping;
157 ENetProtocolSendReliable sendReliable;
158 ENetProtocolSendUnreliable sendUnreliable;
159 ENetProtocolSendUnsequenced sendUnsequenced;
160 ENetProtocolSendFragment sendFragment;
161 ENetProtocolBandwidthLimit bandwidthLimit;
162 ENetProtocolThrottleConfigure throttleConfigure;
163 } ENetProtocol;
164
165 #endif /* __ENET_PROTOCOL_H__ */
166
0 /**
1 @file protocol.h
2 @brief ENet protocol
3 */
4 #ifndef __ENET_PROTOCOL_H__
5 #define __ENET_PROTOCOL_H__
6
7 #include "enet/types.h"
8
9 enum
10 {
11 ENET_PROTOCOL_MINIMUM_MTU = 576,
12 ENET_PROTOCOL_MAXIMUM_MTU = 4096,
13 ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS = 32,
14 ENET_PROTOCOL_MINIMUM_WINDOW_SIZE = 4096,
15 ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE = 32768,
16 ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT = 1,
17 ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT = 255
18 };
19
20 typedef enum
21 {
22 ENET_PROTOCOL_COMMAND_NONE = 0,
23 ENET_PROTOCOL_COMMAND_ACKNOWLEDGE = 1,
24 ENET_PROTOCOL_COMMAND_CONNECT = 2,
25 ENET_PROTOCOL_COMMAND_VERIFY_CONNECT = 3,
26 ENET_PROTOCOL_COMMAND_DISCONNECT = 4,
27 ENET_PROTOCOL_COMMAND_PING = 5,
28 ENET_PROTOCOL_COMMAND_SEND_RELIABLE = 6,
29 ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE = 7,
30 ENET_PROTOCOL_COMMAND_SEND_FRAGMENT = 8,
31 ENET_PROTOCOL_COMMAND_BANDWIDTH_LIMIT = 9,
32 ENET_PROTOCOL_COMMAND_THROTTLE_CONFIGURE = 10
33 } ENetProtocolCommand;
34
35 typedef enum
36 {
37 ENET_PROTOCOL_FLAG_ACKNOWLEDGE = (1 << 0)
38 } ENetProtocolFlag;
39
40 typedef struct
41 {
42 enet_uint16 peerID;
43 enet_uint8 flags;
44 enet_uint8 commandCount;
45 enet_uint32 sentTime;
46 enet_uint32 challenge;
47 } ENetProtocolHeader;
48
49 typedef struct
50 {
51 enet_uint8 command;
52 enet_uint8 channelID;
53 enet_uint8 flags;
54 enet_uint8 reserved;
55 enet_uint32 commandLength;
56 enet_uint32 reliableSequenceNumber;
57 } ENetProtocolCommandHeader;
58
59 typedef struct
60 {
61 ENetProtocolCommandHeader header;
62 enet_uint32 receivedReliableSequenceNumber;
63 enet_uint32 receivedSentTime;
64 } ENetProtocolAcknowledge;
65
66 typedef struct
67 {
68 ENetProtocolCommandHeader header;
69 enet_uint16 outgoingPeerID;
70 enet_uint16 mtu;
71 enet_uint32 windowSize;
72 enet_uint32 channelCount;
73 enet_uint32 incomingBandwidth;
74 enet_uint32 outgoingBandwidth;
75 enet_uint32 packetThrottleInterval;
76 enet_uint32 packetThrottleAcceleration;
77 enet_uint32 packetThrottleDeceleration;
78 } ENetProtocolConnect;
79
80 typedef struct
81 {
82 ENetProtocolCommandHeader header;
83 enet_uint16 outgoingPeerID;
84 enet_uint16 mtu;
85 enet_uint32 windowSize;
86 enet_uint32 channelCount;
87 enet_uint32 incomingBandwidth;
88 enet_uint32 outgoingBandwidth;
89 enet_uint32 packetThrottleInterval;
90 enet_uint32 packetThrottleAcceleration;
91 enet_uint32 packetThrottleDeceleration;
92 } ENetProtocolVerifyConnect;
93
94 typedef struct
95 {
96 ENetProtocolCommandHeader header;
97 enet_uint32 incomingBandwidth;
98 enet_uint32 outgoingBandwidth;
99 } ENetProtocolBandwidthLimit;
100
101 typedef struct
102 {
103 ENetProtocolCommandHeader header;
104 enet_uint32 packetThrottleInterval;
105 enet_uint32 packetThrottleAcceleration;
106 enet_uint32 packetThrottleDeceleration;
107 } ENetProtocolThrottleConfigure;
108
109 typedef struct
110 {
111 ENetProtocolCommandHeader header;
112 } ENetProtocolDisconnect;
113
114 typedef struct
115 {
116 ENetProtocolCommandHeader header;
117 } ENetProtocolPing;
118
119 typedef struct
120 {
121 ENetProtocolCommandHeader header;
122 } ENetProtocolSendReliable;
123
124 typedef struct
125 {
126 ENetProtocolCommandHeader header;
127 enet_uint32 unreliableSequenceNumber;
128 } ENetProtocolSendUnreliable;
129
130 typedef struct
131 {
132 ENetProtocolCommandHeader header;
133 enet_uint32 startSequenceNumber;
134 enet_uint32 fragmentCount;
135 enet_uint32 fragmentNumber;
136 enet_uint32 totalLength;
137 enet_uint32 fragmentOffset;
138 } ENetProtocolSendFragment;
139
140 typedef union
141 {
142 ENetProtocolCommandHeader header;
143 ENetProtocolAcknowledge acknowledge;
144 ENetProtocolConnect connect;
145 ENetProtocolVerifyConnect verifyConnect;
146 ENetProtocolDisconnect disconnect;
147 ENetProtocolPing ping;
148 ENetProtocolSendReliable sendReliable;
149 ENetProtocolSendUnreliable sendUnreliable;
150 ENetProtocolSendFragment sendFragment;
151 ENetProtocolBandwidthLimit bandwidthLimit;
152 ENetProtocolThrottleConfigure throttleConfigure;
153 } ENetProtocol;
154
155 #endif /* __ENET_PROTOCOL_H__ */
156
0 /**
1 @file time.h
2 @brief ENet time constants and macros
3 */
4 #ifndef __ENET_TIME_H__
5 #define __ENET_TIME_H__
6
7 #define ENET_TIME_OVERFLOW 86400000
8
9 #define ENET_TIME_LESS(a, b) ((a) - (b) >= ENET_TIME_OVERFLOW)
10 #define ENET_TIME_GREATER(a, b) ((b) - (a) >= ENET_TIME_OVERFLOW)
11 #define ENET_TIME_LESS_EQUAL(a, b) (! ENET_TIME_GREATER (a, b))
12 #define ENET_TIME_GREATER_EQUAL(a, b) (! ENET_TIME_LESS (a, b))
13
14 #define ENET_TIME_DIFFERENCE(a, b) ((a) - (b) >= ENET_TIME_OVERFLOW ? (b) - (a) : (a) - (b))
15
16 #endif /* __ENET_TIME_H__ */
17
0 /**
1 @file types.h
2 @brief type definitions for ENet
3 */
4 #ifndef __ENET_TYPES_H__
5 #define __ENET_TYPES_H__
6
7 typedef unsigned char enet_uint8; /**< unsigned 8-bit type */
8 typedef unsigned short enet_uint16; /**< unsigned 16-bit type */
9 typedef unsigned int enet_uint32; /**< unsigned 32-bit type */
10
11 #endif /* __ENET_TYPES_H__ */
12
0 /**
1 @file unix.h
2 @brief ENet Unix header
3 */
4 #ifndef __ENET_UNIX_H__
5 #define __ENET_UNIX_H__
6
7 #include <stdlib.h>
8 #include <sys/types.h>
9 #include <netinet/in.h>
10
11 typedef int ENetSocket;
12
13 enum
14 {
15 ENET_SOCKET_NULL = -1
16 };
17
18 #define ENET_HOST_TO_NET_16(value) (htons (value)) /**< macro that converts host to net byte-order of a 16-bit value */
19 #define ENET_HOST_TO_NET_32(value) (htonl (value)) /**< macro that converts host to net byte-order of a 32-bit value */
20
21 #define ENET_NET_TO_HOST_16(value) (ntohs (value)) /**< macro that converts net to host byte-order of a 16-bit value */
22 #define ENET_NET_TO_HOST_32(value) (ntohl (value)) /**< macro that converts net to host byte-order of a 32-bit value */
23
24 typedef struct
25 {
26 void * data;
27 size_t dataLength;
28 } ENetBuffer;
29
30 #define ENET_CALLBACK
31
32 #define ENET_API extern
33
34 #endif /* __ENET_UNIX_H__ */
35
0 /**
1 @file utility.h
2 @brief ENet utility header
3 */
4 #ifndef __ENET_UTILITY_H__
5 #define __ENET_UTILITY_H__
6
7 #define ENET_MAX(x, y) ((x) > (y) ? (x) : (y))
8 #define ENET_MIN(x, y) ((x) < (y) ? (x) : (y))
9
10 #endif /* __ENET_UTILITY_H__ */
11
0 /**
1 @file win32.h
2 @brief ENet Win32 header
3 */
4 #ifndef __ENET_WIN32_H__
5 #define __ENET_WIN32_H__
6
7 #ifdef ENET_BUILDING_LIB
8 #pragma warning (disable: 4996) // 'strncpy' was declared deprecated
9 #pragma warning (disable: 4267) // size_t to int conversion
10 #pragma warning (disable: 4244) // 64bit to 32bit int
11 #pragma warning (disable: 4018) // signed/unsigned mismatch
12 #endif
13
14 #include <stdlib.h>
15 #include <winsock2.h>
16
17 typedef SOCKET ENetSocket;
18
19 enum
20 {
21 ENET_SOCKET_NULL = INVALID_SOCKET
22 };
23
24 #define ENET_HOST_TO_NET_16(value) (htons (value))
25 #define ENET_HOST_TO_NET_32(value) (htonl (value))
26
27 #define ENET_NET_TO_HOST_16(value) (ntohs (value))
28 #define ENET_NET_TO_HOST_32(value) (ntohl (value))
29
30 typedef struct
31 {
32 size_t dataLength;
33 void * data;
34 } ENetBuffer;
35
36 #define ENET_CALLBACK __cdecl
37
38 #if defined ENET_DLL
39 #if defined ENET_BUILDING_LIB
40 #define ENET_API __declspec( dllexport )
41 #else
42 #define ENET_API __declspec( dllimport )
43 #endif /* ENET_BUILDING_LIB */
44 #else /* !ENET_DLL */
45 #define ENET_API extern
46 #endif /* ENET_DLL */
47
48 #endif /* __ENET_WIN32_H__ */
49
50
0 callbacks.o callbacks.o: callbacks.c include/enet/enet.h \
1 /usr/include/stdlib.h /usr/include/features.h /usr/include/sys/cdefs.h \
2 /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \
3 /usr/include/gnu/stubs-32.h \
4 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/stddef.h \
5 /usr/include/sys/types.h /usr/include/bits/types.h \
6 /usr/include/bits/typesizes.h /usr/include/time.h /usr/include/endian.h \
7 /usr/include/bits/endian.h /usr/include/sys/select.h \
8 /usr/include/bits/select.h /usr/include/bits/sigset.h \
9 /usr/include/bits/time.h /usr/include/sys/sysmacros.h \
10 /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \
11 include/enet/unix.h /usr/include/netinet/in.h /usr/include/stdint.h \
12 /usr/include/bits/wchar.h /usr/include/sys/socket.h \
13 /usr/include/sys/uio.h /usr/include/bits/uio.h \
14 /usr/include/bits/socket.h \
15 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/limits.h \
16 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/syslimits.h \
17 /usr/include/limits.h /usr/include/bits/posix1_lim.h \
18 /usr/include/bits/local_lim.h /usr/include/linux/limits.h \
19 /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \
20 /usr/include/asm/socket.h /usr/include/asm-i386/socket.h \
21 /usr/include/asm/sockios.h /usr/include/asm-i386/sockios.h \
22 /usr/include/bits/in.h /usr/include/bits/byteswap.h \
23 include/enet/types.h include/enet/protocol.h include/enet/list.h \
24 include/enet/callbacks.h
25
26 include/enet/enet.h:
27
28 /usr/include/stdlib.h:
29
30 /usr/include/features.h:
31
32 /usr/include/sys/cdefs.h:
33
34 /usr/include/bits/wordsize.h:
35
36 /usr/include/gnu/stubs.h:
37
38 /usr/include/gnu/stubs-32.h:
39
40 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/stddef.h:
41
42 /usr/include/sys/types.h:
43
44 /usr/include/bits/types.h:
45
46 /usr/include/bits/typesizes.h:
47
48 /usr/include/time.h:
49
50 /usr/include/endian.h:
51
52 /usr/include/bits/endian.h:
53
54 /usr/include/sys/select.h:
55
56 /usr/include/bits/select.h:
57
58 /usr/include/bits/sigset.h:
59
60 /usr/include/bits/time.h:
61
62 /usr/include/sys/sysmacros.h:
63
64 /usr/include/bits/pthreadtypes.h:
65
66 /usr/include/alloca.h:
67
68 include/enet/unix.h:
69
70 /usr/include/netinet/in.h:
71
72 /usr/include/stdint.h:
73
74 /usr/include/bits/wchar.h:
75
76 /usr/include/sys/socket.h:
77
78 /usr/include/sys/uio.h:
79
80 /usr/include/bits/uio.h:
81
82 /usr/include/bits/socket.h:
83
84 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/limits.h:
85
86 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/syslimits.h:
87
88 /usr/include/limits.h:
89
90 /usr/include/bits/posix1_lim.h:
91
92 /usr/include/bits/local_lim.h:
93
94 /usr/include/linux/limits.h:
95
96 /usr/include/bits/posix2_lim.h:
97
98 /usr/include/bits/sockaddr.h:
99
100 /usr/include/asm/socket.h:
101
102 /usr/include/asm-i386/socket.h:
103
104 /usr/include/asm/sockios.h:
105
106 /usr/include/asm-i386/sockios.h:
107
108 /usr/include/bits/in.h:
109
110 /usr/include/bits/byteswap.h:
111
112 include/enet/types.h:
113
114 include/enet/protocol.h:
115
116 include/enet/list.h:
117
118 include/enet/callbacks.h:
0 host.o host.o: host.c /usr/include/string.h /usr/include/features.h \
1 /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \
2 /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \
3 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/stddef.h \
4 /usr/include/bits/string.h /usr/include/bits/string2.h \
5 /usr/include/endian.h /usr/include/bits/endian.h \
6 /usr/include/bits/types.h /usr/include/bits/typesizes.h \
7 /usr/include/stdlib.h include/enet/enet.h /usr/include/sys/types.h \
8 /usr/include/time.h /usr/include/sys/select.h \
9 /usr/include/bits/select.h /usr/include/bits/sigset.h \
10 /usr/include/bits/time.h /usr/include/sys/sysmacros.h \
11 /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \
12 include/enet/unix.h /usr/include/netinet/in.h /usr/include/stdint.h \
13 /usr/include/bits/wchar.h /usr/include/sys/socket.h \
14 /usr/include/sys/uio.h /usr/include/bits/uio.h \
15 /usr/include/bits/socket.h \
16 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/limits.h \
17 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/syslimits.h \
18 /usr/include/limits.h /usr/include/bits/posix1_lim.h \
19 /usr/include/bits/local_lim.h /usr/include/linux/limits.h \
20 /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \
21 /usr/include/asm/socket.h /usr/include/asm-i386/socket.h \
22 /usr/include/asm/sockios.h /usr/include/asm-i386/sockios.h \
23 /usr/include/bits/in.h /usr/include/bits/byteswap.h \
24 include/enet/types.h include/enet/protocol.h include/enet/list.h \
25 include/enet/callbacks.h
26
27 /usr/include/string.h:
28
29 /usr/include/features.h:
30
31 /usr/include/sys/cdefs.h:
32
33 /usr/include/bits/wordsize.h:
34
35 /usr/include/gnu/stubs.h:
36
37 /usr/include/gnu/stubs-32.h:
38
39 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/stddef.h:
40
41 /usr/include/bits/string.h:
42
43 /usr/include/bits/string2.h:
44
45 /usr/include/endian.h:
46
47 /usr/include/bits/endian.h:
48
49 /usr/include/bits/types.h:
50
51 /usr/include/bits/typesizes.h:
52
53 /usr/include/stdlib.h:
54
55 include/enet/enet.h:
56
57 /usr/include/sys/types.h:
58
59 /usr/include/time.h:
60
61 /usr/include/sys/select.h:
62
63 /usr/include/bits/select.h:
64
65 /usr/include/bits/sigset.h:
66
67 /usr/include/bits/time.h:
68
69 /usr/include/sys/sysmacros.h:
70
71 /usr/include/bits/pthreadtypes.h:
72
73 /usr/include/alloca.h:
74
75 include/enet/unix.h:
76
77 /usr/include/netinet/in.h:
78
79 /usr/include/stdint.h:
80
81 /usr/include/bits/wchar.h:
82
83 /usr/include/sys/socket.h:
84
85 /usr/include/sys/uio.h:
86
87 /usr/include/bits/uio.h:
88
89 /usr/include/bits/socket.h:
90
91 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/limits.h:
92
93 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/syslimits.h:
94
95 /usr/include/limits.h:
96
97 /usr/include/bits/posix1_lim.h:
98
99 /usr/include/bits/local_lim.h:
100
101 /usr/include/linux/limits.h:
102
103 /usr/include/bits/posix2_lim.h:
104
105 /usr/include/bits/sockaddr.h:
106
107 /usr/include/asm/socket.h:
108
109 /usr/include/asm-i386/socket.h:
110
111 /usr/include/asm/sockios.h:
112
113 /usr/include/asm-i386/sockios.h:
114
115 /usr/include/bits/in.h:
116
117 /usr/include/bits/byteswap.h:
118
119 include/enet/types.h:
120
121 include/enet/protocol.h:
122
123 include/enet/list.h:
124
125 include/enet/callbacks.h:
0 list.o list.o: list.c include/enet/list.h /usr/include/stdlib.h \
1 /usr/include/features.h /usr/include/sys/cdefs.h \
2 /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \
3 /usr/include/gnu/stubs-32.h \
4 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/stddef.h \
5 /usr/include/sys/types.h /usr/include/bits/types.h \
6 /usr/include/bits/typesizes.h /usr/include/time.h /usr/include/endian.h \
7 /usr/include/bits/endian.h /usr/include/sys/select.h \
8 /usr/include/bits/select.h /usr/include/bits/sigset.h \
9 /usr/include/bits/time.h /usr/include/sys/sysmacros.h \
10 /usr/include/bits/pthreadtypes.h /usr/include/alloca.h
11
12 include/enet/list.h:
13
14 /usr/include/stdlib.h:
15
16 /usr/include/features.h:
17
18 /usr/include/sys/cdefs.h:
19
20 /usr/include/bits/wordsize.h:
21
22 /usr/include/gnu/stubs.h:
23
24 /usr/include/gnu/stubs-32.h:
25
26 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/stddef.h:
27
28 /usr/include/sys/types.h:
29
30 /usr/include/bits/types.h:
31
32 /usr/include/bits/typesizes.h:
33
34 /usr/include/time.h:
35
36 /usr/include/endian.h:
37
38 /usr/include/bits/endian.h:
39
40 /usr/include/sys/select.h:
41
42 /usr/include/bits/select.h:
43
44 /usr/include/bits/sigset.h:
45
46 /usr/include/bits/time.h:
47
48 /usr/include/sys/sysmacros.h:
49
50 /usr/include/bits/pthreadtypes.h:
51
52 /usr/include/alloca.h:
0 packet.o packet.o: packet.c /usr/include/string.h /usr/include/features.h \
1 /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \
2 /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \
3 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/stddef.h \
4 /usr/include/bits/string.h /usr/include/bits/string2.h \
5 /usr/include/endian.h /usr/include/bits/endian.h \
6 /usr/include/bits/types.h /usr/include/bits/typesizes.h \
7 /usr/include/stdlib.h include/enet/enet.h /usr/include/sys/types.h \
8 /usr/include/time.h /usr/include/sys/select.h \
9 /usr/include/bits/select.h /usr/include/bits/sigset.h \
10 /usr/include/bits/time.h /usr/include/sys/sysmacros.h \
11 /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \
12 include/enet/unix.h /usr/include/netinet/in.h /usr/include/stdint.h \
13 /usr/include/bits/wchar.h /usr/include/sys/socket.h \
14 /usr/include/sys/uio.h /usr/include/bits/uio.h \
15 /usr/include/bits/socket.h \
16 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/limits.h \
17 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/syslimits.h \
18 /usr/include/limits.h /usr/include/bits/posix1_lim.h \
19 /usr/include/bits/local_lim.h /usr/include/linux/limits.h \
20 /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \
21 /usr/include/asm/socket.h /usr/include/asm-i386/socket.h \
22 /usr/include/asm/sockios.h /usr/include/asm-i386/sockios.h \
23 /usr/include/bits/in.h /usr/include/bits/byteswap.h \
24 include/enet/types.h include/enet/protocol.h include/enet/list.h \
25 include/enet/callbacks.h
26
27 /usr/include/string.h:
28
29 /usr/include/features.h:
30
31 /usr/include/sys/cdefs.h:
32
33 /usr/include/bits/wordsize.h:
34
35 /usr/include/gnu/stubs.h:
36
37 /usr/include/gnu/stubs-32.h:
38
39 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/stddef.h:
40
41 /usr/include/bits/string.h:
42
43 /usr/include/bits/string2.h:
44
45 /usr/include/endian.h:
46
47 /usr/include/bits/endian.h:
48
49 /usr/include/bits/types.h:
50
51 /usr/include/bits/typesizes.h:
52
53 /usr/include/stdlib.h:
54
55 include/enet/enet.h:
56
57 /usr/include/sys/types.h:
58
59 /usr/include/time.h:
60
61 /usr/include/sys/select.h:
62
63 /usr/include/bits/select.h:
64
65 /usr/include/bits/sigset.h:
66
67 /usr/include/bits/time.h:
68
69 /usr/include/sys/sysmacros.h:
70
71 /usr/include/bits/pthreadtypes.h:
72
73 /usr/include/alloca.h:
74
75 include/enet/unix.h:
76
77 /usr/include/netinet/in.h:
78
79 /usr/include/stdint.h:
80
81 /usr/include/bits/wchar.h:
82
83 /usr/include/sys/socket.h:
84
85 /usr/include/sys/uio.h:
86
87 /usr/include/bits/uio.h:
88
89 /usr/include/bits/socket.h:
90
91 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/limits.h:
92
93 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/syslimits.h:
94
95 /usr/include/limits.h:
96
97 /usr/include/bits/posix1_lim.h:
98
99 /usr/include/bits/local_lim.h:
100
101 /usr/include/linux/limits.h:
102
103 /usr/include/bits/posix2_lim.h:
104
105 /usr/include/bits/sockaddr.h:
106
107 /usr/include/asm/socket.h:
108
109 /usr/include/asm-i386/socket.h:
110
111 /usr/include/asm/sockios.h:
112
113 /usr/include/asm-i386/sockios.h:
114
115 /usr/include/bits/in.h:
116
117 /usr/include/bits/byteswap.h:
118
119 include/enet/types.h:
120
121 include/enet/protocol.h:
122
123 include/enet/list.h:
124
125 include/enet/callbacks.h:
0 peer.o peer.o: peer.c /usr/include/string.h /usr/include/features.h \
1 /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \
2 /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \
3 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/stddef.h \
4 /usr/include/bits/string.h /usr/include/bits/string2.h \
5 /usr/include/endian.h /usr/include/bits/endian.h \
6 /usr/include/bits/types.h /usr/include/bits/typesizes.h \
7 /usr/include/stdlib.h include/enet/enet.h /usr/include/sys/types.h \
8 /usr/include/time.h /usr/include/sys/select.h \
9 /usr/include/bits/select.h /usr/include/bits/sigset.h \
10 /usr/include/bits/time.h /usr/include/sys/sysmacros.h \
11 /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \
12 include/enet/unix.h /usr/include/netinet/in.h /usr/include/stdint.h \
13 /usr/include/bits/wchar.h /usr/include/sys/socket.h \
14 /usr/include/sys/uio.h /usr/include/bits/uio.h \
15 /usr/include/bits/socket.h \
16 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/limits.h \
17 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/syslimits.h \
18 /usr/include/limits.h /usr/include/bits/posix1_lim.h \
19 /usr/include/bits/local_lim.h /usr/include/linux/limits.h \
20 /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \
21 /usr/include/asm/socket.h /usr/include/asm-i386/socket.h \
22 /usr/include/asm/sockios.h /usr/include/asm-i386/sockios.h \
23 /usr/include/bits/in.h /usr/include/bits/byteswap.h \
24 include/enet/types.h include/enet/protocol.h include/enet/list.h \
25 include/enet/callbacks.h
26
27 /usr/include/string.h:
28
29 /usr/include/features.h:
30
31 /usr/include/sys/cdefs.h:
32
33 /usr/include/bits/wordsize.h:
34
35 /usr/include/gnu/stubs.h:
36
37 /usr/include/gnu/stubs-32.h:
38
39 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/stddef.h:
40
41 /usr/include/bits/string.h:
42
43 /usr/include/bits/string2.h:
44
45 /usr/include/endian.h:
46
47 /usr/include/bits/endian.h:
48
49 /usr/include/bits/types.h:
50
51 /usr/include/bits/typesizes.h:
52
53 /usr/include/stdlib.h:
54
55 include/enet/enet.h:
56
57 /usr/include/sys/types.h:
58
59 /usr/include/time.h:
60
61 /usr/include/sys/select.h:
62
63 /usr/include/bits/select.h:
64
65 /usr/include/bits/sigset.h:
66
67 /usr/include/bits/time.h:
68
69 /usr/include/sys/sysmacros.h:
70
71 /usr/include/bits/pthreadtypes.h:
72
73 /usr/include/alloca.h:
74
75 include/enet/unix.h:
76
77 /usr/include/netinet/in.h:
78
79 /usr/include/stdint.h:
80
81 /usr/include/bits/wchar.h:
82
83 /usr/include/sys/socket.h:
84
85 /usr/include/sys/uio.h:
86
87 /usr/include/bits/uio.h:
88
89 /usr/include/bits/socket.h:
90
91 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/limits.h:
92
93 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/syslimits.h:
94
95 /usr/include/limits.h:
96
97 /usr/include/bits/posix1_lim.h:
98
99 /usr/include/bits/local_lim.h:
100
101 /usr/include/linux/limits.h:
102
103 /usr/include/bits/posix2_lim.h:
104
105 /usr/include/bits/sockaddr.h:
106
107 /usr/include/asm/socket.h:
108
109 /usr/include/asm-i386/socket.h:
110
111 /usr/include/asm/sockios.h:
112
113 /usr/include/asm-i386/sockios.h:
114
115 /usr/include/bits/in.h:
116
117 /usr/include/bits/byteswap.h:
118
119 include/enet/types.h:
120
121 include/enet/protocol.h:
122
123 include/enet/list.h:
124
125 include/enet/callbacks.h:
0 protocol.o protocol.o: protocol.c /usr/include/stdio.h \
1 /usr/include/features.h /usr/include/sys/cdefs.h \
2 /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \
3 /usr/include/gnu/stubs-32.h \
4 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/stddef.h \
5 /usr/include/bits/types.h /usr/include/bits/typesizes.h \
6 /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \
7 /usr/include/bits/wchar.h /usr/include/gconv.h \
8 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/stdarg.h \
9 /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
10 /usr/include/bits/stdio.h /usr/include/string.h \
11 /usr/include/bits/string.h /usr/include/bits/string2.h \
12 /usr/include/endian.h /usr/include/bits/endian.h /usr/include/stdlib.h \
13 include/enet/utility.h include/enet/time.h include/enet/enet.h \
14 /usr/include/sys/types.h /usr/include/time.h /usr/include/sys/select.h \
15 /usr/include/bits/select.h /usr/include/bits/sigset.h \
16 /usr/include/bits/time.h /usr/include/sys/sysmacros.h \
17 /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \
18 include/enet/unix.h /usr/include/netinet/in.h /usr/include/stdint.h \
19 /usr/include/sys/socket.h /usr/include/sys/uio.h \
20 /usr/include/bits/uio.h /usr/include/bits/socket.h \
21 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/limits.h \
22 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/syslimits.h \
23 /usr/include/limits.h /usr/include/bits/posix1_lim.h \
24 /usr/include/bits/local_lim.h /usr/include/linux/limits.h \
25 /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \
26 /usr/include/asm/socket.h /usr/include/asm-i386/socket.h \
27 /usr/include/asm/sockios.h /usr/include/asm-i386/sockios.h \
28 /usr/include/bits/in.h /usr/include/bits/byteswap.h \
29 include/enet/types.h include/enet/protocol.h include/enet/list.h \
30 include/enet/callbacks.h
31
32 /usr/include/stdio.h:
33
34 /usr/include/features.h:
35
36 /usr/include/sys/cdefs.h:
37
38 /usr/include/bits/wordsize.h:
39
40 /usr/include/gnu/stubs.h:
41
42 /usr/include/gnu/stubs-32.h:
43
44 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/stddef.h:
45
46 /usr/include/bits/types.h:
47
48 /usr/include/bits/typesizes.h:
49
50 /usr/include/libio.h:
51
52 /usr/include/_G_config.h:
53
54 /usr/include/wchar.h:
55
56 /usr/include/bits/wchar.h:
57
58 /usr/include/gconv.h:
59
60 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/stdarg.h:
61
62 /usr/include/bits/stdio_lim.h:
63
64 /usr/include/bits/sys_errlist.h:
65
66 /usr/include/bits/stdio.h:
67
68 /usr/include/string.h:
69
70 /usr/include/bits/string.h:
71
72 /usr/include/bits/string2.h:
73
74 /usr/include/endian.h:
75
76 /usr/include/bits/endian.h:
77
78 /usr/include/stdlib.h:
79
80 include/enet/utility.h:
81
82 include/enet/time.h:
83
84 include/enet/enet.h:
85
86 /usr/include/sys/types.h:
87
88 /usr/include/time.h:
89
90 /usr/include/sys/select.h:
91
92 /usr/include/bits/select.h:
93
94 /usr/include/bits/sigset.h:
95
96 /usr/include/bits/time.h:
97
98 /usr/include/sys/sysmacros.h:
99
100 /usr/include/bits/pthreadtypes.h:
101
102 /usr/include/alloca.h:
103
104 include/enet/unix.h:
105
106 /usr/include/netinet/in.h:
107
108 /usr/include/stdint.h:
109
110 /usr/include/sys/socket.h:
111
112 /usr/include/sys/uio.h:
113
114 /usr/include/bits/uio.h:
115
116 /usr/include/bits/socket.h:
117
118 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/limits.h:
119
120 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/syslimits.h:
121
122 /usr/include/limits.h:
123
124 /usr/include/bits/posix1_lim.h:
125
126 /usr/include/bits/local_lim.h:
127
128 /usr/include/linux/limits.h:
129
130 /usr/include/bits/posix2_lim.h:
131
132 /usr/include/bits/sockaddr.h:
133
134 /usr/include/asm/socket.h:
135
136 /usr/include/asm-i386/socket.h:
137
138 /usr/include/asm/sockios.h:
139
140 /usr/include/asm-i386/sockios.h:
141
142 /usr/include/bits/in.h:
143
144 /usr/include/bits/byteswap.h:
145
146 include/enet/types.h:
147
148 include/enet/protocol.h:
149
150 include/enet/list.h:
151
152 include/enet/callbacks.h:
0 unix.o unix.o: unix.c /usr/include/sys/types.h /usr/include/features.h \
1 /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \
2 /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \
3 /usr/include/bits/types.h \
4 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/stddef.h \
5 /usr/include/bits/typesizes.h /usr/include/time.h /usr/include/endian.h \
6 /usr/include/bits/endian.h /usr/include/sys/select.h \
7 /usr/include/bits/select.h /usr/include/bits/sigset.h \
8 /usr/include/bits/time.h /usr/include/sys/sysmacros.h \
9 /usr/include/bits/pthreadtypes.h /usr/include/sys/socket.h \
10 /usr/include/sys/uio.h /usr/include/bits/uio.h \
11 /usr/include/bits/socket.h \
12 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/limits.h \
13 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/syslimits.h \
14 /usr/include/limits.h /usr/include/bits/posix1_lim.h \
15 /usr/include/bits/local_lim.h /usr/include/linux/limits.h \
16 /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \
17 /usr/include/asm/socket.h /usr/include/asm-i386/socket.h \
18 /usr/include/asm/sockios.h /usr/include/asm-i386/sockios.h \
19 /usr/include/sys/ioctl.h /usr/include/bits/ioctls.h \
20 /usr/include/asm/ioctls.h /usr/include/asm-i386/ioctls.h \
21 /usr/include/asm/ioctl.h /usr/include/asm-i386/ioctl.h \
22 /usr/include/asm-generic/ioctl.h /usr/include/bits/ioctl-types.h \
23 /usr/include/sys/ttydefaults.h /usr/include/sys/time.h \
24 /usr/include/arpa/inet.h /usr/include/netinet/in.h \
25 /usr/include/stdint.h /usr/include/bits/wchar.h /usr/include/bits/in.h \
26 /usr/include/bits/byteswap.h /usr/include/netdb.h \
27 /usr/include/rpc/netdb.h /usr/include/bits/netdb.h \
28 /usr/include/unistd.h /usr/include/bits/posix_opt.h \
29 /usr/include/bits/confname.h /usr/include/getopt.h \
30 /usr/include/string.h /usr/include/bits/string.h \
31 /usr/include/bits/string2.h /usr/include/stdlib.h /usr/include/errno.h \
32 /usr/include/bits/errno.h /usr/include/linux/errno.h \
33 /usr/include/asm/errno.h /usr/include/asm-i386/errno.h \
34 /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \
35 include/enet/enet.h /usr/include/alloca.h include/enet/unix.h \
36 include/enet/types.h include/enet/protocol.h include/enet/list.h \
37 include/enet/callbacks.h /usr/include/fcntl.h /usr/include/bits/fcntl.h \
38 /usr/include/sys/poll.h /usr/include/bits/poll.h
39
40 /usr/include/sys/types.h:
41
42 /usr/include/features.h:
43
44 /usr/include/sys/cdefs.h:
45
46 /usr/include/bits/wordsize.h:
47
48 /usr/include/gnu/stubs.h:
49
50 /usr/include/gnu/stubs-32.h:
51
52 /usr/include/bits/types.h:
53
54 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/stddef.h:
55
56 /usr/include/bits/typesizes.h:
57
58 /usr/include/time.h:
59
60 /usr/include/endian.h:
61
62 /usr/include/bits/endian.h:
63
64 /usr/include/sys/select.h:
65
66 /usr/include/bits/select.h:
67
68 /usr/include/bits/sigset.h:
69
70 /usr/include/bits/time.h:
71
72 /usr/include/sys/sysmacros.h:
73
74 /usr/include/bits/pthreadtypes.h:
75
76 /usr/include/sys/socket.h:
77
78 /usr/include/sys/uio.h:
79
80 /usr/include/bits/uio.h:
81
82 /usr/include/bits/socket.h:
83
84 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/limits.h:
85
86 /usr/lib/gcc/i486-linux-gnu/4.1.2/include/syslimits.h:
87
88 /usr/include/limits.h:
89
90 /usr/include/bits/posix1_lim.h:
91
92 /usr/include/bits/local_lim.h:
93
94 /usr/include/linux/limits.h:
95
96 /usr/include/bits/posix2_lim.h:
97
98 /usr/include/bits/sockaddr.h:
99
100 /usr/include/asm/socket.h:
101
102 /usr/include/asm-i386/socket.h:
103
104 /usr/include/asm/sockios.h:
105
106 /usr/include/asm-i386/sockios.h:
107
108 /usr/include/sys/ioctl.h:
109
110 /usr/include/bits/ioctls.h:
111
112 /usr/include/asm/ioctls.h:
113
114 /usr/include/asm-i386/ioctls.h:
115
116 /usr/include/asm/ioctl.h:
117
118 /usr/include/asm-i386/ioctl.h:
119
120 /usr/include/asm-generic/ioctl.h:
121
122 /usr/include/bits/ioctl-types.h:
123
124 /usr/include/sys/ttydefaults.h:
125
126 /usr/include/sys/time.h:
127
128 /usr/include/arpa/inet.h:
129
130 /usr/include/netinet/in.h:
131
132 /usr/include/stdint.h:
133
134 /usr/include/bits/wchar.h:
135
136 /usr/include/bits/in.h:
137
138 /usr/include/bits/byteswap.h:
139
140 /usr/include/netdb.h:
141
142 /usr/include/rpc/netdb.h:
143
144 /usr/include/bits/netdb.h:
145
146 /usr/include/unistd.h:
147
148 /usr/include/bits/posix_opt.h:
149
150 /usr/include/bits/confname.h:
151
152 /usr/include/getopt.h:
153
154 /usr/include/string.h:
155
156 /usr/include/bits/string.h:
157
158 /usr/include/bits/string2.h:
159
160 /usr/include/stdlib.h:
161
162 /usr/include/errno.h:
163
164 /usr/include/bits/errno.h:
165
166 /usr/include/linux/errno.h:
167
168 /usr/include/asm/errno.h:
169
170 /usr/include/asm-i386/errno.h:
171
172 /usr/include/asm-generic/errno.h:
173
174 /usr/include/asm-generic/errno-base.h:
175
176 include/enet/enet.h:
177
178 /usr/include/alloca.h:
179
180 include/enet/unix.h:
181
182 include/enet/types.h:
183
184 include/enet/protocol.h:
185
186 include/enet/list.h:
187
188 include/enet/callbacks.h:
189
190 /usr/include/fcntl.h:
191
192 /usr/include/bits/fcntl.h:
193
194 /usr/include/sys/poll.h:
195
196 /usr/include/bits/poll.h:
0 win32.o win32.o: win32.c
0 D/docs////
1 D/include////
2 /Doxyfile/1.1.1.1/Tue Mar 14 23:32:27 2006//
3 /LICENSE/1.1.1.1/Tue Mar 14 23:32:27 2006//
4 /Makefile.am/1.1.1.1/Tue Mar 14 23:32:27 2006//
5 /README/1.5/Tue Mar 14 23:32:27 2006//
6 /callbacks.c/1.1.1.1/Tue Mar 14 23:32:27 2006//
7 /configure.in/1.4/Tue Mar 14 23:32:27 2006//
8 /design.txt/1.1.1.1/Tue Mar 14 23:32:27 2006//
9 /enet.dsp/1.1.1.1/Tue Mar 14 23:32:27 2006//
10 /host.c/1.1.1.1/Tue Mar 14 23:32:27 2006//
11 /list.c/1.1.1.1/Tue Mar 14 23:32:27 2006//
12 /packet.c/1.2/Tue Mar 14 23:32:27 2006//
13 /peer.c/1.7/Tue Mar 14 23:32:27 2006//
14 /protocol.c/1.7/Tue Mar 14 23:32:27 2006//
15 /tutorial.txt/1.1.1.1/Tue Mar 14 23:32:27 2006//
16 /unix.c/1.3/Tue Mar 14 23:32:27 2006//
17 /win32.c/1.4/Tue Mar 14 23:32:27 2006//
0 :pserver:anonymous@bespin.org:/var/lib/cvs/enet
0 # Doxyfile 1.2.18
1
2 # This file describes the settings to be used by the documentation system
3 # doxygen (www.doxygen.org) for a project
4 #
5 # All text after a hash (#) is considered a comment and will be ignored
6 # The format is:
7 # TAG = value [value, ...]
8 # For lists items can also be appended using:
9 # TAG += value [value, ...]
10 # Values that contain spaces should be placed between quotes (" ")
11
12 #---------------------------------------------------------------------------
13 # General configuration options
14 #---------------------------------------------------------------------------
15
16 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded
17 # by quotes) that should identify the project.
18
19 PROJECT_NAME = enet
20
21 # The PROJECT_NUMBER tag can be used to enter a project or revision number.
22 # This could be handy for archiving the generated documentation or
23 # if some version control system is used.
24
25 PROJECT_NUMBER =
26
27 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
28 # base path where the generated documentation will be put.
29 # If a relative path is entered, it will be relative to the location
30 # where doxygen was started. If left blank the current directory will be used.
31
32 OUTPUT_DIRECTORY = docs
33
34 # The OUTPUT_LANGUAGE tag is used to specify the language in which all
35 # documentation generated by doxygen is written. Doxygen will use this
36 # information to generate all constant output in the proper language.
37 # The default language is English, other supported languages are:
38 # Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch,
39 # Finnish, French, German, Greek, Hungarian, Italian, Japanese, Japanese-en
40 # (Japanese with english messages), Korean, Norwegian, Polish, Portuguese,
41 # Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish and Ukrainian.
42
43 OUTPUT_LANGUAGE = English
44
45 # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
46 # documentation are documented, even if no documentation was available.
47 # Private class members and static file members will be hidden unless
48 # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
49
50 EXTRACT_ALL = NO
51
52 # If the EXTRACT_PRIVATE tag is set to YES all private members of a class
53 # will be included in the documentation.
54
55 EXTRACT_PRIVATE = NO
56
57 # If the EXTRACT_STATIC tag is set to YES all static members of a file
58 # will be included in the documentation.
59
60 EXTRACT_STATIC = NO
61
62 # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
63 # defined locally in source files will be included in the documentation.
64 # If set to NO only classes defined in header files are included.
65
66 EXTRACT_LOCAL_CLASSES = NO
67
68 # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
69 # undocumented members of documented classes, files or namespaces.
70 # If set to NO (the default) these members will be included in the
71 # various overviews, but no documentation section is generated.
72 # This option has no effect if EXTRACT_ALL is enabled.
73
74 HIDE_UNDOC_MEMBERS = NO
75
76 # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
77 # undocumented classes that are normally visible in the class hierarchy.
78 # If set to NO (the default) these class will be included in the various
79 # overviews. This option has no effect if EXTRACT_ALL is enabled.
80
81 HIDE_UNDOC_CLASSES = NO
82
83 # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
84 # friend (class|struct|union) declarations.
85 # If set to NO (the default) these declarations will be included in the
86 # documentation.
87
88 HIDE_FRIEND_COMPOUNDS = NO
89
90 # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
91 # include brief member descriptions after the members that are listed in
92 # the file and class documentation (similar to JavaDoc).
93 # Set to NO to disable this.
94
95 BRIEF_MEMBER_DESC = YES
96
97 # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
98 # the brief description of a member or function before the detailed description.
99 # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
100 # brief descriptions will be completely suppressed.
101
102 REPEAT_BRIEF = NO
103
104 # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
105 # Doxygen will generate a detailed section even if there is only a brief
106 # description.
107
108 ALWAYS_DETAILED_SEC = NO
109
110 # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited
111 # members of a class in the documentation of that class as if those members were
112 # ordinary class members. Constructors, destructors and assignment operators of
113 # the base classes will not be shown.
114
115 INLINE_INHERITED_MEMB = NO
116
117 # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
118 # path before files name in the file list and in the header files. If set
119 # to NO the shortest path that makes the file name unique will be used.
120
121 FULL_PATH_NAMES = NO
122
123 # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
124 # can be used to strip a user defined part of the path. Stripping is
125 # only done if one of the specified strings matches the left-hand part of
126 # the path. It is allowed to use relative paths in the argument list.
127
128 STRIP_FROM_PATH =
129
130 # The INTERNAL_DOCS tag determines if documentation
131 # that is typed after a \internal command is included. If the tag is set
132 # to NO (the default) then the documentation will be excluded.
133 # Set it to YES to include the internal documentation.
134
135 INTERNAL_DOCS = NO
136
137 # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
138 # doxygen to hide any special comment blocks from generated source code
139 # fragments. Normal C and C++ comments will always remain visible.
140
141 STRIP_CODE_COMMENTS = YES
142
143 # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
144 # file names in lower case letters. If set to YES upper case letters are also
145 # allowed. This is useful if you have classes or files whose names only differ
146 # in case and if your file system supports case sensitive file names. Windows
147 # users are adviced to set this option to NO.
148
149 CASE_SENSE_NAMES = YES
150
151 # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
152 # (but less readable) file names. This can be useful is your file systems
153 # doesn't support long names like on DOS, Mac, or CD-ROM.
154
155 SHORT_NAMES = NO
156
157 # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
158 # will show members with their full class and namespace scopes in the
159 # documentation. If set to YES the scope will be hidden.
160
161 HIDE_SCOPE_NAMES = NO
162
163 # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
164 # will generate a verbatim copy of the header file for each class for
165 # which an include is specified. Set to NO to disable this.
166
167 VERBATIM_HEADERS = YES
168
169 # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
170 # will put list of the files that are included by a file in the documentation
171 # of that file.
172
173 SHOW_INCLUDE_FILES = YES
174
175 # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
176 # will interpret the first line (until the first dot) of a JavaDoc-style
177 # comment as the brief description. If set to NO, the JavaDoc
178 # comments will behave just like the Qt-style comments (thus requiring an
179 # explict @brief command for a brief description.
180
181 JAVADOC_AUTOBRIEF = YES
182
183 # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
184 # treat a multi-line C++ special comment block (i.e. a block of //! or ///
185 # comments) as a brief description. This used to be the default behaviour.
186 # The new default is to treat a multi-line C++ comment block as a detailed
187 # description. Set this tag to YES if you prefer the old behaviour instead.
188
189 MULTILINE_CPP_IS_BRIEF = NO
190
191 # If the DETAILS_AT_TOP tag is set to YES then Doxygen
192 # will output the detailed description near the top, like JavaDoc.
193 # If set to NO, the detailed description appears after the member
194 # documentation.
195
196 DETAILS_AT_TOP = YES
197
198 # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
199 # member inherits the documentation from any documented member that it
200 # reimplements.
201
202 INHERIT_DOCS = YES
203
204 # If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
205 # is inserted in the documentation for inline members.
206
207 INLINE_INFO = YES
208
209 # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
210 # will sort the (detailed) documentation of file and class members
211 # alphabetically by member name. If set to NO the members will appear in
212 # declaration order.
213
214 SORT_MEMBER_DOCS = YES
215
216 # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
217 # tag is set to YES, then doxygen will reuse the documentation of the first
218 # member in the group (if any) for the other members of the group. By default
219 # all members of a group must be documented explicitly.
220
221 DISTRIBUTE_GROUP_DOC = NO
222
223 # The TAB_SIZE tag can be used to set the number of spaces in a tab.
224 # Doxygen uses this value to replace tabs by spaces in code fragments.
225
226 TAB_SIZE = 8
227
228 # The GENERATE_TODOLIST tag can be used to enable (YES) or
229 # disable (NO) the todo list. This list is created by putting \todo
230 # commands in the documentation.
231
232 GENERATE_TODOLIST = YES
233
234 # The GENERATE_TESTLIST tag can be used to enable (YES) or
235 # disable (NO) the test list. This list is created by putting \test
236 # commands in the documentation.
237
238 GENERATE_TESTLIST = YES
239
240 # The GENERATE_BUGLIST tag can be used to enable (YES) or
241 # disable (NO) the bug list. This list is created by putting \bug
242 # commands in the documentation.
243
244 GENERATE_BUGLIST = YES
245
246 # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
247 # disable (NO) the deprecated list. This list is created by putting \deprecated commands in the documentation.
248
249 GENERATE_DEPRECATEDLIST= YES
250
251 # This tag can be used to specify a number of aliases that acts
252 # as commands in the documentation. An alias has the form "name=value".
253 # For example adding "sideeffect=\par Side Effects:\n" will allow you to
254 # put the command \sideeffect (or @sideeffect) in the documentation, which
255 # will result in a user defined paragraph with heading "Side Effects:".
256 # You can put \n's in the value part of an alias to insert newlines.
257
258 ALIASES =
259
260 # The ENABLED_SECTIONS tag can be used to enable conditional
261 # documentation sections, marked by \if sectionname ... \endif.
262
263 ENABLED_SECTIONS =
264
265 # The MAX_INITIALIZER_LINES tag determines the maximum number of lines
266 # the initial value of a variable or define consist of for it to appear in
267 # the documentation. If the initializer consists of more lines than specified
268 # here it will be hidden. Use a value of 0 to hide initializers completely.
269 # The appearance of the initializer of individual variables and defines in the
270 # documentation can be controlled using \showinitializer or \hideinitializer
271 # command in the documentation regardless of this setting.
272
273 MAX_INITIALIZER_LINES = 30
274
275 # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
276 # only. Doxygen will then generate output that is more tailored for C.
277 # For instance some of the names that are used will be different. The list
278 # of all members will be omitted, etc.
279
280 OPTIMIZE_OUTPUT_FOR_C = YES
281
282 # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources
283 # only. Doxygen will then generate output that is more tailored for Java.
284 # For instance namespaces will be presented as packages, qualified scopes
285 # will look different, etc.
286
287 OPTIMIZE_OUTPUT_JAVA = NO
288
289 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated
290 # at the bottom of the documentation of classes and structs. If set to YES the
291 # list will mention the files that were used to generate the documentation.
292
293 SHOW_USED_FILES = YES
294
295 #---------------------------------------------------------------------------
296 # configuration options related to warning and progress messages
297 #---------------------------------------------------------------------------
298
299 # The QUIET tag can be used to turn on/off the messages that are generated
300 # by doxygen. Possible values are YES and NO. If left blank NO is used.
301
302 QUIET = NO
303
304 # The WARNINGS tag can be used to turn on/off the warning messages that are
305 # generated by doxygen. Possible values are YES and NO. If left blank
306 # NO is used.
307
308 WARNINGS = YES
309
310 # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
311 # for undocumented members. If EXTRACT_ALL is set to YES then this flag will
312 # automatically be disabled.
313
314 WARN_IF_UNDOCUMENTED = YES
315
316 # The WARN_FORMAT tag determines the format of the warning messages that
317 # doxygen can produce. The string should contain the $file, $line, and $text
318 # tags, which will be replaced by the file and line number from which the
319 # warning originated and the warning text.
320
321 WARN_FORMAT = "$file:$line: $text"
322
323 # The WARN_LOGFILE tag can be used to specify a file to which warning
324 # and error messages should be written. If left blank the output is written
325 # to stderr.
326
327 WARN_LOGFILE =
328
329 #---------------------------------------------------------------------------
330 # configuration options related to the input files
331 #---------------------------------------------------------------------------
332
333 # The INPUT tag can be used to specify the files and/or directories that contain
334 # documented source files. You may enter file names like "myfile.cpp" or
335 # directories like "/usr/src/myproject". Separate the files or directories
336 # with spaces.
337
338 INPUT = . include/enet docs
339
340 # If the value of the INPUT tag contains directories, you can use the
341 # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
342 # and *.h) to filter out the source-files in the directories. If left
343 # blank the following patterns are tested:
344 # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp
345 # *.h++ *.idl *.odl
346
347 FILE_PATTERNS = *.c *.h *.dox
348
349 # The RECURSIVE tag can be used to turn specify whether or not subdirectories
350 # should be searched for input files as well. Possible values are YES and NO.
351 # If left blank NO is used.
352
353 RECURSIVE = YES
354
355 # The EXCLUDE tag can be used to specify files and/or directories that should
356 # excluded from the INPUT source files. This way you can easily exclude a
357 # subdirectory from a directory tree whose root is specified with the INPUT tag.
358
359 EXCLUDE = Tests
360
361 # The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories
362 # that are symbolic links (a Unix filesystem feature) are excluded from the input.
363
364 EXCLUDE_SYMLINKS = NO
365
366 # If the value of the INPUT tag contains directories, you can use the
367 # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
368 # certain files from those directories.
369
370 EXCLUDE_PATTERNS =
371
372 # The EXAMPLE_PATH tag can be used to specify one or more files or
373 # directories that contain example code fragments that are included (see
374 # the \include command).
375
376 EXAMPLE_PATH =
377
378 # If the value of the EXAMPLE_PATH tag contains directories, you can use the
379 # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
380 # and *.h) to filter out the source-files in the directories. If left
381 # blank all files are included.
382
383 EXAMPLE_PATTERNS =
384
385 # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
386 # searched for input files to be used with the \include or \dontinclude
387 # commands irrespective of the value of the RECURSIVE tag.
388 # Possible values are YES and NO. If left blank NO is used.
389
390 EXAMPLE_RECURSIVE = NO
391
392 # The IMAGE_PATH tag can be used to specify one or more files or
393 # directories that contain image that are included in the documentation (see
394 # the \image command).
395
396 IMAGE_PATH =
397
398 # The INPUT_FILTER tag can be used to specify a program that doxygen should
399 # invoke to filter for each input file. Doxygen will invoke the filter program
400 # by executing (via popen()) the command <filter> <input-file>, where <filter>
401 # is the value of the INPUT_FILTER tag, and <input-file> is the name of an
402 # input file. Doxygen will then use the output that the filter program writes
403 # to standard output.
404
405 INPUT_FILTER =
406
407 # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
408 # INPUT_FILTER) will be used to filter the input files when producing source
409 # files to browse (i.e. when SOURCE_BROWSER is set to YES).
410
411 FILTER_SOURCE_FILES = NO
412
413 #---------------------------------------------------------------------------
414 # configuration options related to source browsing
415 #---------------------------------------------------------------------------
416
417 # If the SOURCE_BROWSER tag is set to YES then a list of source files will
418 # be generated. Documented entities will be cross-referenced with these sources.
419
420 SOURCE_BROWSER = NO
421
422 # Setting the INLINE_SOURCES tag to YES will include the body
423 # of functions and classes directly in the documentation.
424
425 INLINE_SOURCES = NO
426
427 # If the REFERENCED_BY_RELATION tag is set to YES (the default)
428 # then for each documented function all documented
429 # functions referencing it will be listed.
430
431 REFERENCED_BY_RELATION = YES
432
433 # If the REFERENCES_RELATION tag is set to YES (the default)
434 # then for each documented function all documented entities
435 # called/used by that function will be listed.
436
437 REFERENCES_RELATION = YES
438
439 #---------------------------------------------------------------------------
440 # configuration options related to the alphabetical class index
441 #---------------------------------------------------------------------------
442
443 # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
444 # of all compounds will be generated. Enable this if the project
445 # contains a lot of classes, structs, unions or interfaces.
446
447 ALPHABETICAL_INDEX = YES
448
449 # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
450 # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
451 # in which this list will be split (can be a number in the range [1..20])
452
453 COLS_IN_ALPHA_INDEX = 5
454
455 # In case all classes in a project start with a common prefix, all
456 # classes will be put under the same header in the alphabetical index.
457 # The IGNORE_PREFIX tag can be used to specify one or more prefixes that
458 # should be ignored while generating the index headers.
459
460 IGNORE_PREFIX =
461
462 #---------------------------------------------------------------------------
463 # configuration options related to the HTML output
464 #---------------------------------------------------------------------------
465
466 # If the GENERATE_HTML tag is set to YES (the default) Doxygen will
467 # generate HTML output.
468
469 GENERATE_HTML = YES
470
471 # The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
472 # If a relative path is entered the value of OUTPUT_DIRECTORY will be
473 # put in front of it. If left blank `html' will be used as the default path.
474
475 HTML_OUTPUT = html
476
477 # The HTML_FILE_EXTENSION tag can be used to specify the file extension for
478 # each generated HTML page (for example: .htm,.php,.asp). If it is left blank
479 # doxygen will generate files with .html extension.
480
481 HTML_FILE_EXTENSION = .html
482
483 # The HTML_HEADER tag can be used to specify a personal HTML header for
484 # each generated HTML page. If it is left blank doxygen will generate a
485 # standard header.
486
487 HTML_HEADER =
488
489 # The HTML_FOOTER tag can be used to specify a personal HTML footer for
490 # each generated HTML page. If it is left blank doxygen will generate a
491 # standard footer.
492
493 HTML_FOOTER =
494
495 # The HTML_STYLESHEET tag can be used to specify a user defined cascading
496 # style sheet that is used by each HTML page. It can be used to
497 # fine-tune the look of the HTML output. If the tag is left blank doxygen
498 # will generate a default style sheet
499
500 HTML_STYLESHEET =
501
502 # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
503 # files or namespaces will be aligned in HTML using tables. If set to
504 # NO a bullet list will be used.
505
506 HTML_ALIGN_MEMBERS = YES
507
508 # If the GENERATE_HTMLHELP tag is set to YES, additional index files
509 # will be generated that can be used as input for tools like the
510 # Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
511 # of the generated HTML documentation.
512
513 GENERATE_HTMLHELP = NO
514
515 # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
516 # be used to specify the file name of the resulting .chm file. You
517 # can add a path in front of the file if the result should not be
518 # written to the html output dir.
519
520 CHM_FILE =
521
522 # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
523 # be used to specify the location (absolute path including file name) of
524 # the HTML help compiler (hhc.exe). If non empty doxygen will try to run
525 # the html help compiler on the generated index.hhp.
526
527 HHC_LOCATION =
528
529 # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
530 # controls if a separate .chi index file is generated (YES) or that
531 # it should be included in the master .chm file (NO).
532
533 GENERATE_CHI = NO
534
535 # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
536 # controls whether a binary table of contents is generated (YES) or a
537 # normal table of contents (NO) in the .chm file.
538
539 BINARY_TOC = NO
540
541 # The TOC_EXPAND flag can be set to YES to add extra items for group members
542 # to the contents of the Html help documentation and to the tree view.
543
544 TOC_EXPAND = NO
545
546 # The DISABLE_INDEX tag can be used to turn on/off the condensed index at
547 # top of each HTML page. The value NO (the default) enables the index and
548 # the value YES disables it.
549
550 DISABLE_INDEX = NO
551
552 # This tag can be used to set the number of enum values (range [1..20])
553 # that doxygen will group on one line in the generated HTML documentation.
554
555 ENUM_VALUES_PER_LINE = 4
556
557 # If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
558 # generated containing a tree-like index structure (just like the one that
559 # is generated for HTML Help). For this to work a browser that supports
560 # JavaScript and frames is required (for instance Mozilla, Netscape 4.0+,
561 # or Internet explorer 4.0+). Note that for large projects the tree generation
562 # can take a very long time. In such cases it is better to disable this feature.
563 # Windows users are probably better off using the HTML help feature.
564
565 GENERATE_TREEVIEW = NO
566
567 # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
568 # used to set the initial width (in pixels) of the frame in which the tree
569 # is shown.
570
571 TREEVIEW_WIDTH = 250
572
573 #---------------------------------------------------------------------------
574 # configuration options related to the LaTeX output
575 #---------------------------------------------------------------------------
576
577 # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
578 # generate Latex output.
579
580 GENERATE_LATEX = NO
581
582 # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
583 # If a relative path is entered the value of OUTPUT_DIRECTORY will be
584 # put in front of it. If left blank `latex' will be used as the default path.
585
586 LATEX_OUTPUT = latex
587
588 # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be invoked. If left blank `latex' will be used as the default command name.
589
590 LATEX_CMD_NAME = latex
591
592 # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
593 # generate index for LaTeX. If left blank `makeindex' will be used as the
594 # default command name.
595
596 MAKEINDEX_CMD_NAME = makeindex
597
598 # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
599 # LaTeX documents. This may be useful for small projects and may help to
600 # save some trees in general.
601
602 COMPACT_LATEX = NO
603
604 # The PAPER_TYPE tag can be used to set the paper type that is used
605 # by the printer. Possible values are: a4, a4wide, letter, legal and
606 # executive. If left blank a4wide will be used.
607
608 PAPER_TYPE = a4wide
609
610 # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
611 # packages that should be included in the LaTeX output.
612
613 EXTRA_PACKAGES =
614
615 # The LATEX_HEADER tag can be used to specify a personal LaTeX header for
616 # the generated latex document. The header should contain everything until
617 # the first chapter. If it is left blank doxygen will generate a
618 # standard header. Notice: only use this tag if you know what you are doing!
619
620 LATEX_HEADER =
621
622 # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
623 # is prepared for conversion to pdf (using ps2pdf). The pdf file will
624 # contain links (just like the HTML output) instead of page references
625 # This makes the output suitable for online browsing using a pdf viewer.
626
627 PDF_HYPERLINKS = NO
628
629 # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
630 # plain latex in the generated Makefile. Set this option to YES to get a
631 # higher quality PDF documentation.
632
633 USE_PDFLATEX = NO
634
635 # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
636 # command to the generated LaTeX files. This will instruct LaTeX to keep
637 # running if errors occur, instead of asking the user for help.
638 # This option is also used when generating formulas in HTML.
639
640 LATEX_BATCHMODE = NO
641
642 #---------------------------------------------------------------------------
643 # configuration options related to the RTF output
644 #---------------------------------------------------------------------------
645
646 # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
647 # The RTF output is optimised for Word 97 and may not look very pretty with
648 # other RTF readers or editors.
649
650 GENERATE_RTF = NO
651
652 # The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
653 # If a relative path is entered the value of OUTPUT_DIRECTORY will be
654 # put in front of it. If left blank `rtf' will be used as the default path.
655
656 RTF_OUTPUT = rtf
657
658 # If the COMPACT_RTF tag is set to YES Doxygen generates more compact
659 # RTF documents. This may be useful for small projects and may help to
660 # save some trees in general.
661
662 COMPACT_RTF = NO
663
664 # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
665 # will contain hyperlink fields. The RTF file will
666 # contain links (just like the HTML output) instead of page references.
667 # This makes the output suitable for online browsing using WORD or other
668 # programs which support those fields.
669 # Note: wordpad (write) and others do not support links.
670
671 RTF_HYPERLINKS = NO
672
673 # Load stylesheet definitions from file. Syntax is similar to doxygen's
674 # config file, i.e. a series of assigments. You only have to provide
675 # replacements, missing definitions are set to their default value.
676
677 RTF_STYLESHEET_FILE =
678
679 # Set optional variables used in the generation of an rtf document.
680 # Syntax is similar to doxygen's config file.
681
682 RTF_EXTENSIONS_FILE =
683
684 #---------------------------------------------------------------------------
685 # configuration options related to the man page output
686 #---------------------------------------------------------------------------
687
688 # If the GENERATE_MAN tag is set to YES (the default) Doxygen will
689 # generate man pages
690
691 GENERATE_MAN = NO
692
693 # The MAN_OUTPUT tag is used to specify where the man pages will be put.
694 # If a relative path is entered the value of OUTPUT_DIRECTORY will be
695 # put in front of it. If left blank `man' will be used as the default path.
696
697 MAN_OUTPUT = man
698
699 # The MAN_EXTENSION tag determines the extension that is added to
700 # the generated man pages (default is the subroutine's section .3)
701
702 MAN_EXTENSION = .3
703
704 # If the MAN_LINKS tag is set to YES and Doxygen generates man output,
705 # then it will generate one additional man file for each entity
706 # documented in the real man page(s). These additional files
707 # only source the real man page, but without them the man command
708 # would be unable to find the correct page. The default is NO.
709
710 MAN_LINKS = NO
711
712 #---------------------------------------------------------------------------
713 # configuration options related to the XML output
714 #---------------------------------------------------------------------------
715
716 # If the GENERATE_XML tag is set to YES Doxygen will
717 # generate an XML file that captures the structure of
718 # the code including all documentation. Note that this
719 # feature is still experimental and incomplete at the
720 # moment.
721
722 GENERATE_XML = NO
723
724 # The XML_SCHEMA tag can be used to specify an XML schema,
725 # which can be used by a validating XML parser to check the
726 # syntax of the XML files.
727
728 XML_SCHEMA =
729
730 # The XML_DTD tag can be used to specify an XML DTD,
731 # which can be used by a validating XML parser to check the
732 # syntax of the XML files.
733
734 XML_DTD =
735
736 #---------------------------------------------------------------------------
737 # configuration options for the AutoGen Definitions output
738 #---------------------------------------------------------------------------
739
740 # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
741 # generate an AutoGen Definitions (see autogen.sf.net) file
742 # that captures the structure of the code including all
743 # documentation. Note that this feature is still experimental
744 # and incomplete at the moment.
745
746 GENERATE_AUTOGEN_DEF = NO
747
748 #---------------------------------------------------------------------------
749 # Configuration options related to the preprocessor
750 #---------------------------------------------------------------------------
751
752 # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
753 # evaluate all C-preprocessor directives found in the sources and include
754 # files.
755
756 ENABLE_PREPROCESSING = YES
757
758 # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
759 # names in the source code. If set to NO (the default) only conditional
760 # compilation will be performed. Macro expansion can be done in a controlled
761 # way by setting EXPAND_ONLY_PREDEF to YES.
762
763 MACRO_EXPANSION = NO
764
765 # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
766 # then the macro expansion is limited to the macros specified with the
767 # PREDEFINED and EXPAND_AS_PREDEFINED tags.
768
769 EXPAND_ONLY_PREDEF = NO
770
771 # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
772 # in the INCLUDE_PATH (see below) will be search if a #include is found.
773
774 SEARCH_INCLUDES = YES
775
776 # The INCLUDE_PATH tag can be used to specify one or more directories that
777 # contain include files that are not input files but should be processed by
778 # the preprocessor.
779
780 INCLUDE_PATH =
781
782 # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
783 # patterns (like *.h and *.hpp) to filter out the header-files in the
784 # directories. If left blank, the patterns specified with FILE_PATTERNS will
785 # be used.
786
787 INCLUDE_FILE_PATTERNS =
788
789 # The PREDEFINED tag can be used to specify one or more macro names that
790 # are defined before the preprocessor is started (similar to the -D option of
791 # gcc). The argument of the tag is a list of macros of the form: name
792 # or name=definition (no spaces). If the definition and the = are
793 # omitted =1 is assumed.
794
795 PREDEFINED = FORCE_DOXYGEN
796
797 # If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then
798 # this tag can be used to specify a list of macro names that should be expanded.
799 # The macro definition that is found in the sources will be used.
800 # Use the PREDEFINED tag if you want to use a different macro definition.
801
802 EXPAND_AS_DEFINED =
803
804 # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
805 # doxygen's preprocessor will remove all function-like macros that are alone
806 # on a line, have an all uppercase name, and do not end with a semicolon. Such
807 # function macros are typically used for boiler-plate code, and will confuse the
808 # parser if not removed.
809
810 SKIP_FUNCTION_MACROS = YES
811
812 #---------------------------------------------------------------------------
813 # Configuration::addtions related to external references
814 #---------------------------------------------------------------------------
815
816 # The TAGFILES tag can be used to specify one or more tagfiles.
817
818 TAGFILES =
819
820 # When a file name is specified after GENERATE_TAGFILE, doxygen will create
821 # a tag file that is based on the input files it reads.
822
823 GENERATE_TAGFILE =
824
825 # If the ALLEXTERNALS tag is set to YES all external classes will be listed
826 # in the class index. If set to NO only the inherited external classes
827 # will be listed.
828
829 ALLEXTERNALS = NO
830
831 # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
832 # in the modules index. If set to NO, only the current project's groups will
833 # be listed.
834
835 EXTERNAL_GROUPS = YES
836
837 # The PERL_PATH should be the absolute path and name of the perl script
838 # interpreter (i.e. the result of `which perl').
839
840 PERL_PATH = /usr/bin/perl
841
842 #---------------------------------------------------------------------------
843 # Configuration options related to the dot tool
844 #---------------------------------------------------------------------------
845
846 # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
847 # generate a inheritance diagram (in Html, RTF and LaTeX) for classes with base or
848 # super classes. Setting the tag to NO turns the diagrams off. Note that this
849 # option is superceded by the HAVE_DOT option below. This is only a fallback. It is
850 # recommended to install and use dot, since it yield more powerful graphs.
851
852 CLASS_DIAGRAMS = YES
853
854 # If set to YES, the inheritance and collaboration graphs will hide
855 # inheritance and usage relations if the target is undocumented
856 # or is not a class.
857
858 HIDE_UNDOC_RELATIONS = YES
859
860 # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
861 # available from the path. This tool is part of Graphviz, a graph visualization
862 # toolkit from AT&T and Lucent Bell Labs. The other options in this section
863 # have no effect if this option is set to NO (the default)
864
865 HAVE_DOT = NO
866
867 # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
868 # will generate a graph for each documented class showing the direct and
869 # indirect inheritance relations. Setting this tag to YES will force the
870 # the CLASS_DIAGRAMS tag to NO.
871
872 CLASS_GRAPH = YES
873
874 # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
875 # will generate a graph for each documented class showing the direct and
876 # indirect implementation dependencies (inheritance, containment, and
877 # class references variables) of the class with other documented classes.
878
879 COLLABORATION_GRAPH = YES
880
881 # If set to YES, the inheritance and collaboration graphs will show the
882 # relations between templates and their instances.
883
884 TEMPLATE_RELATIONS = YES
885
886 # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
887 # tags are set to YES then doxygen will generate a graph for each documented
888 # file showing the direct and indirect include dependencies of the file with
889 # other documented files.
890
891 INCLUDE_GRAPH = YES
892
893 # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
894 # HAVE_DOT tags are set to YES then doxygen will generate a graph for each
895 # documented header file showing the documented files that directly or
896 # indirectly include this file.
897
898 INCLUDED_BY_GRAPH = YES
899
900 # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
901 # will graphical hierarchy of all classes instead of a textual one.
902
903 GRAPHICAL_HIERARCHY = YES
904
905 # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
906 # generated by dot. Possible values are png, jpg, or gif
907 # If left blank png will be used.
908
909 DOT_IMAGE_FORMAT = png
910
911 # The tag DOT_PATH can be used to specify the path where the dot tool can be
912 # found. If left blank, it is assumed the dot tool can be found on the path.
913
914 DOT_PATH =
915
916 # The DOTFILE_DIRS tag can be used to specify one or more directories that
917 # contain dot files that are included in the documentation (see the
918 # \dotfile command).
919
920 DOTFILE_DIRS =
921
922 # The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
923 # (in pixels) of the graphs generated by dot. If a graph becomes larger than
924 # this value, doxygen will try to truncate the graph, so that it fits within
925 # the specified constraint. Beware that most browsers cannot cope with very
926 # large images.
927
928 MAX_DOT_GRAPH_WIDTH = 1024
929
930 # The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
931 # (in pixels) of the graphs generated by dot. If a graph becomes larger than
932 # this value, doxygen will try to truncate the graph, so that it fits within
933 # the specified constraint. Beware that most browsers cannot cope with very
934 # large images.
935
936 MAX_DOT_GRAPH_HEIGHT = 1024
937
938 # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
939 # generate a legend page explaining the meaning of the various boxes and
940 # arrows in the dot generated graphs.
941
942 GENERATE_LEGEND = YES
943
944 # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
945 # remove the intermedate dot files that are used to generate
946 # the various graphs.
947
948 DOT_CLEANUP = YES
949
950 #---------------------------------------------------------------------------
951 # Configuration::addtions related to the search engine
952 #---------------------------------------------------------------------------
953
954 # The SEARCHENGINE tag specifies whether or not a search engine should be
955 # used. If set to NO the values of all tags below this one will be ignored.
956
957 SEARCHENGINE = NO
958
959 # The CGI_NAME tag should be the name of the CGI script that
960 # starts the search engine (doxysearch) with the correct parameters.
961 # A script with this name will be generated by doxygen.
962
963 CGI_NAME = search.cgi
964
965 # The CGI_URL tag should be the absolute URL to the directory where the
966 # cgi binaries are located. See the documentation of your http daemon for
967 # details.
968
969 CGI_URL =
970
971 # The DOC_URL tag should be the absolute URL to the directory where the
972 # documentation is located. If left blank the absolute path to the
973 # documentation, with file:// prepended to it, will be used.
974
975 DOC_URL =
976
977 # The DOC_ABSPATH tag should be the absolute path to the directory where the
978 # documentation is located. If left blank the directory on the local machine
979 # will be used.
980
981 DOC_ABSPATH =
982
983 # The BIN_ABSPATH tag must point to the directory where the doxysearch binary
984 # is installed.
985
986 BIN_ABSPATH = /usr/local/bin/
987
988 # The EXT_DOC_PATHS tag can be used to specify one or more paths to
989 # documentation generated for other projects. This allows doxysearch to search
990 # the documentation for these projects as well.
991
992 EXT_DOC_PATHS =
0 Copyright (c) 2002 Lee Salzman
1
2 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
3
4 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
5
6 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0 # Makefile.in generated by automake 1.9.3 from Makefile.am.
1 # Makefile. Generated from Makefile.in by configure.
2
3 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
4 # 2003, 2004 Free Software Foundation, Inc.
5 # This Makefile.in is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12 # PARTICULAR PURPOSE.
13
14
15
16 SOURCES = $(libenet_a_SOURCES)
17
18 srcdir = .
19 top_srcdir = .
20
21 pkgdatadir = $(datadir)/libenet.a
22 pkglibdir = $(libdir)/libenet.a
23 pkgincludedir = $(includedir)/libenet.a
24 top_builddir = .
25 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
26 INSTALL = /usr/bin/install -c
27 install_sh_DATA = $(install_sh) -c -m 644
28 install_sh_PROGRAM = $(install_sh) -c
29 install_sh_SCRIPT = $(install_sh) -c
30 INSTALL_HEADER = $(INSTALL_DATA)
31 transform = $(program_transform_name)
32 NORMAL_INSTALL = :
33 PRE_INSTALL = :
34 POST_INSTALL = :
35 NORMAL_UNINSTALL = :
36 PRE_UNINSTALL = :
37 POST_UNINSTALL = :
38 subdir = .
39 DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
40 $(srcdir)/Makefile.in $(top_srcdir)/configure config.guess \
41 config.sub depcomp install-sh missing mkinstalldirs
42 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
43 am__aclocal_m4_deps = $(top_srcdir)/configure.in
44 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
45 $(ACLOCAL_M4)
46 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
47 configure.lineno configure.status.lineno
48 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
49 CONFIG_CLEAN_FILES =
50 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
51 am__vpath_adj = case $$p in \
52 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
53 *) f=$$p;; \
54 esac;
55 am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
56 am__installdirs = "$(DESTDIR)$(libdir)"
57 libLIBRARIES_INSTALL = $(INSTALL_DATA)
58 LIBRARIES = $(lib_LIBRARIES)
59 AR = ar
60 ARFLAGS = cru
61 libenet_a_AR = $(AR) $(ARFLAGS)
62 libenet_a_LIBADD =
63 am_libenet_a_OBJECTS = host.$(OBJEXT) list.$(OBJEXT) \
64 callbacks.$(OBJEXT) packet.$(OBJEXT) peer.$(OBJEXT) \
65 protocol.$(OBJEXT) unix.$(OBJEXT) win32.$(OBJEXT)
66 libenet_a_OBJECTS = $(am_libenet_a_OBJECTS)
67 DEFAULT_INCLUDES = -I. -I$(srcdir)
68 depcomp = $(SHELL) $(top_srcdir)/depcomp
69 am__depfiles_maybe = depfiles
70 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
71 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
72 CCLD = $(CC)
73 LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
74 SOURCES = $(libenet_a_SOURCES)
75 DIST_SOURCES = $(libenet_a_SOURCES)
76 RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
77 html-recursive info-recursive install-data-recursive \
78 install-exec-recursive install-info-recursive \
79 install-recursive installcheck-recursive installdirs-recursive \
80 pdf-recursive ps-recursive uninstall-info-recursive \
81 uninstall-recursive
82 ETAGS = etags
83 CTAGS = ctags
84 DIST_SUBDIRS = $(SUBDIRS)
85 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
86 distdir = $(PACKAGE)-$(VERSION)
87 top_distdir = $(distdir)
88 am__remove_distdir = \
89 { test ! -d $(distdir) \
90 || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
91 && rm -fr $(distdir); }; }
92 DIST_ARCHIVES = $(distdir).tar.gz
93 GZIP_ENV = --best
94 distuninstallcheck_listfiles = find . -type f -print
95 distcleancheck_listfiles = find . -type f -print
96 ACLOCAL = aclocal-1.9
97 AMDEP_FALSE = #
98 AMDEP_TRUE =
99 AMTAR = tar
100 AUTOCONF = autoconf
101 AUTOHEADER = autoheader
102 AUTOMAKE = automake-1.9
103 AWK = gawk
104 CC = gcc
105 CCDEPMODE = depmode=gcc3
106 CFLAGS = -g -O2
107 CPP = gcc -E
108 CPPFLAGS =
109 CYGPATH_W = echo
110 DEFS = -DPACKAGE_NAME=\"libenet\" -DPACKAGE_TARNAME=\"libenet\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"libenet\ 1.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"libenet.a\" -DVERSION=\"1.0\" -DHAS_GETHOSTBYADDR_R=1 -DHAS_GETHOSTBYNAME_R=1 -DHAS_POLL=1 -DHAS_FCNTL=1 -DHAS_INET_PTON=1 -DHAS_INET_NTOP=1 -DHAS_MSGHDR_FLAGS=1 -DHAS_SOCKLEN_T=1
111 DEPDIR = .deps
112 ECHO_C =
113 ECHO_N = -n
114 ECHO_T =
115 EGREP = grep -E
116 EXEEXT =
117 INSTALL_DATA = ${INSTALL} -m 644
118 INSTALL_PROGRAM = ${INSTALL}
119 INSTALL_SCRIPT = ${INSTALL}
120 INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s
121 LDFLAGS =
122 LIBOBJS =
123 LIBS =
124 LTLIBOBJS =
125 MAKEINFO = makeinfo
126 OBJEXT = o
127 PACKAGE = libenet.a
128 PACKAGE_BUGREPORT =
129 PACKAGE_NAME = libenet
130 PACKAGE_STRING = libenet 1.0
131 PACKAGE_TARNAME = libenet
132 PACKAGE_VERSION = 1.0
133 PATH_SEPARATOR = :
134 RANLIB = ranlib
135 SET_MAKE =
136 SHELL = /bin/sh
137 STRIP =
138 VERSION = 1.0
139 ac_ct_CC = gcc
140 ac_ct_RANLIB = ranlib
141 ac_ct_STRIP =
142 am__fastdepCC_FALSE = #
143 am__fastdepCC_TRUE =
144 am__include = include
145 am__leading_dot = .
146 am__quote =
147 am__tar = ${AMTAR} chof - "$$tardir"
148 am__untar = ${AMTAR} xf -
149 bindir = ${exec_prefix}/bin
150 build_alias =
151 datadir = ${prefix}/share
152 exec_prefix = ${prefix}
153 host_alias =
154 includedir = ${prefix}/include
155 infodir = ${prefix}/info
156 install_sh = /home/poul/blockattack-1.3.0/enet-1.0/install-sh
157 libdir = ${exec_prefix}/lib
158 libexecdir = ${exec_prefix}/libexec
159 localstatedir = ${prefix}/var
160 mandir = ${prefix}/man
161 mkdir_p = mkdir -p --
162 oldincludedir = /usr/include
163 prefix = /usr/local
164 program_transform_name = s,x,x,
165 sbindir = ${exec_prefix}/sbin
166 sharedstatedir = ${prefix}/com
167 sysconfdir = ${prefix}/etc
168 target_alias =
169 lib_LIBRARIES = libenet.a
170 libenet_a_SOURCES = host.c list.c callbacks.c packet.c peer.c protocol.c unix.c win32.c
171 INCLUDES = -Iinclude/
172 SUBDIRS = include
173 all: all-recursive
174
175 .SUFFIXES:
176 .SUFFIXES: .c .o .obj
177 am--refresh:
178 @:
179 $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
180 @for dep in $?; do \
181 case '$(am__configure_deps)' in \
182 *$$dep*) \
183 echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \
184 cd $(srcdir) && $(AUTOMAKE) --foreign \
185 && exit 0; \
186 exit 1;; \
187 esac; \
188 done; \
189 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
190 cd $(top_srcdir) && \
191 $(AUTOMAKE) --foreign Makefile
192 .PRECIOUS: Makefile
193 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
194 @case '$?' in \
195 *config.status*) \
196 echo ' $(SHELL) ./config.status'; \
197 $(SHELL) ./config.status;; \
198 *) \
199 echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
200 cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
201 esac;
202
203 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
204 $(SHELL) ./config.status --recheck
205
206 $(top_srcdir)/configure: $(am__configure_deps)
207 cd $(srcdir) && $(AUTOCONF)
208 $(ACLOCAL_M4): $(am__aclocal_m4_deps)
209 cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
210 install-libLIBRARIES: $(lib_LIBRARIES)
211 @$(NORMAL_INSTALL)
212 test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
213 @list='$(lib_LIBRARIES)'; for p in $$list; do \
214 if test -f $$p; then \
215 f=$(am__strip_dir) \
216 echo " $(libLIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
217 $(libLIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
218 else :; fi; \
219 done
220 @$(POST_INSTALL)
221 @list='$(lib_LIBRARIES)'; for p in $$list; do \
222 if test -f $$p; then \
223 p=$(am__strip_dir) \
224 echo " $(RANLIB) '$(DESTDIR)$(libdir)/$$p'"; \
225 $(RANLIB) "$(DESTDIR)$(libdir)/$$p"; \
226 else :; fi; \
227 done
228
229 uninstall-libLIBRARIES:
230 @$(NORMAL_UNINSTALL)
231 @list='$(lib_LIBRARIES)'; for p in $$list; do \
232 p=$(am__strip_dir) \
233 echo " rm -f '$(DESTDIR)$(libdir)/$$p'"; \
234 rm -f "$(DESTDIR)$(libdir)/$$p"; \
235 done
236
237 clean-libLIBRARIES:
238 -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES)
239 libenet.a: $(libenet_a_OBJECTS) $(libenet_a_DEPENDENCIES)
240 -rm -f libenet.a
241 $(libenet_a_AR) libenet.a $(libenet_a_OBJECTS) $(libenet_a_LIBADD)
242 $(RANLIB) libenet.a
243
244 mostlyclean-compile:
245 -rm -f *.$(OBJEXT)
246
247 distclean-compile:
248 -rm -f *.tab.c
249
250 include ./$(DEPDIR)/callbacks.Po
251 include ./$(DEPDIR)/host.Po
252 include ./$(DEPDIR)/list.Po
253 include ./$(DEPDIR)/packet.Po
254 include ./$(DEPDIR)/peer.Po
255 include ./$(DEPDIR)/protocol.Po
256 include ./$(DEPDIR)/unix.Po
257 include ./$(DEPDIR)/win32.Po
258
259 .c.o:
260 if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
261 then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
262 # source='$<' object='$@' libtool=no \
263 # DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
264 # $(COMPILE) -c $<
265
266 .c.obj:
267 if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
268 then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
269 # source='$<' object='$@' libtool=no \
270 # DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
271 # $(COMPILE) -c `$(CYGPATH_W) '$<'`
272 uninstall-info-am:
273
274 # This directory's subdirectories are mostly independent; you can cd
275 # into them and run `make' without going through this Makefile.
276 # To change the values of `make' variables: instead of editing Makefiles,
277 # (1) if the variable is set in `config.status', edit `config.status'
278 # (which will cause the Makefiles to be regenerated when you run `make');
279 # (2) otherwise, pass the desired values on the `make' command line.
280 $(RECURSIVE_TARGETS):
281 @set fnord $$MAKEFLAGS; amf=$$2; \
282 dot_seen=no; \
283 target=`echo $@ | sed s/-recursive//`; \
284 list='$(SUBDIRS)'; for subdir in $$list; do \
285 echo "Making $$target in $$subdir"; \
286 if test "$$subdir" = "."; then \
287 dot_seen=yes; \
288 local_target="$$target-am"; \
289 else \
290 local_target="$$target"; \
291 fi; \
292 (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
293 || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
294 done; \
295 if test "$$dot_seen" = "no"; then \
296 $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
297 fi; test -z "$$fail"
298
299 mostlyclean-recursive clean-recursive distclean-recursive \
300 maintainer-clean-recursive:
301 @set fnord $$MAKEFLAGS; amf=$$2; \
302 dot_seen=no; \
303 case "$@" in \
304 distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
305 *) list='$(SUBDIRS)' ;; \
306 esac; \
307 rev=''; for subdir in $$list; do \
308 if test "$$subdir" = "."; then :; else \
309 rev="$$subdir $$rev"; \
310 fi; \
311 done; \
312 rev="$$rev ."; \
313 target=`echo $@ | sed s/-recursive//`; \
314 for subdir in $$rev; do \
315 echo "Making $$target in $$subdir"; \
316 if test "$$subdir" = "."; then \
317 local_target="$$target-am"; \
318 else \
319 local_target="$$target"; \
320 fi; \
321 (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
322 || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
323 done && test -z "$$fail"
324 tags-recursive:
325 list='$(SUBDIRS)'; for subdir in $$list; do \
326 test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
327 done
328 ctags-recursive:
329 list='$(SUBDIRS)'; for subdir in $$list; do \
330 test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
331 done
332
333 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
334 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
335 unique=`for i in $$list; do \
336 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
337 done | \
338 $(AWK) ' { files[$$0] = 1; } \
339 END { for (i in files) print i; }'`; \
340 mkid -fID $$unique
341 tags: TAGS
342
343 TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
344 $(TAGS_FILES) $(LISP)
345 tags=; \
346 here=`pwd`; \
347 if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
348 include_option=--etags-include; \
349 empty_fix=.; \
350 else \
351 include_option=--include; \
352 empty_fix=; \
353 fi; \
354 list='$(SUBDIRS)'; for subdir in $$list; do \
355 if test "$$subdir" = .; then :; else \
356 test ! -f $$subdir/TAGS || \
357 tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
358 fi; \
359 done; \
360 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
361 unique=`for i in $$list; do \
362 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
363 done | \
364 $(AWK) ' { files[$$0] = 1; } \
365 END { for (i in files) print i; }'`; \
366 if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
367 test -n "$$unique" || unique=$$empty_fix; \
368 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
369 $$tags $$unique; \
370 fi
371 ctags: CTAGS
372 CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
373 $(TAGS_FILES) $(LISP)
374 tags=; \
375 here=`pwd`; \
376 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
377 unique=`for i in $$list; do \
378 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
379 done | \
380 $(AWK) ' { files[$$0] = 1; } \
381 END { for (i in files) print i; }'`; \
382 test -z "$(CTAGS_ARGS)$$tags$$unique" \
383 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
384 $$tags $$unique
385
386 GTAGS:
387 here=`$(am__cd) $(top_builddir) && pwd` \
388 && cd $(top_srcdir) \
389 && gtags -i $(GTAGS_ARGS) $$here
390
391 distclean-tags:
392 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
393
394 distdir: $(DISTFILES)
395 $(am__remove_distdir)
396 mkdir $(distdir)
397 @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
398 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
399 list='$(DISTFILES)'; for file in $$list; do \
400 case $$file in \
401 $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
402 $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
403 esac; \
404 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
405 dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
406 if test "$$dir" != "$$file" && test "$$dir" != "."; then \
407 dir="/$$dir"; \
408 $(mkdir_p) "$(distdir)$$dir"; \
409 else \
410 dir=''; \
411 fi; \
412 if test -d $$d/$$file; then \
413 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
414 cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
415 fi; \
416 cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
417 else \
418 test -f $(distdir)/$$file \
419 || cp -p $$d/$$file $(distdir)/$$file \
420 || exit 1; \
421 fi; \
422 done
423 list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
424 if test "$$subdir" = .; then :; else \
425 test -d "$(distdir)/$$subdir" \
426 || $(mkdir_p) "$(distdir)/$$subdir" \
427 || exit 1; \
428 distdir=`$(am__cd) $(distdir) && pwd`; \
429 top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
430 (cd $$subdir && \
431 $(MAKE) $(AM_MAKEFLAGS) \
432 top_distdir="$$top_distdir" \
433 distdir="$$distdir/$$subdir" \
434 distdir) \
435 || exit 1; \
436 fi; \
437 done
438 -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
439 ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
440 ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
441 ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
442 || chmod -R a+r $(distdir)
443 dist-gzip: distdir
444 tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
445 $(am__remove_distdir)
446
447 dist-bzip2: distdir
448 tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
449 $(am__remove_distdir)
450
451 dist-tarZ: distdir
452 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
453 $(am__remove_distdir)
454
455 dist-shar: distdir
456 shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
457 $(am__remove_distdir)
458
459 dist-zip: distdir
460 -rm -f $(distdir).zip
461 zip -rq $(distdir).zip $(distdir)
462 $(am__remove_distdir)
463
464 dist dist-all: distdir
465 tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
466 $(am__remove_distdir)
467
468 # This target untars the dist file and tries a VPATH configuration. Then
469 # it guarantees that the distribution is self-contained by making another
470 # tarfile.
471 distcheck: dist
472 case '$(DIST_ARCHIVES)' in \
473 *.tar.gz*) \
474 GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
475 *.tar.bz2*) \
476 bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
477 *.tar.Z*) \
478 uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
479 *.shar.gz*) \
480 GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
481 *.zip*) \
482 unzip $(distdir).zip ;;\
483 esac
484 chmod -R a-w $(distdir); chmod a+w $(distdir)
485 mkdir $(distdir)/_build
486 mkdir $(distdir)/_inst
487 chmod a-w $(distdir)
488 dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
489 && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
490 && cd $(distdir)/_build \
491 && ../configure --srcdir=.. --prefix="$$dc_install_base" \
492 $(DISTCHECK_CONFIGURE_FLAGS) \
493 && $(MAKE) $(AM_MAKEFLAGS) \
494 && $(MAKE) $(AM_MAKEFLAGS) dvi \
495 && $(MAKE) $(AM_MAKEFLAGS) check \
496 && $(MAKE) $(AM_MAKEFLAGS) install \
497 && $(MAKE) $(AM_MAKEFLAGS) installcheck \
498 && $(MAKE) $(AM_MAKEFLAGS) uninstall \
499 && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
500 distuninstallcheck \
501 && chmod -R a-w "$$dc_install_base" \
502 && ({ \
503 (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
504 && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
505 && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
506 && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
507 distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
508 } || { rm -rf "$$dc_destdir"; exit 1; }) \
509 && rm -rf "$$dc_destdir" \
510 && $(MAKE) $(AM_MAKEFLAGS) dist \
511 && rm -rf $(DIST_ARCHIVES) \
512 && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
513 $(am__remove_distdir)
514 @(echo "$(distdir) archives ready for distribution: "; \
515 list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
516 sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
517 distuninstallcheck:
518 @cd $(distuninstallcheck_dir) \
519 && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
520 || { echo "ERROR: files left after uninstall:" ; \
521 if test -n "$(DESTDIR)"; then \
522 echo " (check DESTDIR support)"; \
523 fi ; \
524 $(distuninstallcheck_listfiles) ; \
525 exit 1; } >&2
526 distcleancheck: distclean
527 @if test '$(srcdir)' = . ; then \
528 echo "ERROR: distcleancheck can only run from a VPATH build" ; \
529 exit 1 ; \
530 fi
531 @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
532 || { echo "ERROR: files left in build directory after distclean:" ; \
533 $(distcleancheck_listfiles) ; \
534 exit 1; } >&2
535 check-am: all-am
536 check: check-recursive
537 all-am: Makefile $(LIBRARIES)
538 installdirs: installdirs-recursive
539 installdirs-am:
540 for dir in "$(DESTDIR)$(libdir)"; do \
541 test -z "$$dir" || $(mkdir_p) "$$dir"; \
542 done
543 install: install-recursive
544 install-exec: install-exec-recursive
545 install-data: install-data-recursive
546 uninstall: uninstall-recursive
547
548 install-am: all-am
549 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
550
551 installcheck: installcheck-recursive
552 install-strip:
553 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
554 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
555 `test -z '$(STRIP)' || \
556 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
557 mostlyclean-generic:
558
559 clean-generic:
560
561 distclean-generic:
562 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
563
564 maintainer-clean-generic:
565 @echo "This command is intended for maintainers to use"
566 @echo "it deletes files that may require special tools to rebuild."
567 clean: clean-recursive
568
569 clean-am: clean-generic clean-libLIBRARIES mostlyclean-am
570
571 distclean: distclean-recursive
572 -rm -f $(am__CONFIG_DISTCLEAN_FILES)
573 -rm -rf ./$(DEPDIR)
574 -rm -f Makefile
575 distclean-am: clean-am distclean-compile distclean-generic \
576 distclean-tags
577
578 dvi: dvi-recursive
579
580 dvi-am:
581
582 html: html-recursive
583
584 info: info-recursive
585
586 info-am:
587
588 install-data-am:
589
590 install-exec-am: install-libLIBRARIES
591
592 install-info: install-info-recursive
593
594 install-man:
595
596 installcheck-am:
597
598 maintainer-clean: maintainer-clean-recursive
599 -rm -f $(am__CONFIG_DISTCLEAN_FILES)
600 -rm -rf $(top_srcdir)/autom4te.cache
601 -rm -rf ./$(DEPDIR)
602 -rm -f Makefile
603 maintainer-clean-am: distclean-am maintainer-clean-generic
604
605 mostlyclean: mostlyclean-recursive
606
607 mostlyclean-am: mostlyclean-compile mostlyclean-generic
608
609 pdf: pdf-recursive
610
611 pdf-am:
612
613 ps: ps-recursive
614
615 ps-am:
616
617 uninstall-am: uninstall-info-am uninstall-libLIBRARIES
618
619 uninstall-info: uninstall-info-recursive
620
621 .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
622 check-am clean clean-generic clean-libLIBRARIES \
623 clean-recursive ctags ctags-recursive dist dist-all dist-bzip2 \
624 dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \
625 distclean-compile distclean-generic distclean-recursive \
626 distclean-tags distcleancheck distdir distuninstallcheck dvi \
627 dvi-am html html-am info info-am install install-am \
628 install-data install-data-am install-exec install-exec-am \
629 install-info install-info-am install-libLIBRARIES install-man \
630 install-strip installcheck installcheck-am installdirs \
631 installdirs-am maintainer-clean maintainer-clean-generic \
632 maintainer-clean-recursive mostlyclean mostlyclean-compile \
633 mostlyclean-generic mostlyclean-recursive pdf pdf-am ps ps-am \
634 tags tags-recursive uninstall uninstall-am uninstall-info-am \
635 uninstall-libLIBRARIES
636
637 # Tell versions [3.59,3.63) of GNU make to not export all variables.
638 # Otherwise a system limit (for SysV at least) may be exceeded.
639 .NOEXPORT:
0 lib_LIBRARIES = libenet.a
1 libenet_a_SOURCES = host.c list.c callbacks.c packet.c peer.c protocol.c unix.c win32.c
2 INCLUDES = -Iinclude/
3
4 SUBDIRS = include
0 # Makefile.in generated by automake 1.9.3 from Makefile.am.
1 # @configure_input@
2
3 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
4 # 2003, 2004 Free Software Foundation, Inc.
5 # This Makefile.in is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12 # PARTICULAR PURPOSE.
13
14 @SET_MAKE@
15
16 SOURCES = $(libenet_a_SOURCES)
17
18 srcdir = @srcdir@
19 top_srcdir = @top_srcdir@
20 VPATH = @srcdir@
21 pkgdatadir = $(datadir)/@PACKAGE@
22 pkglibdir = $(libdir)/@PACKAGE@
23 pkgincludedir = $(includedir)/@PACKAGE@
24 top_builddir = .
25 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
26 INSTALL = @INSTALL@
27 install_sh_DATA = $(install_sh) -c -m 644
28 install_sh_PROGRAM = $(install_sh) -c
29 install_sh_SCRIPT = $(install_sh) -c
30 INSTALL_HEADER = $(INSTALL_DATA)
31 transform = $(program_transform_name)
32 NORMAL_INSTALL = :
33 PRE_INSTALL = :
34 POST_INSTALL = :
35 NORMAL_UNINSTALL = :
36 PRE_UNINSTALL = :
37 POST_UNINSTALL = :
38 subdir = .
39 DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
40 $(srcdir)/Makefile.in $(top_srcdir)/configure config.guess \
41 config.sub depcomp install-sh missing mkinstalldirs
42 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
43 am__aclocal_m4_deps = $(top_srcdir)/configure.in
44 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
45 $(ACLOCAL_M4)
46 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
47 configure.lineno configure.status.lineno
48 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
49 CONFIG_CLEAN_FILES =
50 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
51 am__vpath_adj = case $$p in \
52 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
53 *) f=$$p;; \
54 esac;
55 am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
56 am__installdirs = "$(DESTDIR)$(libdir)"
57 libLIBRARIES_INSTALL = $(INSTALL_DATA)
58 LIBRARIES = $(lib_LIBRARIES)
59 AR = ar
60 ARFLAGS = cru
61 libenet_a_AR = $(AR) $(ARFLAGS)
62 libenet_a_LIBADD =
63 am_libenet_a_OBJECTS = host.$(OBJEXT) list.$(OBJEXT) \
64 callbacks.$(OBJEXT) packet.$(OBJEXT) peer.$(OBJEXT) \
65 protocol.$(OBJEXT) unix.$(OBJEXT) win32.$(OBJEXT)
66 libenet_a_OBJECTS = $(am_libenet_a_OBJECTS)
67 DEFAULT_INCLUDES = -I. -I$(srcdir)
68 depcomp = $(SHELL) $(top_srcdir)/depcomp
69 am__depfiles_maybe = depfiles
70 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
71 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
72 CCLD = $(CC)
73 LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
74 SOURCES = $(libenet_a_SOURCES)
75 DIST_SOURCES = $(libenet_a_SOURCES)
76 RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
77 html-recursive info-recursive install-data-recursive \
78 install-exec-recursive install-info-recursive \
79 install-recursive installcheck-recursive installdirs-recursive \
80 pdf-recursive ps-recursive uninstall-info-recursive \
81 uninstall-recursive
82 ETAGS = etags
83 CTAGS = ctags
84 DIST_SUBDIRS = $(SUBDIRS)
85 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
86 distdir = $(PACKAGE)-$(VERSION)
87 top_distdir = $(distdir)
88 am__remove_distdir = \
89 { test ! -d $(distdir) \
90 || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
91 && rm -fr $(distdir); }; }
92 DIST_ARCHIVES = $(distdir).tar.gz
93 GZIP_ENV = --best
94 distuninstallcheck_listfiles = find . -type f -print
95 distcleancheck_listfiles = find . -type f -print
96 ACLOCAL = @ACLOCAL@
97 AMDEP_FALSE = @AMDEP_FALSE@
98 AMDEP_TRUE = @AMDEP_TRUE@
99 AMTAR = @AMTAR@
100 AUTOCONF = @AUTOCONF@
101 AUTOHEADER = @AUTOHEADER@
102 AUTOMAKE = @AUTOMAKE@
103 AWK = @AWK@
104 CC = @CC@
105 CCDEPMODE = @CCDEPMODE@
106 CFLAGS = @CFLAGS@
107 CPP = @CPP@
108 CPPFLAGS = @CPPFLAGS@
109 CYGPATH_W = @CYGPATH_W@
110 DEFS = @DEFS@
111 DEPDIR = @DEPDIR@
112 ECHO_C = @ECHO_C@
113 ECHO_N = @ECHO_N@
114 ECHO_T = @ECHO_T@
115 EGREP = @EGREP@
116 EXEEXT = @EXEEXT@
117 INSTALL_DATA = @INSTALL_DATA@
118 INSTALL_PROGRAM = @INSTALL_PROGRAM@
119 INSTALL_SCRIPT = @INSTALL_SCRIPT@
120 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
121 LDFLAGS = @LDFLAGS@
122 LIBOBJS = @LIBOBJS@
123 LIBS = @LIBS@
124 LTLIBOBJS = @LTLIBOBJS@
125 MAKEINFO = @MAKEINFO@
126 OBJEXT = @OBJEXT@
127 PACKAGE = @PACKAGE@
128 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
129 PACKAGE_NAME = @PACKAGE_NAME@
130 PACKAGE_STRING = @PACKAGE_STRING@
131 PACKAGE_TARNAME = @PACKAGE_TARNAME@
132 PACKAGE_VERSION = @PACKAGE_VERSION@
133 PATH_SEPARATOR = @PATH_SEPARATOR@
134 RANLIB = @RANLIB@
135 SET_MAKE = @SET_MAKE@
136 SHELL = @SHELL@
137 STRIP = @STRIP@
138 VERSION = @VERSION@
139 ac_ct_CC = @ac_ct_CC@
140 ac_ct_RANLIB = @ac_ct_RANLIB@
141 ac_ct_STRIP = @ac_ct_STRIP@
142 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
143 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
144 am__include = @am__include@
145 am__leading_dot = @am__leading_dot@
146 am__quote = @am__quote@
147 am__tar = @am__tar@
148 am__untar = @am__untar@
149 bindir = @bindir@
150 build_alias = @build_alias@
151 datadir = @datadir@
152 exec_prefix = @exec_prefix@
153 host_alias = @host_alias@
154 includedir = @includedir@
155 infodir = @infodir@
156 install_sh = @install_sh@
157 libdir = @libdir@
158 libexecdir = @libexecdir@
159 localstatedir = @localstatedir@
160 mandir = @mandir@
161 mkdir_p = @mkdir_p@
162 oldincludedir = @oldincludedir@
163 prefix = @prefix@
164 program_transform_name = @program_transform_name@
165 sbindir = @sbindir@
166 sharedstatedir = @sharedstatedir@
167 sysconfdir = @sysconfdir@
168 target_alias = @target_alias@
169 lib_LIBRARIES = libenet.a
170 libenet_a_SOURCES = host.c list.c callbacks.c packet.c peer.c protocol.c unix.c win32.c
171 INCLUDES = -Iinclude/
172 SUBDIRS = include
173 all: all-recursive
174
175 .SUFFIXES:
176 .SUFFIXES: .c .o .obj
177 am--refresh:
178 @:
179 $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
180 @for dep in $?; do \
181 case '$(am__configure_deps)' in \
182 *$$dep*) \
183 echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \
184 cd $(srcdir) && $(AUTOMAKE) --foreign \
185 && exit 0; \
186 exit 1;; \
187 esac; \
188 done; \
189 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
190 cd $(top_srcdir) && \
191 $(AUTOMAKE) --foreign Makefile
192 .PRECIOUS: Makefile
193 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
194 @case '$?' in \
195 *config.status*) \
196 echo ' $(SHELL) ./config.status'; \
197 $(SHELL) ./config.status;; \
198 *) \
199 echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
200 cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
201 esac;
202
203 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
204 $(SHELL) ./config.status --recheck
205
206 $(top_srcdir)/configure: $(am__configure_deps)
207 cd $(srcdir) && $(AUTOCONF)
208 $(ACLOCAL_M4): $(am__aclocal_m4_deps)
209 cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
210 install-libLIBRARIES: $(lib_LIBRARIES)
211 @$(NORMAL_INSTALL)
212 test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
213 @list='$(lib_LIBRARIES)'; for p in $$list; do \
214 if test -f $$p; then \
215 f=$(am__strip_dir) \
216 echo " $(libLIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
217 $(libLIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
218 else :; fi; \
219 done
220 @$(POST_INSTALL)
221 @list='$(lib_LIBRARIES)'; for p in $$list; do \
222 if test -f $$p; then \
223 p=$(am__strip_dir) \
224 echo " $(RANLIB) '$(DESTDIR)$(libdir)/$$p'"; \
225 $(RANLIB) "$(DESTDIR)$(libdir)/$$p"; \
226 else :; fi; \
227 done
228
229 uninstall-libLIBRARIES:
230 @$(NORMAL_UNINSTALL)
231 @list='$(lib_LIBRARIES)'; for p in $$list; do \
232 p=$(am__strip_dir) \
233 echo " rm -f '$(DESTDIR)$(libdir)/$$p'"; \
234 rm -f "$(DESTDIR)$(libdir)/$$p"; \
235 done
236
237 clean-libLIBRARIES:
238 -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES)
239 libenet.a: $(libenet_a_OBJECTS) $(libenet_a_DEPENDENCIES)
240 -rm -f libenet.a
241 $(libenet_a_AR) libenet.a $(libenet_a_OBJECTS) $(libenet_a_LIBADD)
242 $(RANLIB) libenet.a
243
244 mostlyclean-compile:
245 -rm -f *.$(OBJEXT)
246
247 distclean-compile:
248 -rm -f *.tab.c
249
250 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/callbacks.Po@am__quote@
251 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/host.Po@am__quote@
252 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Po@am__quote@
253 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/packet.Po@am__quote@
254 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/peer.Po@am__quote@
255 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/protocol.Po@am__quote@
256 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unix.Po@am__quote@
257 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/win32.Po@am__quote@
258
259 .c.o:
260 @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
261 @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
262 @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
263 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
264 @am__fastdepCC_FALSE@ $(COMPILE) -c $<
265
266 .c.obj:
267 @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
268 @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
269 @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
270 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
271 @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
272 uninstall-info-am:
273
274 # This directory's subdirectories are mostly independent; you can cd
275 # into them and run `make' without going through this Makefile.
276 # To change the values of `make' variables: instead of editing Makefiles,
277 # (1) if the variable is set in `config.status', edit `config.status'
278 # (which will cause the Makefiles to be regenerated when you run `make');
279 # (2) otherwise, pass the desired values on the `make' command line.
280 $(RECURSIVE_TARGETS):
281 @set fnord $$MAKEFLAGS; amf=$$2; \
282 dot_seen=no; \
283 target=`echo $@ | sed s/-recursive//`; \
284 list='$(SUBDIRS)'; for subdir in $$list; do \
285 echo "Making $$target in $$subdir"; \
286 if test "$$subdir" = "."; then \
287 dot_seen=yes; \
288 local_target="$$target-am"; \
289 else \
290 local_target="$$target"; \
291 fi; \
292 (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
293 || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
294 done; \
295 if test "$$dot_seen" = "no"; then \
296 $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
297 fi; test -z "$$fail"
298
299 mostlyclean-recursive clean-recursive distclean-recursive \
300 maintainer-clean-recursive:
301 @set fnord $$MAKEFLAGS; amf=$$2; \
302 dot_seen=no; \
303 case "$@" in \
304 distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
305 *) list='$(SUBDIRS)' ;; \
306 esac; \
307 rev=''; for subdir in $$list; do \
308 if test "$$subdir" = "."; then :; else \
309 rev="$$subdir $$rev"; \
310 fi; \
311 done; \
312 rev="$$rev ."; \
313 target=`echo $@ | sed s/-recursive//`; \
314 for subdir in $$rev; do \
315 echo "Making $$target in $$subdir"; \
316 if test "$$subdir" = "."; then \
317 local_target="$$target-am"; \
318 else \
319 local_target="$$target"; \
320 fi; \
321 (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
322 || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
323 done && test -z "$$fail"
324 tags-recursive:
325 list='$(SUBDIRS)'; for subdir in $$list; do \
326 test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
327 done
328 ctags-recursive:
329 list='$(SUBDIRS)'; for subdir in $$list; do \
330 test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
331 done
332
333 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
334 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
335 unique=`for i in $$list; do \
336 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
337 done | \
338 $(AWK) ' { files[$$0] = 1; } \
339 END { for (i in files) print i; }'`; \
340 mkid -fID $$unique
341 tags: TAGS
342
343 TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
344 $(TAGS_FILES) $(LISP)
345 tags=; \
346 here=`pwd`; \
347 if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
348 include_option=--etags-include; \
349 empty_fix=.; \
350 else \
351 include_option=--include; \
352 empty_fix=; \
353 fi; \
354 list='$(SUBDIRS)'; for subdir in $$list; do \
355 if test "$$subdir" = .; then :; else \
356 test ! -f $$subdir/TAGS || \
357 tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
358 fi; \
359 done; \
360 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
361 unique=`for i in $$list; do \
362 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
363 done | \
364 $(AWK) ' { files[$$0] = 1; } \
365 END { for (i in files) print i; }'`; \
366 if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
367 test -n "$$unique" || unique=$$empty_fix; \
368 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
369 $$tags $$unique; \
370 fi
371 ctags: CTAGS
372 CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
373 $(TAGS_FILES) $(LISP)
374 tags=; \
375 here=`pwd`; \
376 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
377 unique=`for i in $$list; do \
378 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
379 done | \
380 $(AWK) ' { files[$$0] = 1; } \
381 END { for (i in files) print i; }'`; \
382 test -z "$(CTAGS_ARGS)$$tags$$unique" \
383 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
384 $$tags $$unique
385
386 GTAGS:
387 here=`$(am__cd) $(top_builddir) && pwd` \
388 && cd $(top_srcdir) \
389 && gtags -i $(GTAGS_ARGS) $$here
390
391 distclean-tags:
392 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
393
394 distdir: $(DISTFILES)
395 $(am__remove_distdir)
396 mkdir $(distdir)
397 @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
398 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
399 list='$(DISTFILES)'; for file in $$list; do \
400 case $$file in \
401 $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
402 $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
403 esac; \
404 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
405 dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
406 if test "$$dir" != "$$file" && test "$$dir" != "."; then \
407 dir="/$$dir"; \
408 $(mkdir_p) "$(distdir)$$dir"; \
409 else \
410 dir=''; \
411 fi; \
412 if test -d $$d/$$file; then \
413 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
414 cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
415 fi; \
416 cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
417 else \
418 test -f $(distdir)/$$file \
419 || cp -p $$d/$$file $(distdir)/$$file \
420 || exit 1; \
421 fi; \
422 done
423 list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
424 if test "$$subdir" = .; then :; else \
425 test -d "$(distdir)/$$subdir" \
426 || $(mkdir_p) "$(distdir)/$$subdir" \
427 || exit 1; \
428 distdir=`$(am__cd) $(distdir) && pwd`; \
429 top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
430 (cd $$subdir && \
431 $(MAKE) $(AM_MAKEFLAGS) \
432 top_distdir="$$top_distdir" \
433 distdir="$$distdir/$$subdir" \
434 distdir) \
435 || exit 1; \
436 fi; \
437 done
438 -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
439 ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
440 ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
441 ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
442 || chmod -R a+r $(distdir)
443 dist-gzip: distdir
444 tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
445 $(am__remove_distdir)
446
447 dist-bzip2: distdir
448 tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
449 $(am__remove_distdir)
450
451 dist-tarZ: distdir
452 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
453 $(am__remove_distdir)
454
455 dist-shar: distdir
456 shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
457 $(am__remove_distdir)
458
459 dist-zip: distdir
460 -rm -f $(distdir).zip
461 zip -rq $(distdir).zip $(distdir)
462 $(am__remove_distdir)
463
464 dist dist-all: distdir
465 tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
466 $(am__remove_distdir)
467
468 # This target untars the dist file and tries a VPATH configuration. Then
469 # it guarantees that the distribution is self-contained by making another
470 # tarfile.
471 distcheck: dist
472 case '$(DIST_ARCHIVES)' in \
473 *.tar.gz*) \
474 GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
475 *.tar.bz2*) \
476 bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
477 *.tar.Z*) \
478 uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
479 *.shar.gz*) \
480 GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
481 *.zip*) \
482 unzip $(distdir).zip ;;\
483 esac
484 chmod -R a-w $(distdir); chmod a+w $(distdir)
485 mkdir $(distdir)/_build
486 mkdir $(distdir)/_inst
487 chmod a-w $(distdir)
488 dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
489 && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
490 && cd $(distdir)/_build \
491 && ../configure --srcdir=.. --prefix="$$dc_install_base" \
492 $(DISTCHECK_CONFIGURE_FLAGS) \
493 && $(MAKE) $(AM_MAKEFLAGS) \
494 && $(MAKE) $(AM_MAKEFLAGS) dvi \
495 && $(MAKE) $(AM_MAKEFLAGS) check \
496 && $(MAKE) $(AM_MAKEFLAGS) install \
497 && $(MAKE) $(AM_MAKEFLAGS) installcheck \
498 && $(MAKE) $(AM_MAKEFLAGS) uninstall \
499 && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
500 distuninstallcheck \
501 && chmod -R a-w "$$dc_install_base" \
502 && ({ \
503 (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
504 && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
505 && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
506 && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
507 distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
508 } || { rm -rf "$$dc_destdir"; exit 1; }) \
509 && rm -rf "$$dc_destdir" \
510 && $(MAKE) $(AM_MAKEFLAGS) dist \
511 && rm -rf $(DIST_ARCHIVES) \
512 && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
513 $(am__remove_distdir)
514 @(echo "$(distdir) archives ready for distribution: "; \
515 list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
516 sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
517 distuninstallcheck:
518 @cd $(distuninstallcheck_dir) \
519 && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
520 || { echo "ERROR: files left after uninstall:" ; \
521 if test -n "$(DESTDIR)"; then \
522 echo " (check DESTDIR support)"; \
523 fi ; \
524 $(distuninstallcheck_listfiles) ; \
525 exit 1; } >&2
526 distcleancheck: distclean
527 @if test '$(srcdir)' = . ; then \
528 echo "ERROR: distcleancheck can only run from a VPATH build" ; \
529 exit 1 ; \
530 fi
531 @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
532 || { echo "ERROR: files left in build directory after distclean:" ; \
533 $(distcleancheck_listfiles) ; \
534 exit 1; } >&2
535 check-am: all-am
536 check: check-recursive
537 all-am: Makefile $(LIBRARIES)
538 installdirs: installdirs-recursive
539 installdirs-am:
540 for dir in "$(DESTDIR)$(libdir)"; do \
541 test -z "$$dir" || $(mkdir_p) "$$dir"; \
542 done
543 install: install-recursive
544 install-exec: install-exec-recursive
545 install-data: install-data-recursive
546 uninstall: uninstall-recursive
547
548 install-am: all-am
549 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
550
551 installcheck: installcheck-recursive
552 install-strip:
553 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
554 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
555 `test -z '$(STRIP)' || \
556 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
557 mostlyclean-generic:
558
559 clean-generic:
560
561 distclean-generic:
562 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
563
564 maintainer-clean-generic:
565 @echo "This command is intended for maintainers to use"
566 @echo "it deletes files that may require special tools to rebuild."
567 clean: clean-recursive
568
569 clean-am: clean-generic clean-libLIBRARIES mostlyclean-am
570
571 distclean: distclean-recursive
572 -rm -f $(am__CONFIG_DISTCLEAN_FILES)
573 -rm -rf ./$(DEPDIR)
574 -rm -f Makefile
575 distclean-am: clean-am distclean-compile distclean-generic \
576 distclean-tags
577
578 dvi: dvi-recursive
579
580 dvi-am:
581
582 html: html-recursive
583
584 info: info-recursive
585
586 info-am:
587
588 install-data-am:
589
590 install-exec-am: install-libLIBRARIES
591
592 install-info: install-info-recursive
593
594 install-man:
595
596 installcheck-am:
597
598 maintainer-clean: maintainer-clean-recursive
599 -rm -f $(am__CONFIG_DISTCLEAN_FILES)
600 -rm -rf $(top_srcdir)/autom4te.cache
601 -rm -rf ./$(DEPDIR)
602 -rm -f Makefile
603 maintainer-clean-am: distclean-am maintainer-clean-generic
604
605 mostlyclean: mostlyclean-recursive
606
607 mostlyclean-am: mostlyclean-compile mostlyclean-generic
608
609 pdf: pdf-recursive
610
611 pdf-am:
612
613 ps: ps-recursive
614
615 ps-am:
616
617 uninstall-am: uninstall-info-am uninstall-libLIBRARIES
618
619 uninstall-info: uninstall-info-recursive
620
621 .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
622 check-am clean clean-generic clean-libLIBRARIES \
623 clean-recursive ctags ctags-recursive dist dist-all dist-bzip2 \
624 dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \
625 distclean-compile distclean-generic distclean-recursive \
626 distclean-tags distcleancheck distdir distuninstallcheck dvi \
627 dvi-am html html-am info info-am install install-am \
628 install-data install-data-am install-exec install-exec-am \
629 install-info install-info-am install-libLIBRARIES install-man \
630 install-strip installcheck installcheck-am installdirs \
631 installdirs-am maintainer-clean maintainer-clean-generic \
632 maintainer-clean-recursive mostlyclean mostlyclean-compile \
633 mostlyclean-generic mostlyclean-recursive pdf pdf-am ps ps-am \
634 tags tags-recursive uninstall uninstall-am uninstall-info-am \
635 uninstall-libLIBRARIES
636
637 # Tell versions [3.59,3.63) of GNU make to not export all variables.
638 # Otherwise a system limit (for SysV at least) may be exceeded.
639 .NOEXPORT:
0 Please visit the ENet homepage at http://enet.bespin.org for installation
1 and usage instructions.
2
3 If you obtained this package from CVS, the quick description on how to build
4 is:
5
6 # Generate the build system.
7
8 aclocal && automake -a -c --foreign && autoconf
9
10 # Compile and install the library.
11
12 ./configure && make && make install
13
0 # generated automatically by aclocal 1.9.3 -*- Autoconf -*-
1
2 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
3 # Free Software Foundation, Inc.
4 # This file is free software; the Free Software Foundation
5 # gives unlimited permission to copy and/or distribute it,
6 # with or without modifications, as long as this notice is preserved.
7
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 # PARTICULAR PURPOSE.
12
13 # -*- Autoconf -*-
14 # Copyright (C) 2002, 2003 Free Software Foundation, Inc.
15 # Generated from amversion.in; do not edit by hand.
16
17 # This program is free software; you can redistribute it and/or modify
18 # it under the terms of the GNU General Public License as published by
19 # the Free Software Foundation; either version 2, or (at your option)
20 # any later version.
21
22 # This program is distributed in the hope that it will be useful,
23 # but WITHOUT ANY WARRANTY; without even the implied warranty of
24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 # GNU General Public License for more details.
26
27 # You should have received a copy of the GNU General Public License
28 # along with this program; if not, write to the Free Software
29 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
30
31 # AM_AUTOMAKE_VERSION(VERSION)
32 # ----------------------------
33 # Automake X.Y traces this macro to ensure aclocal.m4 has been
34 # generated from the m4 files accompanying Automake X.Y.
35 AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
36
37 # AM_SET_CURRENT_AUTOMAKE_VERSION
38 # -------------------------------
39 # Call AM_AUTOMAKE_VERSION so it can be traced.
40 # This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
41 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
42 [AM_AUTOMAKE_VERSION([1.9.3])])
43
44 # AM_AUX_DIR_EXPAND
45
46 # Copyright (C) 2001, 2003 Free Software Foundation, Inc.
47
48 # This program is free software; you can redistribute it and/or modify
49 # it under the terms of the GNU General Public License as published by
50 # the Free Software Foundation; either version 2, or (at your option)
51 # any later version.
52
53 # This program is distributed in the hope that it will be useful,
54 # but WITHOUT ANY WARRANTY; without even the implied warranty of
55 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
56 # GNU General Public License for more details.
57
58 # You should have received a copy of the GNU General Public License
59 # along with this program; if not, write to the Free Software
60 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
61 # 02111-1307, USA.
62
63 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
64 # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
65 # `$srcdir', `$srcdir/..', or `$srcdir/../..'.
66 #
67 # Of course, Automake must honor this variable whenever it calls a
68 # tool from the auxiliary directory. The problem is that $srcdir (and
69 # therefore $ac_aux_dir as well) can be either absolute or relative,
70 # depending on how configure is run. This is pretty annoying, since
71 # it makes $ac_aux_dir quite unusable in subdirectories: in the top
72 # source directory, any form will work fine, but in subdirectories a
73 # relative path needs to be adjusted first.
74 #
75 # $ac_aux_dir/missing
76 # fails when called from a subdirectory if $ac_aux_dir is relative
77 # $top_srcdir/$ac_aux_dir/missing
78 # fails if $ac_aux_dir is absolute,
79 # fails when called from a subdirectory in a VPATH build with
80 # a relative $ac_aux_dir
81 #
82 # The reason of the latter failure is that $top_srcdir and $ac_aux_dir
83 # are both prefixed by $srcdir. In an in-source build this is usually
84 # harmless because $srcdir is `.', but things will broke when you
85 # start a VPATH build or use an absolute $srcdir.
86 #
87 # So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
88 # iff we strip the leading $srcdir from $ac_aux_dir. That would be:
89 # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
90 # and then we would define $MISSING as
91 # MISSING="\${SHELL} $am_aux_dir/missing"
92 # This will work as long as MISSING is not called from configure, because
93 # unfortunately $(top_srcdir) has no meaning in configure.
94 # However there are other variables, like CC, which are often used in
95 # configure, and could therefore not use this "fixed" $ac_aux_dir.
96 #
97 # Another solution, used here, is to always expand $ac_aux_dir to an
98 # absolute PATH. The drawback is that using absolute paths prevent a
99 # configured tree to be moved without reconfiguration.
100
101 AC_DEFUN([AM_AUX_DIR_EXPAND],
102 [dnl Rely on autoconf to set up CDPATH properly.
103 AC_PREREQ([2.50])dnl
104 # expand $ac_aux_dir to an absolute path
105 am_aux_dir=`cd $ac_aux_dir && pwd`
106 ])
107
108 # AM_CONDITIONAL -*- Autoconf -*-
109
110 # Copyright (C) 1997, 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
111
112 # This program is free software; you can redistribute it and/or modify
113 # it under the terms of the GNU General Public License as published by
114 # the Free Software Foundation; either version 2, or (at your option)
115 # any later version.
116
117 # This program is distributed in the hope that it will be useful,
118 # but WITHOUT ANY WARRANTY; without even the implied warranty of
119 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
120 # GNU General Public License for more details.
121
122 # You should have received a copy of the GNU General Public License
123 # along with this program; if not, write to the Free Software
124 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
125 # 02111-1307, USA.
126
127 # serial 6
128
129 # AM_CONDITIONAL(NAME, SHELL-CONDITION)
130 # -------------------------------------
131 # Define a conditional.
132 AC_DEFUN([AM_CONDITIONAL],
133 [AC_PREREQ(2.52)dnl
134 ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
135 [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
136 AC_SUBST([$1_TRUE])
137 AC_SUBST([$1_FALSE])
138 if $2; then
139 $1_TRUE=
140 $1_FALSE='#'
141 else
142 $1_TRUE='#'
143 $1_FALSE=
144 fi
145 AC_CONFIG_COMMANDS_PRE(
146 [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
147 AC_MSG_ERROR([[conditional "$1" was never defined.
148 Usually this means the macro was only invoked conditionally.]])
149 fi])])
150
151 # serial 7 -*- Autoconf -*-
152
153 # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
154 # Free Software Foundation, Inc.
155
156 # This program is free software; you can redistribute it and/or modify
157 # it under the terms of the GNU General Public License as published by
158 # the Free Software Foundation; either version 2, or (at your option)
159 # any later version.
160
161 # This program is distributed in the hope that it will be useful,
162 # but WITHOUT ANY WARRANTY; without even the implied warranty of
163 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
164 # GNU General Public License for more details.
165
166 # You should have received a copy of the GNU General Public License
167 # along with this program; if not, write to the Free Software
168 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
169 # 02111-1307, USA.
170
171
172 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
173 # written in clear, in which case automake, when reading aclocal.m4,
174 # will think it sees a *use*, and therefore will trigger all it's
175 # C support machinery. Also note that it means that autoscan, seeing
176 # CC etc. in the Makefile, will ask for an AC_PROG_CC use...
177
178
179
180 # _AM_DEPENDENCIES(NAME)
181 # ----------------------
182 # See how the compiler implements dependency checking.
183 # NAME is "CC", "CXX", "GCJ", or "OBJC".
184 # We try a few techniques and use that to set a single cache variable.
185 #
186 # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
187 # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
188 # dependency, and given that the user is not expected to run this macro,
189 # just rely on AC_PROG_CC.
190 AC_DEFUN([_AM_DEPENDENCIES],
191 [AC_REQUIRE([AM_SET_DEPDIR])dnl
192 AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
193 AC_REQUIRE([AM_MAKE_INCLUDE])dnl
194 AC_REQUIRE([AM_DEP_TRACK])dnl
195
196 ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
197 [$1], CXX, [depcc="$CXX" am_compiler_list=],
198 [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
199 [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
200 [depcc="$$1" am_compiler_list=])
201
202 AC_CACHE_CHECK([dependency style of $depcc],
203 [am_cv_$1_dependencies_compiler_type],
204 [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
205 # We make a subdir and do the tests there. Otherwise we can end up
206 # making bogus files that we don't know about and never remove. For
207 # instance it was reported that on HP-UX the gcc test will end up
208 # making a dummy file named `D' -- because `-MD' means `put the output
209 # in D'.
210 mkdir conftest.dir
211 # Copy depcomp to subdir because otherwise we won't find it if we're
212 # using a relative directory.
213 cp "$am_depcomp" conftest.dir
214 cd conftest.dir
215 # We will build objects and dependencies in a subdirectory because
216 # it helps to detect inapplicable dependency modes. For instance
217 # both Tru64's cc and ICC support -MD to output dependencies as a
218 # side effect of compilation, but ICC will put the dependencies in
219 # the current directory while Tru64 will put them in the object
220 # directory.
221 mkdir sub
222
223 am_cv_$1_dependencies_compiler_type=none
224 if test "$am_compiler_list" = ""; then
225 am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
226 fi
227 for depmode in $am_compiler_list; do
228 # Setup a source with many dependencies, because some compilers
229 # like to wrap large dependency lists on column 80 (with \), and
230 # we should not choose a depcomp mode which is confused by this.
231 #
232 # We need to recreate these files for each test, as the compiler may
233 # overwrite some of them when testing with obscure command lines.
234 # This happens at least with the AIX C compiler.
235 : > sub/conftest.c
236 for i in 1 2 3 4 5 6; do
237 echo '#include "conftst'$i'.h"' >> sub/conftest.c
238 # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
239 # Solaris 8's {/usr,}/bin/sh.
240 touch sub/conftst$i.h
241 done
242 echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
243
244 case $depmode in
245 nosideeffect)
246 # after this tag, mechanisms are not by side-effect, so they'll
247 # only be used when explicitly requested
248 if test "x$enable_dependency_tracking" = xyes; then
249 continue
250 else
251 break
252 fi
253 ;;
254 none) break ;;
255 esac
256 # We check with `-c' and `-o' for the sake of the "dashmstdout"
257 # mode. It turns out that the SunPro C++ compiler does not properly
258 # handle `-M -o', and we need to detect this.
259 if depmode=$depmode \
260 source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
261 depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
262 $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
263 >/dev/null 2>conftest.err &&
264 grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
265 grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
266 ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
267 # icc doesn't choke on unknown options, it will just issue warnings
268 # or remarks (even with -Werror). So we grep stderr for any message
269 # that says an option was ignored or not supported.
270 # When given -MP, icc 7.0 and 7.1 complain thusly:
271 # icc: Command line warning: ignoring option '-M'; no argument required
272 # The diagnosis changed in icc 8.0:
273 # icc: Command line remark: option '-MP' not supported
274 if (grep 'ignoring option' conftest.err ||
275 grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
276 am_cv_$1_dependencies_compiler_type=$depmode
277 break
278 fi
279 fi
280 done
281
282 cd ..
283 rm -rf conftest.dir
284 else
285 am_cv_$1_dependencies_compiler_type=none
286 fi
287 ])
288 AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
289 AM_CONDITIONAL([am__fastdep$1], [
290 test "x$enable_dependency_tracking" != xno \
291 && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
292 ])
293
294
295 # AM_SET_DEPDIR
296 # -------------
297 # Choose a directory name for dependency files.
298 # This macro is AC_REQUIREd in _AM_DEPENDENCIES
299 AC_DEFUN([AM_SET_DEPDIR],
300 [AC_REQUIRE([AM_SET_LEADING_DOT])dnl
301 AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
302 ])
303
304
305 # AM_DEP_TRACK
306 # ------------
307 AC_DEFUN([AM_DEP_TRACK],
308 [AC_ARG_ENABLE(dependency-tracking,
309 [ --disable-dependency-tracking speeds up one-time build
310 --enable-dependency-tracking do not reject slow dependency extractors])
311 if test "x$enable_dependency_tracking" != xno; then
312 am_depcomp="$ac_aux_dir/depcomp"
313 AMDEPBACKSLASH='\'
314 fi
315 AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
316 AC_SUBST([AMDEPBACKSLASH])
317 ])
318
319 # Generate code to set up dependency tracking. -*- Autoconf -*-
320
321 # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
322 # Free Software Foundation, Inc.
323
324 # This program is free software; you can redistribute it and/or modify
325 # it under the terms of the GNU General Public License as published by
326 # the Free Software Foundation; either version 2, or (at your option)
327 # any later version.
328
329 # This program is distributed in the hope that it will be useful,
330 # but WITHOUT ANY WARRANTY; without even the implied warranty of
331 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
332 # GNU General Public License for more details.
333
334 # You should have received a copy of the GNU General Public License
335 # along with this program; if not, write to the Free Software
336 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
337 # 02111-1307, USA.
338
339 #serial 2
340
341 # _AM_OUTPUT_DEPENDENCY_COMMANDS
342 # ------------------------------
343 AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
344 [for mf in $CONFIG_FILES; do
345 # Strip MF so we end up with the name of the file.
346 mf=`echo "$mf" | sed -e 's/:.*$//'`
347 # Check whether this is an Automake generated Makefile or not.
348 # We used to match only the files named `Makefile.in', but
349 # some people rename them; so instead we look at the file content.
350 # Grep'ing the first line is not enough: some people post-process
351 # each Makefile.in and add a new line on top of each file to say so.
352 # So let's grep whole file.
353 if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
354 dirpart=`AS_DIRNAME("$mf")`
355 else
356 continue
357 fi
358 # Extract the definition of DEPDIR, am__include, and am__quote
359 # from the Makefile without running `make'.
360 DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
361 test -z "$DEPDIR" && continue
362 am__include=`sed -n 's/^am__include = //p' < "$mf"`
363 test -z "am__include" && continue
364 am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
365 # When using ansi2knr, U may be empty or an underscore; expand it
366 U=`sed -n 's/^U = //p' < "$mf"`
367 # Find all dependency output files, they are included files with
368 # $(DEPDIR) in their names. We invoke sed twice because it is the
369 # simplest approach to changing $(DEPDIR) to its actual value in the
370 # expansion.
371 for file in `sed -n "
372 s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
373 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
374 # Make sure the directory exists.
375 test -f "$dirpart/$file" && continue
376 fdir=`AS_DIRNAME(["$file"])`
377 AS_MKDIR_P([$dirpart/$fdir])
378 # echo "creating $dirpart/$file"
379 echo '# dummy' > "$dirpart/$file"
380 done
381 done
382 ])# _AM_OUTPUT_DEPENDENCY_COMMANDS
383
384
385 # AM_OUTPUT_DEPENDENCY_COMMANDS
386 # -----------------------------
387 # This macro should only be invoked once -- use via AC_REQUIRE.
388 #
389 # This code is only required when automatic dependency tracking
390 # is enabled. FIXME. This creates each `.P' file that we will
391 # need in order to bootstrap the dependency handling code.
392 AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
393 [AC_CONFIG_COMMANDS([depfiles],
394 [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
395 [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
396 ])
397
398 # Do all the work for Automake. -*- Autoconf -*-
399
400 # This macro actually does too much some checks are only needed if
401 # your package does certain things. But this isn't really a big deal.
402
403 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
404 # Free Software Foundation, Inc.
405
406 # This program is free software; you can redistribute it and/or modify
407 # it under the terms of the GNU General Public License as published by
408 # the Free Software Foundation; either version 2, or (at your option)
409 # any later version.
410
411 # This program is distributed in the hope that it will be useful,
412 # but WITHOUT ANY WARRANTY; without even the implied warranty of
413 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
414 # GNU General Public License for more details.
415
416 # You should have received a copy of the GNU General Public License
417 # along with this program; if not, write to the Free Software
418 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
419 # 02111-1307, USA.
420
421 # serial 11
422
423 # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
424 # AM_INIT_AUTOMAKE([OPTIONS])
425 # -----------------------------------------------
426 # The call with PACKAGE and VERSION arguments is the old style
427 # call (pre autoconf-2.50), which is being phased out. PACKAGE
428 # and VERSION should now be passed to AC_INIT and removed from
429 # the call to AM_INIT_AUTOMAKE.
430 # We support both call styles for the transition. After
431 # the next Automake release, Autoconf can make the AC_INIT
432 # arguments mandatory, and then we can depend on a new Autoconf
433 # release and drop the old call support.
434 AC_DEFUN([AM_INIT_AUTOMAKE],
435 [AC_PREREQ([2.58])dnl
436 dnl Autoconf wants to disallow AM_ names. We explicitly allow
437 dnl the ones we care about.
438 m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
439 AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
440 AC_REQUIRE([AC_PROG_INSTALL])dnl
441 # test to see if srcdir already configured
442 if test "`cd $srcdir && pwd`" != "`pwd`" &&
443 test -f $srcdir/config.status; then
444 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
445 fi
446
447 # test whether we have cygpath
448 if test -z "$CYGPATH_W"; then
449 if (cygpath --version) >/dev/null 2>/dev/null; then
450 CYGPATH_W='cygpath -w'
451 else
452 CYGPATH_W=echo
453 fi
454 fi
455 AC_SUBST([CYGPATH_W])
456
457 # Define the identity of the package.
458 dnl Distinguish between old-style and new-style calls.
459 m4_ifval([$2],
460 [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
461 AC_SUBST([PACKAGE], [$1])dnl
462 AC_SUBST([VERSION], [$2])],
463 [_AM_SET_OPTIONS([$1])dnl
464 AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
465 AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
466
467 _AM_IF_OPTION([no-define],,
468 [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
469 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
470
471 # Some tools Automake needs.
472 AC_REQUIRE([AM_SANITY_CHECK])dnl
473 AC_REQUIRE([AC_ARG_PROGRAM])dnl
474 AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
475 AM_MISSING_PROG(AUTOCONF, autoconf)
476 AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
477 AM_MISSING_PROG(AUTOHEADER, autoheader)
478 AM_MISSING_PROG(MAKEINFO, makeinfo)
479 AM_PROG_INSTALL_SH
480 AM_PROG_INSTALL_STRIP
481 AC_REQUIRE([AM_PROG_MKDIR_P])dnl
482 # We need awk for the "check" target. The system "awk" is bad on
483 # some platforms.
484 AC_REQUIRE([AC_PROG_AWK])dnl
485 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
486 AC_REQUIRE([AM_SET_LEADING_DOT])dnl
487 _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
488 [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
489 [_AM_PROG_TAR([v7])])])
490 _AM_IF_OPTION([no-dependencies],,
491 [AC_PROVIDE_IFELSE([AC_PROG_CC],
492 [_AM_DEPENDENCIES(CC)],
493 [define([AC_PROG_CC],
494 defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
495 AC_PROVIDE_IFELSE([AC_PROG_CXX],
496 [_AM_DEPENDENCIES(CXX)],
497 [define([AC_PROG_CXX],
498 defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
499 ])
500 ])
501
502
503 # When config.status generates a header, we must update the stamp-h file.
504 # This file resides in the same directory as the config header
505 # that is generated. The stamp files are numbered to have different names.
506
507 # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
508 # loop where config.status creates the headers, so we can generate
509 # our stamp files there.
510 AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
511 [# Compute $1's index in $config_headers.
512 _am_stamp_count=1
513 for _am_header in $config_headers :; do
514 case $_am_header in
515 $1 | $1:* )
516 break ;;
517 * )
518 _am_stamp_count=`expr $_am_stamp_count + 1` ;;
519 esac
520 done
521 echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
522
523 # AM_PROG_INSTALL_SH
524 # ------------------
525 # Define $install_sh.
526
527 # Copyright (C) 2001, 2003 Free Software Foundation, Inc.
528
529 # This program is free software; you can redistribute it and/or modify
530 # it under the terms of the GNU General Public License as published by
531 # the Free Software Foundation; either version 2, or (at your option)
532 # any later version.
533
534 # This program is distributed in the hope that it will be useful,
535 # but WITHOUT ANY WARRANTY; without even the implied warranty of
536 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
537 # GNU General Public License for more details.
538
539 # You should have received a copy of the GNU General Public License
540 # along with this program; if not, write to the Free Software
541 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
542 # 02111-1307, USA.
543
544 AC_DEFUN([AM_PROG_INSTALL_SH],
545 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
546 install_sh=${install_sh-"$am_aux_dir/install-sh"}
547 AC_SUBST(install_sh)])
548
549 # -*- Autoconf -*-
550 # Copyright (C) 2003 Free Software Foundation, Inc.
551
552 # This program is free software; you can redistribute it and/or modify
553 # it under the terms of the GNU General Public License as published by
554 # the Free Software Foundation; either version 2, or (at your option)
555 # any later version.
556
557 # This program is distributed in the hope that it will be useful,
558 # but WITHOUT ANY WARRANTY; without even the implied warranty of
559 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
560 # GNU General Public License for more details.
561
562 # You should have received a copy of the GNU General Public License
563 # along with this program; if not, write to the Free Software
564 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
565 # 02111-1307, USA.
566
567 # serial 1
568
569 # Check whether the underlying file-system supports filenames
570 # with a leading dot. For instance MS-DOS doesn't.
571 AC_DEFUN([AM_SET_LEADING_DOT],
572 [rm -rf .tst 2>/dev/null
573 mkdir .tst 2>/dev/null
574 if test -d .tst; then
575 am__leading_dot=.
576 else
577 am__leading_dot=_
578 fi
579 rmdir .tst 2>/dev/null
580 AC_SUBST([am__leading_dot])])
581
582 # Check to see how 'make' treats includes. -*- Autoconf -*-
583
584 # Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
585
586 # This program is free software; you can redistribute it and/or modify
587 # it under the terms of the GNU General Public License as published by
588 # the Free Software Foundation; either version 2, or (at your option)
589 # any later version.
590
591 # This program is distributed in the hope that it will be useful,
592 # but WITHOUT ANY WARRANTY; without even the implied warranty of
593 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
594 # GNU General Public License for more details.
595
596 # You should have received a copy of the GNU General Public License
597 # along with this program; if not, write to the Free Software
598 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
599 # 02111-1307, USA.
600
601 # serial 2
602
603 # AM_MAKE_INCLUDE()
604 # -----------------
605 # Check to see how make treats includes.
606 AC_DEFUN([AM_MAKE_INCLUDE],
607 [am_make=${MAKE-make}
608 cat > confinc << 'END'
609 am__doit:
610 @echo done
611 .PHONY: am__doit
612 END
613 # If we don't find an include directive, just comment out the code.
614 AC_MSG_CHECKING([for style of include used by $am_make])
615 am__include="#"
616 am__quote=
617 _am_result=none
618 # First try GNU make style include.
619 echo "include confinc" > confmf
620 # We grep out `Entering directory' and `Leaving directory'
621 # messages which can occur if `w' ends up in MAKEFLAGS.
622 # In particular we don't look at `^make:' because GNU make might
623 # be invoked under some other name (usually "gmake"), in which
624 # case it prints its new name instead of `make'.
625 if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
626 am__include=include
627 am__quote=
628 _am_result=GNU
629 fi
630 # Now try BSD make style include.
631 if test "$am__include" = "#"; then
632 echo '.include "confinc"' > confmf
633 if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
634 am__include=.include
635 am__quote="\""
636 _am_result=BSD
637 fi
638 fi
639 AC_SUBST([am__include])
640 AC_SUBST([am__quote])
641 AC_MSG_RESULT([$_am_result])
642 rm -f confinc confmf
643 ])
644
645 # -*- Autoconf -*-
646
647
648 # Copyright (C) 1997, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
649
650 # This program is free software; you can redistribute it and/or modify
651 # it under the terms of the GNU General Public License as published by
652 # the Free Software Foundation; either version 2, or (at your option)
653 # any later version.
654
655 # This program is distributed in the hope that it will be useful,
656 # but WITHOUT ANY WARRANTY; without even the implied warranty of
657 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
658 # GNU General Public License for more details.
659
660 # You should have received a copy of the GNU General Public License
661 # along with this program; if not, write to the Free Software
662 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
663 # 02111-1307, USA.
664
665 # serial 3
666
667 # AM_MISSING_PROG(NAME, PROGRAM)
668 # ------------------------------
669 AC_DEFUN([AM_MISSING_PROG],
670 [AC_REQUIRE([AM_MISSING_HAS_RUN])
671 $1=${$1-"${am_missing_run}$2"}
672 AC_SUBST($1)])
673
674
675 # AM_MISSING_HAS_RUN
676 # ------------------
677 # Define MISSING if not defined so far and test if it supports --run.
678 # If it does, set am_missing_run to use it, otherwise, to nothing.
679 AC_DEFUN([AM_MISSING_HAS_RUN],
680 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
681 test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
682 # Use eval to expand $SHELL
683 if eval "$MISSING --run true"; then
684 am_missing_run="$MISSING --run "
685 else
686 am_missing_run=
687 AC_MSG_WARN([`missing' script is too old or missing])
688 fi
689 ])
690
691 # AM_PROG_MKDIR_P
692 # ---------------
693 # Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
694
695 # Copyright (C) 2003, 2004 Free Software Foundation, Inc.
696
697 # This program is free software; you can redistribute it and/or modify
698 # it under the terms of the GNU General Public License as published by
699 # the Free Software Foundation; either version 2, or (at your option)
700 # any later version.
701
702 # This program is distributed in the hope that it will be useful,
703 # but WITHOUT ANY WARRANTY; without even the implied warranty of
704 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
705 # GNU General Public License for more details.
706
707 # You should have received a copy of the GNU General Public License
708 # along with this program; if not, write to the Free Software
709 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
710 # 02111-1307, USA.
711
712 # Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
713 # created by `make install' are always world readable, even if the
714 # installer happens to have an overly restrictive umask (e.g. 077).
715 # This was a mistake. There are at least two reasons why we must not
716 # use `-m 0755':
717 # - it causes special bits like SGID to be ignored,
718 # - it may be too restrictive (some setups expect 775 directories).
719 #
720 # Do not use -m 0755 and let people choose whatever they expect by
721 # setting umask.
722 #
723 # We cannot accept any implementation of `mkdir' that recognizes `-p'.
724 # Some implementations (such as Solaris 8's) are not thread-safe: if a
725 # parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
726 # concurrently, both version can detect that a/ is missing, but only
727 # one can create it and the other will error out. Consequently we
728 # restrict ourselves to GNU make (using the --version option ensures
729 # this.)
730 AC_DEFUN([AM_PROG_MKDIR_P],
731 [if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
732 # We used to keeping the `.' as first argument, in order to
733 # allow $(mkdir_p) to be used without argument. As in
734 # $(mkdir_p) $(somedir)
735 # where $(somedir) is conditionally defined. However this is wrong
736 # for two reasons:
737 # 1. if the package is installed by a user who cannot write `.'
738 # make install will fail,
739 # 2. the above comment should most certainly read
740 # $(mkdir_p) $(DESTDIR)$(somedir)
741 # so it does not work when $(somedir) is undefined and
742 # $(DESTDIR) is not.
743 # To support the latter case, we have to write
744 # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
745 # so the `.' trick is pointless.
746 mkdir_p='mkdir -p --'
747 else
748 # On NextStep and OpenStep, the `mkdir' command does not
749 # recognize any option. It will interpret all options as
750 # directories to create, and then abort because `.' already
751 # exists.
752 for d in ./-p ./--version;
753 do
754 test -d $d && rmdir $d
755 done
756 # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
757 if test -f "$ac_aux_dir/mkinstalldirs"; then
758 mkdir_p='$(mkinstalldirs)'
759 else
760 mkdir_p='$(install_sh) -d'
761 fi
762 fi
763 AC_SUBST([mkdir_p])])
764
765 # Helper functions for option handling. -*- Autoconf -*-
766
767 # Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
768
769 # This program is free software; you can redistribute it and/or modify
770 # it under the terms of the GNU General Public License as published by
771 # the Free Software Foundation; either version 2, or (at your option)
772 # any later version.
773
774 # This program is distributed in the hope that it will be useful,
775 # but WITHOUT ANY WARRANTY; without even the implied warranty of
776 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
777 # GNU General Public License for more details.
778
779 # You should have received a copy of the GNU General Public License
780 # along with this program; if not, write to the Free Software
781 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
782 # 02111-1307, USA.
783
784 # serial 2
785
786 # _AM_MANGLE_OPTION(NAME)
787 # -----------------------
788 AC_DEFUN([_AM_MANGLE_OPTION],
789 [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
790
791 # _AM_SET_OPTION(NAME)
792 # ------------------------------
793 # Set option NAME. Presently that only means defining a flag for this option.
794 AC_DEFUN([_AM_SET_OPTION],
795 [m4_define(_AM_MANGLE_OPTION([$1]), 1)])
796
797 # _AM_SET_OPTIONS(OPTIONS)
798 # ----------------------------------
799 # OPTIONS is a space-separated list of Automake options.
800 AC_DEFUN([_AM_SET_OPTIONS],
801 [AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
802
803 # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
804 # -------------------------------------------
805 # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
806 AC_DEFUN([_AM_IF_OPTION],
807 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
808
809 #
810 # Check to make sure that the build environment is sane.
811 #
812
813 # Copyright (C) 1996, 1997, 2000, 2001, 2003 Free Software Foundation, Inc.
814
815 # This program is free software; you can redistribute it and/or modify
816 # it under the terms of the GNU General Public License as published by
817 # the Free Software Foundation; either version 2, or (at your option)
818 # any later version.
819
820 # This program is distributed in the hope that it will be useful,
821 # but WITHOUT ANY WARRANTY; without even the implied warranty of
822 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
823 # GNU General Public License for more details.
824
825 # You should have received a copy of the GNU General Public License
826 # along with this program; if not, write to the Free Software
827 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
828 # 02111-1307, USA.
829
830 # serial 3
831
832 # AM_SANITY_CHECK
833 # ---------------
834 AC_DEFUN([AM_SANITY_CHECK],
835 [AC_MSG_CHECKING([whether build environment is sane])
836 # Just in case
837 sleep 1
838 echo timestamp > conftest.file
839 # Do `set' in a subshell so we don't clobber the current shell's
840 # arguments. Must try -L first in case configure is actually a
841 # symlink; some systems play weird games with the mod time of symlinks
842 # (eg FreeBSD returns the mod time of the symlink's containing
843 # directory).
844 if (
845 set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
846 if test "$[*]" = "X"; then
847 # -L didn't work.
848 set X `ls -t $srcdir/configure conftest.file`
849 fi
850 rm -f conftest.file
851 if test "$[*]" != "X $srcdir/configure conftest.file" \
852 && test "$[*]" != "X conftest.file $srcdir/configure"; then
853
854 # If neither matched, then we have a broken ls. This can happen
855 # if, for instance, CONFIG_SHELL is bash and it inherits a
856 # broken ls alias from the environment. This has actually
857 # happened. Such a system could not be considered "sane".
858 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
859 alias in your environment])
860 fi
861
862 test "$[2]" = conftest.file
863 )
864 then
865 # Ok.
866 :
867 else
868 AC_MSG_ERROR([newly created file is older than distributed files!
869 Check your system clock])
870 fi
871 AC_MSG_RESULT(yes)])
872
873 # AM_PROG_INSTALL_STRIP
874
875 # Copyright (C) 2001, 2003 Free Software Foundation, Inc.
876
877 # This program is free software; you can redistribute it and/or modify
878 # it under the terms of the GNU General Public License as published by
879 # the Free Software Foundation; either version 2, or (at your option)
880 # any later version.
881
882 # This program is distributed in the hope that it will be useful,
883 # but WITHOUT ANY WARRANTY; without even the implied warranty of
884 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
885 # GNU General Public License for more details.
886
887 # You should have received a copy of the GNU General Public License
888 # along with this program; if not, write to the Free Software
889 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
890 # 02111-1307, USA.
891
892 # One issue with vendor `install' (even GNU) is that you can't
893 # specify the program used to strip binaries. This is especially
894 # annoying in cross-compiling environments, where the build's strip
895 # is unlikely to handle the host's binaries.
896 # Fortunately install-sh will honor a STRIPPROG variable, so we
897 # always use install-sh in `make install-strip', and initialize
898 # STRIPPROG with the value of the STRIP variable (set by the user).
899 AC_DEFUN([AM_PROG_INSTALL_STRIP],
900 [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
901 # Installed binaries are usually stripped using `strip' when the user
902 # run `make install-strip'. However `strip' might not be the right
903 # tool to use in cross-compilation environments, therefore Automake
904 # will honor the `STRIP' environment variable to overrule this program.
905 dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
906 if test "$cross_compiling" != no; then
907 AC_CHECK_TOOL([STRIP], [strip], :)
908 fi
909 INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
910 AC_SUBST([INSTALL_STRIP_PROGRAM])])
911
912 # Check how to create a tarball. -*- Autoconf -*-
913
914 # Copyright (C) 2004 Free Software Foundation, Inc.
915
916 # This program is free software; you can redistribute it and/or modify
917 # it under the terms of the GNU General Public License as published by
918 # the Free Software Foundation; either version 2, or (at your option)
919 # any later version.
920
921 # This program is distributed in the hope that it will be useful,
922 # but WITHOUT ANY WARRANTY; without even the implied warranty of
923 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
924 # GNU General Public License for more details.
925
926 # You should have received a copy of the GNU General Public License
927 # along with this program; if not, write to the Free Software
928 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
929 # 02111-1307, USA.
930
931 # serial 1
932
933
934 # _AM_PROG_TAR(FORMAT)
935 # --------------------
936 # Check how to create a tarball in format FORMAT.
937 # FORMAT should be one of `v7', `ustar', or `pax'.
938 #
939 # Substitute a variable $(am__tar) that is a command
940 # writing to stdout a FORMAT-tarball containing the directory
941 # $tardir.
942 # tardir=directory && $(am__tar) > result.tar
943 #
944 # Substitute a variable $(am__untar) that extract such
945 # a tarball read from stdin.
946 # $(am__untar) < result.tar
947 AC_DEFUN([_AM_PROG_TAR],
948 [# Always define AMTAR for backward compatibility.
949 AM_MISSING_PROG([AMTAR], [tar])
950 m4_if([$1], [v7],
951 [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
952 [m4_case([$1], [ustar],, [pax],,
953 [m4_fatal([Unknown tar format])])
954 AC_MSG_CHECKING([how to create a $1 tar archive])
955 # Loop over all known methods to create a tar archive until one works.
956 _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
957 _am_tools=${am_cv_prog_tar_$1-$_am_tools}
958 # Do not fold the above two line into one, because Tru64 sh and
959 # Solaris sh will not grok spaces in the rhs of `-'.
960 for _am_tool in $_am_tools
961 do
962 case $_am_tool in
963 gnutar)
964 for _am_tar in tar gnutar gtar;
965 do
966 AM_RUN_LOG([$_am_tar --version]) && break
967 done
968 am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
969 am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
970 am__untar="$_am_tar -xf -"
971 ;;
972 plaintar)
973 # Must skip GNU tar: if it does not support --format= it doesn't create
974 # ustar tarball either.
975 (tar --version) >/dev/null 2>&1 && continue
976 am__tar='tar chf - "$$tardir"'
977 am__tar_='tar chf - "$tardir"'
978 am__untar='tar xf -'
979 ;;
980 pax)
981 am__tar='pax -L -x $1 -w "$$tardir"'
982 am__tar_='pax -L -x $1 -w "$tardir"'
983 am__untar='pax -r'
984 ;;
985 cpio)
986 am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
987 am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
988 am__untar='cpio -i -H $1 -d'
989 ;;
990 none)
991 am__tar=false
992 am__tar_=false
993 am__untar=false
994 ;;
995 esac
996
997 # If the value was cached, stop now. We just wanted to have am__tar
998 # and am__untar set.
999 test -n "${am_cv_prog_tar_$1}" && break
1000
1001 # tar/untar a dummy directory, and stop if the command works
1002 rm -rf conftest.dir
1003 mkdir conftest.dir
1004 echo GrepMe > conftest.dir/file
1005 AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1006 rm -rf conftest.dir
1007 if test -s conftest.tar; then
1008 AM_RUN_LOG([$am__untar <conftest.tar])
1009 grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1010 fi
1011 done
1012 rm -rf conftest.dir
1013
1014 AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1015 AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1016 AC_SUBST([am__tar])
1017 AC_SUBST([am__untar])
1018 ]) # _AM_PROG_TAR
1019
0 /**
1 @file callbacks.c
2 @brief ENet callback functions
3 */
4 #define ENET_BUILDING_LIB 1
5 #include "enet/enet.h"
6
7 static ENetCallbacks callbacks = { malloc, free, rand };
8
9 int
10 enet_initialize_with_callbacks (ENetVersion version, const ENetCallbacks * inits)
11 {
12 if (version != ENET_VERSION)
13 return -1;
14
15 if (inits -> malloc != NULL || inits -> free != NULL)
16 {
17 if (inits -> malloc == NULL || inits -> free == NULL)
18 return -1;
19
20 callbacks.malloc = inits -> malloc;
21 callbacks.free = inits -> free;
22 }
23
24 if (inits -> rand != NULL)
25 callbacks.rand = inits -> rand;
26
27 return enet_initialize ();
28 }
29
30 void *
31 enet_malloc (size_t size)
32 {
33 void * memory = callbacks.malloc (size);
34
35 if (memory == NULL)
36 abort ();
37
38 return memory;
39 }
40
41 void
42 enet_free (void * memory)
43 {
44 callbacks.free (memory);
45 }
46
47 int
48 enet_rand (void)
49 {
50 return callbacks.rand ();
51 }
52
Binary diff not shown
0 #! /bin/sh
1 # Attempt to guess a canonical system name.
2 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3 # 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
4
5 timestamp='2004-08-13'
6
7 # This file is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #
21 # As a special exception to the GNU General Public License, if you
22 # distribute this file as part of a program that contains a
23 # configuration script generated by Autoconf, you may include it under
24 # the same distribution terms that you use for the rest of that program.
25
26 # Originally written by Per Bothner <per@bothner.com>.
27 # Please send patches to <config-patches@gnu.org>. Submit a context
28 # diff and a properly formatted ChangeLog entry.
29 #
30 # This script attempts to guess a canonical system name similar to
31 # config.sub. If it succeeds, it prints the system name on stdout, and
32 # exits with 0. Otherwise, it exits with 1.
33 #
34 # The plan is that this can be called by configure scripts if you
35 # don't specify an explicit build system type.
36
37 me=`echo "$0" | sed -e 's,.*/,,'`
38
39 usage="\
40 Usage: $0 [OPTION]
41
42 Output the configuration name of the system \`$me' is run on.
43
44 Operation modes:
45 -h, --help print this help, then exit
46 -t, --time-stamp print date of last modification, then exit
47 -v, --version print version number, then exit
48
49 Report bugs and patches to <config-patches@gnu.org>."
50
51 version="\
52 GNU config.guess ($timestamp)
53
54 Originally written by Per Bothner.
55 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
56 Free Software Foundation, Inc.
57
58 This is free software; see the source for copying conditions. There is NO
59 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
60
61 help="
62 Try \`$me --help' for more information."
63
64 # Parse command line
65 while test $# -gt 0 ; do
66 case $1 in
67 --time-stamp | --time* | -t )
68 echo "$timestamp" ; exit 0 ;;
69 --version | -v )
70 echo "$version" ; exit 0 ;;
71 --help | --h* | -h )
72 echo "$usage"; exit 0 ;;
73 -- ) # Stop option processing
74 shift; break ;;
75 - ) # Use stdin as input.
76 break ;;
77 -* )
78 echo "$me: invalid option $1$help" >&2
79 exit 1 ;;
80 * )
81 break ;;
82 esac
83 done
84
85 if test $# != 0; then
86 echo "$me: too many arguments$help" >&2
87 exit 1
88 fi
89
90 trap 'exit 1' 1 2 15
91
92 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a
93 # compiler to aid in system detection is discouraged as it requires
94 # temporary files to be created and, as you can see below, it is a
95 # headache to deal with in a portable fashion.
96
97 # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
98 # use `HOST_CC' if defined, but it is deprecated.
99
100 # Portable tmp directory creation inspired by the Autoconf team.
101
102 set_cc_for_build='
103 trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
104 trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
105 : ${TMPDIR=/tmp} ;
106 { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
107 { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
108 { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
109 { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
110 dummy=$tmp/dummy ;
111 tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
112 case $CC_FOR_BUILD,$HOST_CC,$CC in
113 ,,) echo "int x;" > $dummy.c ;
114 for c in cc gcc c89 c99 ; do
115 if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
116 CC_FOR_BUILD="$c"; break ;
117 fi ;
118 done ;
119 if test x"$CC_FOR_BUILD" = x ; then
120 CC_FOR_BUILD=no_compiler_found ;
121 fi
122 ;;
123 ,,*) CC_FOR_BUILD=$CC ;;
124 ,*,*) CC_FOR_BUILD=$HOST_CC ;;
125 esac ;'
126
127 # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
128 # (ghazi@noc.rutgers.edu 1994-08-24)
129 if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
130 PATH=$PATH:/.attbin ; export PATH
131 fi
132
133 UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
134 UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
135 UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
136 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
137
138 # Note: order is significant - the case branches are not exclusive.
139
140 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
141 *:NetBSD:*:*)
142 # NetBSD (nbsd) targets should (where applicable) match one or
143 # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
144 # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
145 # switched to ELF, *-*-netbsd* would select the old
146 # object file format. This provides both forward
147 # compatibility and a consistent mechanism for selecting the
148 # object file format.
149 #
150 # Note: NetBSD doesn't particularly care about the vendor
151 # portion of the name. We always set it to "unknown".
152 sysctl="sysctl -n hw.machine_arch"
153 UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
154 /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
155 case "${UNAME_MACHINE_ARCH}" in
156 armeb) machine=armeb-unknown ;;
157 arm*) machine=arm-unknown ;;
158 sh3el) machine=shl-unknown ;;
159 sh3eb) machine=sh-unknown ;;
160 *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
161 esac
162 # The Operating System including object format, if it has switched
163 # to ELF recently, or will in the future.
164 case "${UNAME_MACHINE_ARCH}" in
165 arm*|i386|m68k|ns32k|sh3*|sparc|vax)
166 eval $set_cc_for_build
167 if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
168 | grep __ELF__ >/dev/null
169 then
170 # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
171 # Return netbsd for either. FIX?
172 os=netbsd
173 else
174 os=netbsdelf
175 fi
176 ;;
177 *)
178 os=netbsd
179 ;;
180 esac
181 # The OS release
182 # Debian GNU/NetBSD machines have a different userland, and
183 # thus, need a distinct triplet. However, they do not need
184 # kernel version information, so it can be replaced with a
185 # suitable tag, in the style of linux-gnu.
186 case "${UNAME_VERSION}" in
187 Debian*)
188 release='-gnu'
189 ;;
190 *)
191 release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
192 ;;
193 esac
194 # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
195 # contains redundant information, the shorter form:
196 # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
197 echo "${machine}-${os}${release}"
198 exit 0 ;;
199 amd64:OpenBSD:*:*)
200 echo x86_64-unknown-openbsd${UNAME_RELEASE}
201 exit 0 ;;
202 amiga:OpenBSD:*:*)
203 echo m68k-unknown-openbsd${UNAME_RELEASE}
204 exit 0 ;;
205 cats:OpenBSD:*:*)
206 echo arm-unknown-openbsd${UNAME_RELEASE}
207 exit 0 ;;
208 hp300:OpenBSD:*:*)
209 echo m68k-unknown-openbsd${UNAME_RELEASE}
210 exit 0 ;;
211 luna88k:OpenBSD:*:*)
212 echo m88k-unknown-openbsd${UNAME_RELEASE}
213 exit 0 ;;
214 mac68k:OpenBSD:*:*)
215 echo m68k-unknown-openbsd${UNAME_RELEASE}
216 exit 0 ;;
217 macppc:OpenBSD:*:*)
218 echo powerpc-unknown-openbsd${UNAME_RELEASE}
219 exit 0 ;;
220 mvme68k:OpenBSD:*:*)
221 echo m68k-unknown-openbsd${UNAME_RELEASE}
222 exit 0 ;;
223 mvme88k:OpenBSD:*:*)
224 echo m88k-unknown-openbsd${UNAME_RELEASE}
225 exit 0 ;;
226 mvmeppc:OpenBSD:*:*)
227 echo powerpc-unknown-openbsd${UNAME_RELEASE}
228 exit 0 ;;
229 sgi:OpenBSD:*:*)
230 echo mips64-unknown-openbsd${UNAME_RELEASE}
231 exit 0 ;;
232 sun3:OpenBSD:*:*)
233 echo m68k-unknown-openbsd${UNAME_RELEASE}
234 exit 0 ;;
235 *:OpenBSD:*:*)
236 echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
237 exit 0 ;;
238 *:ekkoBSD:*:*)
239 echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
240 exit 0 ;;
241 macppc:MirBSD:*:*)
242 echo powerppc-unknown-mirbsd${UNAME_RELEASE}
243 exit 0 ;;
244 *:MirBSD:*:*)
245 echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
246 exit 0 ;;
247 alpha:OSF1:*:*)
248 case $UNAME_RELEASE in
249 *4.0)
250 UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
251 ;;
252 *5.*)
253 UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
254 ;;
255 esac
256 # According to Compaq, /usr/sbin/psrinfo has been available on
257 # OSF/1 and Tru64 systems produced since 1995. I hope that
258 # covers most systems running today. This code pipes the CPU
259 # types through head -n 1, so we only detect the type of CPU 0.
260 ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
261 case "$ALPHA_CPU_TYPE" in
262 "EV4 (21064)")
263 UNAME_MACHINE="alpha" ;;
264 "EV4.5 (21064)")
265 UNAME_MACHINE="alpha" ;;
266 "LCA4 (21066/21068)")
267 UNAME_MACHINE="alpha" ;;
268 "EV5 (21164)")
269 UNAME_MACHINE="alphaev5" ;;
270 "EV5.6 (21164A)")
271 UNAME_MACHINE="alphaev56" ;;
272 "EV5.6 (21164PC)")
273 UNAME_MACHINE="alphapca56" ;;
274 "EV5.7 (21164PC)")
275 UNAME_MACHINE="alphapca57" ;;
276 "EV6 (21264)")
277 UNAME_MACHINE="alphaev6" ;;
278 "EV6.7 (21264A)")
279 UNAME_MACHINE="alphaev67" ;;
280 "EV6.8CB (21264C)")
281 UNAME_MACHINE="alphaev68" ;;
282 "EV6.8AL (21264B)")
283 UNAME_MACHINE="alphaev68" ;;
284 "EV6.8CX (21264D)")
285 UNAME_MACHINE="alphaev68" ;;
286 "EV6.9A (21264/EV69A)")
287 UNAME_MACHINE="alphaev69" ;;
288 "EV7 (21364)")
289 UNAME_MACHINE="alphaev7" ;;
290 "EV7.9 (21364A)")
291 UNAME_MACHINE="alphaev79" ;;
292 esac
293 # A Pn.n version is a patched version.
294 # A Vn.n version is a released version.
295 # A Tn.n version is a released field test version.
296 # A Xn.n version is an unreleased experimental baselevel.
297 # 1.2 uses "1.2" for uname -r.
298 echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
299 exit 0 ;;
300 Alpha\ *:Windows_NT*:*)
301 # How do we know it's Interix rather than the generic POSIX subsystem?
302 # Should we change UNAME_MACHINE based on the output of uname instead
303 # of the specific Alpha model?
304 echo alpha-pc-interix
305 exit 0 ;;
306 21064:Windows_NT:50:3)
307 echo alpha-dec-winnt3.5
308 exit 0 ;;
309 Amiga*:UNIX_System_V:4.0:*)
310 echo m68k-unknown-sysv4
311 exit 0;;
312 *:[Aa]miga[Oo][Ss]:*:*)
313 echo ${UNAME_MACHINE}-unknown-amigaos
314 exit 0 ;;
315 *:[Mm]orph[Oo][Ss]:*:*)
316 echo ${UNAME_MACHINE}-unknown-morphos
317 exit 0 ;;
318 *:OS/390:*:*)
319 echo i370-ibm-openedition
320 exit 0 ;;
321 *:OS400:*:*)
322 echo powerpc-ibm-os400
323 exit 0 ;;
324 arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
325 echo arm-acorn-riscix${UNAME_RELEASE}
326 exit 0;;
327 SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
328 echo hppa1.1-hitachi-hiuxmpp
329 exit 0;;
330 Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
331 # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
332 if test "`(/bin/universe) 2>/dev/null`" = att ; then
333 echo pyramid-pyramid-sysv3
334 else
335 echo pyramid-pyramid-bsd
336 fi
337 exit 0 ;;
338 NILE*:*:*:dcosx)
339 echo pyramid-pyramid-svr4
340 exit 0 ;;
341 DRS?6000:unix:4.0:6*)
342 echo sparc-icl-nx6
343 exit 0 ;;
344 DRS?6000:UNIX_SV:4.2*:7*)
345 case `/usr/bin/uname -p` in
346 sparc) echo sparc-icl-nx7 && exit 0 ;;
347 esac ;;
348 sun4H:SunOS:5.*:*)
349 echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
350 exit 0 ;;
351 sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
352 echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
353 exit 0 ;;
354 i86pc:SunOS:5.*:*)
355 echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
356 exit 0 ;;
357 sun4*:SunOS:6*:*)
358 # According to config.sub, this is the proper way to canonicalize
359 # SunOS6. Hard to guess exactly what SunOS6 will be like, but
360 # it's likely to be more like Solaris than SunOS4.
361 echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
362 exit 0 ;;
363 sun4*:SunOS:*:*)
364 case "`/usr/bin/arch -k`" in
365 Series*|S4*)
366 UNAME_RELEASE=`uname -v`
367 ;;
368 esac
369 # Japanese Language versions have a version number like `4.1.3-JL'.
370 echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
371 exit 0 ;;
372 sun3*:SunOS:*:*)
373 echo m68k-sun-sunos${UNAME_RELEASE}
374 exit 0 ;;
375 sun*:*:4.2BSD:*)
376 UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
377 test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
378 case "`/bin/arch`" in
379 sun3)
380 echo m68k-sun-sunos${UNAME_RELEASE}
381 ;;
382 sun4)
383 echo sparc-sun-sunos${UNAME_RELEASE}
384 ;;
385 esac
386 exit 0 ;;
387 aushp:SunOS:*:*)
388 echo sparc-auspex-sunos${UNAME_RELEASE}
389 exit 0 ;;
390 # The situation for MiNT is a little confusing. The machine name
391 # can be virtually everything (everything which is not
392 # "atarist" or "atariste" at least should have a processor
393 # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
394 # to the lowercase version "mint" (or "freemint"). Finally
395 # the system name "TOS" denotes a system which is actually not
396 # MiNT. But MiNT is downward compatible to TOS, so this should
397 # be no problem.
398 atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
399 echo m68k-atari-mint${UNAME_RELEASE}
400 exit 0 ;;
401 atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
402 echo m68k-atari-mint${UNAME_RELEASE}
403 exit 0 ;;
404 *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
405 echo m68k-atari-mint${UNAME_RELEASE}
406 exit 0 ;;
407 milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
408 echo m68k-milan-mint${UNAME_RELEASE}
409 exit 0 ;;
410 hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
411 echo m68k-hades-mint${UNAME_RELEASE}
412 exit 0 ;;
413 *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
414 echo m68k-unknown-mint${UNAME_RELEASE}
415 exit 0 ;;
416 m68k:machten:*:*)
417 echo m68k-apple-machten${UNAME_RELEASE}
418 exit 0 ;;
419 powerpc:machten:*:*)
420 echo powerpc-apple-machten${UNAME_RELEASE}
421 exit 0 ;;
422 RISC*:Mach:*:*)
423 echo mips-dec-mach_bsd4.3
424 exit 0 ;;
425 RISC*:ULTRIX:*:*)
426 echo mips-dec-ultrix${UNAME_RELEASE}
427 exit 0 ;;
428 VAX*:ULTRIX*:*:*)
429 echo vax-dec-ultrix${UNAME_RELEASE}
430 exit 0 ;;
431 2020:CLIX:*:* | 2430:CLIX:*:*)
432 echo clipper-intergraph-clix${UNAME_RELEASE}
433 exit 0 ;;
434 mips:*:*:UMIPS | mips:*:*:RISCos)
435 eval $set_cc_for_build
436 sed 's/^ //' << EOF >$dummy.c
437 #ifdef __cplusplus
438 #include <stdio.h> /* for printf() prototype */
439 int main (int argc, char *argv[]) {
440 #else
441 int main (argc, argv) int argc; char *argv[]; {
442 #endif
443 #if defined (host_mips) && defined (MIPSEB)
444 #if defined (SYSTYPE_SYSV)
445 printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
446 #endif
447 #if defined (SYSTYPE_SVR4)
448 printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
449 #endif
450 #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
451 printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
452 #endif
453 #endif
454 exit (-1);
455 }
456 EOF
457 $CC_FOR_BUILD -o $dummy $dummy.c \
458 && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
459 && exit 0
460 echo mips-mips-riscos${UNAME_RELEASE}
461 exit 0 ;;
462 Motorola:PowerMAX_OS:*:*)
463 echo powerpc-motorola-powermax
464 exit 0 ;;
465 Motorola:*:4.3:PL8-*)
466 echo powerpc-harris-powermax
467 exit 0 ;;
468 Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
469 echo powerpc-harris-powermax
470 exit 0 ;;
471 Night_Hawk:Power_UNIX:*:*)
472 echo powerpc-harris-powerunix
473 exit 0 ;;
474 m88k:CX/UX:7*:*)
475 echo m88k-harris-cxux7
476 exit 0 ;;
477 m88k:*:4*:R4*)
478 echo m88k-motorola-sysv4
479 exit 0 ;;
480 m88k:*:3*:R3*)
481 echo m88k-motorola-sysv3
482 exit 0 ;;
483 AViiON:dgux:*:*)
484 # DG/UX returns AViiON for all architectures
485 UNAME_PROCESSOR=`/usr/bin/uname -p`
486 if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
487 then
488 if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
489 [ ${TARGET_BINARY_INTERFACE}x = x ]
490 then
491 echo m88k-dg-dgux${UNAME_RELEASE}
492 else
493 echo m88k-dg-dguxbcs${UNAME_RELEASE}
494 fi
495 else
496 echo i586-dg-dgux${UNAME_RELEASE}
497 fi
498 exit 0 ;;
499 M88*:DolphinOS:*:*) # DolphinOS (SVR3)
500 echo m88k-dolphin-sysv3
501 exit 0 ;;
502 M88*:*:R3*:*)
503 # Delta 88k system running SVR3
504 echo m88k-motorola-sysv3
505 exit 0 ;;
506 XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
507 echo m88k-tektronix-sysv3
508 exit 0 ;;
509 Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
510 echo m68k-tektronix-bsd
511 exit 0 ;;
512 *:IRIX*:*:*)
513 echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
514 exit 0 ;;
515 ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
516 echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
517 exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
518 i*86:AIX:*:*)
519 echo i386-ibm-aix
520 exit 0 ;;
521 ia64:AIX:*:*)
522 if [ -x /usr/bin/oslevel ] ; then
523 IBM_REV=`/usr/bin/oslevel`
524 else
525 IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
526 fi
527 echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
528 exit 0 ;;
529 *:AIX:2:3)
530 if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
531 eval $set_cc_for_build
532 sed 's/^ //' << EOF >$dummy.c
533 #include <sys/systemcfg.h>
534
535 main()
536 {
537 if (!__power_pc())
538 exit(1);
539 puts("powerpc-ibm-aix3.2.5");
540 exit(0);
541 }
542 EOF
543 $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
544 echo rs6000-ibm-aix3.2.5
545 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
546 echo rs6000-ibm-aix3.2.4
547 else
548 echo rs6000-ibm-aix3.2
549 fi
550 exit 0 ;;
551 *:AIX:*:[45])
552 IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
553 if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
554 IBM_ARCH=rs6000
555 else
556 IBM_ARCH=powerpc
557 fi
558 if [ -x /usr/bin/oslevel ] ; then
559 IBM_REV=`/usr/bin/oslevel`
560 else
561 IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
562 fi
563 echo ${IBM_ARCH}-ibm-aix${IBM_REV}
564 exit 0 ;;
565 *:AIX:*:*)
566 echo rs6000-ibm-aix
567 exit 0 ;;
568 ibmrt:4.4BSD:*|romp-ibm:BSD:*)
569 echo romp-ibm-bsd4.4
570 exit 0 ;;
571 ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
572 echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
573 exit 0 ;; # report: romp-ibm BSD 4.3
574 *:BOSX:*:*)
575 echo rs6000-bull-bosx
576 exit 0 ;;
577 DPX/2?00:B.O.S.:*:*)
578 echo m68k-bull-sysv3
579 exit 0 ;;
580 9000/[34]??:4.3bsd:1.*:*)
581 echo m68k-hp-bsd
582 exit 0 ;;
583 hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
584 echo m68k-hp-bsd4.4
585 exit 0 ;;
586 9000/[34678]??:HP-UX:*:*)
587 HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
588 case "${UNAME_MACHINE}" in
589 9000/31? ) HP_ARCH=m68000 ;;
590 9000/[34]?? ) HP_ARCH=m68k ;;
591 9000/[678][0-9][0-9])
592 if [ -x /usr/bin/getconf ]; then
593 sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
594 sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
595 case "${sc_cpu_version}" in
596 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
597 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
598 532) # CPU_PA_RISC2_0
599 case "${sc_kernel_bits}" in
600 32) HP_ARCH="hppa2.0n" ;;
601 64) HP_ARCH="hppa2.0w" ;;
602 '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
603 esac ;;
604 esac
605 fi
606 if [ "${HP_ARCH}" = "" ]; then
607 eval $set_cc_for_build
608 sed 's/^ //' << EOF >$dummy.c
609
610 #define _HPUX_SOURCE
611 #include <stdlib.h>
612 #include <unistd.h>
613
614 int main ()
615 {
616 #if defined(_SC_KERNEL_BITS)
617 long bits = sysconf(_SC_KERNEL_BITS);
618 #endif
619 long cpu = sysconf (_SC_CPU_VERSION);
620
621 switch (cpu)
622 {
623 case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
624 case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
625 case CPU_PA_RISC2_0:
626 #if defined(_SC_KERNEL_BITS)
627 switch (bits)
628 {
629 case 64: puts ("hppa2.0w"); break;
630 case 32: puts ("hppa2.0n"); break;
631 default: puts ("hppa2.0"); break;
632 } break;
633 #else /* !defined(_SC_KERNEL_BITS) */
634 puts ("hppa2.0"); break;
635 #endif
636 default: puts ("hppa1.0"); break;
637 }
638 exit (0);
639 }
640 EOF
641 (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
642 test -z "$HP_ARCH" && HP_ARCH=hppa
643 fi ;;
644 esac
645 if [ ${HP_ARCH} = "hppa2.0w" ]
646 then
647 # avoid double evaluation of $set_cc_for_build
648 test -n "$CC_FOR_BUILD" || eval $set_cc_for_build
649 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null
650 then
651 HP_ARCH="hppa2.0w"
652 else
653 HP_ARCH="hppa64"
654 fi
655 fi
656 echo ${HP_ARCH}-hp-hpux${HPUX_REV}
657 exit 0 ;;
658 ia64:HP-UX:*:*)
659 HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
660 echo ia64-hp-hpux${HPUX_REV}
661 exit 0 ;;
662 3050*:HI-UX:*:*)
663 eval $set_cc_for_build
664 sed 's/^ //' << EOF >$dummy.c
665 #include <unistd.h>
666 int
667 main ()
668 {
669 long cpu = sysconf (_SC_CPU_VERSION);
670 /* The order matters, because CPU_IS_HP_MC68K erroneously returns
671 true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
672 results, however. */
673 if (CPU_IS_PA_RISC (cpu))
674 {
675 switch (cpu)
676 {
677 case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
678 case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
679 case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
680 default: puts ("hppa-hitachi-hiuxwe2"); break;
681 }
682 }
683 else if (CPU_IS_HP_MC68K (cpu))
684 puts ("m68k-hitachi-hiuxwe2");
685 else puts ("unknown-hitachi-hiuxwe2");
686 exit (0);
687 }
688 EOF
689 $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
690 echo unknown-hitachi-hiuxwe2
691 exit 0 ;;
692 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
693 echo hppa1.1-hp-bsd
694 exit 0 ;;
695 9000/8??:4.3bsd:*:*)
696 echo hppa1.0-hp-bsd
697 exit 0 ;;
698 *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
699 echo hppa1.0-hp-mpeix
700 exit 0 ;;
701 hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
702 echo hppa1.1-hp-osf
703 exit 0 ;;
704 hp8??:OSF1:*:*)
705 echo hppa1.0-hp-osf
706 exit 0 ;;
707 i*86:OSF1:*:*)
708 if [ -x /usr/sbin/sysversion ] ; then
709 echo ${UNAME_MACHINE}-unknown-osf1mk
710 else
711 echo ${UNAME_MACHINE}-unknown-osf1
712 fi
713 exit 0 ;;
714 parisc*:Lites*:*:*)
715 echo hppa1.1-hp-lites
716 exit 0 ;;
717 C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
718 echo c1-convex-bsd
719 exit 0 ;;
720 C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
721 if getsysinfo -f scalar_acc
722 then echo c32-convex-bsd
723 else echo c2-convex-bsd
724 fi
725 exit 0 ;;
726 C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
727 echo c34-convex-bsd
728 exit 0 ;;
729 C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
730 echo c38-convex-bsd
731 exit 0 ;;
732 C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
733 echo c4-convex-bsd
734 exit 0 ;;
735 CRAY*Y-MP:*:*:*)
736 echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
737 exit 0 ;;
738 CRAY*[A-Z]90:*:*:*)
739 echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
740 | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
741 -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
742 -e 's/\.[^.]*$/.X/'
743 exit 0 ;;
744 CRAY*TS:*:*:*)
745 echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
746 exit 0 ;;
747 CRAY*T3E:*:*:*)
748 echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
749 exit 0 ;;
750 CRAY*SV1:*:*:*)
751 echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
752 exit 0 ;;
753 *:UNICOS/mp:*:*)
754 echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
755 exit 0 ;;
756 F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
757 FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
758 FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
759 FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
760 echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
761 exit 0 ;;
762 5000:UNIX_System_V:4.*:*)
763 FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
764 FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
765 echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
766 exit 0 ;;
767 i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
768 echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
769 exit 0 ;;
770 sparc*:BSD/OS:*:*)
771 echo sparc-unknown-bsdi${UNAME_RELEASE}
772 exit 0 ;;
773 *:BSD/OS:*:*)
774 echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
775 exit 0 ;;
776 *:FreeBSD:*:*)
777 echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
778 exit 0 ;;
779 i*:CYGWIN*:*)
780 echo ${UNAME_MACHINE}-pc-cygwin
781 exit 0 ;;
782 i*:MINGW*:*)
783 echo ${UNAME_MACHINE}-pc-mingw32
784 exit 0 ;;
785 i*:PW*:*)
786 echo ${UNAME_MACHINE}-pc-pw32
787 exit 0 ;;
788 x86:Interix*:[34]*)
789 echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
790 exit 0 ;;
791 [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
792 echo i${UNAME_MACHINE}-pc-mks
793 exit 0 ;;
794 i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
795 # How do we know it's Interix rather than the generic POSIX subsystem?
796 # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
797 # UNAME_MACHINE based on the output of uname instead of i386?
798 echo i586-pc-interix
799 exit 0 ;;
800 i*:UWIN*:*)
801 echo ${UNAME_MACHINE}-pc-uwin
802 exit 0 ;;
803 p*:CYGWIN*:*)
804 echo powerpcle-unknown-cygwin
805 exit 0 ;;
806 prep*:SunOS:5.*:*)
807 echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
808 exit 0 ;;
809 *:GNU:*:*)
810 # the GNU system
811 echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
812 exit 0 ;;
813 *:GNU/*:*:*)
814 # other systems with GNU libc and userland
815 echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
816 exit 0 ;;
817 i*86:Minix:*:*)
818 echo ${UNAME_MACHINE}-pc-minix
819 exit 0 ;;
820 arm*:Linux:*:*)
821 echo ${UNAME_MACHINE}-unknown-linux-gnu
822 exit 0 ;;
823 cris:Linux:*:*)
824 echo cris-axis-linux-gnu
825 exit 0 ;;
826 ia64:Linux:*:*)
827 echo ${UNAME_MACHINE}-unknown-linux-gnu
828 exit 0 ;;
829 m32r*:Linux:*:*)
830 echo ${UNAME_MACHINE}-unknown-linux-gnu
831 exit 0 ;;
832 m68*:Linux:*:*)
833 echo ${UNAME_MACHINE}-unknown-linux-gnu
834 exit 0 ;;
835 mips:Linux:*:*)
836 eval $set_cc_for_build
837 sed 's/^ //' << EOF >$dummy.c
838 #undef CPU
839 #undef mips
840 #undef mipsel
841 #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
842 CPU=mipsel
843 #else
844 #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
845 CPU=mips
846 #else
847 CPU=
848 #endif
849 #endif
850 EOF
851 eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
852 test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
853 ;;
854 mips64:Linux:*:*)
855 eval $set_cc_for_build
856 sed 's/^ //' << EOF >$dummy.c
857 #undef CPU
858 #undef mips64
859 #undef mips64el
860 #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
861 CPU=mips64el
862 #else
863 #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
864 CPU=mips64
865 #else
866 CPU=
867 #endif
868 #endif
869 EOF
870 eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
871 test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
872 ;;
873 ppc:Linux:*:*)
874 echo powerpc-unknown-linux-gnu
875 exit 0 ;;
876 ppc64:Linux:*:*)
877 echo powerpc64-unknown-linux-gnu
878 exit 0 ;;
879 alpha:Linux:*:*)
880 case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
881 EV5) UNAME_MACHINE=alphaev5 ;;
882 EV56) UNAME_MACHINE=alphaev56 ;;
883 PCA56) UNAME_MACHINE=alphapca56 ;;
884 PCA57) UNAME_MACHINE=alphapca56 ;;
885 EV6) UNAME_MACHINE=alphaev6 ;;
886 EV67) UNAME_MACHINE=alphaev67 ;;
887 EV68*) UNAME_MACHINE=alphaev68 ;;
888 esac
889 objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
890 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
891 echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
892 exit 0 ;;
893 parisc:Linux:*:* | hppa:Linux:*:*)
894 # Look for CPU level
895 case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
896 PA7*) echo hppa1.1-unknown-linux-gnu ;;
897 PA8*) echo hppa2.0-unknown-linux-gnu ;;
898 *) echo hppa-unknown-linux-gnu ;;
899 esac
900 exit 0 ;;
901 parisc64:Linux:*:* | hppa64:Linux:*:*)
902 echo hppa64-unknown-linux-gnu
903 exit 0 ;;
904 s390:Linux:*:* | s390x:Linux:*:*)
905 echo ${UNAME_MACHINE}-ibm-linux
906 exit 0 ;;
907 sh64*:Linux:*:*)
908 echo ${UNAME_MACHINE}-unknown-linux-gnu
909 exit 0 ;;
910 sh*:Linux:*:*)
911 echo ${UNAME_MACHINE}-unknown-linux-gnu
912 exit 0 ;;
913 sparc:Linux:*:* | sparc64:Linux:*:*)
914 echo ${UNAME_MACHINE}-unknown-linux-gnu
915 exit 0 ;;
916 x86_64:Linux:*:*)
917 echo x86_64-unknown-linux-gnu
918 exit 0 ;;
919 i*86:Linux:*:*)
920 # The BFD linker knows what the default object file format is, so
921 # first see if it will tell us. cd to the root directory to prevent
922 # problems with other programs or directories called `ld' in the path.
923 # Set LC_ALL=C to ensure ld outputs messages in English.
924 ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
925 | sed -ne '/supported targets:/!d
926 s/[ ][ ]*/ /g
927 s/.*supported targets: *//
928 s/ .*//
929 p'`
930 case "$ld_supported_targets" in
931 elf32-i386)
932 TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
933 ;;
934 a.out-i386-linux)
935 echo "${UNAME_MACHINE}-pc-linux-gnuaout"
936 exit 0 ;;
937 coff-i386)
938 echo "${UNAME_MACHINE}-pc-linux-gnucoff"
939 exit 0 ;;
940 "")
941 # Either a pre-BFD a.out linker (linux-gnuoldld) or
942 # one that does not give us useful --help.
943 echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
944 exit 0 ;;
945 esac
946 # Determine whether the default compiler is a.out or elf
947 eval $set_cc_for_build
948 sed 's/^ //' << EOF >$dummy.c
949 #include <features.h>
950 #ifdef __ELF__
951 # ifdef __GLIBC__
952 # if __GLIBC__ >= 2
953 LIBC=gnu
954 # else
955 LIBC=gnulibc1
956 # endif
957 # else
958 LIBC=gnulibc1
959 # endif
960 #else
961 #ifdef __INTEL_COMPILER
962 LIBC=gnu
963 #else
964 LIBC=gnuaout
965 #endif
966 #endif
967 #ifdef __dietlibc__
968 LIBC=dietlibc
969 #endif
970 EOF
971 eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
972 test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
973 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
974 ;;
975 i*86:DYNIX/ptx:4*:*)
976 # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
977 # earlier versions are messed up and put the nodename in both
978 # sysname and nodename.
979 echo i386-sequent-sysv4
980 exit 0 ;;
981 i*86:UNIX_SV:4.2MP:2.*)
982 # Unixware is an offshoot of SVR4, but it has its own version
983 # number series starting with 2...
984 # I am not positive that other SVR4 systems won't match this,
985 # I just have to hope. -- rms.
986 # Use sysv4.2uw... so that sysv4* matches it.
987 echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
988 exit 0 ;;
989 i*86:OS/2:*:*)
990 # If we were able to find `uname', then EMX Unix compatibility
991 # is probably installed.
992 echo ${UNAME_MACHINE}-pc-os2-emx
993 exit 0 ;;
994 i*86:XTS-300:*:STOP)
995 echo ${UNAME_MACHINE}-unknown-stop
996 exit 0 ;;
997 i*86:atheos:*:*)
998 echo ${UNAME_MACHINE}-unknown-atheos
999 exit 0 ;;
1000 i*86:syllable:*:*)
1001 echo ${UNAME_MACHINE}-pc-syllable
1002 exit 0 ;;
1003 i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
1004 echo i386-unknown-lynxos${UNAME_RELEASE}
1005 exit 0 ;;
1006 i*86:*DOS:*:*)
1007 echo ${UNAME_MACHINE}-pc-msdosdjgpp
1008 exit 0 ;;
1009 i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
1010 UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
1011 if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1012 echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
1013 else
1014 echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
1015 fi
1016 exit 0 ;;
1017 i*86:*:5:[78]*)
1018 case `/bin/uname -X | grep "^Machine"` in
1019 *486*) UNAME_MACHINE=i486 ;;
1020 *Pentium) UNAME_MACHINE=i586 ;;
1021 *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
1022 esac
1023 echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1024 exit 0 ;;
1025 i*86:*:3.2:*)
1026 if test -f /usr/options/cb.name; then
1027 UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1028 echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
1029 elif /bin/uname -X 2>/dev/null >/dev/null ; then
1030 UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1031 (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1032 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
1033 && UNAME_MACHINE=i586
1034 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
1035 && UNAME_MACHINE=i686
1036 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
1037 && UNAME_MACHINE=i686
1038 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
1039 else
1040 echo ${UNAME_MACHINE}-pc-sysv32
1041 fi
1042 exit 0 ;;
1043 pc:*:*:*)
1044 # Left here for compatibility:
1045 # uname -m prints for DJGPP always 'pc', but it prints nothing about
1046 # the processor, so we play safe by assuming i386.
1047 echo i386-pc-msdosdjgpp
1048 exit 0 ;;
1049 Intel:Mach:3*:*)
1050 echo i386-pc-mach3
1051 exit 0 ;;
1052 paragon:*:*:*)
1053 echo i860-intel-osf1
1054 exit 0 ;;
1055 i860:*:4.*:*) # i860-SVR4
1056 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1057 echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
1058 else # Add other i860-SVR4 vendors below as they are discovered.
1059 echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
1060 fi
1061 exit 0 ;;
1062 mini*:CTIX:SYS*5:*)
1063 # "miniframe"
1064 echo m68010-convergent-sysv
1065 exit 0 ;;
1066 mc68k:UNIX:SYSTEM5:3.51m)
1067 echo m68k-convergent-sysv
1068 exit 0 ;;
1069 M680?0:D-NIX:5.3:*)
1070 echo m68k-diab-dnix
1071 exit 0 ;;
1072 M68*:*:R3V[5678]*:*)
1073 test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
1074 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
1075 OS_REL=''
1076 test -r /etc/.relid \
1077 && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1078 /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1079 && echo i486-ncr-sysv4.3${OS_REL} && exit 0
1080 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1081 && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
1082 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1083 /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1084 && echo i486-ncr-sysv4 && exit 0 ;;
1085 m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1086 echo m68k-unknown-lynxos${UNAME_RELEASE}
1087 exit 0 ;;
1088 mc68030:UNIX_System_V:4.*:*)
1089 echo m68k-atari-sysv4
1090 exit 0 ;;
1091 TSUNAMI:LynxOS:2.*:*)
1092 echo sparc-unknown-lynxos${UNAME_RELEASE}
1093 exit 0 ;;
1094 rs6000:LynxOS:2.*:*)
1095 echo rs6000-unknown-lynxos${UNAME_RELEASE}
1096 exit 0 ;;
1097 PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
1098 echo powerpc-unknown-lynxos${UNAME_RELEASE}
1099 exit 0 ;;
1100 SM[BE]S:UNIX_SV:*:*)
1101 echo mips-dde-sysv${UNAME_RELEASE}
1102 exit 0 ;;
1103 RM*:ReliantUNIX-*:*:*)
1104 echo mips-sni-sysv4
1105 exit 0 ;;
1106 RM*:SINIX-*:*:*)
1107 echo mips-sni-sysv4
1108 exit 0 ;;
1109 *:SINIX-*:*:*)
1110 if uname -p 2>/dev/null >/dev/null ; then
1111 UNAME_MACHINE=`(uname -p) 2>/dev/null`
1112 echo ${UNAME_MACHINE}-sni-sysv4
1113 else
1114 echo ns32k-sni-sysv
1115 fi
1116 exit 0 ;;
1117 PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1118 # says <Richard.M.Bartel@ccMail.Census.GOV>
1119 echo i586-unisys-sysv4
1120 exit 0 ;;
1121 *:UNIX_System_V:4*:FTX*)
1122 # From Gerald Hewes <hewes@openmarket.com>.
1123 # How about differentiating between stratus architectures? -djm
1124 echo hppa1.1-stratus-sysv4
1125 exit 0 ;;
1126 *:*:*:FTX*)
1127 # From seanf@swdc.stratus.com.
1128 echo i860-stratus-sysv4
1129 exit 0 ;;
1130 *:VOS:*:*)
1131 # From Paul.Green@stratus.com.
1132 echo hppa1.1-stratus-vos
1133 exit 0 ;;
1134 mc68*:A/UX:*:*)
1135 echo m68k-apple-aux${UNAME_RELEASE}
1136 exit 0 ;;
1137 news*:NEWS-OS:6*:*)
1138 echo mips-sony-newsos6
1139 exit 0 ;;
1140 R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1141 if [ -d /usr/nec ]; then
1142 echo mips-nec-sysv${UNAME_RELEASE}
1143 else
1144 echo mips-unknown-sysv${UNAME_RELEASE}
1145 fi
1146 exit 0 ;;
1147 BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
1148 echo powerpc-be-beos
1149 exit 0 ;;
1150 BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
1151 echo powerpc-apple-beos
1152 exit 0 ;;
1153 BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
1154 echo i586-pc-beos
1155 exit 0 ;;
1156 SX-4:SUPER-UX:*:*)
1157 echo sx4-nec-superux${UNAME_RELEASE}
1158 exit 0 ;;
1159 SX-5:SUPER-UX:*:*)
1160 echo sx5-nec-superux${UNAME_RELEASE}
1161 exit 0 ;;
1162 SX-6:SUPER-UX:*:*)
1163 echo sx6-nec-superux${UNAME_RELEASE}
1164 exit 0 ;;
1165 Power*:Rhapsody:*:*)
1166 echo powerpc-apple-rhapsody${UNAME_RELEASE}
1167 exit 0 ;;
1168 *:Rhapsody:*:*)
1169 echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
1170 exit 0 ;;
1171 *:Darwin:*:*)
1172 UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
1173 case $UNAME_PROCESSOR in
1174 *86) UNAME_PROCESSOR=i686 ;;
1175 unknown) UNAME_PROCESSOR=powerpc ;;
1176 esac
1177 echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
1178 exit 0 ;;
1179 *:procnto*:*:* | *:QNX:[0123456789]*:*)
1180 UNAME_PROCESSOR=`uname -p`
1181 if test "$UNAME_PROCESSOR" = "x86"; then
1182 UNAME_PROCESSOR=i386
1183 UNAME_MACHINE=pc
1184 fi
1185 echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
1186 exit 0 ;;
1187 *:QNX:*:4*)
1188 echo i386-pc-qnx
1189 exit 0 ;;
1190 NSR-?:NONSTOP_KERNEL:*:*)
1191 echo nsr-tandem-nsk${UNAME_RELEASE}
1192 exit 0 ;;
1193 *:NonStop-UX:*:*)
1194 echo mips-compaq-nonstopux
1195 exit 0 ;;
1196 BS2000:POSIX*:*:*)
1197 echo bs2000-siemens-sysv
1198 exit 0 ;;
1199 DS/*:UNIX_System_V:*:*)
1200 echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
1201 exit 0 ;;
1202 *:Plan9:*:*)
1203 # "uname -m" is not consistent, so use $cputype instead. 386
1204 # is converted to i386 for consistency with other x86
1205 # operating systems.
1206 if test "$cputype" = "386"; then
1207 UNAME_MACHINE=i386
1208 else
1209 UNAME_MACHINE="$cputype"
1210 fi
1211 echo ${UNAME_MACHINE}-unknown-plan9
1212 exit 0 ;;
1213 *:TOPS-10:*:*)
1214 echo pdp10-unknown-tops10
1215 exit 0 ;;
1216 *:TENEX:*:*)
1217 echo pdp10-unknown-tenex
1218 exit 0 ;;
1219 KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1220 echo pdp10-dec-tops20
1221 exit 0 ;;
1222 XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1223 echo pdp10-xkl-tops20
1224 exit 0 ;;
1225 *:TOPS-20:*:*)
1226 echo pdp10-unknown-tops20
1227 exit 0 ;;
1228 *:ITS:*:*)
1229 echo pdp10-unknown-its
1230 exit 0 ;;
1231 SEI:*:*:SEIUX)
1232 echo mips-sei-seiux${UNAME_RELEASE}
1233 exit 0 ;;
1234 *:DragonFly:*:*)
1235 echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
1236 exit 0 ;;
1237 *:*VMS:*:*)
1238 UNAME_MACHINE=`(uname -p) 2>/dev/null`
1239 case "${UNAME_MACHINE}" in
1240 A*) echo alpha-dec-vms && exit 0 ;;
1241 I*) echo ia64-dec-vms && exit 0 ;;
1242 V*) echo vax-dec-vms && exit 0 ;;
1243 esac
1244 esac
1245
1246 #echo '(No uname command or uname output not recognized.)' 1>&2
1247 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
1248
1249 eval $set_cc_for_build
1250 cat >$dummy.c <<EOF
1251 #ifdef _SEQUENT_
1252 # include <sys/types.h>
1253 # include <sys/utsname.h>
1254 #endif
1255 main ()
1256 {
1257 #if defined (sony)
1258 #if defined (MIPSEB)
1259 /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
1260 I don't know.... */
1261 printf ("mips-sony-bsd\n"); exit (0);
1262 #else
1263 #include <sys/param.h>
1264 printf ("m68k-sony-newsos%s\n",
1265 #ifdef NEWSOS4
1266 "4"
1267 #else
1268 ""
1269 #endif
1270 ); exit (0);
1271 #endif
1272 #endif
1273
1274 #if defined (__arm) && defined (__acorn) && defined (__unix)
1275 printf ("arm-acorn-riscix"); exit (0);
1276 #endif
1277
1278 #if defined (hp300) && !defined (hpux)
1279 printf ("m68k-hp-bsd\n"); exit (0);
1280 #endif
1281
1282 #if defined (NeXT)
1283 #if !defined (__ARCHITECTURE__)
1284 #define __ARCHITECTURE__ "m68k"
1285 #endif
1286 int version;
1287 version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1288 if (version < 4)
1289 printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1290 else
1291 printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1292 exit (0);
1293 #endif
1294
1295 #if defined (MULTIMAX) || defined (n16)
1296 #if defined (UMAXV)
1297 printf ("ns32k-encore-sysv\n"); exit (0);
1298 #else
1299 #if defined (CMU)
1300 printf ("ns32k-encore-mach\n"); exit (0);
1301 #else
1302 printf ("ns32k-encore-bsd\n"); exit (0);
1303 #endif
1304 #endif
1305 #endif
1306
1307 #if defined (__386BSD__)
1308 printf ("i386-pc-bsd\n"); exit (0);
1309 #endif
1310
1311 #if defined (sequent)
1312 #if defined (i386)
1313 printf ("i386-sequent-dynix\n"); exit (0);
1314 #endif
1315 #if defined (ns32000)
1316 printf ("ns32k-sequent-dynix\n"); exit (0);
1317 #endif
1318 #endif
1319
1320 #if defined (_SEQUENT_)
1321 struct utsname un;
1322
1323 uname(&un);
1324
1325 if (strncmp(un.version, "V2", 2) == 0) {
1326 printf ("i386-sequent-ptx2\n"); exit (0);
1327 }
1328 if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1329 printf ("i386-sequent-ptx1\n"); exit (0);
1330 }
1331 printf ("i386-sequent-ptx\n"); exit (0);
1332
1333 #endif
1334
1335 #if defined (vax)
1336 # if !defined (ultrix)
1337 # include <sys/param.h>
1338 # if defined (BSD)
1339 # if BSD == 43
1340 printf ("vax-dec-bsd4.3\n"); exit (0);
1341 # else
1342 # if BSD == 199006
1343 printf ("vax-dec-bsd4.3reno\n"); exit (0);
1344 # else
1345 printf ("vax-dec-bsd\n"); exit (0);
1346 # endif
1347 # endif
1348 # else
1349 printf ("vax-dec-bsd\n"); exit (0);
1350 # endif
1351 # else
1352 printf ("vax-dec-ultrix\n"); exit (0);
1353 # endif
1354 #endif
1355
1356 #if defined (alliant) && defined (i860)
1357 printf ("i860-alliant-bsd\n"); exit (0);
1358 #endif
1359
1360 exit (1);
1361 }
1362 EOF
1363
1364 $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0
1365
1366 # Apollos put the system type in the environment.
1367
1368 test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
1369
1370 # Convex versions that predate uname can use getsysinfo(1)
1371
1372 if [ -x /usr/convex/getsysinfo ]
1373 then
1374 case `getsysinfo -f cpu_type` in
1375 c1*)
1376 echo c1-convex-bsd
1377 exit 0 ;;
1378 c2*)
1379 if getsysinfo -f scalar_acc
1380 then echo c32-convex-bsd
1381 else echo c2-convex-bsd
1382 fi
1383 exit 0 ;;
1384 c34*)
1385 echo c34-convex-bsd
1386 exit 0 ;;
1387 c38*)
1388 echo c38-convex-bsd
1389 exit 0 ;;
1390 c4*)
1391 echo c4-convex-bsd
1392 exit 0 ;;
1393 esac
1394 fi
1395
1396 cat >&2 <<EOF
1397 $0: unable to guess system type
1398
1399 This script, last modified $timestamp, has failed to recognize
1400 the operating system you are using. It is advised that you
1401 download the most up to date version of the config scripts from
1402
1403 ftp://ftp.gnu.org/pub/gnu/config/
1404
1405 If the version you run ($0) is already up to date, please
1406 send the following data and any information you think might be
1407 pertinent to <config-patches@gnu.org> in order to provide the needed
1408 information to handle your system.
1409
1410 config.guess timestamp = $timestamp
1411
1412 uname -m = `(uname -m) 2>/dev/null || echo unknown`
1413 uname -r = `(uname -r) 2>/dev/null || echo unknown`
1414 uname -s = `(uname -s) 2>/dev/null || echo unknown`
1415 uname -v = `(uname -v) 2>/dev/null || echo unknown`
1416
1417 /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
1418 /bin/uname -X = `(/bin/uname -X) 2>/dev/null`
1419
1420 hostinfo = `(hostinfo) 2>/dev/null`
1421 /bin/universe = `(/bin/universe) 2>/dev/null`
1422 /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
1423 /bin/arch = `(/bin/arch) 2>/dev/null`
1424 /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
1425 /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1426
1427 UNAME_MACHINE = ${UNAME_MACHINE}
1428 UNAME_RELEASE = ${UNAME_RELEASE}
1429 UNAME_SYSTEM = ${UNAME_SYSTEM}
1430 UNAME_VERSION = ${UNAME_VERSION}
1431 EOF
1432
1433 exit 1
1434
1435 # Local variables:
1436 # eval: (add-hook 'write-file-hooks 'time-stamp)
1437 # time-stamp-start: "timestamp='"
1438 # time-stamp-format: "%:y-%02m-%02d"
1439 # time-stamp-end: "'"
1440 # End:
0 This file contains any messages produced by compilers while
1 running configure, to aid debugging if configure makes a mistake.
2
3 It was created by libenet configure 1.0, which was
4 generated by GNU Autoconf 2.59. Invocation command line was
5
6 $ ./configure
7
8 ## --------- ##
9 ## Platform. ##
10 ## --------- ##
11
12 hostname = poul2006
13 uname -m = i686
14 uname -r = 2.6.15-26-k7
15 uname -s = Linux
16 uname -v = #1 SMP PREEMPT Thu Aug 3 03:40:32 UTC 2006
17
18 /usr/bin/uname -p = unknown
19 /bin/uname -X = unknown
20
21 /bin/arch = i686
22 /usr/bin/arch -k = unknown
23 /usr/convex/getsysinfo = unknown
24 hostinfo = unknown
25 /bin/machine = unknown
26 /usr/bin/oslevel = unknown
27 /bin/universe = unknown
28
29 PATH: /usr/local/sbin
30 PATH: /usr/local/bin
31 PATH: /usr/sbin
32 PATH: /usr/bin
33 PATH: /sbin
34 PATH: /bin
35 PATH: /usr/bin/X11
36 PATH: /usr/games
37
38
39 ## ----------- ##
40 ## Core tests. ##
41 ## ----------- ##
42
43 configure:1311: checking for a BSD-compatible install
44 configure:1366: result: /usr/bin/install -c
45 configure:1377: checking whether build environment is sane
46 configure:1420: result: yes
47 configure:1444: WARNING: `missing' script is too old or missing
48 configure:1485: checking for gawk
49 configure:1501: found /usr/bin/gawk
50 configure:1511: result: gawk
51 configure:1521: checking whether make sets $(MAKE)
52 configure:1541: result: yes
53 configure:1756: checking for gcc
54 configure:1772: found /usr/bin/gcc
55 configure:1782: result: gcc
56 configure:2026: checking for C compiler version
57 configure:2029: gcc --version </dev/null >&5
58 gcc (GCC) 4.0.3 (Ubuntu 4.0.3-1ubuntu5)
59 Copyright (C) 2006 Free Software Foundation, Inc.
60 This is free software; see the source for copying conditions. There is NO
61 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
62
63 configure:2032: $? = 0
64 configure:2034: gcc -v </dev/null >&5
65 Using built-in specs.
66 Target: i486-linux-gnu
67 Configured with: ../src/configure -v --enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.0 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-java-awt=gtk-default --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre --enable-mpfr --disable-werror --with-tune=pentium4 --enable-checking=release i486-linux-gnu
68 Thread model: posix
69 gcc version 4.0.3 (Ubuntu 4.0.3-1ubuntu5)
70 configure:2037: $? = 0
71 configure:2039: gcc -V </dev/null >&5
72 gcc: '-V' option must have argument
73 configure:2042: $? = 1
74 configure:2065: checking for C compiler default output file name
75 configure:2068: gcc conftest.c >&5
76 configure:2071: $? = 0
77 configure:2117: result: a.out
78 configure:2122: checking whether the C compiler works
79 configure:2128: ./a.out
80 configure:2131: $? = 0
81 configure:2148: result: yes
82 configure:2155: checking whether we are cross compiling
83 configure:2157: result: no
84 configure:2160: checking for suffix of executables
85 configure:2162: gcc -o conftest conftest.c >&5
86 configure:2165: $? = 0
87 configure:2190: result:
88 configure:2196: checking for suffix of object files
89 configure:2217: gcc -c conftest.c >&5
90 configure:2220: $? = 0
91 configure:2242: result: o
92 configure:2246: checking whether we are using the GNU C compiler
93 configure:2270: gcc -c conftest.c >&5
94 configure:2276: $? = 0
95 configure:2279: test -z || test ! -s conftest.err
96 configure:2282: $? = 0
97 configure:2285: test -s conftest.o
98 configure:2288: $? = 0
99 configure:2301: result: yes
100 configure:2307: checking whether gcc accepts -g
101 configure:2328: gcc -c -g conftest.c >&5
102 configure:2334: $? = 0
103 configure:2337: test -z || test ! -s conftest.err
104 configure:2340: $? = 0
105 configure:2343: test -s conftest.o
106 configure:2346: $? = 0
107 configure:2357: result: yes
108 configure:2374: checking for gcc option to accept ANSI C
109 configure:2444: gcc -c -g -O2 conftest.c >&5
110 configure:2450: $? = 0
111 configure:2453: test -z || test ! -s conftest.err
112 configure:2456: $? = 0
113 configure:2459: test -s conftest.o
114 configure:2462: $? = 0
115 configure:2480: result: none needed
116 configure:2498: gcc -c -g -O2 conftest.c >&5
117 conftest.c:2: error: syntax error before 'me'
118 configure:2504: $? = 1
119 configure: failed program was:
120 | #ifndef __cplusplus
121 | choke me
122 | #endif
123 configure:2645: checking for style of include used by make
124 configure:2673: result: GNU
125 configure:2701: checking dependency style of gcc
126 configure:2791: result: gcc3
127 configure:2849: checking for ranlib
128 configure:2865: found /usr/bin/ranlib
129 configure:2876: result: ranlib
130 configure:2890: checking for gethostbyaddr_r
131 configure:2947: gcc -o conftest -g -O2 conftest.c >&5
132 configure:2953: $? = 0
133 configure:2956: test -z || test ! -s conftest.err
134 configure:2959: $? = 0
135 configure:2962: test -s conftest
136 configure:2965: $? = 0
137 configure:2977: result: yes
138 configure:2986: checking for gethostbyname_r
139 configure:3043: gcc -o conftest -g -O2 conftest.c >&5
140 configure:3049: $? = 0
141 configure:3052: test -z || test ! -s conftest.err
142 configure:3055: $? = 0
143 configure:3058: test -s conftest
144 configure:3061: $? = 0
145 configure:3073: result: yes
146 configure:3082: checking for poll
147 configure:3139: gcc -o conftest -g -O2 conftest.c >&5
148 configure:3145: $? = 0
149 configure:3148: test -z || test ! -s conftest.err
150 configure:3151: $? = 0
151 configure:3154: test -s conftest
152 configure:3157: $? = 0
153 configure:3169: result: yes
154 configure:3178: checking for fcntl
155 configure:3235: gcc -o conftest -g -O2 conftest.c >&5
156 configure:3241: $? = 0
157 configure:3244: test -z || test ! -s conftest.err
158 configure:3247: $? = 0
159 configure:3250: test -s conftest
160 configure:3253: $? = 0
161 configure:3265: result: yes
162 configure:3274: checking for inet_pton
163 configure:3331: gcc -o conftest -g -O2 conftest.c >&5
164 configure:3337: $? = 0
165 configure:3340: test -z || test ! -s conftest.err
166 configure:3343: $? = 0
167 configure:3346: test -s conftest
168 configure:3349: $? = 0
169 configure:3361: result: yes
170 configure:3370: checking for inet_ntop
171 configure:3427: gcc -o conftest -g -O2 conftest.c >&5
172 configure:3433: $? = 0
173 configure:3436: test -z || test ! -s conftest.err
174 configure:3439: $? = 0
175 configure:3442: test -s conftest
176 configure:3445: $? = 0
177 configure:3457: result: yes
178 configure:3467: checking for struct msghdr.msg_flags
179 configure:3491: gcc -c -g -O2 conftest.c >&5
180 configure:3497: $? = 0
181 configure:3500: test -z || test ! -s conftest.err
182 configure:3503: $? = 0
183 configure:3506: test -s conftest.o
184 configure:3509: $? = 0
185 configure:3566: result: yes
186 configure:3576: checking for socklen_t
187 configure:3603: gcc -c -g -O2 conftest.c >&5
188 configure:3609: $? = 0
189 configure:3612: test -z || test ! -s conftest.err
190 configure:3615: $? = 0
191 configure:3618: test -s conftest.o
192 configure:3621: $? = 0
193 configure:3632: result: yes
194 configure:3647: checking how to run the C preprocessor
195 configure:3682: gcc -E conftest.c
196 configure:3688: $? = 0
197 configure:3720: gcc -E conftest.c
198 conftest.c:19:28: error: ac_nonexistent.h: No such file or directory
199 configure:3726: $? = 1
200 configure: failed program was:
201 | /* confdefs.h. */
202 |
203 | #define PACKAGE_NAME "libenet"
204 | #define PACKAGE_TARNAME "libenet"
205 | #define PACKAGE_VERSION "1.0"
206 | #define PACKAGE_STRING "libenet 1.0"
207 | #define PACKAGE_BUGREPORT ""
208 | #define PACKAGE "libenet.a"
209 | #define VERSION "1.0"
210 | #define HAS_GETHOSTBYADDR_R 1
211 | #define HAS_GETHOSTBYNAME_R 1
212 | #define HAS_POLL 1
213 | #define HAS_FCNTL 1
214 | #define HAS_INET_PTON 1
215 | #define HAS_INET_NTOP 1
216 | #define HAS_MSGHDR_FLAGS 1
217 | #define HAS_SOCKLEN_T 1
218 | /* end confdefs.h. */
219 | #include <ac_nonexistent.h>
220 configure:3765: result: gcc -E
221 configure:3789: gcc -E conftest.c
222 configure:3795: $? = 0
223 configure:3827: gcc -E conftest.c
224 conftest.c:19:28: error: ac_nonexistent.h: No such file or directory
225 configure:3833: $? = 1
226 configure: failed program was:
227 | /* confdefs.h. */
228 |
229 | #define PACKAGE_NAME "libenet"
230 | #define PACKAGE_TARNAME "libenet"
231 | #define PACKAGE_VERSION "1.0"
232 | #define PACKAGE_STRING "libenet 1.0"
233 | #define PACKAGE_BUGREPORT ""
234 | #define PACKAGE "libenet.a"
235 | #define VERSION "1.0"
236 | #define HAS_GETHOSTBYADDR_R 1
237 | #define HAS_GETHOSTBYNAME_R 1
238 | #define HAS_POLL 1
239 | #define HAS_FCNTL 1
240 | #define HAS_INET_PTON 1
241 | #define HAS_INET_NTOP 1
242 | #define HAS_MSGHDR_FLAGS 1
243 | #define HAS_SOCKLEN_T 1
244 | /* end confdefs.h. */
245 | #include <ac_nonexistent.h>
246 configure:3877: checking for egrep
247 configure:3887: result: grep -E
248 conftest.c:19:20: error: socket.h: No such file or directory
249 configure:4070: creating ./config.status
250
251 ## ---------------------- ##
252 ## Running config.status. ##
253 ## ---------------------- ##
254
255 This file was extended by libenet config.status 1.0, which was
256 generated by GNU Autoconf 2.59. Invocation command line was
257
258 CONFIG_FILES =
259 CONFIG_HEADERS =
260 CONFIG_LINKS =
261 CONFIG_COMMANDS =
262 $ ./config.status
263
264 on poul2006
265
266 config.status:724: creating Makefile
267 config.status:724: creating include/Makefile
268 config.status:724: creating include/enet/Makefile
269 config.status:869: executing depfiles commands
270
271 ## ---------------- ##
272 ## Cache variables. ##
273 ## ---------------- ##
274
275 ac_cv_c_compiler_gnu=yes
276 ac_cv_env_CC_set=
277 ac_cv_env_CC_value=
278 ac_cv_env_CFLAGS_set=
279 ac_cv_env_CFLAGS_value=
280 ac_cv_env_CPPFLAGS_set=
281 ac_cv_env_CPPFLAGS_value=
282 ac_cv_env_CPP_set=
283 ac_cv_env_CPP_value=
284 ac_cv_env_LDFLAGS_set=
285 ac_cv_env_LDFLAGS_value=
286 ac_cv_env_build_alias_set=
287 ac_cv_env_build_alias_value=
288 ac_cv_env_host_alias_set=
289 ac_cv_env_host_alias_value=
290 ac_cv_env_target_alias_set=
291 ac_cv_env_target_alias_value=
292 ac_cv_exeext=
293 ac_cv_func_fcntl=yes
294 ac_cv_func_gethostbyaddr_r=yes
295 ac_cv_func_gethostbyname_r=yes
296 ac_cv_func_inet_ntop=yes
297 ac_cv_func_inet_pton=yes
298 ac_cv_func_poll=yes
299 ac_cv_member_struct_msghdr_msg_flags=yes
300 ac_cv_objext=o
301 ac_cv_path_install='/usr/bin/install -c'
302 ac_cv_prog_AWK=gawk
303 ac_cv_prog_CPP='gcc -E'
304 ac_cv_prog_ac_ct_CC=gcc
305 ac_cv_prog_ac_ct_RANLIB=ranlib
306 ac_cv_prog_cc_g=yes
307 ac_cv_prog_cc_stdc=
308 ac_cv_prog_egrep='grep -E'
309 ac_cv_prog_make_make_set=yes
310 ac_cv_type_socklen_t=yes
311 am_cv_CC_dependencies_compiler_type=gcc3
312
313 ## ----------------- ##
314 ## Output variables. ##
315 ## ----------------- ##
316
317 ACLOCAL='aclocal-1.9'
318 AMDEPBACKSLASH='\'
319 AMDEP_FALSE='#'
320 AMDEP_TRUE=''
321 AMTAR='tar'
322 AUTOCONF='autoconf'
323 AUTOHEADER='autoheader'
324 AUTOMAKE='automake-1.9'
325 AWK='gawk'
326 CC='gcc'
327 CCDEPMODE='depmode=gcc3'
328 CFLAGS='-g -O2'
329 CPP='gcc -E'
330 CPPFLAGS=''
331 CYGPATH_W='echo'
332 DEFS='-DPACKAGE_NAME=\"libenet\" -DPACKAGE_TARNAME=\"libenet\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"libenet\ 1.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"libenet.a\" -DVERSION=\"1.0\" -DHAS_GETHOSTBYADDR_R=1 -DHAS_GETHOSTBYNAME_R=1 -DHAS_POLL=1 -DHAS_FCNTL=1 -DHAS_INET_PTON=1 -DHAS_INET_NTOP=1 -DHAS_MSGHDR_FLAGS=1 -DHAS_SOCKLEN_T=1 '
333 DEPDIR='.deps'
334 ECHO_C=''
335 ECHO_N='-n'
336 ECHO_T=''
337 EGREP='grep -E'
338 EXEEXT=''
339 INSTALL_DATA='${INSTALL} -m 644'
340 INSTALL_PROGRAM='${INSTALL}'
341 INSTALL_SCRIPT='${INSTALL}'
342 INSTALL_STRIP_PROGRAM='${SHELL} $(install_sh) -c -s'
343 LDFLAGS=''
344 LIBOBJS=''
345 LIBS=''
346 LTLIBOBJS=''
347 MAKEINFO='makeinfo'
348 OBJEXT='o'
349 PACKAGE='libenet.a'
350 PACKAGE_BUGREPORT=''
351 PACKAGE_NAME='libenet'
352 PACKAGE_STRING='libenet 1.0'
353 PACKAGE_TARNAME='libenet'
354 PACKAGE_VERSION='1.0'
355 PATH_SEPARATOR=':'
356 RANLIB='ranlib'
357 SET_MAKE=''
358 SHELL='/bin/sh'
359 STRIP=''
360 VERSION='1.0'
361 ac_ct_CC='gcc'
362 ac_ct_RANLIB='ranlib'
363 ac_ct_STRIP=''
364 am__fastdepCC_FALSE='#'
365 am__fastdepCC_TRUE=''
366 am__include='include'
367 am__leading_dot='.'
368 am__quote=''
369 am__tar='${AMTAR} chof - "$$tardir"'
370 am__untar='${AMTAR} xf -'
371 bindir='${exec_prefix}/bin'
372 build_alias=''
373 datadir='${prefix}/share'
374 exec_prefix='${prefix}'
375 host_alias=''
376 includedir='${prefix}/include'
377 infodir='${prefix}/info'
378 install_sh='/home/poul/blockattack-1.3.0/enet-1.0/install-sh'
379 libdir='${exec_prefix}/lib'
380 libexecdir='${exec_prefix}/libexec'
381 localstatedir='${prefix}/var'
382 mandir='${prefix}/man'
383 mkdir_p='mkdir -p --'
384 oldincludedir='/usr/include'
385 prefix='/usr/local'
386 program_transform_name='s,x,x,'
387 sbindir='${exec_prefix}/sbin'
388 sharedstatedir='${prefix}/com'
389 sysconfdir='${prefix}/etc'
390 target_alias=''
391
392 ## ----------- ##
393 ## confdefs.h. ##
394 ## ----------- ##
395
396 #define HAS_FCNTL 1
397 #define HAS_GETHOSTBYADDR_R 1
398 #define HAS_GETHOSTBYNAME_R 1
399 #define HAS_INET_NTOP 1
400 #define HAS_INET_PTON 1
401 #define HAS_MSGHDR_FLAGS 1
402 #define HAS_POLL 1
403 #define HAS_SOCKLEN_T 1
404 #define PACKAGE "libenet.a"
405 #define PACKAGE_BUGREPORT ""
406 #define PACKAGE_NAME "libenet"
407 #define PACKAGE_STRING "libenet 1.0"
408 #define PACKAGE_TARNAME "libenet"
409 #define PACKAGE_VERSION "1.0"
410 #define VERSION "1.0"
411
412 configure: exit 0
0 #! /bin/sh
1 # Generated by configure.
2 # Run this file to recreate the current configuration.
3 # Compiler output produced by configure, useful for debugging
4 # configure, is in config.log if it exists.
5
6 debug=false
7 ac_cs_recheck=false
8 ac_cs_silent=false
9 SHELL=${CONFIG_SHELL-/bin/sh}
10 ## --------------------- ##
11 ## M4sh Initialization. ##
12 ## --------------------- ##
13
14 # Be Bourne compatible
15 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
16 emulate sh
17 NULLCMD=:
18 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
19 # is contrary to our usage. Disable this feature.
20 alias -g '${1+"$@"}'='"$@"'
21 elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
22 set -o posix
23 fi
24 DUALCASE=1; export DUALCASE # for MKS sh
25
26 # Support unset when possible.
27 if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
28 as_unset=unset
29 else
30 as_unset=false
31 fi
32
33
34 # Work around bugs in pre-3.0 UWIN ksh.
35 $as_unset ENV MAIL MAILPATH
36 PS1='$ '
37 PS2='> '
38 PS4='+ '
39
40 # NLS nuisances.
41 for as_var in \
42 LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
43 LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
44 LC_TELEPHONE LC_TIME
45 do
46 if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
47 eval $as_var=C; export $as_var
48 else
49 $as_unset $as_var
50 fi
51 done
52
53 # Required to use basename.
54 if expr a : '\(a\)' >/dev/null 2>&1; then
55 as_expr=expr
56 else
57 as_expr=false
58 fi
59
60 if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
61 as_basename=basename
62 else
63 as_basename=false
64 fi
65
66
67 # Name of the executable.
68 as_me=`$as_basename "$0" ||
69 $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
70 X"$0" : 'X\(//\)$' \| \
71 X"$0" : 'X\(/\)$' \| \
72 . : '\(.\)' 2>/dev/null ||
73 echo X/"$0" |
74 sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
75 /^X\/\(\/\/\)$/{ s//\1/; q; }
76 /^X\/\(\/\).*/{ s//\1/; q; }
77 s/.*/./; q'`
78
79
80 # PATH needs CR, and LINENO needs CR and PATH.
81 # Avoid depending upon Character Ranges.
82 as_cr_letters='abcdefghijklmnopqrstuvwxyz'
83 as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
84 as_cr_Letters=$as_cr_letters$as_cr_LETTERS
85 as_cr_digits='0123456789'
86 as_cr_alnum=$as_cr_Letters$as_cr_digits
87
88 # The user is always right.
89 if test "${PATH_SEPARATOR+set}" != set; then
90 echo "#! /bin/sh" >conf$$.sh
91 echo "exit 0" >>conf$$.sh
92 chmod +x conf$$.sh
93 if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
94 PATH_SEPARATOR=';'
95 else
96 PATH_SEPARATOR=:
97 fi
98 rm -f conf$$.sh
99 fi
100
101
102 as_lineno_1=$LINENO
103 as_lineno_2=$LINENO
104 as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
105 test "x$as_lineno_1" != "x$as_lineno_2" &&
106 test "x$as_lineno_3" = "x$as_lineno_2" || {
107 # Find who we are. Look in the path if we contain no path at all
108 # relative or not.
109 case $0 in
110 *[\\/]* ) as_myself=$0 ;;
111 *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
112 for as_dir in $PATH
113 do
114 IFS=$as_save_IFS
115 test -z "$as_dir" && as_dir=.
116 test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
117 done
118
119 ;;
120 esac
121 # We did not find ourselves, most probably we were run as `sh COMMAND'
122 # in which case we are not to be found in the path.
123 if test "x$as_myself" = x; then
124 as_myself=$0
125 fi
126 if test ! -f "$as_myself"; then
127 { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
128 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
129 { (exit 1); exit 1; }; }
130 fi
131 case $CONFIG_SHELL in
132 '')
133 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
134 for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
135 do
136 IFS=$as_save_IFS
137 test -z "$as_dir" && as_dir=.
138 for as_base in sh bash ksh sh5; do
139 case $as_dir in
140 /*)
141 if ("$as_dir/$as_base" -c '
142 as_lineno_1=$LINENO
143 as_lineno_2=$LINENO
144 as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
145 test "x$as_lineno_1" != "x$as_lineno_2" &&
146 test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
147 $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
148 $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
149 CONFIG_SHELL=$as_dir/$as_base
150 export CONFIG_SHELL
151 exec "$CONFIG_SHELL" "$0" ${1+"$@"}
152 fi;;
153 esac
154 done
155 done
156 ;;
157 esac
158
159 # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
160 # uniformly replaced by the line number. The first 'sed' inserts a
161 # line-number line before each line; the second 'sed' does the real
162 # work. The second script uses 'N' to pair each line-number line
163 # with the numbered line, and appends trailing '-' during
164 # substitution so that $LINENO is not a special case at line end.
165 # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
166 # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
167 sed '=' <$as_myself |
168 sed '
169 N
170 s,$,-,
171 : loop
172 s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
173 t loop
174 s,-$,,
175 s,^['$as_cr_digits']*\n,,
176 ' >$as_me.lineno &&
177 chmod +x $as_me.lineno ||
178 { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
179 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
180 { (exit 1); exit 1; }; }
181
182 # Don't try to exec as it changes $[0], causing all sort of problems
183 # (the dirname of $[0] is not the place where we might find the
184 # original and so on. Autoconf is especially sensible to this).
185 . ./$as_me.lineno
186 # Exit status is that of the last command.
187 exit
188 }
189
190
191 case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
192 *c*,-n*) ECHO_N= ECHO_C='
193 ' ECHO_T=' ' ;;
194 *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
195 *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
196 esac
197
198 if expr a : '\(a\)' >/dev/null 2>&1; then
199 as_expr=expr
200 else
201 as_expr=false
202 fi
203
204 rm -f conf$$ conf$$.exe conf$$.file
205 echo >conf$$.file
206 if ln -s conf$$.file conf$$ 2>/dev/null; then
207 # We could just check for DJGPP; but this test a) works b) is more generic
208 # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
209 if test -f conf$$.exe; then
210 # Don't use ln at all; we don't have any links
211 as_ln_s='cp -p'
212 else
213 as_ln_s='ln -s'
214 fi
215 elif ln conf$$.file conf$$ 2>/dev/null; then
216 as_ln_s=ln
217 else
218 as_ln_s='cp -p'
219 fi
220 rm -f conf$$ conf$$.exe conf$$.file
221
222 if mkdir -p . 2>/dev/null; then
223 as_mkdir_p=:
224 else
225 test -d ./-p && rmdir ./-p
226 as_mkdir_p=false
227 fi
228
229 as_executable_p="test -f"
230
231 # Sed expression to map a string onto a valid CPP name.
232 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
233
234 # Sed expression to map a string onto a valid variable name.
235 as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
236
237
238 # IFS
239 # We need space, tab and new line, in precisely that order.
240 as_nl='
241 '
242 IFS=" $as_nl"
243
244 # CDPATH.
245 $as_unset CDPATH
246
247 exec 6>&1
248
249 # Open the log real soon, to keep \$[0] and so on meaningful, and to
250 # report actual input values of CONFIG_FILES etc. instead of their
251 # values after options handling. Logging --version etc. is OK.
252 exec 5>>config.log
253 {
254 echo
255 sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
256 ## Running $as_me. ##
257 _ASBOX
258 } >&5
259 cat >&5 <<_CSEOF
260
261 This file was extended by libenet $as_me 1.0, which was
262 generated by GNU Autoconf 2.59. Invocation command line was
263
264 CONFIG_FILES = $CONFIG_FILES
265 CONFIG_HEADERS = $CONFIG_HEADERS
266 CONFIG_LINKS = $CONFIG_LINKS
267 CONFIG_COMMANDS = $CONFIG_COMMANDS
268 $ $0 $@
269
270 _CSEOF
271 echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
272 echo >&5
273 config_files=" Makefile include/Makefile include/enet/Makefile"
274 config_commands=" depfiles"
275
276 ac_cs_usage="\
277 \`$as_me' instantiates files from templates according to the
278 current configuration.
279
280 Usage: $0 [OPTIONS] [FILE]...
281
282 -h, --help print this help, then exit
283 -V, --version print version number, then exit
284 -q, --quiet do not print progress messages
285 -d, --debug don't remove temporary files
286 --recheck update $as_me by reconfiguring in the same conditions
287 --file=FILE[:TEMPLATE]
288 instantiate the configuration file FILE
289
290 Configuration files:
291 $config_files
292
293 Configuration commands:
294 $config_commands
295
296 Report bugs to <bug-autoconf@gnu.org>."
297 ac_cs_version="\
298 libenet config.status 1.0
299 configured by ./configure, generated by GNU Autoconf 2.59,
300 with options \"\"
301
302 Copyright (C) 2003 Free Software Foundation, Inc.
303 This config.status script is free software; the Free Software Foundation
304 gives unlimited permission to copy, distribute and modify it."
305 srcdir=.
306 INSTALL="/usr/bin/install -c"
307 # If no file are specified by the user, then we need to provide default
308 # value. By we need to know if files were specified by the user.
309 ac_need_defaults=:
310 while test $# != 0
311 do
312 case $1 in
313 --*=*)
314 ac_option=`expr "x$1" : 'x\([^=]*\)='`
315 ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
316 ac_shift=:
317 ;;
318 -*)
319 ac_option=$1
320 ac_optarg=$2
321 ac_shift=shift
322 ;;
323 *) # This is not an option, so the user has probably given explicit
324 # arguments.
325 ac_option=$1
326 ac_need_defaults=false;;
327 esac
328
329 case $ac_option in
330 # Handling of the options.
331 -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
332 ac_cs_recheck=: ;;
333 --version | --vers* | -V )
334 echo "$ac_cs_version"; exit 0 ;;
335 --he | --h)
336 # Conflict between --help and --header
337 { { echo "$as_me:$LINENO: error: ambiguous option: $1
338 Try \`$0 --help' for more information." >&5
339 echo "$as_me: error: ambiguous option: $1
340 Try \`$0 --help' for more information." >&2;}
341 { (exit 1); exit 1; }; };;
342 --help | --hel | -h )
343 echo "$ac_cs_usage"; exit 0 ;;
344 --debug | --d* | -d )
345 debug=: ;;
346 --file | --fil | --fi | --f )
347 $ac_shift
348 CONFIG_FILES="$CONFIG_FILES $ac_optarg"
349 ac_need_defaults=false;;
350 --header | --heade | --head | --hea )
351 $ac_shift
352 CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
353 ac_need_defaults=false;;
354 -q | -quiet | --quiet | --quie | --qui | --qu | --q \
355 | -silent | --silent | --silen | --sile | --sil | --si | --s)
356 ac_cs_silent=: ;;
357
358 # This is an error.
359 -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
360 Try \`$0 --help' for more information." >&5
361 echo "$as_me: error: unrecognized option: $1
362 Try \`$0 --help' for more information." >&2;}
363 { (exit 1); exit 1; }; } ;;
364
365 *) ac_config_targets="$ac_config_targets $1" ;;
366
367 esac
368 shift
369 done
370
371 ac_configure_extra_args=
372
373 if $ac_cs_silent; then
374 exec 6>/dev/null
375 ac_configure_extra_args="$ac_configure_extra_args --silent"
376 fi
377
378 if $ac_cs_recheck; then
379 echo "running /bin/sh ./configure " $ac_configure_extra_args " --no-create --no-recursion" >&6
380 exec /bin/sh ./configure $ac_configure_extra_args --no-create --no-recursion
381 fi
382
383 #
384 # INIT-COMMANDS section.
385 #
386
387 AMDEP_TRUE="" ac_aux_dir="."
388
389 for ac_config_target in $ac_config_targets
390 do
391 case "$ac_config_target" in
392 # Handling of arguments.
393 "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
394 "include/Makefile" ) CONFIG_FILES="$CONFIG_FILES include/Makefile" ;;
395 "include/enet/Makefile" ) CONFIG_FILES="$CONFIG_FILES include/enet/Makefile" ;;
396 "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
397 *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
398 echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
399 { (exit 1); exit 1; }; };;
400 esac
401 done
402
403 # If the user did not use the arguments to specify the items to instantiate,
404 # then the envvar interface is used. Set only those that are not.
405 # We use the long form for the default assignment because of an extremely
406 # bizarre bug on SunOS 4.1.3.
407 if $ac_need_defaults; then
408 test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
409 test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
410 fi
411
412 # Have a temporary directory for convenience. Make it in the build tree
413 # simply because there is no reason to put it here, and in addition,
414 # creating and moving files from /tmp can sometimes cause problems.
415 # Create a temporary directory, and hook for its removal unless debugging.
416 $debug ||
417 {
418 trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
419 trap '{ (exit 1); exit 1; }' 1 2 13 15
420 }
421
422 # Create a (secure) tmp directory for tmp files.
423
424 {
425 tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
426 test -n "$tmp" && test -d "$tmp"
427 } ||
428 {
429 tmp=./confstat$$-$RANDOM
430 (umask 077 && mkdir $tmp)
431 } ||
432 {
433 echo "$me: cannot create a temporary directory in ." >&2
434 { (exit 1); exit 1; }
435 }
436
437
438 #
439 # CONFIG_FILES section.
440 #
441
442 # No need to generate the scripts if there are no CONFIG_FILES.
443 # This happens for instance when ./config.status config.h
444 if test -n "$CONFIG_FILES"; then
445 # Protect against being on the right side of a sed subst in config.status.
446 sed 's/,@/@@/; s/@,/@@/; s/,;t t$/@;t t/; /@;t t$/s/[\\&,]/\\&/g;
447 s/@@/,@/; s/@@/@,/; s/@;t t$/,;t t/' >$tmp/subs.sed <<\CEOF
448 s,@SHELL@,/bin/sh,;t t
449 s,@PATH_SEPARATOR@,:,;t t
450 s,@PACKAGE_NAME@,libenet,;t t
451 s,@PACKAGE_TARNAME@,libenet,;t t
452 s,@PACKAGE_VERSION@,1.0,;t t
453 s,@PACKAGE_STRING@,libenet 1.0,;t t
454 s,@PACKAGE_BUGREPORT@,,;t t
455 s,@exec_prefix@,${prefix},;t t
456 s,@prefix@,/usr/local,;t t
457 s,@program_transform_name@,s,x,x,,;t t
458 s,@bindir@,${exec_prefix}/bin,;t t
459 s,@sbindir@,${exec_prefix}/sbin,;t t
460 s,@libexecdir@,${exec_prefix}/libexec,;t t
461 s,@datadir@,${prefix}/share,;t t
462 s,@sysconfdir@,${prefix}/etc,;t t
463 s,@sharedstatedir@,${prefix}/com,;t t
464 s,@localstatedir@,${prefix}/var,;t t
465 s,@libdir@,${exec_prefix}/lib,;t t
466 s,@includedir@,${prefix}/include,;t t
467 s,@oldincludedir@,/usr/include,;t t
468 s,@infodir@,${prefix}/info,;t t
469 s,@mandir@,${prefix}/man,;t t
470 s,@build_alias@,,;t t
471 s,@host_alias@,,;t t
472 s,@target_alias@,,;t t
473 s,@DEFS@,-DPACKAGE_NAME=\"libenet\" -DPACKAGE_TARNAME=\"libenet\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"libenet\ 1.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"libenet.a\" -DVERSION=\"1.0\" -DHAS_GETHOSTBYADDR_R=1 -DHAS_GETHOSTBYNAME_R=1 -DHAS_POLL=1 -DHAS_FCNTL=1 -DHAS_INET_PTON=1 -DHAS_INET_NTOP=1 -DHAS_MSGHDR_FLAGS=1 -DHAS_SOCKLEN_T=1 ,;t t
474 s,@ECHO_C@,,;t t
475 s,@ECHO_N@,-n,;t t
476 s,@ECHO_T@,,;t t
477 s,@LIBS@,,;t t
478 s,@INSTALL_PROGRAM@,${INSTALL},;t t
479 s,@INSTALL_SCRIPT@,${INSTALL},;t t
480 s,@INSTALL_DATA@,${INSTALL} -m 644,;t t
481 s,@CYGPATH_W@,echo,;t t
482 s,@PACKAGE@,libenet.a,;t t
483 s,@VERSION@,1.0,;t t
484 s,@ACLOCAL@,aclocal-1.9,;t t
485 s,@AUTOCONF@,autoconf,;t t
486 s,@AUTOMAKE@,automake-1.9,;t t
487 s,@AUTOHEADER@,autoheader,;t t
488 s,@MAKEINFO@,makeinfo,;t t
489 s,@install_sh@,/home/poul/blockattack-1.3.0/enet-1.0/install-sh,;t t
490 s,@STRIP@,,;t t
491 s,@ac_ct_STRIP@,,;t t
492 s,@INSTALL_STRIP_PROGRAM@,${SHELL} $(install_sh) -c -s,;t t
493 s,@mkdir_p@,mkdir -p --,;t t
494 s,@AWK@,gawk,;t t
495 s,@SET_MAKE@,,;t t
496 s,@am__leading_dot@,.,;t t
497 s,@AMTAR@,tar,;t t
498 s,@am__tar@,${AMTAR} chof - "$$tardir",;t t
499 s,@am__untar@,${AMTAR} xf -,;t t
500 s,@CC@,gcc,;t t
501 s,@CFLAGS@,-g -O2,;t t
502 s,@LDFLAGS@,,;t t
503 s,@CPPFLAGS@,,;t t
504 s,@ac_ct_CC@,gcc,;t t
505 s,@EXEEXT@,,;t t
506 s,@OBJEXT@,o,;t t
507 s,@DEPDIR@,.deps,;t t
508 s,@am__include@,include,;t t
509 s,@am__quote@,,;t t
510 s,@AMDEP_TRUE@,,;t t
511 s,@AMDEP_FALSE@,#,;t t
512 s,@AMDEPBACKSLASH@,\,;t t
513 s,@CCDEPMODE@,depmode=gcc3,;t t
514 s,@am__fastdepCC_TRUE@,,;t t
515 s,@am__fastdepCC_FALSE@,#,;t t
516 s,@RANLIB@,ranlib,;t t
517 s,@ac_ct_RANLIB@,ranlib,;t t
518 s,@CPP@,gcc -E,;t t
519 s,@EGREP@,grep -E,;t t
520 s,@LIBOBJS@,,;t t
521 s,@LTLIBOBJS@,,;t t
522 CEOF
523
524 # Split the substitutions into bite-sized pieces for seds with
525 # small command number limits, like on Digital OSF/1 and HP-UX.
526 ac_max_sed_lines=48
527 ac_sed_frag=1 # Number of current file.
528 ac_beg=1 # First line for current file.
529 ac_end=$ac_max_sed_lines # Line after last line for current file.
530 ac_more_lines=:
531 ac_sed_cmds=
532 while $ac_more_lines; do
533 if test $ac_beg -gt 1; then
534 sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
535 else
536 sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
537 fi
538 if test ! -s $tmp/subs.frag; then
539 ac_more_lines=false
540 else
541 # The purpose of the label and of the branching condition is to
542 # speed up the sed processing (if there are no `@' at all, there
543 # is no need to browse any of the substitutions).
544 # These are the two extra sed commands mentioned above.
545 (echo ':t
546 /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
547 if test -z "$ac_sed_cmds"; then
548 ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
549 else
550 ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
551 fi
552 ac_sed_frag=`expr $ac_sed_frag + 1`
553 ac_beg=$ac_end
554 ac_end=`expr $ac_end + $ac_max_sed_lines`
555 fi
556 done
557 if test -z "$ac_sed_cmds"; then
558 ac_sed_cmds=cat
559 fi
560 fi # test -n "$CONFIG_FILES"
561
562 for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
563 # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
564 case $ac_file in
565 - | *:- | *:-:* ) # input from stdin
566 cat >$tmp/stdin
567 ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
568 ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
569 *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
570 ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
571 * ) ac_file_in=$ac_file.in ;;
572 esac
573
574 # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
575 ac_dir=`(dirname "$ac_file") 2>/dev/null ||
576 $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
577 X"$ac_file" : 'X\(//\)[^/]' \| \
578 X"$ac_file" : 'X\(//\)$' \| \
579 X"$ac_file" : 'X\(/\)' \| \
580 . : '\(.\)' 2>/dev/null ||
581 echo X"$ac_file" |
582 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
583 /^X\(\/\/\)[^/].*/{ s//\1/; q; }
584 /^X\(\/\/\)$/{ s//\1/; q; }
585 /^X\(\/\).*/{ s//\1/; q; }
586 s/.*/./; q'`
587 { if $as_mkdir_p; then
588 mkdir -p "$ac_dir"
589 else
590 as_dir="$ac_dir"
591 as_dirs=
592 while test ! -d "$as_dir"; do
593 as_dirs="$as_dir $as_dirs"
594 as_dir=`(dirname "$as_dir") 2>/dev/null ||
595 $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
596 X"$as_dir" : 'X\(//\)[^/]' \| \
597 X"$as_dir" : 'X\(//\)$' \| \
598 X"$as_dir" : 'X\(/\)' \| \
599 . : '\(.\)' 2>/dev/null ||
600 echo X"$as_dir" |
601 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
602 /^X\(\/\/\)[^/].*/{ s//\1/; q; }
603 /^X\(\/\/\)$/{ s//\1/; q; }
604 /^X\(\/\).*/{ s//\1/; q; }
605 s/.*/./; q'`
606 done
607 test ! -n "$as_dirs" || mkdir $as_dirs
608 fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
609 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
610 { (exit 1); exit 1; }; }; }
611
612 ac_builddir=.
613
614 if test "$ac_dir" != .; then
615 ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
616 # A "../" for each directory in $ac_dir_suffix.
617 ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
618 else
619 ac_dir_suffix= ac_top_builddir=
620 fi
621
622 case $srcdir in
623 .) # No --srcdir option. We are building in place.
624 ac_srcdir=.
625 if test -z "$ac_top_builddir"; then
626 ac_top_srcdir=.
627 else
628 ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
629 fi ;;
630 [\\/]* | ?:[\\/]* ) # Absolute path.
631 ac_srcdir=$srcdir$ac_dir_suffix;
632 ac_top_srcdir=$srcdir ;;
633 *) # Relative path.
634 ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
635 ac_top_srcdir=$ac_top_builddir$srcdir ;;
636 esac
637
638 # Do not use `cd foo && pwd` to compute absolute paths, because
639 # the directories may not exist.
640 case `pwd` in
641 .) ac_abs_builddir="$ac_dir";;
642 *)
643 case "$ac_dir" in
644 .) ac_abs_builddir=`pwd`;;
645 [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
646 *) ac_abs_builddir=`pwd`/"$ac_dir";;
647 esac;;
648 esac
649 case $ac_abs_builddir in
650 .) ac_abs_top_builddir=${ac_top_builddir}.;;
651 *)
652 case ${ac_top_builddir}. in
653 .) ac_abs_top_builddir=$ac_abs_builddir;;
654 [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
655 *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
656 esac;;
657 esac
658 case $ac_abs_builddir in
659 .) ac_abs_srcdir=$ac_srcdir;;
660 *)
661 case $ac_srcdir in
662 .) ac_abs_srcdir=$ac_abs_builddir;;
663 [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
664 *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
665 esac;;
666 esac
667 case $ac_abs_builddir in
668 .) ac_abs_top_srcdir=$ac_top_srcdir;;
669 *)
670 case $ac_top_srcdir in
671 .) ac_abs_top_srcdir=$ac_abs_builddir;;
672 [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
673 *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
674 esac;;
675 esac
676
677
678 case $INSTALL in
679 [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
680 *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
681 esac
682
683 # Let's still pretend it is `configure' which instantiates (i.e., don't
684 # use $as_me), people would be surprised to read:
685 # /* config.h. Generated by config.status. */
686 if test x"$ac_file" = x-; then
687 configure_input=
688 else
689 configure_input="$ac_file. "
690 fi
691 configure_input=$configure_input"Generated from `echo $ac_file_in |
692 sed 's,.*/,,'` by configure."
693
694 # First look for the input files in the build tree, otherwise in the
695 # src tree.
696 ac_file_inputs=`IFS=:
697 for f in $ac_file_in; do
698 case $f in
699 -) echo $tmp/stdin ;;
700 [\\/$]*)
701 # Absolute (can't be DOS-style, as IFS=:)
702 test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
703 echo "$as_me: error: cannot find input file: $f" >&2;}
704 { (exit 1); exit 1; }; }
705 echo "$f";;
706 *) # Relative
707 if test -f "$f"; then
708 # Build tree
709 echo "$f"
710 elif test -f "$srcdir/$f"; then
711 # Source tree
712 echo "$srcdir/$f"
713 else
714 # /dev/null tree
715 { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
716 echo "$as_me: error: cannot find input file: $f" >&2;}
717 { (exit 1); exit 1; }; }
718 fi;;
719 esac
720 done` || { (exit 1); exit 1; }
721
722 if test x"$ac_file" != x-; then
723 { echo "$as_me:$LINENO: creating $ac_file" >&5
724 echo "$as_me: creating $ac_file" >&6;}
725 rm -f "$ac_file"
726 fi
727 sed "/^[ ]*VPATH[ ]*=/{
728 s/:*\$(srcdir):*/:/;
729 s/:*\${srcdir}:*/:/;
730 s/:*@srcdir@:*/:/;
731 s/^\([^=]*=[ ]*\):*/\1/;
732 s/:*$//;
733 s/^[^=]*=[ ]*$//;
734 }
735
736 :t
737 /@[a-zA-Z_][a-zA-Z_0-9]*@/!b
738 s,@configure_input@,$configure_input,;t t
739 s,@srcdir@,$ac_srcdir,;t t
740 s,@abs_srcdir@,$ac_abs_srcdir,;t t
741 s,@top_srcdir@,$ac_top_srcdir,;t t
742 s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
743 s,@builddir@,$ac_builddir,;t t
744 s,@abs_builddir@,$ac_abs_builddir,;t t
745 s,@top_builddir@,$ac_top_builddir,;t t
746 s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
747 s,@INSTALL@,$ac_INSTALL,;t t
748 " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
749 rm -f $tmp/stdin
750 if test x"$ac_file" != x-; then
751 mv $tmp/out $ac_file
752 else
753 cat $tmp/out
754 rm -f $tmp/out
755 fi
756
757 done
758
759 #
760 # CONFIG_COMMANDS section.
761 #
762 for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
763 ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
764 ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
765 ac_dir=`(dirname "$ac_dest") 2>/dev/null ||
766 $as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
767 X"$ac_dest" : 'X\(//\)[^/]' \| \
768 X"$ac_dest" : 'X\(//\)$' \| \
769 X"$ac_dest" : 'X\(/\)' \| \
770 . : '\(.\)' 2>/dev/null ||
771 echo X"$ac_dest" |
772 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
773 /^X\(\/\/\)[^/].*/{ s//\1/; q; }
774 /^X\(\/\/\)$/{ s//\1/; q; }
775 /^X\(\/\).*/{ s//\1/; q; }
776 s/.*/./; q'`
777 { if $as_mkdir_p; then
778 mkdir -p "$ac_dir"
779 else
780 as_dir="$ac_dir"
781 as_dirs=
782 while test ! -d "$as_dir"; do
783 as_dirs="$as_dir $as_dirs"
784 as_dir=`(dirname "$as_dir") 2>/dev/null ||
785 $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
786 X"$as_dir" : 'X\(//\)[^/]' \| \
787 X"$as_dir" : 'X\(//\)$' \| \
788 X"$as_dir" : 'X\(/\)' \| \
789 . : '\(.\)' 2>/dev/null ||
790 echo X"$as_dir" |
791 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
792 /^X\(\/\/\)[^/].*/{ s//\1/; q; }
793 /^X\(\/\/\)$/{ s//\1/; q; }
794 /^X\(\/\).*/{ s//\1/; q; }
795 s/.*/./; q'`
796 done
797 test ! -n "$as_dirs" || mkdir $as_dirs
798 fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
799 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
800 { (exit 1); exit 1; }; }; }
801
802 ac_builddir=.
803
804 if test "$ac_dir" != .; then
805 ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
806 # A "../" for each directory in $ac_dir_suffix.
807 ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
808 else
809 ac_dir_suffix= ac_top_builddir=
810 fi
811
812 case $srcdir in
813 .) # No --srcdir option. We are building in place.
814 ac_srcdir=.
815 if test -z "$ac_top_builddir"; then
816 ac_top_srcdir=.
817 else
818 ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
819 fi ;;
820 [\\/]* | ?:[\\/]* ) # Absolute path.
821 ac_srcdir=$srcdir$ac_dir_suffix;
822 ac_top_srcdir=$srcdir ;;
823 *) # Relative path.
824 ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
825 ac_top_srcdir=$ac_top_builddir$srcdir ;;
826 esac
827
828 # Do not use `cd foo && pwd` to compute absolute paths, because
829 # the directories may not exist.
830 case `pwd` in
831 .) ac_abs_builddir="$ac_dir";;
832 *)
833 case "$ac_dir" in
834 .) ac_abs_builddir=`pwd`;;
835 [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
836 *) ac_abs_builddir=`pwd`/"$ac_dir";;
837 esac;;
838 esac
839 case $ac_abs_builddir in
840 .) ac_abs_top_builddir=${ac_top_builddir}.;;
841 *)
842 case ${ac_top_builddir}. in
843 .) ac_abs_top_builddir=$ac_abs_builddir;;
844 [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
845 *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
846 esac;;
847 esac
848 case $ac_abs_builddir in
849 .) ac_abs_srcdir=$ac_srcdir;;
850 *)
851 case $ac_srcdir in
852 .) ac_abs_srcdir=$ac_abs_builddir;;
853 [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
854 *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
855 esac;;
856 esac
857 case $ac_abs_builddir in
858 .) ac_abs_top_srcdir=$ac_top_srcdir;;
859 *)
860 case $ac_top_srcdir in
861 .) ac_abs_top_srcdir=$ac_abs_builddir;;
862 [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
863 *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
864 esac;;
865 esac
866
867
868 { echo "$as_me:$LINENO: executing $ac_dest commands" >&5
869 echo "$as_me: executing $ac_dest commands" >&6;}
870 case $ac_dest in
871 depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do
872 # Strip MF so we end up with the name of the file.
873 mf=`echo "$mf" | sed -e 's/:.*$//'`
874 # Check whether this is an Automake generated Makefile or not.
875 # We used to match only the files named `Makefile.in', but
876 # some people rename them; so instead we look at the file content.
877 # Grep'ing the first line is not enough: some people post-process
878 # each Makefile.in and add a new line on top of each file to say so.
879 # So let's grep whole file.
880 if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
881 dirpart=`(dirname "$mf") 2>/dev/null ||
882 $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
883 X"$mf" : 'X\(//\)[^/]' \| \
884 X"$mf" : 'X\(//\)$' \| \
885 X"$mf" : 'X\(/\)' \| \
886 . : '\(.\)' 2>/dev/null ||
887 echo X"$mf" |
888 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
889 /^X\(\/\/\)[^/].*/{ s//\1/; q; }
890 /^X\(\/\/\)$/{ s//\1/; q; }
891 /^X\(\/\).*/{ s//\1/; q; }
892 s/.*/./; q'`
893 else
894 continue
895 fi
896 # Extract the definition of DEPDIR, am__include, and am__quote
897 # from the Makefile without running `make'.
898 DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
899 test -z "$DEPDIR" && continue
900 am__include=`sed -n 's/^am__include = //p' < "$mf"`
901 test -z "am__include" && continue
902 am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
903 # When using ansi2knr, U may be empty or an underscore; expand it
904 U=`sed -n 's/^U = //p' < "$mf"`
905 # Find all dependency output files, they are included files with
906 # $(DEPDIR) in their names. We invoke sed twice because it is the
907 # simplest approach to changing $(DEPDIR) to its actual value in the
908 # expansion.
909 for file in `sed -n "
910 s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
911 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
912 # Make sure the directory exists.
913 test -f "$dirpart/$file" && continue
914 fdir=`(dirname "$file") 2>/dev/null ||
915 $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
916 X"$file" : 'X\(//\)[^/]' \| \
917 X"$file" : 'X\(//\)$' \| \
918 X"$file" : 'X\(/\)' \| \
919 . : '\(.\)' 2>/dev/null ||
920 echo X"$file" |
921 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
922 /^X\(\/\/\)[^/].*/{ s//\1/; q; }
923 /^X\(\/\/\)$/{ s//\1/; q; }
924 /^X\(\/\).*/{ s//\1/; q; }
925 s/.*/./; q'`
926 { if $as_mkdir_p; then
927 mkdir -p $dirpart/$fdir
928 else
929 as_dir=$dirpart/$fdir
930 as_dirs=
931 while test ! -d "$as_dir"; do
932 as_dirs="$as_dir $as_dirs"
933 as_dir=`(dirname "$as_dir") 2>/dev/null ||
934 $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
935 X"$as_dir" : 'X\(//\)[^/]' \| \
936 X"$as_dir" : 'X\(//\)$' \| \
937 X"$as_dir" : 'X\(/\)' \| \
938 . : '\(.\)' 2>/dev/null ||
939 echo X"$as_dir" |
940 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
941 /^X\(\/\/\)[^/].*/{ s//\1/; q; }
942 /^X\(\/\/\)$/{ s//\1/; q; }
943 /^X\(\/\).*/{ s//\1/; q; }
944 s/.*/./; q'`
945 done
946 test ! -n "$as_dirs" || mkdir $as_dirs
947 fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5
948 echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;}
949 { (exit 1); exit 1; }; }; }
950
951 # echo "creating $dirpart/$file"
952 echo '# dummy' > "$dirpart/$file"
953 done
954 done
955 ;;
956 esac
957 done
958
959 { (exit 0); exit 0; }
0 #! /bin/sh
1 # Configuration validation subroutine script.
2 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3 # 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
4
5 timestamp='2004-06-24'
6
7 # This file is (in principle) common to ALL GNU software.
8 # The presence of a machine in this file suggests that SOME GNU software
9 # can handle that machine. It does not imply ALL GNU software can.
10 #
11 # This file 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 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
20 #
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write to the Free Software
23 # Foundation, Inc., 59 Temple Place - Suite 330,
24 # Boston, MA 02111-1307, USA.
25
26 # As a special exception to the GNU General Public License, if you
27 # distribute this file as part of a program that contains a
28 # configuration script generated by Autoconf, you may include it under
29 # the same distribution terms that you use for the rest of that program.
30
31 # Please send patches to <config-patches@gnu.org>. Submit a context
32 # diff and a properly formatted ChangeLog entry.
33 #
34 # Configuration subroutine to validate and canonicalize a configuration type.
35 # Supply the specified configuration type as an argument.
36 # If it is invalid, we print an error message on stderr and exit with code 1.
37 # Otherwise, we print the canonical config type on stdout and succeed.
38
39 # This file is supposed to be the same for all GNU packages
40 # and recognize all the CPU types, system types and aliases
41 # that are meaningful with *any* GNU software.
42 # Each package is responsible for reporting which valid configurations
43 # it does not support. The user should be able to distinguish
44 # a failure to support a valid configuration from a meaningless
45 # configuration.
46
47 # The goal of this file is to map all the various variations of a given
48 # machine specification into a single specification in the form:
49 # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
50 # or in some cases, the newer four-part form:
51 # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
52 # It is wrong to echo any other type of specification.
53
54 me=`echo "$0" | sed -e 's,.*/,,'`
55
56 usage="\
57 Usage: $0 [OPTION] CPU-MFR-OPSYS
58 $0 [OPTION] ALIAS
59
60 Canonicalize a configuration name.
61
62 Operation modes:
63 -h, --help print this help, then exit
64 -t, --time-stamp print date of last modification, then exit
65 -v, --version print version number, then exit
66
67 Report bugs and patches to <config-patches@gnu.org>."
68
69 version="\
70 GNU config.sub ($timestamp)
71
72 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
73 Free Software Foundation, Inc.
74
75 This is free software; see the source for copying conditions. There is NO
76 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
77
78 help="
79 Try \`$me --help' for more information."
80
81 # Parse command line
82 while test $# -gt 0 ; do
83 case $1 in
84 --time-stamp | --time* | -t )
85 echo "$timestamp" ; exit 0 ;;
86 --version | -v )
87 echo "$version" ; exit 0 ;;
88 --help | --h* | -h )
89 echo "$usage"; exit 0 ;;
90 -- ) # Stop option processing
91 shift; break ;;
92 - ) # Use stdin as input.
93 break ;;
94 -* )
95 echo "$me: invalid option $1$help"
96 exit 1 ;;
97
98 *local*)
99 # First pass through any local machine types.
100 echo $1
101 exit 0;;
102
103 * )
104 break ;;
105 esac
106 done
107
108 case $# in
109 0) echo "$me: missing argument$help" >&2
110 exit 1;;
111 1) ;;
112 *) echo "$me: too many arguments$help" >&2
113 exit 1;;
114 esac
115
116 # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
117 # Here we must recognize all the valid KERNEL-OS combinations.
118 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
119 case $maybe_os in
120 nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
121 kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
122 os=-$maybe_os
123 basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
124 ;;
125 *)
126 basic_machine=`echo $1 | sed 's/-[^-]*$//'`
127 if [ $basic_machine != $1 ]
128 then os=`echo $1 | sed 's/.*-/-/'`
129 else os=; fi
130 ;;
131 esac
132
133 ### Let's recognize common machines as not being operating systems so
134 ### that things like config.sub decstation-3100 work. We also
135 ### recognize some manufacturers as not being operating systems, so we
136 ### can provide default operating systems below.
137 case $os in
138 -sun*os*)
139 # Prevent following clause from handling this invalid input.
140 ;;
141 -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
142 -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
143 -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
144 -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
145 -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
146 -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
147 -apple | -axis | -knuth | -cray)
148 os=
149 basic_machine=$1
150 ;;
151 -sim | -cisco | -oki | -wec | -winbond)
152 os=
153 basic_machine=$1
154 ;;
155 -scout)
156 ;;
157 -wrs)
158 os=-vxworks
159 basic_machine=$1
160 ;;
161 -chorusos*)
162 os=-chorusos
163 basic_machine=$1
164 ;;
165 -chorusrdb)
166 os=-chorusrdb
167 basic_machine=$1
168 ;;
169 -hiux*)
170 os=-hiuxwe2
171 ;;
172 -sco5)
173 os=-sco3.2v5
174 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
175 ;;
176 -sco4)
177 os=-sco3.2v4
178 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
179 ;;
180 -sco3.2.[4-9]*)
181 os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
182 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
183 ;;
184 -sco3.2v[4-9]*)
185 # Don't forget version if it is 3.2v4 or newer.
186 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
187 ;;
188 -sco*)
189 os=-sco3.2v2
190 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
191 ;;
192 -udk*)
193 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
194 ;;
195 -isc)
196 os=-isc2.2
197 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
198 ;;
199 -clix*)
200 basic_machine=clipper-intergraph
201 ;;
202 -isc*)
203 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
204 ;;
205 -lynx*)
206 os=-lynxos
207 ;;
208 -ptx*)
209 basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
210 ;;
211 -windowsnt*)
212 os=`echo $os | sed -e 's/windowsnt/winnt/'`
213 ;;
214 -psos*)
215 os=-psos
216 ;;
217 -mint | -mint[0-9]*)
218 basic_machine=m68k-atari
219 os=-mint
220 ;;
221 esac
222
223 # Decode aliases for certain CPU-COMPANY combinations.
224 case $basic_machine in
225 # Recognize the basic CPU types without company name.
226 # Some are omitted here because they have special meanings below.
227 1750a | 580 \
228 | a29k \
229 | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
230 | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
231 | am33_2.0 \
232 | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
233 | c4x | clipper \
234 | d10v | d30v | dlx | dsp16xx \
235 | fr30 | frv \
236 | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
237 | i370 | i860 | i960 | ia64 \
238 | ip2k | iq2000 \
239 | m32r | m32rle | m68000 | m68k | m88k | mcore \
240 | mips | mipsbe | mipseb | mipsel | mipsle \
241 | mips16 \
242 | mips64 | mips64el \
243 | mips64vr | mips64vrel \
244 | mips64orion | mips64orionel \
245 | mips64vr4100 | mips64vr4100el \
246 | mips64vr4300 | mips64vr4300el \
247 | mips64vr5000 | mips64vr5000el \
248 | mipsisa32 | mipsisa32el \
249 | mipsisa32r2 | mipsisa32r2el \
250 | mipsisa64 | mipsisa64el \
251 | mipsisa64r2 | mipsisa64r2el \
252 | mipsisa64sb1 | mipsisa64sb1el \
253 | mipsisa64sr71k | mipsisa64sr71kel \
254 | mipstx39 | mipstx39el \
255 | mn10200 | mn10300 \
256 | msp430 \
257 | ns16k | ns32k \
258 | openrisc | or32 \
259 | pdp10 | pdp11 | pj | pjl \
260 | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
261 | pyramid \
262 | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
263 | sh64 | sh64le \
264 | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \
265 | strongarm \
266 | tahoe | thumb | tic4x | tic80 | tron \
267 | v850 | v850e \
268 | we32k \
269 | x86 | xscale | xstormy16 | xtensa \
270 | z8k)
271 basic_machine=$basic_machine-unknown
272 ;;
273 m6811 | m68hc11 | m6812 | m68hc12)
274 # Motorola 68HC11/12.
275 basic_machine=$basic_machine-unknown
276 os=-none
277 ;;
278 m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
279 ;;
280
281 # We use `pc' rather than `unknown'
282 # because (1) that's what they normally are, and
283 # (2) the word "unknown" tends to confuse beginning users.
284 i*86 | x86_64)
285 basic_machine=$basic_machine-pc
286 ;;
287 # Object if more than one company name word.
288 *-*-*)
289 echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
290 exit 1
291 ;;
292 # Recognize the basic CPU types with company name.
293 580-* \
294 | a29k-* \
295 | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
296 | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
297 | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
298 | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
299 | avr-* \
300 | bs2000-* \
301 | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
302 | clipper-* | craynv-* | cydra-* \
303 | d10v-* | d30v-* | dlx-* \
304 | elxsi-* \
305 | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
306 | h8300-* | h8500-* \
307 | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
308 | i*86-* | i860-* | i960-* | ia64-* \
309 | ip2k-* | iq2000-* \
310 | m32r-* | m32rle-* \
311 | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
312 | m88110-* | m88k-* | mcore-* \
313 | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
314 | mips16-* \
315 | mips64-* | mips64el-* \
316 | mips64vr-* | mips64vrel-* \
317 | mips64orion-* | mips64orionel-* \
318 | mips64vr4100-* | mips64vr4100el-* \
319 | mips64vr4300-* | mips64vr4300el-* \
320 | mips64vr5000-* | mips64vr5000el-* \
321 | mipsisa32-* | mipsisa32el-* \
322 | mipsisa32r2-* | mipsisa32r2el-* \
323 | mipsisa64-* | mipsisa64el-* \
324 | mipsisa64r2-* | mipsisa64r2el-* \
325 | mipsisa64sb1-* | mipsisa64sb1el-* \
326 | mipsisa64sr71k-* | mipsisa64sr71kel-* \
327 | mipstx39-* | mipstx39el-* \
328 | mmix-* \
329 | msp430-* \
330 | none-* | np1-* | ns16k-* | ns32k-* \
331 | orion-* \
332 | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
333 | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
334 | pyramid-* \
335 | romp-* | rs6000-* \
336 | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
337 | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
338 | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
339 | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
340 | tahoe-* | thumb-* \
341 | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
342 | tron-* \
343 | v850-* | v850e-* | vax-* \
344 | we32k-* \
345 | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
346 | xtensa-* \
347 | ymp-* \
348 | z8k-*)
349 ;;
350 # Recognize the various machine names and aliases which stand
351 # for a CPU type and a company and sometimes even an OS.
352 386bsd)
353 basic_machine=i386-unknown
354 os=-bsd
355 ;;
356 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
357 basic_machine=m68000-att
358 ;;
359 3b*)
360 basic_machine=we32k-att
361 ;;
362 a29khif)
363 basic_machine=a29k-amd
364 os=-udi
365 ;;
366 abacus)
367 basic_machine=abacus-unknown
368 ;;
369 adobe68k)
370 basic_machine=m68010-adobe
371 os=-scout
372 ;;
373 alliant | fx80)
374 basic_machine=fx80-alliant
375 ;;
376 altos | altos3068)
377 basic_machine=m68k-altos
378 ;;
379 am29k)
380 basic_machine=a29k-none
381 os=-bsd
382 ;;
383 amd64)
384 basic_machine=x86_64-pc
385 ;;
386 amd64-*)
387 basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
388 ;;
389 amdahl)
390 basic_machine=580-amdahl
391 os=-sysv
392 ;;
393 amiga | amiga-*)
394 basic_machine=m68k-unknown
395 ;;
396 amigaos | amigados)
397 basic_machine=m68k-unknown
398 os=-amigaos
399 ;;
400 amigaunix | amix)
401 basic_machine=m68k-unknown
402 os=-sysv4
403 ;;
404 apollo68)
405 basic_machine=m68k-apollo
406 os=-sysv
407 ;;
408 apollo68bsd)
409 basic_machine=m68k-apollo
410 os=-bsd
411 ;;
412 aux)
413 basic_machine=m68k-apple
414 os=-aux
415 ;;
416 balance)
417 basic_machine=ns32k-sequent
418 os=-dynix
419 ;;
420 c90)
421 basic_machine=c90-cray
422 os=-unicos
423 ;;
424 convex-c1)
425 basic_machine=c1-convex
426 os=-bsd
427 ;;
428 convex-c2)
429 basic_machine=c2-convex
430 os=-bsd
431 ;;
432 convex-c32)
433 basic_machine=c32-convex
434 os=-bsd
435 ;;
436 convex-c34)
437 basic_machine=c34-convex
438 os=-bsd
439 ;;
440 convex-c38)
441 basic_machine=c38-convex
442 os=-bsd
443 ;;
444 cray | j90)
445 basic_machine=j90-cray
446 os=-unicos
447 ;;
448 craynv)
449 basic_machine=craynv-cray
450 os=-unicosmp
451 ;;
452 cr16c)
453 basic_machine=cr16c-unknown
454 os=-elf
455 ;;
456 crds | unos)
457 basic_machine=m68k-crds
458 ;;
459 cris | cris-* | etrax*)
460 basic_machine=cris-axis
461 ;;
462 crx)
463 basic_machine=crx-unknown
464 os=-elf
465 ;;
466 da30 | da30-*)
467 basic_machine=m68k-da30
468 ;;
469 decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
470 basic_machine=mips-dec
471 ;;
472 decsystem10* | dec10*)
473 basic_machine=pdp10-dec
474 os=-tops10
475 ;;
476 decsystem20* | dec20*)
477 basic_machine=pdp10-dec
478 os=-tops20
479 ;;
480 delta | 3300 | motorola-3300 | motorola-delta \
481 | 3300-motorola | delta-motorola)
482 basic_machine=m68k-motorola
483 ;;
484 delta88)
485 basic_machine=m88k-motorola
486 os=-sysv3
487 ;;
488 dpx20 | dpx20-*)
489 basic_machine=rs6000-bull
490 os=-bosx
491 ;;
492 dpx2* | dpx2*-bull)
493 basic_machine=m68k-bull
494 os=-sysv3
495 ;;
496 ebmon29k)
497 basic_machine=a29k-amd
498 os=-ebmon
499 ;;
500 elxsi)
501 basic_machine=elxsi-elxsi
502 os=-bsd
503 ;;
504 encore | umax | mmax)
505 basic_machine=ns32k-encore
506 ;;
507 es1800 | OSE68k | ose68k | ose | OSE)
508 basic_machine=m68k-ericsson
509 os=-ose
510 ;;
511 fx2800)
512 basic_machine=i860-alliant
513 ;;
514 genix)
515 basic_machine=ns32k-ns
516 ;;
517 gmicro)
518 basic_machine=tron-gmicro
519 os=-sysv
520 ;;
521 go32)
522 basic_machine=i386-pc
523 os=-go32
524 ;;
525 h3050r* | hiux*)
526 basic_machine=hppa1.1-hitachi
527 os=-hiuxwe2
528 ;;
529 h8300hms)
530 basic_machine=h8300-hitachi
531 os=-hms
532 ;;
533 h8300xray)
534 basic_machine=h8300-hitachi
535 os=-xray
536 ;;
537 h8500hms)
538 basic_machine=h8500-hitachi
539 os=-hms
540 ;;
541 harris)
542 basic_machine=m88k-harris
543 os=-sysv3
544 ;;
545 hp300-*)
546 basic_machine=m68k-hp
547 ;;
548 hp300bsd)
549 basic_machine=m68k-hp
550 os=-bsd
551 ;;
552 hp300hpux)
553 basic_machine=m68k-hp
554 os=-hpux
555 ;;
556 hp3k9[0-9][0-9] | hp9[0-9][0-9])
557 basic_machine=hppa1.0-hp
558 ;;
559 hp9k2[0-9][0-9] | hp9k31[0-9])
560 basic_machine=m68000-hp
561 ;;
562 hp9k3[2-9][0-9])
563 basic_machine=m68k-hp
564 ;;
565 hp9k6[0-9][0-9] | hp6[0-9][0-9])
566 basic_machine=hppa1.0-hp
567 ;;
568 hp9k7[0-79][0-9] | hp7[0-79][0-9])
569 basic_machine=hppa1.1-hp
570 ;;
571 hp9k78[0-9] | hp78[0-9])
572 # FIXME: really hppa2.0-hp
573 basic_machine=hppa1.1-hp
574 ;;
575 hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
576 # FIXME: really hppa2.0-hp
577 basic_machine=hppa1.1-hp
578 ;;
579 hp9k8[0-9][13679] | hp8[0-9][13679])
580 basic_machine=hppa1.1-hp
581 ;;
582 hp9k8[0-9][0-9] | hp8[0-9][0-9])
583 basic_machine=hppa1.0-hp
584 ;;
585 hppa-next)
586 os=-nextstep3
587 ;;
588 hppaosf)
589 basic_machine=hppa1.1-hp
590 os=-osf
591 ;;
592 hppro)
593 basic_machine=hppa1.1-hp
594 os=-proelf
595 ;;
596 i370-ibm* | ibm*)
597 basic_machine=i370-ibm
598 ;;
599 # I'm not sure what "Sysv32" means. Should this be sysv3.2?
600 i*86v32)
601 basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
602 os=-sysv32
603 ;;
604 i*86v4*)
605 basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
606 os=-sysv4
607 ;;
608 i*86v)
609 basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
610 os=-sysv
611 ;;
612 i*86sol2)
613 basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
614 os=-solaris2
615 ;;
616 i386mach)
617 basic_machine=i386-mach
618 os=-mach
619 ;;
620 i386-vsta | vsta)
621 basic_machine=i386-unknown
622 os=-vsta
623 ;;
624 iris | iris4d)
625 basic_machine=mips-sgi
626 case $os in
627 -irix*)
628 ;;
629 *)
630 os=-irix4
631 ;;
632 esac
633 ;;
634 isi68 | isi)
635 basic_machine=m68k-isi
636 os=-sysv
637 ;;
638 m88k-omron*)
639 basic_machine=m88k-omron
640 ;;
641 magnum | m3230)
642 basic_machine=mips-mips
643 os=-sysv
644 ;;
645 merlin)
646 basic_machine=ns32k-utek
647 os=-sysv
648 ;;
649 mingw32)
650 basic_machine=i386-pc
651 os=-mingw32
652 ;;
653 miniframe)
654 basic_machine=m68000-convergent
655 ;;
656 *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
657 basic_machine=m68k-atari
658 os=-mint
659 ;;
660 mips3*-*)
661 basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
662 ;;
663 mips3*)
664 basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
665 ;;
666 monitor)
667 basic_machine=m68k-rom68k
668 os=-coff
669 ;;
670 morphos)
671 basic_machine=powerpc-unknown
672 os=-morphos
673 ;;
674 msdos)
675 basic_machine=i386-pc
676 os=-msdos
677 ;;
678 mvs)
679 basic_machine=i370-ibm
680 os=-mvs
681 ;;
682 ncr3000)
683 basic_machine=i486-ncr
684 os=-sysv4
685 ;;
686 netbsd386)
687 basic_machine=i386-unknown
688 os=-netbsd
689 ;;
690 netwinder)
691 basic_machine=armv4l-rebel
692 os=-linux
693 ;;
694 news | news700 | news800 | news900)
695 basic_machine=m68k-sony
696 os=-newsos
697 ;;
698 news1000)
699 basic_machine=m68030-sony
700 os=-newsos
701 ;;
702 news-3600 | risc-news)
703 basic_machine=mips-sony
704 os=-newsos
705 ;;
706 necv70)
707 basic_machine=v70-nec
708 os=-sysv
709 ;;
710 next | m*-next )
711 basic_machine=m68k-next
712 case $os in
713 -nextstep* )
714 ;;
715 -ns2*)
716 os=-nextstep2
717 ;;
718 *)
719 os=-nextstep3
720 ;;
721 esac
722 ;;
723 nh3000)
724 basic_machine=m68k-harris
725 os=-cxux
726 ;;
727 nh[45]000)
728 basic_machine=m88k-harris
729 os=-cxux
730 ;;
731 nindy960)
732 basic_machine=i960-intel
733 os=-nindy
734 ;;
735 mon960)
736 basic_machine=i960-intel
737 os=-mon960
738 ;;
739 nonstopux)
740 basic_machine=mips-compaq
741 os=-nonstopux
742 ;;
743 np1)
744 basic_machine=np1-gould
745 ;;
746 nsr-tandem)
747 basic_machine=nsr-tandem
748 ;;
749 op50n-* | op60c-*)
750 basic_machine=hppa1.1-oki
751 os=-proelf
752 ;;
753 or32 | or32-*)
754 basic_machine=or32-unknown
755 os=-coff
756 ;;
757 os400)
758 basic_machine=powerpc-ibm
759 os=-os400
760 ;;
761 OSE68000 | ose68000)
762 basic_machine=m68000-ericsson
763 os=-ose
764 ;;
765 os68k)
766 basic_machine=m68k-none
767 os=-os68k
768 ;;
769 pa-hitachi)
770 basic_machine=hppa1.1-hitachi
771 os=-hiuxwe2
772 ;;
773 paragon)
774 basic_machine=i860-intel
775 os=-osf
776 ;;
777 pbd)
778 basic_machine=sparc-tti
779 ;;
780 pbb)
781 basic_machine=m68k-tti
782 ;;
783 pc532 | pc532-*)
784 basic_machine=ns32k-pc532
785 ;;
786 pentium | p5 | k5 | k6 | nexgen | viac3)
787 basic_machine=i586-pc
788 ;;
789 pentiumpro | p6 | 6x86 | athlon | athlon_*)
790 basic_machine=i686-pc
791 ;;
792 pentiumii | pentium2 | pentiumiii | pentium3)
793 basic_machine=i686-pc
794 ;;
795 pentium4)
796 basic_machine=i786-pc
797 ;;
798 pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
799 basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
800 ;;
801 pentiumpro-* | p6-* | 6x86-* | athlon-*)
802 basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
803 ;;
804 pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
805 basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
806 ;;
807 pentium4-*)
808 basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
809 ;;
810 pn)
811 basic_machine=pn-gould
812 ;;
813 power) basic_machine=power-ibm
814 ;;
815 ppc) basic_machine=powerpc-unknown
816 ;;
817 ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
818 ;;
819 ppcle | powerpclittle | ppc-le | powerpc-little)
820 basic_machine=powerpcle-unknown
821 ;;
822 ppcle-* | powerpclittle-*)
823 basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
824 ;;
825 ppc64) basic_machine=powerpc64-unknown
826 ;;
827 ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
828 ;;
829 ppc64le | powerpc64little | ppc64-le | powerpc64-little)
830 basic_machine=powerpc64le-unknown
831 ;;
832 ppc64le-* | powerpc64little-*)
833 basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
834 ;;
835 ps2)
836 basic_machine=i386-ibm
837 ;;
838 pw32)
839 basic_machine=i586-unknown
840 os=-pw32
841 ;;
842 rom68k)
843 basic_machine=m68k-rom68k
844 os=-coff
845 ;;
846 rm[46]00)
847 basic_machine=mips-siemens
848 ;;
849 rtpc | rtpc-*)
850 basic_machine=romp-ibm
851 ;;
852 s390 | s390-*)
853 basic_machine=s390-ibm
854 ;;
855 s390x | s390x-*)
856 basic_machine=s390x-ibm
857 ;;
858 sa29200)
859 basic_machine=a29k-amd
860 os=-udi
861 ;;
862 sb1)
863 basic_machine=mipsisa64sb1-unknown
864 ;;
865 sb1el)
866 basic_machine=mipsisa64sb1el-unknown
867 ;;
868 sei)
869 basic_machine=mips-sei
870 os=-seiux
871 ;;
872 sequent)
873 basic_machine=i386-sequent
874 ;;
875 sh)
876 basic_machine=sh-hitachi
877 os=-hms
878 ;;
879 sh64)
880 basic_machine=sh64-unknown
881 ;;
882 sparclite-wrs | simso-wrs)
883 basic_machine=sparclite-wrs
884 os=-vxworks
885 ;;
886 sps7)
887 basic_machine=m68k-bull
888 os=-sysv2
889 ;;
890 spur)
891 basic_machine=spur-unknown
892 ;;
893 st2000)
894 basic_machine=m68k-tandem
895 ;;
896 stratus)
897 basic_machine=i860-stratus
898 os=-sysv4
899 ;;
900 sun2)
901 basic_machine=m68000-sun
902 ;;
903 sun2os3)
904 basic_machine=m68000-sun
905 os=-sunos3
906 ;;
907 sun2os4)
908 basic_machine=m68000-sun
909 os=-sunos4
910 ;;
911 sun3os3)
912 basic_machine=m68k-sun
913 os=-sunos3
914 ;;
915 sun3os4)
916 basic_machine=m68k-sun
917 os=-sunos4
918 ;;
919 sun4os3)
920 basic_machine=sparc-sun
921 os=-sunos3
922 ;;
923 sun4os4)
924 basic_machine=sparc-sun
925 os=-sunos4
926 ;;
927 sun4sol2)
928 basic_machine=sparc-sun
929 os=-solaris2
930 ;;
931 sun3 | sun3-*)
932 basic_machine=m68k-sun
933 ;;
934 sun4)
935 basic_machine=sparc-sun
936 ;;
937 sun386 | sun386i | roadrunner)
938 basic_machine=i386-sun
939 ;;
940 sv1)
941 basic_machine=sv1-cray
942 os=-unicos
943 ;;
944 symmetry)
945 basic_machine=i386-sequent
946 os=-dynix
947 ;;
948 t3e)
949 basic_machine=alphaev5-cray
950 os=-unicos
951 ;;
952 t90)
953 basic_machine=t90-cray
954 os=-unicos
955 ;;
956 tic54x | c54x*)
957 basic_machine=tic54x-unknown
958 os=-coff
959 ;;
960 tic55x | c55x*)
961 basic_machine=tic55x-unknown
962 os=-coff
963 ;;
964 tic6x | c6x*)
965 basic_machine=tic6x-unknown
966 os=-coff
967 ;;
968 tx39)
969 basic_machine=mipstx39-unknown
970 ;;
971 tx39el)
972 basic_machine=mipstx39el-unknown
973 ;;
974 toad1)
975 basic_machine=pdp10-xkl
976 os=-tops20
977 ;;
978 tower | tower-32)
979 basic_machine=m68k-ncr
980 ;;
981 tpf)
982 basic_machine=s390x-ibm
983 os=-tpf
984 ;;
985 udi29k)
986 basic_machine=a29k-amd
987 os=-udi
988 ;;
989 ultra3)
990 basic_machine=a29k-nyu
991 os=-sym1
992 ;;
993 v810 | necv810)
994 basic_machine=v810-nec
995 os=-none
996 ;;
997 vaxv)
998 basic_machine=vax-dec
999 os=-sysv
1000 ;;
1001 vms)
1002 basic_machine=vax-dec
1003 os=-vms
1004 ;;
1005 vpp*|vx|vx-*)
1006 basic_machine=f301-fujitsu
1007 ;;
1008 vxworks960)
1009 basic_machine=i960-wrs
1010 os=-vxworks
1011 ;;
1012 vxworks68)
1013 basic_machine=m68k-wrs
1014 os=-vxworks
1015 ;;
1016 vxworks29k)
1017 basic_machine=a29k-wrs
1018 os=-vxworks
1019 ;;
1020 w65*)
1021 basic_machine=w65-wdc
1022 os=-none
1023 ;;
1024 w89k-*)
1025 basic_machine=hppa1.1-winbond
1026 os=-proelf
1027 ;;
1028 xps | xps100)
1029 basic_machine=xps100-honeywell
1030 ;;
1031 ymp)
1032 basic_machine=ymp-cray
1033 os=-unicos
1034 ;;
1035 z8k-*-coff)
1036 basic_machine=z8k-unknown
1037 os=-sim
1038 ;;
1039 none)
1040 basic_machine=none-none
1041 os=-none
1042 ;;
1043
1044 # Here we handle the default manufacturer of certain CPU types. It is in
1045 # some cases the only manufacturer, in others, it is the most popular.
1046 w89k)
1047 basic_machine=hppa1.1-winbond
1048 ;;
1049 op50n)
1050 basic_machine=hppa1.1-oki
1051 ;;
1052 op60c)
1053 basic_machine=hppa1.1-oki
1054 ;;
1055 romp)
1056 basic_machine=romp-ibm
1057 ;;
1058 mmix)
1059 basic_machine=mmix-knuth
1060 ;;
1061 rs6000)
1062 basic_machine=rs6000-ibm
1063 ;;
1064 vax)
1065 basic_machine=vax-dec
1066 ;;
1067 pdp10)
1068 # there are many clones, so DEC is not a safe bet
1069 basic_machine=pdp10-unknown
1070 ;;
1071 pdp11)
1072 basic_machine=pdp11-dec
1073 ;;
1074 we32k)
1075 basic_machine=we32k-att
1076 ;;
1077 sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
1078 basic_machine=sh-unknown
1079 ;;
1080 sh64)
1081 basic_machine=sh64-unknown
1082 ;;
1083 sparc | sparcv8 | sparcv9 | sparcv9b)
1084 basic_machine=sparc-sun
1085 ;;
1086 cydra)
1087 basic_machine=cydra-cydrome
1088 ;;
1089 orion)
1090 basic_machine=orion-highlevel
1091 ;;
1092 orion105)
1093 basic_machine=clipper-highlevel
1094 ;;
1095 mac | mpw | mac-mpw)
1096 basic_machine=m68k-apple
1097 ;;
1098 pmac | pmac-mpw)
1099 basic_machine=powerpc-apple
1100 ;;
1101 *-unknown)
1102 # Make sure to match an already-canonicalized machine name.
1103 ;;
1104 *)
1105 echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
1106 exit 1
1107 ;;
1108 esac
1109
1110 # Here we canonicalize certain aliases for manufacturers.
1111 case $basic_machine in
1112 *-digital*)
1113 basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
1114 ;;
1115 *-commodore*)
1116 basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
1117 ;;
1118 *)
1119 ;;
1120 esac
1121
1122 # Decode manufacturer-specific aliases for certain operating systems.
1123
1124 if [ x"$os" != x"" ]
1125 then
1126 case $os in
1127 # First match some system type aliases
1128 # that might get confused with valid system types.
1129 # -solaris* is a basic system type, with this one exception.
1130 -solaris1 | -solaris1.*)
1131 os=`echo $os | sed -e 's|solaris1|sunos4|'`
1132 ;;
1133 -solaris)
1134 os=-solaris2
1135 ;;
1136 -svr4*)
1137 os=-sysv4
1138 ;;
1139 -unixware*)
1140 os=-sysv4.2uw
1141 ;;
1142 -gnu/linux*)
1143 os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
1144 ;;
1145 # First accept the basic system types.
1146 # The portable systems comes first.
1147 # Each alternative MUST END IN A *, to match a version number.
1148 # -sysv* is not here because it comes later, after sysvr4.
1149 -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
1150 | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
1151 | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
1152 | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
1153 | -aos* \
1154 | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
1155 | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
1156 | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
1157 | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
1158 | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
1159 | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
1160 | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
1161 | -chorusos* | -chorusrdb* \
1162 | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
1163 | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
1164 | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
1165 | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
1166 | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
1167 | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
1168 | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
1169 | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*)
1170 # Remember, each alternative MUST END IN *, to match a version number.
1171 ;;
1172 -qnx*)
1173 case $basic_machine in
1174 x86-* | i*86-*)
1175 ;;
1176 *)
1177 os=-nto$os
1178 ;;
1179 esac
1180 ;;
1181 -nto-qnx*)
1182 ;;
1183 -nto*)
1184 os=`echo $os | sed -e 's|nto|nto-qnx|'`
1185 ;;
1186 -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
1187 | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
1188 | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
1189 ;;
1190 -mac*)
1191 os=`echo $os | sed -e 's|mac|macos|'`
1192 ;;
1193 -linux-dietlibc)
1194 os=-linux-dietlibc
1195 ;;
1196 -linux*)
1197 os=`echo $os | sed -e 's|linux|linux-gnu|'`
1198 ;;
1199 -sunos5*)
1200 os=`echo $os | sed -e 's|sunos5|solaris2|'`
1201 ;;
1202 -sunos6*)
1203 os=`echo $os | sed -e 's|sunos6|solaris3|'`
1204 ;;
1205 -opened*)
1206 os=-openedition
1207 ;;
1208 -os400*)
1209 os=-os400
1210 ;;
1211 -wince*)
1212 os=-wince
1213 ;;
1214 -osfrose*)
1215 os=-osfrose
1216 ;;
1217 -osf*)
1218 os=-osf
1219 ;;
1220 -utek*)
1221 os=-bsd
1222 ;;
1223 -dynix*)
1224 os=-bsd
1225 ;;
1226 -acis*)
1227 os=-aos
1228 ;;
1229 -atheos*)
1230 os=-atheos
1231 ;;
1232 -syllable*)
1233 os=-syllable
1234 ;;
1235 -386bsd)
1236 os=-bsd
1237 ;;
1238 -ctix* | -uts*)
1239 os=-sysv
1240 ;;
1241 -nova*)
1242 os=-rtmk-nova
1243 ;;
1244 -ns2 )
1245 os=-nextstep2
1246 ;;
1247 -nsk*)
1248 os=-nsk
1249 ;;
1250 # Preserve the version number of sinix5.
1251 -sinix5.*)
1252 os=`echo $os | sed -e 's|sinix|sysv|'`
1253 ;;
1254 -sinix*)
1255 os=-sysv4
1256 ;;
1257 -tpf*)
1258 os=-tpf
1259 ;;
1260 -triton*)
1261 os=-sysv3
1262 ;;
1263 -oss*)
1264 os=-sysv3
1265 ;;
1266 -svr4)
1267 os=-sysv4
1268 ;;
1269 -svr3)
1270 os=-sysv3
1271 ;;
1272 -sysvr4)
1273 os=-sysv4
1274 ;;
1275 # This must come after -sysvr4.
1276 -sysv*)
1277 ;;
1278 -ose*)
1279 os=-ose
1280 ;;
1281 -es1800*)
1282 os=-ose
1283 ;;
1284 -xenix)
1285 os=-xenix
1286 ;;
1287 -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
1288 os=-mint
1289 ;;
1290 -aros*)
1291 os=-aros
1292 ;;
1293 -kaos*)
1294 os=-kaos
1295 ;;
1296 -none)
1297 ;;
1298 *)
1299 # Get rid of the `-' at the beginning of $os.
1300 os=`echo $os | sed 's/[^-]*-//'`
1301 echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
1302 exit 1
1303 ;;
1304 esac
1305 else
1306
1307 # Here we handle the default operating systems that come with various machines.
1308 # The value should be what the vendor currently ships out the door with their
1309 # machine or put another way, the most popular os provided with the machine.
1310
1311 # Note that if you're going to try to match "-MANUFACTURER" here (say,
1312 # "-sun"), then you have to tell the case statement up towards the top
1313 # that MANUFACTURER isn't an operating system. Otherwise, code above
1314 # will signal an error saying that MANUFACTURER isn't an operating
1315 # system, and we'll never get to this point.
1316
1317 case $basic_machine in
1318 *-acorn)
1319 os=-riscix1.2
1320 ;;
1321 arm*-rebel)
1322 os=-linux
1323 ;;
1324 arm*-semi)
1325 os=-aout
1326 ;;
1327 c4x-* | tic4x-*)
1328 os=-coff
1329 ;;
1330 # This must come before the *-dec entry.
1331 pdp10-*)
1332 os=-tops20
1333 ;;
1334 pdp11-*)
1335 os=-none
1336 ;;
1337 *-dec | vax-*)
1338 os=-ultrix4.2
1339 ;;
1340 m68*-apollo)
1341 os=-domain
1342 ;;
1343 i386-sun)
1344 os=-sunos4.0.2
1345 ;;
1346 m68000-sun)
1347 os=-sunos3
1348 # This also exists in the configure program, but was not the
1349 # default.
1350 # os=-sunos4
1351 ;;
1352 m68*-cisco)
1353 os=-aout
1354 ;;
1355 mips*-cisco)
1356 os=-elf
1357 ;;
1358 mips*-*)
1359 os=-elf
1360 ;;
1361 or32-*)
1362 os=-coff
1363 ;;
1364 *-tti) # must be before sparc entry or we get the wrong os.
1365 os=-sysv3
1366 ;;
1367 sparc-* | *-sun)
1368 os=-sunos4.1.1
1369 ;;
1370 *-be)
1371 os=-beos
1372 ;;
1373 *-ibm)
1374 os=-aix
1375 ;;
1376 *-knuth)
1377 os=-mmixware
1378 ;;
1379 *-wec)
1380 os=-proelf
1381 ;;
1382 *-winbond)
1383 os=-proelf
1384 ;;
1385 *-oki)
1386 os=-proelf
1387 ;;
1388 *-hp)
1389 os=-hpux
1390 ;;
1391 *-hitachi)
1392 os=-hiux
1393 ;;
1394 i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
1395 os=-sysv
1396 ;;
1397 *-cbm)
1398 os=-amigaos
1399 ;;
1400 *-dg)
1401 os=-dgux
1402 ;;
1403 *-dolphin)
1404 os=-sysv3
1405 ;;
1406 m68k-ccur)
1407 os=-rtu
1408 ;;
1409 m88k-omron*)
1410 os=-luna
1411 ;;
1412 *-next )
1413 os=-nextstep
1414 ;;
1415 *-sequent)
1416 os=-ptx
1417 ;;
1418 *-crds)
1419 os=-unos
1420 ;;
1421 *-ns)
1422 os=-genix
1423 ;;
1424 i370-*)
1425 os=-mvs
1426 ;;
1427 *-next)
1428 os=-nextstep3
1429 ;;
1430 *-gould)
1431 os=-sysv
1432 ;;
1433 *-highlevel)
1434 os=-bsd
1435 ;;
1436 *-encore)
1437 os=-bsd
1438 ;;
1439 *-sgi)
1440 os=-irix
1441 ;;
1442 *-siemens)
1443 os=-sysv4
1444 ;;
1445 *-masscomp)
1446 os=-rtu
1447 ;;
1448 f30[01]-fujitsu | f700-fujitsu)
1449 os=-uxpv
1450 ;;
1451 *-rom68k)
1452 os=-coff
1453 ;;
1454 *-*bug)
1455 os=-coff
1456 ;;
1457 *-apple)
1458 os=-macos
1459 ;;
1460 *-atari*)
1461 os=-mint
1462 ;;
1463 *)
1464 os=-none
1465 ;;
1466 esac
1467 fi
1468
1469 # Here we handle the case where we know the os, and the CPU type, but not the
1470 # manufacturer. We pick the logical manufacturer.
1471 vendor=unknown
1472 case $basic_machine in
1473 *-unknown)
1474 case $os in
1475 -riscix*)
1476 vendor=acorn
1477 ;;
1478 -sunos*)
1479 vendor=sun
1480 ;;
1481 -aix*)
1482 vendor=ibm
1483 ;;
1484 -beos*)
1485 vendor=be
1486 ;;
1487 -hpux*)
1488 vendor=hp
1489 ;;
1490 -mpeix*)
1491 vendor=hp
1492 ;;
1493 -hiux*)
1494 vendor=hitachi
1495 ;;
1496 -unos*)
1497 vendor=crds
1498 ;;
1499 -dgux*)
1500 vendor=dg
1501 ;;
1502 -luna*)
1503 vendor=omron
1504 ;;
1505 -genix*)
1506 vendor=ns
1507 ;;
1508 -mvs* | -opened*)
1509 vendor=ibm
1510 ;;
1511 -os400*)
1512 vendor=ibm
1513 ;;
1514 -ptx*)
1515 vendor=sequent
1516 ;;
1517 -tpf*)
1518 vendor=ibm
1519 ;;
1520 -vxsim* | -vxworks* | -windiss*)
1521 vendor=wrs
1522 ;;
1523 -aux*)
1524 vendor=apple
1525 ;;
1526 -hms*)
1527 vendor=hitachi
1528 ;;
1529 -mpw* | -macos*)
1530 vendor=apple
1531 ;;
1532 -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
1533 vendor=atari
1534 ;;
1535 -vos*)
1536 vendor=stratus
1537 ;;
1538 esac
1539 basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
1540 ;;
1541 esac
1542
1543 echo $basic_machine$os
1544 exit 0
1545
1546 # Local variables:
1547 # eval: (add-hook 'write-file-hooks 'time-stamp)
1548 # time-stamp-start: "timestamp='"
1549 # time-stamp-format: "%:y-%02m-%02d"
1550 # time-stamp-end: "'"
1551 # End:
0 #! /bin/sh
1 # Guess values for system-dependent variables and create Makefiles.
2 # Generated by GNU Autoconf 2.59 for libenet 1.0.
3 #
4 # Copyright (C) 2003 Free Software Foundation, Inc.
5 # This configure script is free software; the Free Software Foundation
6 # gives unlimited permission to copy, distribute and modify it.
7 ## --------------------- ##
8 ## M4sh Initialization. ##
9 ## --------------------- ##
10
11 # Be Bourne compatible
12 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
13 emulate sh
14 NULLCMD=:
15 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
16 # is contrary to our usage. Disable this feature.
17 alias -g '${1+"$@"}'='"$@"'
18 elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
19 set -o posix
20 fi
21 DUALCASE=1; export DUALCASE # for MKS sh
22
23 # Support unset when possible.
24 if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
25 as_unset=unset
26 else
27 as_unset=false
28 fi
29
30
31 # Work around bugs in pre-3.0 UWIN ksh.
32 $as_unset ENV MAIL MAILPATH
33 PS1='$ '
34 PS2='> '
35 PS4='+ '
36
37 # NLS nuisances.
38 for as_var in \
39 LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
40 LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
41 LC_TELEPHONE LC_TIME
42 do
43 if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
44 eval $as_var=C; export $as_var
45 else
46 $as_unset $as_var
47 fi
48 done
49
50 # Required to use basename.
51 if expr a : '\(a\)' >/dev/null 2>&1; then
52 as_expr=expr
53 else
54 as_expr=false
55 fi
56
57 if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
58 as_basename=basename
59 else
60 as_basename=false
61 fi
62
63
64 # Name of the executable.
65 as_me=`$as_basename "$0" ||
66 $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
67 X"$0" : 'X\(//\)$' \| \
68 X"$0" : 'X\(/\)$' \| \
69 . : '\(.\)' 2>/dev/null ||
70 echo X/"$0" |
71 sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
72 /^X\/\(\/\/\)$/{ s//\1/; q; }
73 /^X\/\(\/\).*/{ s//\1/; q; }
74 s/.*/./; q'`
75
76
77 # PATH needs CR, and LINENO needs CR and PATH.
78 # Avoid depending upon Character Ranges.
79 as_cr_letters='abcdefghijklmnopqrstuvwxyz'
80 as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
81 as_cr_Letters=$as_cr_letters$as_cr_LETTERS
82 as_cr_digits='0123456789'
83 as_cr_alnum=$as_cr_Letters$as_cr_digits
84
85 # The user is always right.
86 if test "${PATH_SEPARATOR+set}" != set; then
87 echo "#! /bin/sh" >conf$$.sh
88 echo "exit 0" >>conf$$.sh
89 chmod +x conf$$.sh
90 if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
91 PATH_SEPARATOR=';'
92 else
93 PATH_SEPARATOR=:
94 fi
95 rm -f conf$$.sh
96 fi
97
98
99 as_lineno_1=$LINENO
100 as_lineno_2=$LINENO
101 as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
102 test "x$as_lineno_1" != "x$as_lineno_2" &&
103 test "x$as_lineno_3" = "x$as_lineno_2" || {
104 # Find who we are. Look in the path if we contain no path at all
105 # relative or not.
106 case $0 in
107 *[\\/]* ) as_myself=$0 ;;
108 *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
109 for as_dir in $PATH
110 do
111 IFS=$as_save_IFS
112 test -z "$as_dir" && as_dir=.
113 test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
114 done
115
116 ;;
117 esac
118 # We did not find ourselves, most probably we were run as `sh COMMAND'
119 # in which case we are not to be found in the path.
120 if test "x$as_myself" = x; then
121 as_myself=$0
122 fi
123 if test ! -f "$as_myself"; then
124 { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
125 { (exit 1); exit 1; }; }
126 fi
127 case $CONFIG_SHELL in
128 '')
129 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
130 for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
131 do
132 IFS=$as_save_IFS
133 test -z "$as_dir" && as_dir=.
134 for as_base in sh bash ksh sh5; do
135 case $as_dir in
136 /*)
137 if ("$as_dir/$as_base" -c '
138 as_lineno_1=$LINENO
139 as_lineno_2=$LINENO
140 as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
141 test "x$as_lineno_1" != "x$as_lineno_2" &&
142 test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
143 $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
144 $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
145 CONFIG_SHELL=$as_dir/$as_base
146 export CONFIG_SHELL
147 exec "$CONFIG_SHELL" "$0" ${1+"$@"}
148 fi;;
149 esac
150 done
151 done
152 ;;
153 esac
154
155 # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
156 # uniformly replaced by the line number. The first 'sed' inserts a
157 # line-number line before each line; the second 'sed' does the real
158 # work. The second script uses 'N' to pair each line-number line
159 # with the numbered line, and appends trailing '-' during
160 # substitution so that $LINENO is not a special case at line end.
161 # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
162 # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
163 sed '=' <$as_myself |
164 sed '
165 N
166 s,$,-,
167 : loop
168 s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
169 t loop
170 s,-$,,
171 s,^['$as_cr_digits']*\n,,
172 ' >$as_me.lineno &&
173 chmod +x $as_me.lineno ||
174 { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
175 { (exit 1); exit 1; }; }
176
177 # Don't try to exec as it changes $[0], causing all sort of problems
178 # (the dirname of $[0] is not the place where we might find the
179 # original and so on. Autoconf is especially sensible to this).
180 . ./$as_me.lineno
181 # Exit status is that of the last command.
182 exit
183 }
184
185
186 case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
187 *c*,-n*) ECHO_N= ECHO_C='
188 ' ECHO_T=' ' ;;
189 *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
190 *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
191 esac
192
193 if expr a : '\(a\)' >/dev/null 2>&1; then
194 as_expr=expr
195 else
196 as_expr=false
197 fi
198
199 rm -f conf$$ conf$$.exe conf$$.file
200 echo >conf$$.file
201 if ln -s conf$$.file conf$$ 2>/dev/null; then
202 # We could just check for DJGPP; but this test a) works b) is more generic
203 # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
204 if test -f conf$$.exe; then
205 # Don't use ln at all; we don't have any links
206 as_ln_s='cp -p'
207 else
208 as_ln_s='ln -s'
209 fi
210 elif ln conf$$.file conf$$ 2>/dev/null; then
211 as_ln_s=ln
212 else
213 as_ln_s='cp -p'
214 fi
215 rm -f conf$$ conf$$.exe conf$$.file
216
217 if mkdir -p . 2>/dev/null; then
218 as_mkdir_p=:
219 else
220 test -d ./-p && rmdir ./-p
221 as_mkdir_p=false
222 fi
223
224 as_executable_p="test -f"
225
226 # Sed expression to map a string onto a valid CPP name.
227 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
228
229 # Sed expression to map a string onto a valid variable name.
230 as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
231
232
233 # IFS
234 # We need space, tab and new line, in precisely that order.
235 as_nl='
236 '
237 IFS=" $as_nl"
238
239 # CDPATH.
240 $as_unset CDPATH
241
242
243 # Name of the host.
244 # hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
245 # so uname gets run too.
246 ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
247
248 exec 6>&1
249
250 #
251 # Initializations.
252 #
253 ac_default_prefix=/usr/local
254 ac_config_libobj_dir=.
255 cross_compiling=no
256 subdirs=
257 MFLAGS=
258 MAKEFLAGS=
259 SHELL=${CONFIG_SHELL-/bin/sh}
260
261 # Maximum number of lines to put in a shell here document.
262 # This variable seems obsolete. It should probably be removed, and
263 # only ac_max_sed_lines should be used.
264 : ${ac_max_here_lines=38}
265
266 # Identity of this package.
267 PACKAGE_NAME='libenet'
268 PACKAGE_TARNAME='libenet'
269 PACKAGE_VERSION='1.0'
270 PACKAGE_STRING='libenet 1.0'
271 PACKAGE_BUGREPORT=''
272
273 ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE RANLIB ac_ct_RANLIB CPP EGREP LIBOBJS LTLIBOBJS'
274 ac_subst_files=''
275
276 # Initialize some variables set by options.
277 ac_init_help=
278 ac_init_version=false
279 # The variables have the same names as the options, with
280 # dashes changed to underlines.
281 cache_file=/dev/null
282 exec_prefix=NONE
283 no_create=
284 no_recursion=
285 prefix=NONE
286 program_prefix=NONE
287 program_suffix=NONE
288 program_transform_name=s,x,x,
289 silent=
290 site=
291 srcdir=
292 verbose=
293 x_includes=NONE
294 x_libraries=NONE
295
296 # Installation directory options.
297 # These are left unexpanded so users can "make install exec_prefix=/foo"
298 # and all the variables that are supposed to be based on exec_prefix
299 # by default will actually change.
300 # Use braces instead of parens because sh, perl, etc. also accept them.
301 bindir='${exec_prefix}/bin'
302 sbindir='${exec_prefix}/sbin'
303 libexecdir='${exec_prefix}/libexec'
304 datadir='${prefix}/share'
305 sysconfdir='${prefix}/etc'
306 sharedstatedir='${prefix}/com'
307 localstatedir='${prefix}/var'
308 libdir='${exec_prefix}/lib'
309 includedir='${prefix}/include'
310 oldincludedir='/usr/include'
311 infodir='${prefix}/info'
312 mandir='${prefix}/man'
313
314 ac_prev=
315 for ac_option
316 do
317 # If the previous option needs an argument, assign it.
318 if test -n "$ac_prev"; then
319 eval "$ac_prev=\$ac_option"
320 ac_prev=
321 continue
322 fi
323
324 ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
325
326 # Accept the important Cygnus configure options, so we can diagnose typos.
327
328 case $ac_option in
329
330 -bindir | --bindir | --bindi | --bind | --bin | --bi)
331 ac_prev=bindir ;;
332 -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
333 bindir=$ac_optarg ;;
334
335 -build | --build | --buil | --bui | --bu)
336 ac_prev=build_alias ;;
337 -build=* | --build=* | --buil=* | --bui=* | --bu=*)
338 build_alias=$ac_optarg ;;
339
340 -cache-file | --cache-file | --cache-fil | --cache-fi \
341 | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
342 ac_prev=cache_file ;;
343 -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
344 | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
345 cache_file=$ac_optarg ;;
346
347 --config-cache | -C)
348 cache_file=config.cache ;;
349
350 -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
351 ac_prev=datadir ;;
352 -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
353 | --da=*)
354 datadir=$ac_optarg ;;
355
356 -disable-* | --disable-*)
357 ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
358 # Reject names that are not valid shell variable names.
359 expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
360 { echo "$as_me: error: invalid feature name: $ac_feature" >&2
361 { (exit 1); exit 1; }; }
362 ac_feature=`echo $ac_feature | sed 's/-/_/g'`
363 eval "enable_$ac_feature=no" ;;
364
365 -enable-* | --enable-*)
366 ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
367 # Reject names that are not valid shell variable names.
368 expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
369 { echo "$as_me: error: invalid feature name: $ac_feature" >&2
370 { (exit 1); exit 1; }; }
371 ac_feature=`echo $ac_feature | sed 's/-/_/g'`
372 case $ac_option in
373 *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
374 *) ac_optarg=yes ;;
375 esac
376 eval "enable_$ac_feature='$ac_optarg'" ;;
377
378 -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
379 | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
380 | --exec | --exe | --ex)
381 ac_prev=exec_prefix ;;
382 -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
383 | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
384 | --exec=* | --exe=* | --ex=*)
385 exec_prefix=$ac_optarg ;;
386
387 -gas | --gas | --ga | --g)
388 # Obsolete; use --with-gas.
389 with_gas=yes ;;
390
391 -help | --help | --hel | --he | -h)
392 ac_init_help=long ;;
393 -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
394 ac_init_help=recursive ;;
395 -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
396 ac_init_help=short ;;
397
398 -host | --host | --hos | --ho)
399 ac_prev=host_alias ;;
400 -host=* | --host=* | --hos=* | --ho=*)
401 host_alias=$ac_optarg ;;
402
403 -includedir | --includedir | --includedi | --included | --include \
404 | --includ | --inclu | --incl | --inc)
405 ac_prev=includedir ;;
406 -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
407 | --includ=* | --inclu=* | --incl=* | --inc=*)
408 includedir=$ac_optarg ;;
409
410 -infodir | --infodir | --infodi | --infod | --info | --inf)
411 ac_prev=infodir ;;
412 -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
413 infodir=$ac_optarg ;;
414
415 -libdir | --libdir | --libdi | --libd)
416 ac_prev=libdir ;;
417 -libdir=* | --libdir=* | --libdi=* | --libd=*)
418 libdir=$ac_optarg ;;
419
420 -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
421 | --libexe | --libex | --libe)
422 ac_prev=libexecdir ;;
423 -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
424 | --libexe=* | --libex=* | --libe=*)
425 libexecdir=$ac_optarg ;;
426
427 -localstatedir | --localstatedir | --localstatedi | --localstated \
428 | --localstate | --localstat | --localsta | --localst \
429 | --locals | --local | --loca | --loc | --lo)
430 ac_prev=localstatedir ;;
431 -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
432 | --localstate=* | --localstat=* | --localsta=* | --localst=* \
433 | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
434 localstatedir=$ac_optarg ;;
435
436 -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
437 ac_prev=mandir ;;
438 -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
439 mandir=$ac_optarg ;;
440
441 -nfp | --nfp | --nf)
442 # Obsolete; use --without-fp.
443 with_fp=no ;;
444
445 -no-create | --no-create | --no-creat | --no-crea | --no-cre \
446 | --no-cr | --no-c | -n)
447 no_create=yes ;;
448
449 -no-recursion | --no-recursion | --no-recursio | --no-recursi \
450 | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
451 no_recursion=yes ;;
452
453 -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
454 | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
455 | --oldin | --oldi | --old | --ol | --o)
456 ac_prev=oldincludedir ;;
457 -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
458 | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
459 | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
460 oldincludedir=$ac_optarg ;;
461
462 -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
463 ac_prev=prefix ;;
464 -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
465 prefix=$ac_optarg ;;
466
467 -program-prefix | --program-prefix | --program-prefi | --program-pref \
468 | --program-pre | --program-pr | --program-p)
469 ac_prev=program_prefix ;;
470 -program-prefix=* | --program-prefix=* | --program-prefi=* \
471 | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
472 program_prefix=$ac_optarg ;;
473
474 -program-suffix | --program-suffix | --program-suffi | --program-suff \
475 | --program-suf | --program-su | --program-s)
476 ac_prev=program_suffix ;;
477 -program-suffix=* | --program-suffix=* | --program-suffi=* \
478 | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
479 program_suffix=$ac_optarg ;;
480
481 -program-transform-name | --program-transform-name \
482 | --program-transform-nam | --program-transform-na \
483 | --program-transform-n | --program-transform- \
484 | --program-transform | --program-transfor \
485 | --program-transfo | --program-transf \
486 | --program-trans | --program-tran \
487 | --progr-tra | --program-tr | --program-t)
488 ac_prev=program_transform_name ;;
489 -program-transform-name=* | --program-transform-name=* \
490 | --program-transform-nam=* | --program-transform-na=* \
491 | --program-transform-n=* | --program-transform-=* \
492 | --program-transform=* | --program-transfor=* \
493 | --program-transfo=* | --program-transf=* \
494 | --program-trans=* | --program-tran=* \
495 | --progr-tra=* | --program-tr=* | --program-t=*)
496 program_transform_name=$ac_optarg ;;
497
498 -q | -quiet | --quiet | --quie | --qui | --qu | --q \
499 | -silent | --silent | --silen | --sile | --sil)
500 silent=yes ;;
501
502 -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
503 ac_prev=sbindir ;;
504 -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
505 | --sbi=* | --sb=*)
506 sbindir=$ac_optarg ;;
507
508 -sharedstatedir | --sharedstatedir | --sharedstatedi \
509 | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
510 | --sharedst | --shareds | --shared | --share | --shar \
511 | --sha | --sh)
512 ac_prev=sharedstatedir ;;
513 -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
514 | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
515 | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
516 | --sha=* | --sh=*)
517 sharedstatedir=$ac_optarg ;;
518
519 -site | --site | --sit)
520 ac_prev=site ;;
521 -site=* | --site=* | --sit=*)
522 site=$ac_optarg ;;
523
524 -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
525 ac_prev=srcdir ;;
526 -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
527 srcdir=$ac_optarg ;;
528
529 -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
530 | --syscon | --sysco | --sysc | --sys | --sy)
531 ac_prev=sysconfdir ;;
532 -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
533 | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
534 sysconfdir=$ac_optarg ;;
535
536 -target | --target | --targe | --targ | --tar | --ta | --t)
537 ac_prev=target_alias ;;
538 -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
539 target_alias=$ac_optarg ;;
540
541 -v | -verbose | --verbose | --verbos | --verbo | --verb)
542 verbose=yes ;;
543
544 -version | --version | --versio | --versi | --vers | -V)
545 ac_init_version=: ;;
546
547 -with-* | --with-*)
548 ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
549 # Reject names that are not valid shell variable names.
550 expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
551 { echo "$as_me: error: invalid package name: $ac_package" >&2
552 { (exit 1); exit 1; }; }
553 ac_package=`echo $ac_package| sed 's/-/_/g'`
554 case $ac_option in
555 *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
556 *) ac_optarg=yes ;;
557 esac
558 eval "with_$ac_package='$ac_optarg'" ;;
559
560 -without-* | --without-*)
561 ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
562 # Reject names that are not valid shell variable names.
563 expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
564 { echo "$as_me: error: invalid package name: $ac_package" >&2
565 { (exit 1); exit 1; }; }
566 ac_package=`echo $ac_package | sed 's/-/_/g'`
567 eval "with_$ac_package=no" ;;
568
569 --x)
570 # Obsolete; use --with-x.
571 with_x=yes ;;
572
573 -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
574 | --x-incl | --x-inc | --x-in | --x-i)
575 ac_prev=x_includes ;;
576 -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
577 | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
578 x_includes=$ac_optarg ;;
579
580 -x-libraries | --x-libraries | --x-librarie | --x-librari \
581 | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
582 ac_prev=x_libraries ;;
583 -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
584 | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
585 x_libraries=$ac_optarg ;;
586
587 -*) { echo "$as_me: error: unrecognized option: $ac_option
588 Try \`$0 --help' for more information." >&2
589 { (exit 1); exit 1; }; }
590 ;;
591
592 *=*)
593 ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
594 # Reject names that are not valid shell variable names.
595 expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
596 { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
597 { (exit 1); exit 1; }; }
598 ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
599 eval "$ac_envvar='$ac_optarg'"
600 export $ac_envvar ;;
601
602 *)
603 # FIXME: should be removed in autoconf 3.0.
604 echo "$as_me: WARNING: you should use --build, --host, --target" >&2
605 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
606 echo "$as_me: WARNING: invalid host type: $ac_option" >&2
607 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
608 ;;
609
610 esac
611 done
612
613 if test -n "$ac_prev"; then
614 ac_option=--`echo $ac_prev | sed 's/_/-/g'`
615 { echo "$as_me: error: missing argument to $ac_option" >&2
616 { (exit 1); exit 1; }; }
617 fi
618
619 # Be sure to have absolute paths.
620 for ac_var in exec_prefix prefix
621 do
622 eval ac_val=$`echo $ac_var`
623 case $ac_val in
624 [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
625 *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
626 { (exit 1); exit 1; }; };;
627 esac
628 done
629
630 # Be sure to have absolute paths.
631 for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
632 localstatedir libdir includedir oldincludedir infodir mandir
633 do
634 eval ac_val=$`echo $ac_var`
635 case $ac_val in
636 [\\/$]* | ?:[\\/]* ) ;;
637 *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
638 { (exit 1); exit 1; }; };;
639 esac
640 done
641
642 # There might be people who depend on the old broken behavior: `$host'
643 # used to hold the argument of --host etc.
644 # FIXME: To remove some day.
645 build=$build_alias
646 host=$host_alias
647 target=$target_alias
648
649 # FIXME: To remove some day.
650 if test "x$host_alias" != x; then
651 if test "x$build_alias" = x; then
652 cross_compiling=maybe
653 echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
654 If a cross compiler is detected then cross compile mode will be used." >&2
655 elif test "x$build_alias" != "x$host_alias"; then
656 cross_compiling=yes
657 fi
658 fi
659
660 ac_tool_prefix=
661 test -n "$host_alias" && ac_tool_prefix=$host_alias-
662
663 test "$silent" = yes && exec 6>/dev/null
664
665
666 # Find the source files, if location was not specified.
667 if test -z "$srcdir"; then
668 ac_srcdir_defaulted=yes
669 # Try the directory containing this script, then its parent.
670 ac_confdir=`(dirname "$0") 2>/dev/null ||
671 $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
672 X"$0" : 'X\(//\)[^/]' \| \
673 X"$0" : 'X\(//\)$' \| \
674 X"$0" : 'X\(/\)' \| \
675 . : '\(.\)' 2>/dev/null ||
676 echo X"$0" |
677 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
678 /^X\(\/\/\)[^/].*/{ s//\1/; q; }
679 /^X\(\/\/\)$/{ s//\1/; q; }
680 /^X\(\/\).*/{ s//\1/; q; }
681 s/.*/./; q'`
682 srcdir=$ac_confdir
683 if test ! -r $srcdir/$ac_unique_file; then
684 srcdir=..
685 fi
686 else
687 ac_srcdir_defaulted=no
688 fi
689 if test ! -r $srcdir/$ac_unique_file; then
690 if test "$ac_srcdir_defaulted" = yes; then
691 { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
692 { (exit 1); exit 1; }; }
693 else
694 { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
695 { (exit 1); exit 1; }; }
696 fi
697 fi
698 (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
699 { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
700 { (exit 1); exit 1; }; }
701 srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
702 ac_env_build_alias_set=${build_alias+set}
703 ac_env_build_alias_value=$build_alias
704 ac_cv_env_build_alias_set=${build_alias+set}
705 ac_cv_env_build_alias_value=$build_alias
706 ac_env_host_alias_set=${host_alias+set}
707 ac_env_host_alias_value=$host_alias
708 ac_cv_env_host_alias_set=${host_alias+set}
709 ac_cv_env_host_alias_value=$host_alias
710 ac_env_target_alias_set=${target_alias+set}
711 ac_env_target_alias_value=$target_alias
712 ac_cv_env_target_alias_set=${target_alias+set}
713 ac_cv_env_target_alias_value=$target_alias
714 ac_env_CC_set=${CC+set}
715 ac_env_CC_value=$CC
716 ac_cv_env_CC_set=${CC+set}
717 ac_cv_env_CC_value=$CC
718 ac_env_CFLAGS_set=${CFLAGS+set}
719 ac_env_CFLAGS_value=$CFLAGS
720 ac_cv_env_CFLAGS_set=${CFLAGS+set}
721 ac_cv_env_CFLAGS_value=$CFLAGS
722 ac_env_LDFLAGS_set=${LDFLAGS+set}
723 ac_env_LDFLAGS_value=$LDFLAGS
724 ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
725 ac_cv_env_LDFLAGS_value=$LDFLAGS
726 ac_env_CPPFLAGS_set=${CPPFLAGS+set}
727 ac_env_CPPFLAGS_value=$CPPFLAGS
728 ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
729 ac_cv_env_CPPFLAGS_value=$CPPFLAGS
730 ac_env_CPP_set=${CPP+set}
731 ac_env_CPP_value=$CPP
732 ac_cv_env_CPP_set=${CPP+set}
733 ac_cv_env_CPP_value=$CPP
734
735 #
736 # Report the --help message.
737 #
738 if test "$ac_init_help" = "long"; then
739 # Omit some internal or obsolete options to make the list less imposing.
740 # This message is too long to be a string in the A/UX 3.1 sh.
741 cat <<_ACEOF
742 \`configure' configures libenet 1.0 to adapt to many kinds of systems.
743
744 Usage: $0 [OPTION]... [VAR=VALUE]...
745
746 To assign environment variables (e.g., CC, CFLAGS...), specify them as
747 VAR=VALUE. See below for descriptions of some of the useful variables.
748
749 Defaults for the options are specified in brackets.
750
751 Configuration:
752 -h, --help display this help and exit
753 --help=short display options specific to this package
754 --help=recursive display the short help of all the included packages
755 -V, --version display version information and exit
756 -q, --quiet, --silent do not print \`checking...' messages
757 --cache-file=FILE cache test results in FILE [disabled]
758 -C, --config-cache alias for \`--cache-file=config.cache'
759 -n, --no-create do not create output files
760 --srcdir=DIR find the sources in DIR [configure dir or \`..']
761
762 _ACEOF
763
764 cat <<_ACEOF
765 Installation directories:
766 --prefix=PREFIX install architecture-independent files in PREFIX
767 [$ac_default_prefix]
768 --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
769 [PREFIX]
770
771 By default, \`make install' will install all the files in
772 \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
773 an installation prefix other than \`$ac_default_prefix' using \`--prefix',
774 for instance \`--prefix=\$HOME'.
775
776 For better control, use the options below.
777
778 Fine tuning of the installation directories:
779 --bindir=DIR user executables [EPREFIX/bin]
780 --sbindir=DIR system admin executables [EPREFIX/sbin]
781 --libexecdir=DIR program executables [EPREFIX/libexec]
782 --datadir=DIR read-only architecture-independent data [PREFIX/share]
783 --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
784 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
785 --localstatedir=DIR modifiable single-machine data [PREFIX/var]
786 --libdir=DIR object code libraries [EPREFIX/lib]
787 --includedir=DIR C header files [PREFIX/include]
788 --oldincludedir=DIR C header files for non-gcc [/usr/include]
789 --infodir=DIR info documentation [PREFIX/info]
790 --mandir=DIR man documentation [PREFIX/man]
791 _ACEOF
792
793 cat <<\_ACEOF
794
795 Program names:
796 --program-prefix=PREFIX prepend PREFIX to installed program names
797 --program-suffix=SUFFIX append SUFFIX to installed program names
798 --program-transform-name=PROGRAM run sed PROGRAM on installed program names
799 _ACEOF
800 fi
801
802 if test -n "$ac_init_help"; then
803 case $ac_init_help in
804 short | recursive ) echo "Configuration of libenet 1.0:";;
805 esac
806 cat <<\_ACEOF
807
808 Optional Features:
809 --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
810 --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
811 --disable-dependency-tracking speeds up one-time build
812 --enable-dependency-tracking do not reject slow dependency extractors
813
814 Some influential environment variables:
815 CC C compiler command
816 CFLAGS C compiler flags
817 LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
818 nonstandard directory <lib dir>
819 CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
820 headers in a nonstandard directory <include dir>
821 CPP C preprocessor
822
823 Use these variables to override the choices made by `configure' or to help
824 it to find libraries and programs with nonstandard names/locations.
825
826 _ACEOF
827 fi
828
829 if test "$ac_init_help" = "recursive"; then
830 # If there are subdirs, report their specific --help.
831 ac_popdir=`pwd`
832 for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
833 test -d $ac_dir || continue
834 ac_builddir=.
835
836 if test "$ac_dir" != .; then
837 ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
838 # A "../" for each directory in $ac_dir_suffix.
839 ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
840 else
841 ac_dir_suffix= ac_top_builddir=
842 fi
843
844 case $srcdir in
845 .) # No --srcdir option. We are building in place.
846 ac_srcdir=.
847 if test -z "$ac_top_builddir"; then
848 ac_top_srcdir=.
849 else
850 ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
851 fi ;;
852 [\\/]* | ?:[\\/]* ) # Absolute path.
853 ac_srcdir=$srcdir$ac_dir_suffix;
854 ac_top_srcdir=$srcdir ;;
855 *) # Relative path.
856 ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
857 ac_top_srcdir=$ac_top_builddir$srcdir ;;
858 esac
859
860 # Do not use `cd foo && pwd` to compute absolute paths, because
861 # the directories may not exist.
862 case `pwd` in
863 .) ac_abs_builddir="$ac_dir";;
864 *)
865 case "$ac_dir" in
866 .) ac_abs_builddir=`pwd`;;
867 [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
868 *) ac_abs_builddir=`pwd`/"$ac_dir";;
869 esac;;
870 esac
871 case $ac_abs_builddir in
872 .) ac_abs_top_builddir=${ac_top_builddir}.;;
873 *)
874 case ${ac_top_builddir}. in
875 .) ac_abs_top_builddir=$ac_abs_builddir;;
876 [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
877 *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
878 esac;;
879 esac
880 case $ac_abs_builddir in
881 .) ac_abs_srcdir=$ac_srcdir;;
882 *)
883 case $ac_srcdir in
884 .) ac_abs_srcdir=$ac_abs_builddir;;
885 [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
886 *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
887 esac;;
888 esac
889 case $ac_abs_builddir in
890 .) ac_abs_top_srcdir=$ac_top_srcdir;;
891 *)
892 case $ac_top_srcdir in
893 .) ac_abs_top_srcdir=$ac_abs_builddir;;
894 [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
895 *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
896 esac;;
897 esac
898
899 cd $ac_dir
900 # Check for guested configure; otherwise get Cygnus style configure.
901 if test -f $ac_srcdir/configure.gnu; then
902 echo
903 $SHELL $ac_srcdir/configure.gnu --help=recursive
904 elif test -f $ac_srcdir/configure; then
905 echo
906 $SHELL $ac_srcdir/configure --help=recursive
907 elif test -f $ac_srcdir/configure.ac ||
908 test -f $ac_srcdir/configure.in; then
909 echo
910 $ac_configure --help
911 else
912 echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
913 fi
914 cd "$ac_popdir"
915 done
916 fi
917
918 test -n "$ac_init_help" && exit 0
919 if $ac_init_version; then
920 cat <<\_ACEOF
921 libenet configure 1.0
922 generated by GNU Autoconf 2.59
923
924 Copyright (C) 2003 Free Software Foundation, Inc.
925 This configure script is free software; the Free Software Foundation
926 gives unlimited permission to copy, distribute and modify it.
927 _ACEOF
928 exit 0
929 fi
930 exec 5>config.log
931 cat >&5 <<_ACEOF
932 This file contains any messages produced by compilers while
933 running configure, to aid debugging if configure makes a mistake.
934
935 It was created by libenet $as_me 1.0, which was
936 generated by GNU Autoconf 2.59. Invocation command line was
937
938 $ $0 $@
939
940 _ACEOF
941 {
942 cat <<_ASUNAME
943 ## --------- ##
944 ## Platform. ##
945 ## --------- ##
946
947 hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
948 uname -m = `(uname -m) 2>/dev/null || echo unknown`
949 uname -r = `(uname -r) 2>/dev/null || echo unknown`
950 uname -s = `(uname -s) 2>/dev/null || echo unknown`
951 uname -v = `(uname -v) 2>/dev/null || echo unknown`
952
953 /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
954 /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
955
956 /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
957 /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
958 /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
959 hostinfo = `(hostinfo) 2>/dev/null || echo unknown`
960 /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
961 /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
962 /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
963
964 _ASUNAME
965
966 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
967 for as_dir in $PATH
968 do
969 IFS=$as_save_IFS
970 test -z "$as_dir" && as_dir=.
971 echo "PATH: $as_dir"
972 done
973
974 } >&5
975
976 cat >&5 <<_ACEOF
977
978
979 ## ----------- ##
980 ## Core tests. ##
981 ## ----------- ##
982
983 _ACEOF
984
985
986 # Keep a trace of the command line.
987 # Strip out --no-create and --no-recursion so they do not pile up.
988 # Strip out --silent because we don't want to record it for future runs.
989 # Also quote any args containing shell meta-characters.
990 # Make two passes to allow for proper duplicate-argument suppression.
991 ac_configure_args=
992 ac_configure_args0=
993 ac_configure_args1=
994 ac_sep=
995 ac_must_keep_next=false
996 for ac_pass in 1 2
997 do
998 for ac_arg
999 do
1000 case $ac_arg in
1001 -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
1002 -q | -quiet | --quiet | --quie | --qui | --qu | --q \
1003 | -silent | --silent | --silen | --sile | --sil)
1004 continue ;;
1005 *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
1006 ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
1007 esac
1008 case $ac_pass in
1009 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
1010 2)
1011 ac_configure_args1="$ac_configure_args1 '$ac_arg'"
1012 if test $ac_must_keep_next = true; then
1013 ac_must_keep_next=false # Got value, back to normal.
1014 else
1015 case $ac_arg in
1016 *=* | --config-cache | -C | -disable-* | --disable-* \
1017 | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
1018 | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
1019 | -with-* | --with-* | -without-* | --without-* | --x)
1020 case "$ac_configure_args0 " in
1021 "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
1022 esac
1023 ;;
1024 -* ) ac_must_keep_next=true ;;
1025 esac
1026 fi
1027 ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
1028 # Get rid of the leading space.
1029 ac_sep=" "
1030 ;;
1031 esac
1032 done
1033 done
1034 $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
1035 $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
1036
1037 # When interrupted or exit'd, cleanup temporary files, and complete
1038 # config.log. We remove comments because anyway the quotes in there
1039 # would cause problems or look ugly.
1040 # WARNING: Be sure not to use single quotes in there, as some shells,
1041 # such as our DU 5.0 friend, will then `close' the trap.
1042 trap 'exit_status=$?
1043 # Save into config.log some information that might help in debugging.
1044 {
1045 echo
1046
1047 cat <<\_ASBOX
1048 ## ---------------- ##
1049 ## Cache variables. ##
1050 ## ---------------- ##
1051 _ASBOX
1052 echo
1053 # The following way of writing the cache mishandles newlines in values,
1054 {
1055 (set) 2>&1 |
1056 case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
1057 *ac_space=\ *)
1058 sed -n \
1059 "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
1060 s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
1061 ;;
1062 *)
1063 sed -n \
1064 "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
1065 ;;
1066 esac;
1067 }
1068 echo
1069
1070 cat <<\_ASBOX
1071 ## ----------------- ##
1072 ## Output variables. ##
1073 ## ----------------- ##
1074 _ASBOX
1075 echo
1076 for ac_var in $ac_subst_vars
1077 do
1078 eval ac_val=$`echo $ac_var`
1079 echo "$ac_var='"'"'$ac_val'"'"'"
1080 done | sort
1081 echo
1082
1083 if test -n "$ac_subst_files"; then
1084 cat <<\_ASBOX
1085 ## ------------- ##
1086 ## Output files. ##
1087 ## ------------- ##
1088 _ASBOX
1089 echo
1090 for ac_var in $ac_subst_files
1091 do
1092 eval ac_val=$`echo $ac_var`
1093 echo "$ac_var='"'"'$ac_val'"'"'"
1094 done | sort
1095 echo
1096 fi
1097
1098 if test -s confdefs.h; then
1099 cat <<\_ASBOX
1100 ## ----------- ##
1101 ## confdefs.h. ##
1102 ## ----------- ##
1103 _ASBOX
1104 echo
1105 sed "/^$/d" confdefs.h | sort
1106 echo
1107 fi
1108 test "$ac_signal" != 0 &&
1109 echo "$as_me: caught signal $ac_signal"
1110 echo "$as_me: exit $exit_status"
1111 } >&5
1112 rm -f core *.core &&
1113 rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
1114 exit $exit_status
1115 ' 0
1116 for ac_signal in 1 2 13 15; do
1117 trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
1118 done
1119 ac_signal=0
1120
1121 # confdefs.h avoids OS command line length limits that DEFS can exceed.
1122 rm -rf conftest* confdefs.h
1123 # AIX cpp loses on an empty file, so make sure it contains at least a newline.
1124 echo >confdefs.h
1125
1126 # Predefined preprocessor variables.
1127
1128 cat >>confdefs.h <<_ACEOF
1129 #define PACKAGE_NAME "$PACKAGE_NAME"
1130 _ACEOF
1131
1132
1133 cat >>confdefs.h <<_ACEOF
1134 #define PACKAGE_TARNAME "$PACKAGE_TARNAME"
1135 _ACEOF
1136
1137
1138 cat >>confdefs.h <<_ACEOF
1139 #define PACKAGE_VERSION "$PACKAGE_VERSION"
1140 _ACEOF
1141
1142
1143 cat >>confdefs.h <<_ACEOF
1144 #define PACKAGE_STRING "$PACKAGE_STRING"
1145 _ACEOF
1146
1147
1148 cat >>confdefs.h <<_ACEOF
1149 #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
1150 _ACEOF
1151
1152
1153 # Let the site file select an alternate cache file if it wants to.
1154 # Prefer explicitly selected file to automatically selected ones.
1155 if test -z "$CONFIG_SITE"; then
1156 if test "x$prefix" != xNONE; then
1157 CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
1158 else
1159 CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
1160 fi
1161 fi
1162 for ac_site_file in $CONFIG_SITE; do
1163 if test -r "$ac_site_file"; then
1164 { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
1165 echo "$as_me: loading site script $ac_site_file" >&6;}
1166 sed 's/^/| /' "$ac_site_file" >&5
1167 . "$ac_site_file"
1168 fi
1169 done
1170
1171 if test -r "$cache_file"; then
1172 # Some versions of bash will fail to source /dev/null (special
1173 # files actually), so we avoid doing that.
1174 if test -f "$cache_file"; then
1175 { echo "$as_me:$LINENO: loading cache $cache_file" >&5
1176 echo "$as_me: loading cache $cache_file" >&6;}
1177 case $cache_file in
1178 [\\/]* | ?:[\\/]* ) . $cache_file;;
1179 *) . ./$cache_file;;
1180 esac
1181 fi
1182 else
1183 { echo "$as_me:$LINENO: creating cache $cache_file" >&5
1184 echo "$as_me: creating cache $cache_file" >&6;}
1185 >$cache_file
1186 fi
1187
1188 # Check that the precious variables saved in the cache have kept the same
1189 # value.
1190 ac_cache_corrupted=false
1191 for ac_var in `(set) 2>&1 |
1192 sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
1193 eval ac_old_set=\$ac_cv_env_${ac_var}_set
1194 eval ac_new_set=\$ac_env_${ac_var}_set
1195 eval ac_old_val="\$ac_cv_env_${ac_var}_value"
1196 eval ac_new_val="\$ac_env_${ac_var}_value"
1197 case $ac_old_set,$ac_new_set in
1198 set,)
1199 { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
1200 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
1201 ac_cache_corrupted=: ;;
1202 ,set)
1203 { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
1204 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
1205 ac_cache_corrupted=: ;;
1206 ,);;
1207 *)
1208 if test "x$ac_old_val" != "x$ac_new_val"; then
1209 { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
1210 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
1211 { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
1212 echo "$as_me: former value: $ac_old_val" >&2;}
1213 { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
1214 echo "$as_me: current value: $ac_new_val" >&2;}
1215 ac_cache_corrupted=:
1216 fi;;
1217 esac
1218 # Pass precious variables to config.status.
1219 if test "$ac_new_set" = set; then
1220 case $ac_new_val in
1221 *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
1222 ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
1223 *) ac_arg=$ac_var=$ac_new_val ;;
1224 esac
1225 case " $ac_configure_args " in
1226 *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
1227 *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
1228 esac
1229 fi
1230 done
1231 if $ac_cache_corrupted; then
1232 { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
1233 echo "$as_me: error: changes in the environment can compromise the build" >&2;}
1234 { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
1235 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
1236 { (exit 1); exit 1; }; }
1237 fi
1238
1239 ac_ext=c
1240 ac_cpp='$CPP $CPPFLAGS'
1241 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
1242 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
1243 ac_compiler_gnu=$ac_cv_c_compiler_gnu
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271 am__api_version="1.9"
1272 ac_aux_dir=
1273 for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
1274 if test -f $ac_dir/install-sh; then
1275 ac_aux_dir=$ac_dir
1276 ac_install_sh="$ac_aux_dir/install-sh -c"
1277 break
1278 elif test -f $ac_dir/install.sh; then
1279 ac_aux_dir=$ac_dir
1280 ac_install_sh="$ac_aux_dir/install.sh -c"
1281 break
1282 elif test -f $ac_dir/shtool; then
1283 ac_aux_dir=$ac_dir
1284 ac_install_sh="$ac_aux_dir/shtool install -c"
1285 break
1286 fi
1287 done
1288 if test -z "$ac_aux_dir"; then
1289 { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
1290 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
1291 { (exit 1); exit 1; }; }
1292 fi
1293 ac_config_guess="$SHELL $ac_aux_dir/config.guess"
1294 ac_config_sub="$SHELL $ac_aux_dir/config.sub"
1295 ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
1296
1297 # Find a good install program. We prefer a C program (faster),
1298 # so one script is as good as another. But avoid the broken or
1299 # incompatible versions:
1300 # SysV /etc/install, /usr/sbin/install
1301 # SunOS /usr/etc/install
1302 # IRIX /sbin/install
1303 # AIX /bin/install
1304 # AmigaOS /C/install, which installs bootblocks on floppy discs
1305 # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
1306 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
1307 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
1308 # OS/2's system install, which has a completely different semantic
1309 # ./install, which can be erroneously created by make from ./install.sh.
1310 echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
1311 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
1312 if test -z "$INSTALL"; then
1313 if test "${ac_cv_path_install+set}" = set; then
1314 echo $ECHO_N "(cached) $ECHO_C" >&6
1315 else
1316 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1317 for as_dir in $PATH
1318 do
1319 IFS=$as_save_IFS
1320 test -z "$as_dir" && as_dir=.
1321 # Account for people who put trailing slashes in PATH elements.
1322 case $as_dir/ in
1323 ./ | .// | /cC/* | \
1324 /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
1325 ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
1326 /usr/ucb/* ) ;;
1327 *)
1328 # OSF1 and SCO ODT 3.0 have their own names for install.
1329 # Don't use installbsd from OSF since it installs stuff as root
1330 # by default.
1331 for ac_prog in ginstall scoinst install; do
1332 for ac_exec_ext in '' $ac_executable_extensions; do
1333 if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
1334 if test $ac_prog = install &&
1335 grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
1336 # AIX install. It has an incompatible calling convention.
1337 :
1338 elif test $ac_prog = install &&
1339 grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
1340 # program-specific install script used by HP pwplus--don't use.
1341 :
1342 else
1343 ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
1344 break 3
1345 fi
1346 fi
1347 done
1348 done
1349 ;;
1350 esac
1351 done
1352
1353
1354 fi
1355 if test "${ac_cv_path_install+set}" = set; then
1356 INSTALL=$ac_cv_path_install
1357 else
1358 # As a last resort, use the slow shell script. We don't cache a
1359 # path for INSTALL within a source directory, because that will
1360 # break other packages using the cache if that directory is
1361 # removed, or if the path is relative.
1362 INSTALL=$ac_install_sh
1363 fi
1364 fi
1365 echo "$as_me:$LINENO: result: $INSTALL" >&5
1366 echo "${ECHO_T}$INSTALL" >&6
1367
1368 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
1369 # It thinks the first close brace ends the variable substitution.
1370 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
1371
1372 test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
1373
1374 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
1375
1376 echo "$as_me:$LINENO: checking whether build environment is sane" >&5
1377 echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6
1378 # Just in case
1379 sleep 1
1380 echo timestamp > conftest.file
1381 # Do `set' in a subshell so we don't clobber the current shell's
1382 # arguments. Must try -L first in case configure is actually a
1383 # symlink; some systems play weird games with the mod time of symlinks
1384 # (eg FreeBSD returns the mod time of the symlink's containing
1385 # directory).
1386 if (
1387 set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
1388 if test "$*" = "X"; then
1389 # -L didn't work.
1390 set X `ls -t $srcdir/configure conftest.file`
1391 fi
1392 rm -f conftest.file
1393 if test "$*" != "X $srcdir/configure conftest.file" \
1394 && test "$*" != "X conftest.file $srcdir/configure"; then
1395
1396 # If neither matched, then we have a broken ls. This can happen
1397 # if, for instance, CONFIG_SHELL is bash and it inherits a
1398 # broken ls alias from the environment. This has actually
1399 # happened. Such a system could not be considered "sane".
1400 { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken
1401 alias in your environment" >&5
1402 echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken
1403 alias in your environment" >&2;}
1404 { (exit 1); exit 1; }; }
1405 fi
1406
1407 test "$2" = conftest.file
1408 )
1409 then
1410 # Ok.
1411 :
1412 else
1413 { { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
1414 Check your system clock" >&5
1415 echo "$as_me: error: newly created file is older than distributed files!
1416 Check your system clock" >&2;}
1417 { (exit 1); exit 1; }; }
1418 fi
1419 echo "$as_me:$LINENO: result: yes" >&5
1420 echo "${ECHO_T}yes" >&6
1421 test "$program_prefix" != NONE &&
1422 program_transform_name="s,^,$program_prefix,;$program_transform_name"
1423 # Use a double $ so make ignores it.
1424 test "$program_suffix" != NONE &&
1425 program_transform_name="s,\$,$program_suffix,;$program_transform_name"
1426 # Double any \ or $. echo might interpret backslashes.
1427 # By default was `s,x,x', remove it if useless.
1428 cat <<\_ACEOF >conftest.sed
1429 s/[\\$]/&&/g;s/;s,x,x,$//
1430 _ACEOF
1431 program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
1432 rm conftest.sed
1433
1434 # expand $ac_aux_dir to an absolute path
1435 am_aux_dir=`cd $ac_aux_dir && pwd`
1436
1437 test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
1438 # Use eval to expand $SHELL
1439 if eval "$MISSING --run true"; then
1440 am_missing_run="$MISSING --run "
1441 else
1442 am_missing_run=
1443 { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
1444 echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
1445 fi
1446
1447 if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
1448 # We used to keeping the `.' as first argument, in order to
1449 # allow $(mkdir_p) to be used without argument. As in
1450 # $(mkdir_p) $(somedir)
1451 # where $(somedir) is conditionally defined. However this is wrong
1452 # for two reasons:
1453 # 1. if the package is installed by a user who cannot write `.'
1454 # make install will fail,
1455 # 2. the above comment should most certainly read
1456 # $(mkdir_p) $(DESTDIR)$(somedir)
1457 # so it does not work when $(somedir) is undefined and
1458 # $(DESTDIR) is not.
1459 # To support the latter case, we have to write
1460 # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
1461 # so the `.' trick is pointless.
1462 mkdir_p='mkdir -p --'
1463 else
1464 # On NextStep and OpenStep, the `mkdir' command does not
1465 # recognize any option. It will interpret all options as
1466 # directories to create, and then abort because `.' already
1467 # exists.
1468 for d in ./-p ./--version;
1469 do
1470 test -d $d && rmdir $d
1471 done
1472 # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
1473 if test -f "$ac_aux_dir/mkinstalldirs"; then
1474 mkdir_p='$(mkinstalldirs)'
1475 else
1476 mkdir_p='$(install_sh) -d'
1477 fi
1478 fi
1479
1480 for ac_prog in gawk mawk nawk awk
1481 do
1482 # Extract the first word of "$ac_prog", so it can be a program name with args.
1483 set dummy $ac_prog; ac_word=$2
1484 echo "$as_me:$LINENO: checking for $ac_word" >&5
1485 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
1486 if test "${ac_cv_prog_AWK+set}" = set; then
1487 echo $ECHO_N "(cached) $ECHO_C" >&6
1488 else
1489 if test -n "$AWK"; then
1490 ac_cv_prog_AWK="$AWK" # Let the user override the test.
1491 else
1492 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1493 for as_dir in $PATH
1494 do
1495 IFS=$as_save_IFS
1496 test -z "$as_dir" && as_dir=.
1497 for ac_exec_ext in '' $ac_executable_extensions; do
1498 if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
1499 ac_cv_prog_AWK="$ac_prog"
1500 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
1501 break 2
1502 fi
1503 done
1504 done
1505
1506 fi
1507 fi
1508 AWK=$ac_cv_prog_AWK
1509 if test -n "$AWK"; then
1510 echo "$as_me:$LINENO: result: $AWK" >&5
1511 echo "${ECHO_T}$AWK" >&6
1512 else
1513 echo "$as_me:$LINENO: result: no" >&5
1514 echo "${ECHO_T}no" >&6
1515 fi
1516
1517 test -n "$AWK" && break
1518 done
1519
1520 echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
1521 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
1522 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'`
1523 if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
1524 echo $ECHO_N "(cached) $ECHO_C" >&6
1525 else
1526 cat >conftest.make <<\_ACEOF
1527 all:
1528 @echo 'ac_maketemp="$(MAKE)"'
1529 _ACEOF
1530 # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
1531 eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
1532 if test -n "$ac_maketemp"; then
1533 eval ac_cv_prog_make_${ac_make}_set=yes
1534 else
1535 eval ac_cv_prog_make_${ac_make}_set=no
1536 fi
1537 rm -f conftest.make
1538 fi
1539 if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
1540 echo "$as_me:$LINENO: result: yes" >&5
1541 echo "${ECHO_T}yes" >&6
1542 SET_MAKE=
1543 else
1544 echo "$as_me:$LINENO: result: no" >&5
1545 echo "${ECHO_T}no" >&6
1546 SET_MAKE="MAKE=${MAKE-make}"
1547 fi
1548
1549 rm -rf .tst 2>/dev/null
1550 mkdir .tst 2>/dev/null
1551 if test -d .tst; then
1552 am__leading_dot=.
1553 else
1554 am__leading_dot=_
1555 fi
1556 rmdir .tst 2>/dev/null
1557
1558 # test to see if srcdir already configured
1559 if test "`cd $srcdir && pwd`" != "`pwd`" &&
1560 test -f $srcdir/config.status; then
1561 { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
1562 echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
1563 { (exit 1); exit 1; }; }
1564 fi
1565
1566 # test whether we have cygpath
1567 if test -z "$CYGPATH_W"; then
1568 if (cygpath --version) >/dev/null 2>/dev/null; then
1569 CYGPATH_W='cygpath -w'
1570 else
1571 CYGPATH_W=echo
1572 fi
1573 fi
1574
1575
1576 # Define the identity of the package.
1577 PACKAGE=libenet.a
1578 VERSION=1.0
1579
1580
1581 cat >>confdefs.h <<_ACEOF
1582 #define PACKAGE "$PACKAGE"
1583 _ACEOF
1584
1585
1586 cat >>confdefs.h <<_ACEOF
1587 #define VERSION "$VERSION"
1588 _ACEOF
1589
1590 # Some tools Automake needs.
1591
1592 ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
1593
1594
1595 AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
1596
1597
1598 AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
1599
1600
1601 AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
1602
1603
1604 MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
1605
1606 install_sh=${install_sh-"$am_aux_dir/install-sh"}
1607
1608 # Installed binaries are usually stripped using `strip' when the user
1609 # run `make install-strip'. However `strip' might not be the right
1610 # tool to use in cross-compilation environments, therefore Automake
1611 # will honor the `STRIP' environment variable to overrule this program.
1612 if test "$cross_compiling" != no; then
1613 if test -n "$ac_tool_prefix"; then
1614 # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
1615 set dummy ${ac_tool_prefix}strip; ac_word=$2
1616 echo "$as_me:$LINENO: checking for $ac_word" >&5
1617 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
1618 if test "${ac_cv_prog_STRIP+set}" = set; then
1619 echo $ECHO_N "(cached) $ECHO_C" >&6
1620 else
1621 if test -n "$STRIP"; then
1622 ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
1623 else
1624 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1625 for as_dir in $PATH
1626 do
1627 IFS=$as_save_IFS
1628 test -z "$as_dir" && as_dir=.
1629 for ac_exec_ext in '' $ac_executable_extensions; do
1630 if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
1631 ac_cv_prog_STRIP="${ac_tool_prefix}strip"
1632 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
1633 break 2
1634 fi
1635 done
1636 done
1637
1638 fi
1639 fi
1640 STRIP=$ac_cv_prog_STRIP
1641 if test -n "$STRIP"; then
1642 echo "$as_me:$LINENO: result: $STRIP" >&5
1643 echo "${ECHO_T}$STRIP" >&6
1644 else
1645 echo "$as_me:$LINENO: result: no" >&5
1646 echo "${ECHO_T}no" >&6
1647 fi
1648
1649 fi
1650 if test -z "$ac_cv_prog_STRIP"; then
1651 ac_ct_STRIP=$STRIP
1652 # Extract the first word of "strip", so it can be a program name with args.
1653 set dummy strip; ac_word=$2
1654 echo "$as_me:$LINENO: checking for $ac_word" >&5
1655 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
1656 if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
1657 echo $ECHO_N "(cached) $ECHO_C" >&6
1658 else
1659 if test -n "$ac_ct_STRIP"; then
1660 ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
1661 else
1662 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1663 for as_dir in $PATH
1664 do
1665 IFS=$as_save_IFS
1666 test -z "$as_dir" && as_dir=.
1667 for ac_exec_ext in '' $ac_executable_extensions; do
1668 if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
1669 ac_cv_prog_ac_ct_STRIP="strip"
1670 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
1671 break 2
1672 fi
1673 done
1674 done
1675
1676 test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":"
1677 fi
1678 fi
1679 ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
1680 if test -n "$ac_ct_STRIP"; then
1681 echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
1682 echo "${ECHO_T}$ac_ct_STRIP" >&6
1683 else
1684 echo "$as_me:$LINENO: result: no" >&5
1685 echo "${ECHO_T}no" >&6
1686 fi
1687
1688 STRIP=$ac_ct_STRIP
1689 else
1690 STRIP="$ac_cv_prog_STRIP"
1691 fi
1692
1693 fi
1694 INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
1695
1696 # We need awk for the "check" target. The system "awk" is bad on
1697 # some platforms.
1698 # Always define AMTAR for backward compatibility.
1699
1700 AMTAR=${AMTAR-"${am_missing_run}tar"}
1701
1702 am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
1703
1704
1705
1706
1707
1708
1709 ac_ext=c
1710 ac_cpp='$CPP $CPPFLAGS'
1711 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
1712 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
1713 ac_compiler_gnu=$ac_cv_c_compiler_gnu
1714 if test -n "$ac_tool_prefix"; then
1715 # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
1716 set dummy ${ac_tool_prefix}gcc; ac_word=$2
1717 echo "$as_me:$LINENO: checking for $ac_word" >&5
1718 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
1719 if test "${ac_cv_prog_CC+set}" = set; then
1720 echo $ECHO_N "(cached) $ECHO_C" >&6
1721 else
1722 if test -n "$CC"; then
1723 ac_cv_prog_CC="$CC" # Let the user override the test.
1724 else
1725 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1726 for as_dir in $PATH
1727 do
1728 IFS=$as_save_IFS
1729 test -z "$as_dir" && as_dir=.
1730 for ac_exec_ext in '' $ac_executable_extensions; do
1731 if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
1732 ac_cv_prog_CC="${ac_tool_prefix}gcc"
1733 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
1734 break 2
1735 fi
1736 done
1737 done
1738
1739 fi
1740 fi
1741 CC=$ac_cv_prog_CC
1742 if test -n "$CC"; then
1743 echo "$as_me:$LINENO: result: $CC" >&5
1744 echo "${ECHO_T}$CC" >&6
1745 else
1746 echo "$as_me:$LINENO: result: no" >&5
1747 echo "${ECHO_T}no" >&6
1748 fi
1749
1750 fi
1751 if test -z "$ac_cv_prog_CC"; then
1752 ac_ct_CC=$CC
1753 # Extract the first word of "gcc", so it can be a program name with args.
1754 set dummy gcc; ac_word=$2
1755 echo "$as_me:$LINENO: checking for $ac_word" >&5
1756 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
1757 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
1758 echo $ECHO_N "(cached) $ECHO_C" >&6
1759 else
1760 if test -n "$ac_ct_CC"; then
1761 ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
1762 else
1763 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1764 for as_dir in $PATH
1765 do
1766 IFS=$as_save_IFS
1767 test -z "$as_dir" && as_dir=.
1768 for ac_exec_ext in '' $ac_executable_extensions; do
1769 if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
1770 ac_cv_prog_ac_ct_CC="gcc"
1771 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
1772 break 2
1773 fi
1774 done
1775 done
1776
1777 fi
1778 fi
1779 ac_ct_CC=$ac_cv_prog_ac_ct_CC
1780 if test -n "$ac_ct_CC"; then
1781 echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
1782 echo "${ECHO_T}$ac_ct_CC" >&6
1783 else
1784 echo "$as_me:$LINENO: result: no" >&5
1785 echo "${ECHO_T}no" >&6
1786 fi
1787
1788 CC=$ac_ct_CC
1789 else
1790 CC="$ac_cv_prog_CC"
1791 fi
1792
1793 if test -z "$CC"; then
1794 if test -n "$ac_tool_prefix"; then
1795 # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
1796 set dummy ${ac_tool_prefix}cc; ac_word=$2
1797 echo "$as_me:$LINENO: checking for $ac_word" >&5
1798 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
1799 if test "${ac_cv_prog_CC+set}" = set; then
1800 echo $ECHO_N "(cached) $ECHO_C" >&6
1801 else
1802 if test -n "$CC"; then
1803 ac_cv_prog_CC="$CC" # Let the user override the test.
1804 else
1805 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1806 for as_dir in $PATH
1807 do
1808 IFS=$as_save_IFS
1809 test -z "$as_dir" && as_dir=.
1810 for ac_exec_ext in '' $ac_executable_extensions; do
1811 if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
1812 ac_cv_prog_CC="${ac_tool_prefix}cc"
1813 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
1814 break 2
1815 fi
1816 done
1817 done
1818
1819 fi
1820 fi
1821 CC=$ac_cv_prog_CC
1822 if test -n "$CC"; then
1823 echo "$as_me:$LINENO: result: $CC" >&5
1824 echo "${ECHO_T}$CC" >&6
1825 else
1826 echo "$as_me:$LINENO: result: no" >&5
1827 echo "${ECHO_T}no" >&6
1828 fi
1829
1830 fi
1831 if test -z "$ac_cv_prog_CC"; then
1832 ac_ct_CC=$CC
1833 # Extract the first word of "cc", so it can be a program name with args.
1834 set dummy cc; ac_word=$2
1835 echo "$as_me:$LINENO: checking for $ac_word" >&5
1836 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
1837 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
1838 echo $ECHO_N "(cached) $ECHO_C" >&6
1839 else
1840 if test -n "$ac_ct_CC"; then
1841 ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
1842 else
1843 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1844 for as_dir in $PATH
1845 do
1846 IFS=$as_save_IFS
1847 test -z "$as_dir" && as_dir=.
1848 for ac_exec_ext in '' $ac_executable_extensions; do
1849 if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
1850 ac_cv_prog_ac_ct_CC="cc"
1851 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
1852 break 2
1853 fi
1854 done
1855 done
1856
1857 fi
1858 fi
1859 ac_ct_CC=$ac_cv_prog_ac_ct_CC
1860 if test -n "$ac_ct_CC"; then
1861 echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
1862 echo "${ECHO_T}$ac_ct_CC" >&6
1863 else
1864 echo "$as_me:$LINENO: result: no" >&5
1865 echo "${ECHO_T}no" >&6
1866 fi
1867
1868 CC=$ac_ct_CC
1869 else
1870 CC="$ac_cv_prog_CC"
1871 fi
1872
1873 fi
1874 if test -z "$CC"; then
1875 # Extract the first word of "cc", so it can be a program name with args.
1876 set dummy cc; ac_word=$2
1877 echo "$as_me:$LINENO: checking for $ac_word" >&5
1878 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
1879 if test "${ac_cv_prog_CC+set}" = set; then
1880 echo $ECHO_N "(cached) $ECHO_C" >&6
1881 else
1882 if test -n "$CC"; then
1883 ac_cv_prog_CC="$CC" # Let the user override the test.
1884 else
1885 ac_prog_rejected=no
1886 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1887 for as_dir in $PATH
1888 do
1889 IFS=$as_save_IFS
1890 test -z "$as_dir" && as_dir=.
1891 for ac_exec_ext in '' $ac_executable_extensions; do
1892 if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
1893 if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
1894 ac_prog_rejected=yes
1895 continue
1896 fi
1897 ac_cv_prog_CC="cc"
1898 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
1899 break 2
1900 fi
1901 done
1902 done
1903
1904 if test $ac_prog_rejected = yes; then
1905 # We found a bogon in the path, so make sure we never use it.
1906 set dummy $ac_cv_prog_CC
1907 shift
1908 if test $# != 0; then
1909 # We chose a different compiler from the bogus one.
1910 # However, it has the same basename, so the bogon will be chosen
1911 # first if we set CC to just the basename; use the full file name.
1912 shift
1913 ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
1914 fi
1915 fi
1916 fi
1917 fi
1918 CC=$ac_cv_prog_CC
1919 if test -n "$CC"; then
1920 echo "$as_me:$LINENO: result: $CC" >&5
1921 echo "${ECHO_T}$CC" >&6
1922 else
1923 echo "$as_me:$LINENO: result: no" >&5
1924 echo "${ECHO_T}no" >&6
1925 fi
1926
1927 fi
1928 if test -z "$CC"; then
1929 if test -n "$ac_tool_prefix"; then
1930 for ac_prog in cl
1931 do
1932 # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
1933 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
1934 echo "$as_me:$LINENO: checking for $ac_word" >&5
1935 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
1936 if test "${ac_cv_prog_CC+set}" = set; then
1937 echo $ECHO_N "(cached) $ECHO_C" >&6
1938 else
1939 if test -n "$CC"; then
1940 ac_cv_prog_CC="$CC" # Let the user override the test.
1941 else
1942 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1943 for as_dir in $PATH
1944 do
1945 IFS=$as_save_IFS
1946 test -z "$as_dir" && as_dir=.
1947 for ac_exec_ext in '' $ac_executable_extensions; do
1948 if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
1949 ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
1950 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
1951 break 2
1952 fi
1953 done
1954 done
1955
1956 fi
1957 fi
1958 CC=$ac_cv_prog_CC
1959 if test -n "$CC"; then
1960 echo "$as_me:$LINENO: result: $CC" >&5
1961 echo "${ECHO_T}$CC" >&6
1962 else
1963 echo "$as_me:$LINENO: result: no" >&5
1964 echo "${ECHO_T}no" >&6
1965 fi
1966
1967 test -n "$CC" && break
1968 done
1969 fi
1970 if test -z "$CC"; then
1971 ac_ct_CC=$CC
1972 for ac_prog in cl
1973 do
1974 # Extract the first word of "$ac_prog", so it can be a program name with args.
1975 set dummy $ac_prog; ac_word=$2
1976 echo "$as_me:$LINENO: checking for $ac_word" >&5
1977 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
1978 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
1979 echo $ECHO_N "(cached) $ECHO_C" >&6
1980 else
1981 if test -n "$ac_ct_CC"; then
1982 ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
1983 else
1984 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1985 for as_dir in $PATH
1986 do
1987 IFS=$as_save_IFS
1988 test -z "$as_dir" && as_dir=.
1989 for ac_exec_ext in '' $ac_executable_extensions; do
1990 if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
1991 ac_cv_prog_ac_ct_CC="$ac_prog"
1992 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
1993 break 2
1994 fi
1995 done
1996 done
1997
1998 fi
1999 fi
2000 ac_ct_CC=$ac_cv_prog_ac_ct_CC
2001 if test -n "$ac_ct_CC"; then
2002 echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
2003 echo "${ECHO_T}$ac_ct_CC" >&6
2004 else
2005 echo "$as_me:$LINENO: result: no" >&5
2006 echo "${ECHO_T}no" >&6
2007 fi
2008
2009 test -n "$ac_ct_CC" && break
2010 done
2011
2012 CC=$ac_ct_CC
2013 fi
2014
2015 fi
2016
2017
2018 test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
2019 See \`config.log' for more details." >&5
2020 echo "$as_me: error: no acceptable C compiler found in \$PATH
2021 See \`config.log' for more details." >&2;}
2022 { (exit 1); exit 1; }; }
2023
2024 # Provide some information about the compiler.
2025 echo "$as_me:$LINENO:" \
2026 "checking for C compiler version" >&5
2027 ac_compiler=`set X $ac_compile; echo $2`
2028 { (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
2029 (eval $ac_compiler --version </dev/null >&5) 2>&5
2030 ac_status=$?
2031 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2032 (exit $ac_status); }
2033 { (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
2034 (eval $ac_compiler -v </dev/null >&5) 2>&5
2035 ac_status=$?
2036 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2037 (exit $ac_status); }
2038 { (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
2039 (eval $ac_compiler -V </dev/null >&5) 2>&5
2040 ac_status=$?
2041 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2042 (exit $ac_status); }
2043
2044 cat >conftest.$ac_ext <<_ACEOF
2045 /* confdefs.h. */
2046 _ACEOF
2047 cat confdefs.h >>conftest.$ac_ext
2048 cat >>conftest.$ac_ext <<_ACEOF
2049 /* end confdefs.h. */
2050
2051 int
2052 main ()
2053 {
2054
2055 ;
2056 return 0;
2057 }
2058 _ACEOF
2059 ac_clean_files_save=$ac_clean_files
2060 ac_clean_files="$ac_clean_files a.out a.exe b.out"
2061 # Try to create an executable without -o first, disregard a.out.
2062 # It will help us diagnose broken compilers, and finding out an intuition
2063 # of exeext.
2064 echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
2065 echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
2066 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
2067 if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
2068 (eval $ac_link_default) 2>&5
2069 ac_status=$?
2070 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2071 (exit $ac_status); }; then
2072 # Find the output, starting from the most likely. This scheme is
2073 # not robust to junk in `.', hence go to wildcards (a.*) only as a last
2074 # resort.
2075
2076 # Be careful to initialize this variable, since it used to be cached.
2077 # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
2078 ac_cv_exeext=
2079 # b.out is created by i960 compilers.
2080 for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
2081 do
2082 test -f "$ac_file" || continue
2083 case $ac_file in
2084 *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
2085 ;;
2086 conftest.$ac_ext )
2087 # This is the source file.
2088 ;;
2089 [ab].out )
2090 # We found the default executable, but exeext='' is most
2091 # certainly right.
2092 break;;
2093 *.* )
2094 ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
2095 # FIXME: I believe we export ac_cv_exeext for Libtool,
2096 # but it would be cool to find out if it's true. Does anybody
2097 # maintain Libtool? --akim.
2098 export ac_cv_exeext
2099 break;;
2100 * )
2101 break;;
2102 esac
2103 done
2104 else
2105 echo "$as_me: failed program was:" >&5
2106 sed 's/^/| /' conftest.$ac_ext >&5
2107
2108 { { echo "$as_me:$LINENO: error: C compiler cannot create executables
2109 See \`config.log' for more details." >&5
2110 echo "$as_me: error: C compiler cannot create executables
2111 See \`config.log' for more details." >&2;}
2112 { (exit 77); exit 77; }; }
2113 fi
2114
2115 ac_exeext=$ac_cv_exeext
2116 echo "$as_me:$LINENO: result: $ac_file" >&5
2117 echo "${ECHO_T}$ac_file" >&6
2118
2119 # Check the compiler produces executables we can run. If not, either
2120 # the compiler is broken, or we cross compile.
2121 echo "$as_me:$LINENO: checking whether the C compiler works" >&5
2122 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
2123 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0
2124 # If not cross compiling, check that we can run a simple program.
2125 if test "$cross_compiling" != yes; then
2126 if { ac_try='./$ac_file'
2127 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2128 (eval $ac_try) 2>&5
2129 ac_status=$?
2130 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2131 (exit $ac_status); }; }; then
2132 cross_compiling=no
2133 else
2134 if test "$cross_compiling" = maybe; then
2135 cross_compiling=yes
2136 else
2137 { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
2138 If you meant to cross compile, use \`--host'.
2139 See \`config.log' for more details." >&5
2140 echo "$as_me: error: cannot run C compiled programs.
2141 If you meant to cross compile, use \`--host'.
2142 See \`config.log' for more details." >&2;}
2143 { (exit 1); exit 1; }; }
2144 fi
2145 fi
2146 fi
2147 echo "$as_me:$LINENO: result: yes" >&5
2148 echo "${ECHO_T}yes" >&6
2149
2150 rm -f a.out a.exe conftest$ac_cv_exeext b.out
2151 ac_clean_files=$ac_clean_files_save
2152 # Check the compiler produces executables we can run. If not, either
2153 # the compiler is broken, or we cross compile.
2154 echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
2155 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
2156 echo "$as_me:$LINENO: result: $cross_compiling" >&5
2157 echo "${ECHO_T}$cross_compiling" >&6
2158
2159 echo "$as_me:$LINENO: checking for suffix of executables" >&5
2160 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
2161 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
2162 (eval $ac_link) 2>&5
2163 ac_status=$?
2164 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2165 (exit $ac_status); }; then
2166 # If both `conftest.exe' and `conftest' are `present' (well, observable)
2167 # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
2168 # work properly (i.e., refer to `conftest.exe'), while it won't with
2169 # `rm'.
2170 for ac_file in conftest.exe conftest conftest.*; do
2171 test -f "$ac_file" || continue
2172 case $ac_file in
2173 *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
2174 *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
2175 export ac_cv_exeext
2176 break;;
2177 * ) break;;
2178 esac
2179 done
2180 else
2181 { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
2182 See \`config.log' for more details." >&5
2183 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
2184 See \`config.log' for more details." >&2;}
2185 { (exit 1); exit 1; }; }
2186 fi
2187
2188 rm -f conftest$ac_cv_exeext
2189 echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
2190 echo "${ECHO_T}$ac_cv_exeext" >&6
2191
2192 rm -f conftest.$ac_ext
2193 EXEEXT=$ac_cv_exeext
2194 ac_exeext=$EXEEXT
2195 echo "$as_me:$LINENO: checking for suffix of object files" >&5
2196 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
2197 if test "${ac_cv_objext+set}" = set; then
2198 echo $ECHO_N "(cached) $ECHO_C" >&6
2199 else
2200 cat >conftest.$ac_ext <<_ACEOF
2201 /* confdefs.h. */
2202 _ACEOF
2203 cat confdefs.h >>conftest.$ac_ext
2204 cat >>conftest.$ac_ext <<_ACEOF
2205 /* end confdefs.h. */
2206
2207 int
2208 main ()
2209 {
2210
2211 ;
2212 return 0;
2213 }
2214 _ACEOF
2215 rm -f conftest.o conftest.obj
2216 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
2217 (eval $ac_compile) 2>&5
2218 ac_status=$?
2219 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2220 (exit $ac_status); }; then
2221 for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
2222 case $ac_file in
2223 *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
2224 *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
2225 break;;
2226 esac
2227 done
2228 else
2229 echo "$as_me: failed program was:" >&5
2230 sed 's/^/| /' conftest.$ac_ext >&5
2231
2232 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
2233 See \`config.log' for more details." >&5
2234 echo "$as_me: error: cannot compute suffix of object files: cannot compile
2235 See \`config.log' for more details." >&2;}
2236 { (exit 1); exit 1; }; }
2237 fi
2238
2239 rm -f conftest.$ac_cv_objext conftest.$ac_ext
2240 fi
2241 echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
2242 echo "${ECHO_T}$ac_cv_objext" >&6
2243 OBJEXT=$ac_cv_objext
2244 ac_objext=$OBJEXT
2245 echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
2246 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
2247 if test "${ac_cv_c_compiler_gnu+set}" = set; then
2248 echo $ECHO_N "(cached) $ECHO_C" >&6
2249 else
2250 cat >conftest.$ac_ext <<_ACEOF
2251 /* confdefs.h. */
2252 _ACEOF
2253 cat confdefs.h >>conftest.$ac_ext
2254 cat >>conftest.$ac_ext <<_ACEOF
2255 /* end confdefs.h. */
2256
2257 int
2258 main ()
2259 {
2260 #ifndef __GNUC__
2261 choke me
2262 #endif
2263
2264 ;
2265 return 0;
2266 }
2267 _ACEOF
2268 rm -f conftest.$ac_objext
2269 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
2270 (eval $ac_compile) 2>conftest.er1
2271 ac_status=$?
2272 grep -v '^ *+' conftest.er1 >conftest.err
2273 rm -f conftest.er1
2274 cat conftest.err >&5
2275 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2276 (exit $ac_status); } &&
2277 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
2278 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2279 (eval $ac_try) 2>&5
2280 ac_status=$?
2281 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2282 (exit $ac_status); }; } &&
2283 { ac_try='test -s conftest.$ac_objext'
2284 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2285 (eval $ac_try) 2>&5
2286 ac_status=$?
2287 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2288 (exit $ac_status); }; }; then
2289 ac_compiler_gnu=yes
2290 else
2291 echo "$as_me: failed program was:" >&5
2292 sed 's/^/| /' conftest.$ac_ext >&5
2293
2294 ac_compiler_gnu=no
2295 fi
2296 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
2297 ac_cv_c_compiler_gnu=$ac_compiler_gnu
2298
2299 fi
2300 echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
2301 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
2302 GCC=`test $ac_compiler_gnu = yes && echo yes`
2303 ac_test_CFLAGS=${CFLAGS+set}
2304 ac_save_CFLAGS=$CFLAGS
2305 CFLAGS="-g"
2306 echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
2307 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
2308 if test "${ac_cv_prog_cc_g+set}" = set; then
2309 echo $ECHO_N "(cached) $ECHO_C" >&6
2310 else
2311 cat >conftest.$ac_ext <<_ACEOF
2312 /* confdefs.h. */
2313 _ACEOF
2314 cat confdefs.h >>conftest.$ac_ext
2315 cat >>conftest.$ac_ext <<_ACEOF
2316 /* end confdefs.h. */
2317
2318 int
2319 main ()
2320 {
2321
2322 ;
2323 return 0;
2324 }
2325 _ACEOF
2326 rm -f conftest.$ac_objext
2327 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
2328 (eval $ac_compile) 2>conftest.er1
2329 ac_status=$?
2330 grep -v '^ *+' conftest.er1 >conftest.err
2331 rm -f conftest.er1
2332 cat conftest.err >&5
2333 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2334 (exit $ac_status); } &&
2335 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
2336 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2337 (eval $ac_try) 2>&5
2338 ac_status=$?
2339 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2340 (exit $ac_status); }; } &&
2341 { ac_try='test -s conftest.$ac_objext'
2342 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2343 (eval $ac_try) 2>&5
2344 ac_status=$?
2345 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2346 (exit $ac_status); }; }; then
2347 ac_cv_prog_cc_g=yes
2348 else
2349 echo "$as_me: failed program was:" >&5
2350 sed 's/^/| /' conftest.$ac_ext >&5
2351
2352 ac_cv_prog_cc_g=no
2353 fi
2354 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
2355 fi
2356 echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
2357 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
2358 if test "$ac_test_CFLAGS" = set; then
2359 CFLAGS=$ac_save_CFLAGS
2360 elif test $ac_cv_prog_cc_g = yes; then
2361 if test "$GCC" = yes; then
2362 CFLAGS="-g -O2"
2363 else
2364 CFLAGS="-g"
2365 fi
2366 else
2367 if test "$GCC" = yes; then
2368 CFLAGS="-O2"
2369 else
2370 CFLAGS=
2371 fi
2372 fi
2373 echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
2374 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
2375 if test "${ac_cv_prog_cc_stdc+set}" = set; then
2376 echo $ECHO_N "(cached) $ECHO_C" >&6
2377 else
2378 ac_cv_prog_cc_stdc=no
2379 ac_save_CC=$CC
2380 cat >conftest.$ac_ext <<_ACEOF
2381 /* confdefs.h. */
2382 _ACEOF
2383 cat confdefs.h >>conftest.$ac_ext
2384 cat >>conftest.$ac_ext <<_ACEOF
2385 /* end confdefs.h. */
2386 #include <stdarg.h>
2387 #include <stdio.h>
2388 #include <sys/types.h>
2389 #include <sys/stat.h>
2390 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
2391 struct buf { int x; };
2392 FILE * (*rcsopen) (struct buf *, struct stat *, int);
2393 static char *e (p, i)
2394 char **p;
2395 int i;
2396 {
2397 return p[i];
2398 }
2399 static char *f (char * (*g) (char **, int), char **p, ...)
2400 {
2401 char *s;
2402 va_list v;
2403 va_start (v,p);
2404 s = g (p, va_arg (v,int));
2405 va_end (v);
2406 return s;
2407 }
2408
2409 /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
2410 function prototypes and stuff, but not '\xHH' hex character constants.
2411 These don't provoke an error unfortunately, instead are silently treated
2412 as 'x'. The following induces an error, until -std1 is added to get
2413 proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
2414 array size at least. It's necessary to write '\x00'==0 to get something
2415 that's true only with -std1. */
2416 int osf4_cc_array ['\x00' == 0 ? 1 : -1];
2417
2418 int test (int i, double x);
2419 struct s1 {int (*f) (int a);};
2420 struct s2 {int (*f) (double a);};
2421 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
2422 int argc;
2423 char **argv;
2424 int
2425 main ()
2426 {
2427 return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
2428 ;
2429 return 0;
2430 }
2431 _ACEOF
2432 # Don't try gcc -ansi; that turns off useful extensions and
2433 # breaks some systems' header files.
2434 # AIX -qlanglvl=ansi
2435 # Ultrix and OSF/1 -std1
2436 # HP-UX 10.20 and later -Ae
2437 # HP-UX older versions -Aa -D_HPUX_SOURCE
2438 # SVR4 -Xc -D__EXTENSIONS__
2439 for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
2440 do
2441 CC="$ac_save_CC $ac_arg"
2442 rm -f conftest.$ac_objext
2443 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
2444 (eval $ac_compile) 2>conftest.er1
2445 ac_status=$?
2446 grep -v '^ *+' conftest.er1 >conftest.err
2447 rm -f conftest.er1
2448 cat conftest.err >&5
2449 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2450 (exit $ac_status); } &&
2451 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
2452 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2453 (eval $ac_try) 2>&5
2454 ac_status=$?
2455 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2456 (exit $ac_status); }; } &&
2457 { ac_try='test -s conftest.$ac_objext'
2458 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2459 (eval $ac_try) 2>&5
2460 ac_status=$?
2461 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2462 (exit $ac_status); }; }; then
2463 ac_cv_prog_cc_stdc=$ac_arg
2464 break
2465 else
2466 echo "$as_me: failed program was:" >&5
2467 sed 's/^/| /' conftest.$ac_ext >&5
2468
2469 fi
2470 rm -f conftest.err conftest.$ac_objext
2471 done
2472 rm -f conftest.$ac_ext conftest.$ac_objext
2473 CC=$ac_save_CC
2474
2475 fi
2476
2477 case "x$ac_cv_prog_cc_stdc" in
2478 x|xno)
2479 echo "$as_me:$LINENO: result: none needed" >&5
2480 echo "${ECHO_T}none needed" >&6 ;;
2481 *)
2482 echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
2483 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
2484 CC="$CC $ac_cv_prog_cc_stdc" ;;
2485 esac
2486
2487 # Some people use a C++ compiler to compile C. Since we use `exit',
2488 # in C++ we need to declare it. In case someone uses the same compiler
2489 # for both compiling C and C++ we need to have the C++ compiler decide
2490 # the declaration of exit, since it's the most demanding environment.
2491 cat >conftest.$ac_ext <<_ACEOF
2492 #ifndef __cplusplus
2493 choke me
2494 #endif
2495 _ACEOF
2496 rm -f conftest.$ac_objext
2497 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
2498 (eval $ac_compile) 2>conftest.er1
2499 ac_status=$?
2500 grep -v '^ *+' conftest.er1 >conftest.err
2501 rm -f conftest.er1
2502 cat conftest.err >&5
2503 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2504 (exit $ac_status); } &&
2505 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
2506 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2507 (eval $ac_try) 2>&5
2508 ac_status=$?
2509 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2510 (exit $ac_status); }; } &&
2511 { ac_try='test -s conftest.$ac_objext'
2512 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2513 (eval $ac_try) 2>&5
2514 ac_status=$?
2515 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2516 (exit $ac_status); }; }; then
2517 for ac_declaration in \
2518 '' \
2519 'extern "C" void std::exit (int) throw (); using std::exit;' \
2520 'extern "C" void std::exit (int); using std::exit;' \
2521 'extern "C" void exit (int) throw ();' \
2522 'extern "C" void exit (int);' \
2523 'void exit (int);'
2524 do
2525 cat >conftest.$ac_ext <<_ACEOF
2526 /* confdefs.h. */
2527 _ACEOF
2528 cat confdefs.h >>conftest.$ac_ext
2529 cat >>conftest.$ac_ext <<_ACEOF
2530 /* end confdefs.h. */
2531 $ac_declaration
2532 #include <stdlib.h>
2533 int
2534 main ()
2535 {
2536 exit (42);
2537 ;
2538 return 0;
2539 }
2540 _ACEOF
2541 rm -f conftest.$ac_objext
2542 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
2543 (eval $ac_compile) 2>conftest.er1
2544 ac_status=$?
2545 grep -v '^ *+' conftest.er1 >conftest.err
2546 rm -f conftest.er1
2547 cat conftest.err >&5
2548 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2549 (exit $ac_status); } &&
2550 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
2551 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2552 (eval $ac_try) 2>&5
2553 ac_status=$?
2554 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2555 (exit $ac_status); }; } &&
2556 { ac_try='test -s conftest.$ac_objext'
2557 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2558 (eval $ac_try) 2>&5
2559 ac_status=$?
2560 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2561 (exit $ac_status); }; }; then
2562 :
2563 else
2564 echo "$as_me: failed program was:" >&5
2565 sed 's/^/| /' conftest.$ac_ext >&5
2566
2567 continue
2568 fi
2569 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
2570 cat >conftest.$ac_ext <<_ACEOF
2571 /* confdefs.h. */
2572 _ACEOF
2573 cat confdefs.h >>conftest.$ac_ext
2574 cat >>conftest.$ac_ext <<_ACEOF
2575 /* end confdefs.h. */
2576 $ac_declaration
2577 int
2578 main ()
2579 {
2580 exit (42);
2581 ;
2582 return 0;
2583 }
2584 _ACEOF
2585 rm -f conftest.$ac_objext
2586 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
2587 (eval $ac_compile) 2>conftest.er1
2588 ac_status=$?
2589 grep -v '^ *+' conftest.er1 >conftest.err
2590 rm -f conftest.er1
2591 cat conftest.err >&5
2592 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2593 (exit $ac_status); } &&
2594 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
2595 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2596 (eval $ac_try) 2>&5
2597 ac_status=$?
2598 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2599 (exit $ac_status); }; } &&
2600 { ac_try='test -s conftest.$ac_objext'
2601 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2602 (eval $ac_try) 2>&5
2603 ac_status=$?
2604 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2605 (exit $ac_status); }; }; then
2606 break
2607 else
2608 echo "$as_me: failed program was:" >&5
2609 sed 's/^/| /' conftest.$ac_ext >&5
2610
2611 fi
2612 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
2613 done
2614 rm -f conftest*
2615 if test -n "$ac_declaration"; then
2616 echo '#ifdef __cplusplus' >>confdefs.h
2617 echo $ac_declaration >>confdefs.h
2618 echo '#endif' >>confdefs.h
2619 fi
2620
2621 else
2622 echo "$as_me: failed program was:" >&5
2623 sed 's/^/| /' conftest.$ac_ext >&5
2624
2625 fi
2626 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
2627 ac_ext=c
2628 ac_cpp='$CPP $CPPFLAGS'
2629 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
2630 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
2631 ac_compiler_gnu=$ac_cv_c_compiler_gnu
2632 DEPDIR="${am__leading_dot}deps"
2633
2634 ac_config_commands="$ac_config_commands depfiles"
2635
2636
2637 am_make=${MAKE-make}
2638 cat > confinc << 'END'
2639 am__doit:
2640 @echo done
2641 .PHONY: am__doit
2642 END
2643 # If we don't find an include directive, just comment out the code.
2644 echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
2645 echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6
2646 am__include="#"
2647 am__quote=
2648 _am_result=none
2649 # First try GNU make style include.
2650 echo "include confinc" > confmf
2651 # We grep out `Entering directory' and `Leaving directory'
2652 # messages which can occur if `w' ends up in MAKEFLAGS.
2653 # In particular we don't look at `^make:' because GNU make might
2654 # be invoked under some other name (usually "gmake"), in which
2655 # case it prints its new name instead of `make'.
2656 if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
2657 am__include=include
2658 am__quote=
2659 _am_result=GNU
2660 fi
2661 # Now try BSD make style include.
2662 if test "$am__include" = "#"; then
2663 echo '.include "confinc"' > confmf
2664 if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
2665 am__include=.include
2666 am__quote="\""
2667 _am_result=BSD
2668 fi
2669 fi
2670
2671
2672 echo "$as_me:$LINENO: result: $_am_result" >&5
2673 echo "${ECHO_T}$_am_result" >&6
2674 rm -f confinc confmf
2675
2676 # Check whether --enable-dependency-tracking or --disable-dependency-tracking was given.
2677 if test "${enable_dependency_tracking+set}" = set; then
2678 enableval="$enable_dependency_tracking"
2679
2680 fi;
2681 if test "x$enable_dependency_tracking" != xno; then
2682 am_depcomp="$ac_aux_dir/depcomp"
2683 AMDEPBACKSLASH='\'
2684 fi
2685
2686
2687 if test "x$enable_dependency_tracking" != xno; then
2688 AMDEP_TRUE=
2689 AMDEP_FALSE='#'
2690 else
2691 AMDEP_TRUE='#'
2692 AMDEP_FALSE=
2693 fi
2694
2695
2696
2697
2698 depcc="$CC" am_compiler_list=
2699
2700 echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
2701 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6
2702 if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
2703 echo $ECHO_N "(cached) $ECHO_C" >&6
2704 else
2705 if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
2706 # We make a subdir and do the tests there. Otherwise we can end up
2707 # making bogus files that we don't know about and never remove. For
2708 # instance it was reported that on HP-UX the gcc test will end up
2709 # making a dummy file named `D' -- because `-MD' means `put the output
2710 # in D'.
2711 mkdir conftest.dir
2712 # Copy depcomp to subdir because otherwise we won't find it if we're
2713 # using a relative directory.
2714 cp "$am_depcomp" conftest.dir
2715 cd conftest.dir
2716 # We will build objects and dependencies in a subdirectory because
2717 # it helps to detect inapplicable dependency modes. For instance
2718 # both Tru64's cc and ICC support -MD to output dependencies as a
2719 # side effect of compilation, but ICC will put the dependencies in
2720 # the current directory while Tru64 will put them in the object
2721 # directory.
2722 mkdir sub
2723
2724 am_cv_CC_dependencies_compiler_type=none
2725 if test "$am_compiler_list" = ""; then
2726 am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
2727 fi
2728 for depmode in $am_compiler_list; do
2729 # Setup a source with many dependencies, because some compilers
2730 # like to wrap large dependency lists on column 80 (with \), and
2731 # we should not choose a depcomp mode which is confused by this.
2732 #
2733 # We need to recreate these files for each test, as the compiler may
2734 # overwrite some of them when testing with obscure command lines.
2735 # This happens at least with the AIX C compiler.
2736 : > sub/conftest.c
2737 for i in 1 2 3 4 5 6; do
2738 echo '#include "conftst'$i'.h"' >> sub/conftest.c
2739 # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
2740 # Solaris 8's {/usr,}/bin/sh.
2741 touch sub/conftst$i.h
2742 done
2743 echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2744
2745 case $depmode in
2746 nosideeffect)
2747 # after this tag, mechanisms are not by side-effect, so they'll
2748 # only be used when explicitly requested
2749 if test "x$enable_dependency_tracking" = xyes; then
2750 continue
2751 else
2752 break
2753 fi
2754 ;;
2755 none) break ;;
2756 esac
2757 # We check with `-c' and `-o' for the sake of the "dashmstdout"
2758 # mode. It turns out that the SunPro C++ compiler does not properly
2759 # handle `-M -o', and we need to detect this.
2760 if depmode=$depmode \
2761 source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
2762 depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2763 $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
2764 >/dev/null 2>conftest.err &&
2765 grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2766 grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
2767 ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2768 # icc doesn't choke on unknown options, it will just issue warnings
2769 # or remarks (even with -Werror). So we grep stderr for any message
2770 # that says an option was ignored or not supported.
2771 # When given -MP, icc 7.0 and 7.1 complain thusly:
2772 # icc: Command line warning: ignoring option '-M'; no argument required
2773 # The diagnosis changed in icc 8.0:
2774 # icc: Command line remark: option '-MP' not supported
2775 if (grep 'ignoring option' conftest.err ||
2776 grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2777 am_cv_CC_dependencies_compiler_type=$depmode
2778 break
2779 fi
2780 fi
2781 done
2782
2783 cd ..
2784 rm -rf conftest.dir
2785 else
2786 am_cv_CC_dependencies_compiler_type=none
2787 fi
2788
2789 fi
2790 echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
2791 echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6
2792 CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
2793
2794
2795
2796 if
2797 test "x$enable_dependency_tracking" != xno \
2798 && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
2799 am__fastdepCC_TRUE=
2800 am__fastdepCC_FALSE='#'
2801 else
2802 am__fastdepCC_TRUE='#'
2803 am__fastdepCC_FALSE=
2804 fi
2805
2806
2807 if test -n "$ac_tool_prefix"; then
2808 # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
2809 set dummy ${ac_tool_prefix}ranlib; ac_word=$2
2810 echo "$as_me:$LINENO: checking for $ac_word" >&5
2811 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
2812 if test "${ac_cv_prog_RANLIB+set}" = set; then
2813 echo $ECHO_N "(cached) $ECHO_C" >&6
2814 else
2815 if test -n "$RANLIB"; then
2816 ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
2817 else
2818 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
2819 for as_dir in $PATH
2820 do
2821 IFS=$as_save_IFS
2822 test -z "$as_dir" && as_dir=.
2823 for ac_exec_ext in '' $ac_executable_extensions; do
2824 if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
2825 ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
2826 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
2827 break 2
2828 fi
2829 done
2830 done
2831
2832 fi
2833 fi
2834 RANLIB=$ac_cv_prog_RANLIB
2835 if test -n "$RANLIB"; then
2836 echo "$as_me:$LINENO: result: $RANLIB" >&5
2837 echo "${ECHO_T}$RANLIB" >&6
2838 else
2839 echo "$as_me:$LINENO: result: no" >&5
2840 echo "${ECHO_T}no" >&6
2841 fi
2842
2843 fi
2844 if test -z "$ac_cv_prog_RANLIB"; then
2845 ac_ct_RANLIB=$RANLIB
2846 # Extract the first word of "ranlib", so it can be a program name with args.
2847 set dummy ranlib; ac_word=$2
2848 echo "$as_me:$LINENO: checking for $ac_word" >&5
2849 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
2850 if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
2851 echo $ECHO_N "(cached) $ECHO_C" >&6
2852 else
2853 if test -n "$ac_ct_RANLIB"; then
2854 ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
2855 else
2856 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
2857 for as_dir in $PATH
2858 do
2859 IFS=$as_save_IFS
2860 test -z "$as_dir" && as_dir=.
2861 for ac_exec_ext in '' $ac_executable_extensions; do
2862 if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
2863 ac_cv_prog_ac_ct_RANLIB="ranlib"
2864 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
2865 break 2
2866 fi
2867 done
2868 done
2869
2870 test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
2871 fi
2872 fi
2873 ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
2874 if test -n "$ac_ct_RANLIB"; then
2875 echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
2876 echo "${ECHO_T}$ac_ct_RANLIB" >&6
2877 else
2878 echo "$as_me:$LINENO: result: no" >&5
2879 echo "${ECHO_T}no" >&6
2880 fi
2881
2882 RANLIB=$ac_ct_RANLIB
2883 else
2884 RANLIB="$ac_cv_prog_RANLIB"
2885 fi
2886
2887
2888
2889 echo "$as_me:$LINENO: checking for gethostbyaddr_r" >&5
2890 echo $ECHO_N "checking for gethostbyaddr_r... $ECHO_C" >&6
2891 if test "${ac_cv_func_gethostbyaddr_r+set}" = set; then
2892 echo $ECHO_N "(cached) $ECHO_C" >&6
2893 else
2894 cat >conftest.$ac_ext <<_ACEOF
2895 /* confdefs.h. */
2896 _ACEOF
2897 cat confdefs.h >>conftest.$ac_ext
2898 cat >>conftest.$ac_ext <<_ACEOF
2899 /* end confdefs.h. */
2900 /* Define gethostbyaddr_r to an innocuous variant, in case <limits.h> declares gethostbyaddr_r.
2901 For example, HP-UX 11i <limits.h> declares gettimeofday. */
2902 #define gethostbyaddr_r innocuous_gethostbyaddr_r
2903
2904 /* System header to define __stub macros and hopefully few prototypes,
2905 which can conflict with char gethostbyaddr_r (); below.
2906 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
2907 <limits.h> exists even on freestanding compilers. */
2908
2909 #ifdef __STDC__
2910 # include <limits.h>
2911 #else
2912 # include <assert.h>
2913 #endif
2914
2915 #undef gethostbyaddr_r
2916
2917 /* Override any gcc2 internal prototype to avoid an error. */
2918 #ifdef __cplusplus
2919 extern "C"
2920 {
2921 #endif
2922 /* We use char because int might match the return type of a gcc2
2923 builtin and then its argument prototype would still apply. */
2924 char gethostbyaddr_r ();
2925 /* The GNU C library defines this for functions which it implements
2926 to always fail with ENOSYS. Some functions are actually named
2927 something starting with __ and the normal name is an alias. */
2928 #if defined (__stub_gethostbyaddr_r) || defined (__stub___gethostbyaddr_r)
2929 choke me
2930 #else
2931 char (*f) () = gethostbyaddr_r;
2932 #endif
2933 #ifdef __cplusplus
2934 }
2935 #endif
2936
2937 int
2938 main ()
2939 {
2940 return f != gethostbyaddr_r;
2941 ;
2942 return 0;
2943 }
2944 _ACEOF
2945 rm -f conftest.$ac_objext conftest$ac_exeext
2946 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
2947 (eval $ac_link) 2>conftest.er1
2948 ac_status=$?
2949 grep -v '^ *+' conftest.er1 >conftest.err
2950 rm -f conftest.er1
2951 cat conftest.err >&5
2952 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2953 (exit $ac_status); } &&
2954 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
2955 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2956 (eval $ac_try) 2>&5
2957 ac_status=$?
2958 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2959 (exit $ac_status); }; } &&
2960 { ac_try='test -s conftest$ac_exeext'
2961 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2962 (eval $ac_try) 2>&5
2963 ac_status=$?
2964 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2965 (exit $ac_status); }; }; then
2966 ac_cv_func_gethostbyaddr_r=yes
2967 else
2968 echo "$as_me: failed program was:" >&5
2969 sed 's/^/| /' conftest.$ac_ext >&5
2970
2971 ac_cv_func_gethostbyaddr_r=no
2972 fi
2973 rm -f conftest.err conftest.$ac_objext \
2974 conftest$ac_exeext conftest.$ac_ext
2975 fi
2976 echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyaddr_r" >&5
2977 echo "${ECHO_T}$ac_cv_func_gethostbyaddr_r" >&6
2978 if test $ac_cv_func_gethostbyaddr_r = yes; then
2979 cat >>confdefs.h <<\_ACEOF
2980 #define HAS_GETHOSTBYADDR_R 1
2981 _ACEOF
2982
2983 fi
2984
2985 echo "$as_me:$LINENO: checking for gethostbyname_r" >&5
2986 echo $ECHO_N "checking for gethostbyname_r... $ECHO_C" >&6
2987 if test "${ac_cv_func_gethostbyname_r+set}" = set; then
2988 echo $ECHO_N "(cached) $ECHO_C" >&6
2989 else
2990 cat >conftest.$ac_ext <<_ACEOF
2991 /* confdefs.h. */
2992 _ACEOF
2993 cat confdefs.h >>conftest.$ac_ext
2994 cat >>conftest.$ac_ext <<_ACEOF
2995 /* end confdefs.h. */
2996 /* Define gethostbyname_r to an innocuous variant, in case <limits.h> declares gethostbyname_r.
2997 For example, HP-UX 11i <limits.h> declares gettimeofday. */
2998 #define gethostbyname_r innocuous_gethostbyname_r
2999
3000 /* System header to define __stub macros and hopefully few prototypes,
3001 which can conflict with char gethostbyname_r (); below.
3002 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
3003 <limits.h> exists even on freestanding compilers. */
3004
3005 #ifdef __STDC__
3006 # include <limits.h>
3007 #else
3008 # include <assert.h>
3009 #endif
3010
3011 #undef gethostbyname_r
3012
3013 /* Override any gcc2 internal prototype to avoid an error. */
3014 #ifdef __cplusplus
3015 extern "C"
3016 {
3017 #endif
3018 /* We use char because int might match the return type of a gcc2
3019 builtin and then its argument prototype would still apply. */
3020 char gethostbyname_r ();
3021 /* The GNU C library defines this for functions which it implements
3022 to always fail with ENOSYS. Some functions are actually named
3023 something starting with __ and the normal name is an alias. */
3024 #if defined (__stub_gethostbyname_r) || defined (__stub___gethostbyname_r)
3025 choke me
3026 #else
3027 char (*f) () = gethostbyname_r;
3028 #endif
3029 #ifdef __cplusplus
3030 }
3031 #endif
3032
3033 int
3034 main ()
3035 {
3036 return f != gethostbyname_r;
3037 ;
3038 return 0;
3039 }
3040 _ACEOF
3041 rm -f conftest.$ac_objext conftest$ac_exeext
3042 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
3043 (eval $ac_link) 2>conftest.er1
3044 ac_status=$?
3045 grep -v '^ *+' conftest.er1 >conftest.err
3046 rm -f conftest.er1
3047 cat conftest.err >&5
3048 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3049 (exit $ac_status); } &&
3050 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
3051 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3052 (eval $ac_try) 2>&5
3053 ac_status=$?
3054 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3055 (exit $ac_status); }; } &&
3056 { ac_try='test -s conftest$ac_exeext'
3057 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3058 (eval $ac_try) 2>&5
3059 ac_status=$?
3060 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3061 (exit $ac_status); }; }; then
3062 ac_cv_func_gethostbyname_r=yes
3063 else
3064 echo "$as_me: failed program was:" >&5
3065 sed 's/^/| /' conftest.$ac_ext >&5
3066
3067 ac_cv_func_gethostbyname_r=no
3068 fi
3069 rm -f conftest.err conftest.$ac_objext \
3070 conftest$ac_exeext conftest.$ac_ext
3071 fi
3072 echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname_r" >&5
3073 echo "${ECHO_T}$ac_cv_func_gethostbyname_r" >&6
3074 if test $ac_cv_func_gethostbyname_r = yes; then
3075 cat >>confdefs.h <<\_ACEOF
3076 #define HAS_GETHOSTBYNAME_R 1
3077 _ACEOF
3078
3079 fi
3080
3081 echo "$as_me:$LINENO: checking for poll" >&5
3082 echo $ECHO_N "checking for poll... $ECHO_C" >&6
3083 if test "${ac_cv_func_poll+set}" = set; then
3084 echo $ECHO_N "(cached) $ECHO_C" >&6
3085 else
3086 cat >conftest.$ac_ext <<_ACEOF
3087 /* confdefs.h. */
3088 _ACEOF
3089 cat confdefs.h >>conftest.$ac_ext
3090 cat >>conftest.$ac_ext <<_ACEOF
3091 /* end confdefs.h. */
3092 /* Define poll to an innocuous variant, in case <limits.h> declares poll.
3093 For example, HP-UX 11i <limits.h> declares gettimeofday. */
3094 #define poll innocuous_poll
3095
3096 /* System header to define __stub macros and hopefully few prototypes,
3097 which can conflict with char poll (); below.
3098 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
3099 <limits.h> exists even on freestanding compilers. */
3100
3101 #ifdef __STDC__
3102 # include <limits.h>
3103 #else
3104 # include <assert.h>
3105 #endif
3106
3107 #undef poll
3108
3109 /* Override any gcc2 internal prototype to avoid an error. */
3110 #ifdef __cplusplus
3111 extern "C"
3112 {
3113 #endif
3114 /* We use char because int might match the return type of a gcc2
3115 builtin and then its argument prototype would still apply. */
3116 char poll ();
3117 /* The GNU C library defines this for functions which it implements
3118 to always fail with ENOSYS. Some functions are actually named
3119 something starting with __ and the normal name is an alias. */
3120 #if defined (__stub_poll) || defined (__stub___poll)
3121 choke me
3122 #else
3123 char (*f) () = poll;
3124 #endif
3125 #ifdef __cplusplus
3126 }
3127 #endif
3128
3129 int
3130 main ()
3131 {
3132 return f != poll;
3133 ;
3134 return 0;
3135 }
3136 _ACEOF
3137 rm -f conftest.$ac_objext conftest$ac_exeext
3138 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
3139 (eval $ac_link) 2>conftest.er1
3140 ac_status=$?
3141 grep -v '^ *+' conftest.er1 >conftest.err
3142 rm -f conftest.er1
3143 cat conftest.err >&5
3144 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3145 (exit $ac_status); } &&
3146 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
3147 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3148 (eval $ac_try) 2>&5
3149 ac_status=$?
3150 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3151 (exit $ac_status); }; } &&
3152 { ac_try='test -s conftest$ac_exeext'
3153 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3154 (eval $ac_try) 2>&5
3155 ac_status=$?
3156 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3157 (exit $ac_status); }; }; then
3158 ac_cv_func_poll=yes
3159 else
3160 echo "$as_me: failed program was:" >&5
3161 sed 's/^/| /' conftest.$ac_ext >&5
3162
3163 ac_cv_func_poll=no
3164 fi
3165 rm -f conftest.err conftest.$ac_objext \
3166 conftest$ac_exeext conftest.$ac_ext
3167 fi
3168 echo "$as_me:$LINENO: result: $ac_cv_func_poll" >&5
3169 echo "${ECHO_T}$ac_cv_func_poll" >&6
3170 if test $ac_cv_func_poll = yes; then
3171 cat >>confdefs.h <<\_ACEOF
3172 #define HAS_POLL 1
3173 _ACEOF
3174
3175 fi
3176
3177 echo "$as_me:$LINENO: checking for fcntl" >&5
3178 echo $ECHO_N "checking for fcntl... $ECHO_C" >&6
3179 if test "${ac_cv_func_fcntl+set}" = set; then
3180 echo $ECHO_N "(cached) $ECHO_C" >&6
3181 else
3182 cat >conftest.$ac_ext <<_ACEOF
3183 /* confdefs.h. */
3184 _ACEOF
3185 cat confdefs.h >>conftest.$ac_ext
3186 cat >>conftest.$ac_ext <<_ACEOF
3187 /* end confdefs.h. */
3188 /* Define fcntl to an innocuous variant, in case <limits.h> declares fcntl.
3189 For example, HP-UX 11i <limits.h> declares gettimeofday. */
3190 #define fcntl innocuous_fcntl
3191
3192 /* System header to define __stub macros and hopefully few prototypes,
3193 which can conflict with char fcntl (); below.
3194 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
3195 <limits.h> exists even on freestanding compilers. */
3196
3197 #ifdef __STDC__
3198 # include <limits.h>
3199 #else
3200 # include <assert.h>
3201 #endif
3202
3203 #undef fcntl
3204
3205 /* Override any gcc2 internal prototype to avoid an error. */
3206 #ifdef __cplusplus
3207 extern "C"
3208 {
3209 #endif
3210 /* We use char because int might match the return type of a gcc2
3211 builtin and then its argument prototype would still apply. */
3212 char fcntl ();
3213 /* The GNU C library defines this for functions which it implements
3214 to always fail with ENOSYS. Some functions are actually named
3215 something starting with __ and the normal name is an alias. */
3216 #if defined (__stub_fcntl) || defined (__stub___fcntl)
3217 choke me
3218 #else
3219 char (*f) () = fcntl;
3220 #endif
3221 #ifdef __cplusplus
3222 }
3223 #endif
3224
3225 int
3226 main ()
3227 {
3228 return f != fcntl;
3229 ;
3230 return 0;
3231 }
3232 _ACEOF
3233 rm -f conftest.$ac_objext conftest$ac_exeext
3234 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
3235 (eval $ac_link) 2>conftest.er1
3236 ac_status=$?
3237 grep -v '^ *+' conftest.er1 >conftest.err
3238 rm -f conftest.er1
3239 cat conftest.err >&5
3240 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3241 (exit $ac_status); } &&
3242 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
3243 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3244 (eval $ac_try) 2>&5
3245 ac_status=$?
3246 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3247 (exit $ac_status); }; } &&
3248 { ac_try='test -s conftest$ac_exeext'
3249 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3250 (eval $ac_try) 2>&5
3251 ac_status=$?
3252 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3253 (exit $ac_status); }; }; then
3254 ac_cv_func_fcntl=yes
3255 else
3256 echo "$as_me: failed program was:" >&5
3257 sed 's/^/| /' conftest.$ac_ext >&5
3258
3259 ac_cv_func_fcntl=no
3260 fi
3261 rm -f conftest.err conftest.$ac_objext \
3262 conftest$ac_exeext conftest.$ac_ext
3263 fi
3264 echo "$as_me:$LINENO: result: $ac_cv_func_fcntl" >&5
3265 echo "${ECHO_T}$ac_cv_func_fcntl" >&6
3266 if test $ac_cv_func_fcntl = yes; then
3267 cat >>confdefs.h <<\_ACEOF
3268 #define HAS_FCNTL 1
3269 _ACEOF
3270
3271 fi
3272
3273 echo "$as_me:$LINENO: checking for inet_pton" >&5
3274 echo $ECHO_N "checking for inet_pton... $ECHO_C" >&6
3275 if test "${ac_cv_func_inet_pton+set}" = set; then
3276 echo $ECHO_N "(cached) $ECHO_C" >&6
3277 else
3278 cat >conftest.$ac_ext <<_ACEOF
3279 /* confdefs.h. */
3280 _ACEOF
3281 cat confdefs.h >>conftest.$ac_ext
3282 cat >>conftest.$ac_ext <<_ACEOF
3283 /* end confdefs.h. */
3284 /* Define inet_pton to an innocuous variant, in case <limits.h> declares inet_pton.
3285 For example, HP-UX 11i <limits.h> declares gettimeofday. */
3286 #define inet_pton innocuous_inet_pton
3287
3288 /* System header to define __stub macros and hopefully few prototypes,
3289 which can conflict with char inet_pton (); below.
3290 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
3291 <limits.h> exists even on freestanding compilers. */
3292
3293 #ifdef __STDC__
3294 # include <limits.h>
3295 #else
3296 # include <assert.h>
3297 #endif
3298
3299 #undef inet_pton
3300
3301 /* Override any gcc2 internal prototype to avoid an error. */
3302 #ifdef __cplusplus
3303 extern "C"
3304 {
3305 #endif
3306 /* We use char because int might match the return type of a gcc2
3307 builtin and then its argument prototype would still apply. */
3308 char inet_pton ();
3309 /* The GNU C library defines this for functions which it implements
3310 to always fail with ENOSYS. Some functions are actually named
3311 something starting with __ and the normal name is an alias. */
3312 #if defined (__stub_inet_pton) || defined (__stub___inet_pton)
3313 choke me
3314 #else
3315 char (*f) () = inet_pton;
3316 #endif
3317 #ifdef __cplusplus
3318 }
3319 #endif
3320
3321 int
3322 main ()
3323 {
3324 return f != inet_pton;
3325 ;
3326 return 0;
3327 }
3328 _ACEOF
3329 rm -f conftest.$ac_objext conftest$ac_exeext
3330 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
3331 (eval $ac_link) 2>conftest.er1
3332 ac_status=$?
3333 grep -v '^ *+' conftest.er1 >conftest.err
3334 rm -f conftest.er1
3335 cat conftest.err >&5
3336 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3337 (exit $ac_status); } &&
3338 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
3339 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3340 (eval $ac_try) 2>&5
3341 ac_status=$?
3342 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3343 (exit $ac_status); }; } &&
3344 { ac_try='test -s conftest$ac_exeext'
3345 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3346 (eval $ac_try) 2>&5
3347 ac_status=$?
3348 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3349 (exit $ac_status); }; }; then
3350 ac_cv_func_inet_pton=yes
3351 else
3352 echo "$as_me: failed program was:" >&5
3353 sed 's/^/| /' conftest.$ac_ext >&5
3354
3355 ac_cv_func_inet_pton=no
3356 fi
3357 rm -f conftest.err conftest.$ac_objext \
3358 conftest$ac_exeext conftest.$ac_ext
3359 fi
3360 echo "$as_me:$LINENO: result: $ac_cv_func_inet_pton" >&5
3361 echo "${ECHO_T}$ac_cv_func_inet_pton" >&6
3362 if test $ac_cv_func_inet_pton = yes; then
3363 cat >>confdefs.h <<\_ACEOF
3364 #define HAS_INET_PTON 1
3365 _ACEOF
3366
3367 fi
3368
3369 echo "$as_me:$LINENO: checking for inet_ntop" >&5
3370 echo $ECHO_N "checking for inet_ntop... $ECHO_C" >&6
3371 if test "${ac_cv_func_inet_ntop+set}" = set; then
3372 echo $ECHO_N "(cached) $ECHO_C" >&6
3373 else
3374 cat >conftest.$ac_ext <<_ACEOF
3375 /* confdefs.h. */
3376 _ACEOF
3377 cat confdefs.h >>conftest.$ac_ext
3378 cat >>conftest.$ac_ext <<_ACEOF
3379 /* end confdefs.h. */
3380 /* Define inet_ntop to an innocuous variant, in case <limits.h> declares inet_ntop.
3381 For example, HP-UX 11i <limits.h> declares gettimeofday. */
3382 #define inet_ntop innocuous_inet_ntop
3383
3384 /* System header to define __stub macros and hopefully few prototypes,
3385 which can conflict with char inet_ntop (); below.
3386 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
3387 <limits.h> exists even on freestanding compilers. */
3388
3389 #ifdef __STDC__
3390 # include <limits.h>
3391 #else
3392 # include <assert.h>
3393 #endif
3394
3395 #undef inet_ntop
3396
3397 /* Override any gcc2 internal prototype to avoid an error. */
3398 #ifdef __cplusplus
3399 extern "C"
3400 {
3401 #endif
3402 /* We use char because int might match the return type of a gcc2
3403 builtin and then its argument prototype would still apply. */
3404 char inet_ntop ();
3405 /* The GNU C library defines this for functions which it implements
3406 to always fail with ENOSYS. Some functions are actually named
3407 something starting with __ and the normal name is an alias. */
3408 #if defined (__stub_inet_ntop) || defined (__stub___inet_ntop)
3409 choke me
3410 #else
3411 char (*f) () = inet_ntop;
3412 #endif
3413 #ifdef __cplusplus
3414 }
3415 #endif
3416
3417 int
3418 main ()
3419 {
3420 return f != inet_ntop;
3421 ;
3422 return 0;
3423 }
3424 _ACEOF
3425 rm -f conftest.$ac_objext conftest$ac_exeext
3426 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
3427 (eval $ac_link) 2>conftest.er1
3428 ac_status=$?
3429 grep -v '^ *+' conftest.er1 >conftest.err
3430 rm -f conftest.er1
3431 cat conftest.err >&5
3432 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3433 (exit $ac_status); } &&
3434 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
3435 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3436 (eval $ac_try) 2>&5
3437 ac_status=$?
3438 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3439 (exit $ac_status); }; } &&
3440 { ac_try='test -s conftest$ac_exeext'
3441 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3442 (eval $ac_try) 2>&5
3443 ac_status=$?
3444 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3445 (exit $ac_status); }; }; then
3446 ac_cv_func_inet_ntop=yes
3447 else
3448 echo "$as_me: failed program was:" >&5
3449 sed 's/^/| /' conftest.$ac_ext >&5
3450
3451 ac_cv_func_inet_ntop=no
3452 fi
3453 rm -f conftest.err conftest.$ac_objext \
3454 conftest$ac_exeext conftest.$ac_ext
3455 fi
3456 echo "$as_me:$LINENO: result: $ac_cv_func_inet_ntop" >&5
3457 echo "${ECHO_T}$ac_cv_func_inet_ntop" >&6
3458 if test $ac_cv_func_inet_ntop = yes; then
3459 cat >>confdefs.h <<\_ACEOF
3460 #define HAS_INET_NTOP 1
3461 _ACEOF
3462
3463 fi
3464
3465
3466 echo "$as_me:$LINENO: checking for struct msghdr.msg_flags" >&5
3467 echo $ECHO_N "checking for struct msghdr.msg_flags... $ECHO_C" >&6
3468 if test "${ac_cv_member_struct_msghdr_msg_flags+set}" = set; then
3469 echo $ECHO_N "(cached) $ECHO_C" >&6
3470 else
3471 cat >conftest.$ac_ext <<_ACEOF
3472 /* confdefs.h. */
3473 _ACEOF
3474 cat confdefs.h >>conftest.$ac_ext
3475 cat >>conftest.$ac_ext <<_ACEOF
3476 /* end confdefs.h. */
3477 #include <sys/socket.h>
3478
3479 int
3480 main ()
3481 {
3482 static struct msghdr ac_aggr;
3483 if (ac_aggr.msg_flags)
3484 return 0;
3485 ;
3486 return 0;
3487 }
3488 _ACEOF
3489 rm -f conftest.$ac_objext
3490 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
3491 (eval $ac_compile) 2>conftest.er1
3492 ac_status=$?
3493 grep -v '^ *+' conftest.er1 >conftest.err
3494 rm -f conftest.er1
3495 cat conftest.err >&5
3496 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3497 (exit $ac_status); } &&
3498 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
3499 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3500 (eval $ac_try) 2>&5
3501 ac_status=$?
3502 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3503 (exit $ac_status); }; } &&
3504 { ac_try='test -s conftest.$ac_objext'
3505 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3506 (eval $ac_try) 2>&5
3507 ac_status=$?
3508 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3509 (exit $ac_status); }; }; then
3510 ac_cv_member_struct_msghdr_msg_flags=yes
3511 else
3512 echo "$as_me: failed program was:" >&5
3513 sed 's/^/| /' conftest.$ac_ext >&5
3514
3515 cat >conftest.$ac_ext <<_ACEOF
3516 /* confdefs.h. */
3517 _ACEOF
3518 cat confdefs.h >>conftest.$ac_ext
3519 cat >>conftest.$ac_ext <<_ACEOF
3520 /* end confdefs.h. */
3521 #include <sys/socket.h>
3522
3523 int
3524 main ()
3525 {
3526 static struct msghdr ac_aggr;
3527 if (sizeof ac_aggr.msg_flags)
3528 return 0;
3529 ;
3530 return 0;
3531 }
3532 _ACEOF
3533 rm -f conftest.$ac_objext
3534 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
3535 (eval $ac_compile) 2>conftest.er1
3536 ac_status=$?
3537 grep -v '^ *+' conftest.er1 >conftest.err
3538 rm -f conftest.er1
3539 cat conftest.err >&5
3540 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3541 (exit $ac_status); } &&
3542 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
3543 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3544 (eval $ac_try) 2>&5
3545 ac_status=$?
3546 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3547 (exit $ac_status); }; } &&
3548 { ac_try='test -s conftest.$ac_objext'
3549 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3550 (eval $ac_try) 2>&5
3551 ac_status=$?
3552 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3553 (exit $ac_status); }; }; then
3554 ac_cv_member_struct_msghdr_msg_flags=yes
3555 else
3556 echo "$as_me: failed program was:" >&5
3557 sed 's/^/| /' conftest.$ac_ext >&5
3558
3559 ac_cv_member_struct_msghdr_msg_flags=no
3560 fi
3561 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
3562 fi
3563 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
3564 fi
3565 echo "$as_me:$LINENO: result: $ac_cv_member_struct_msghdr_msg_flags" >&5
3566 echo "${ECHO_T}$ac_cv_member_struct_msghdr_msg_flags" >&6
3567 if test $ac_cv_member_struct_msghdr_msg_flags = yes; then
3568 cat >>confdefs.h <<\_ACEOF
3569 #define HAS_MSGHDR_FLAGS 1
3570 _ACEOF
3571
3572 fi
3573
3574
3575 echo "$as_me:$LINENO: checking for socklen_t" >&5
3576 echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6
3577 if test "${ac_cv_type_socklen_t+set}" = set; then
3578 echo $ECHO_N "(cached) $ECHO_C" >&6
3579 else
3580 cat >conftest.$ac_ext <<_ACEOF
3581 /* confdefs.h. */
3582 _ACEOF
3583 cat confdefs.h >>conftest.$ac_ext
3584 cat >>conftest.$ac_ext <<_ACEOF
3585 /* end confdefs.h. */
3586 #include <sys/types.h>
3587 #include <sys/socket.h>
3588
3589
3590 int
3591 main ()
3592 {
3593 if ((socklen_t *) 0)
3594 return 0;
3595 if (sizeof (socklen_t))
3596 return 0;
3597 ;
3598 return 0;
3599 }
3600 _ACEOF
3601 rm -f conftest.$ac_objext
3602 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
3603 (eval $ac_compile) 2>conftest.er1
3604 ac_status=$?
3605 grep -v '^ *+' conftest.er1 >conftest.err
3606 rm -f conftest.er1
3607 cat conftest.err >&5
3608 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3609 (exit $ac_status); } &&
3610 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
3611 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3612 (eval $ac_try) 2>&5
3613 ac_status=$?
3614 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3615 (exit $ac_status); }; } &&
3616 { ac_try='test -s conftest.$ac_objext'
3617 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3618 (eval $ac_try) 2>&5
3619 ac_status=$?
3620 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3621 (exit $ac_status); }; }; then
3622 ac_cv_type_socklen_t=yes
3623 else
3624 echo "$as_me: failed program was:" >&5
3625 sed 's/^/| /' conftest.$ac_ext >&5
3626
3627 ac_cv_type_socklen_t=no
3628 fi
3629 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
3630 fi
3631 echo "$as_me:$LINENO: result: $ac_cv_type_socklen_t" >&5
3632 echo "${ECHO_T}$ac_cv_type_socklen_t" >&6
3633 if test $ac_cv_type_socklen_t = yes; then
3634 cat >>confdefs.h <<\_ACEOF
3635 #define HAS_SOCKLEN_T 1
3636 _ACEOF
3637
3638 fi
3639
3640
3641 ac_ext=c
3642 ac_cpp='$CPP $CPPFLAGS'
3643 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
3644 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
3645 ac_compiler_gnu=$ac_cv_c_compiler_gnu
3646 echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
3647 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
3648 # On Suns, sometimes $CPP names a directory.
3649 if test -n "$CPP" && test -d "$CPP"; then
3650 CPP=
3651 fi
3652 if test -z "$CPP"; then
3653 if test "${ac_cv_prog_CPP+set}" = set; then
3654 echo $ECHO_N "(cached) $ECHO_C" >&6
3655 else
3656 # Double quotes because CPP needs to be expanded
3657 for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
3658 do
3659 ac_preproc_ok=false
3660 for ac_c_preproc_warn_flag in '' yes
3661 do
3662 # Use a header file that comes with gcc, so configuring glibc
3663 # with a fresh cross-compiler works.
3664 # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
3665 # <limits.h> exists even on freestanding compilers.
3666 # On the NeXT, cc -E runs the code through the compiler's parser,
3667 # not just through cpp. "Syntax error" is here to catch this case.
3668 cat >conftest.$ac_ext <<_ACEOF
3669 /* confdefs.h. */
3670 _ACEOF
3671 cat confdefs.h >>conftest.$ac_ext
3672 cat >>conftest.$ac_ext <<_ACEOF
3673 /* end confdefs.h. */
3674 #ifdef __STDC__
3675 # include <limits.h>
3676 #else
3677 # include <assert.h>
3678 #endif
3679 Syntax error
3680 _ACEOF
3681 if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
3682 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
3683 ac_status=$?
3684 grep -v '^ *+' conftest.er1 >conftest.err
3685 rm -f conftest.er1
3686 cat conftest.err >&5
3687 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3688 (exit $ac_status); } >/dev/null; then
3689 if test -s conftest.err; then
3690 ac_cpp_err=$ac_c_preproc_warn_flag
3691 ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
3692 else
3693 ac_cpp_err=
3694 fi
3695 else
3696 ac_cpp_err=yes
3697 fi
3698 if test -z "$ac_cpp_err"; then
3699 :
3700 else
3701 echo "$as_me: failed program was:" >&5
3702 sed 's/^/| /' conftest.$ac_ext >&5
3703
3704 # Broken: fails on valid input.
3705 continue
3706 fi
3707 rm -f conftest.err conftest.$ac_ext
3708
3709 # OK, works on sane cases. Now check whether non-existent headers
3710 # can be detected and how.
3711 cat >conftest.$ac_ext <<_ACEOF
3712 /* confdefs.h. */
3713 _ACEOF
3714 cat confdefs.h >>conftest.$ac_ext
3715 cat >>conftest.$ac_ext <<_ACEOF
3716 /* end confdefs.h. */
3717 #include <ac_nonexistent.h>
3718 _ACEOF
3719 if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
3720 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
3721 ac_status=$?
3722 grep -v '^ *+' conftest.er1 >conftest.err
3723 rm -f conftest.er1
3724 cat conftest.err >&5
3725 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3726 (exit $ac_status); } >/dev/null; then
3727 if test -s conftest.err; then
3728 ac_cpp_err=$ac_c_preproc_warn_flag
3729 ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
3730 else
3731 ac_cpp_err=
3732 fi
3733 else
3734 ac_cpp_err=yes
3735 fi
3736 if test -z "$ac_cpp_err"; then
3737 # Broken: success on invalid input.
3738 continue
3739 else
3740 echo "$as_me: failed program was:" >&5
3741 sed 's/^/| /' conftest.$ac_ext >&5
3742
3743 # Passes both tests.
3744 ac_preproc_ok=:
3745 break
3746 fi
3747 rm -f conftest.err conftest.$ac_ext
3748
3749 done
3750 # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
3751 rm -f conftest.err conftest.$ac_ext
3752 if $ac_preproc_ok; then
3753 break
3754 fi
3755
3756 done
3757 ac_cv_prog_CPP=$CPP
3758
3759 fi
3760 CPP=$ac_cv_prog_CPP
3761 else
3762 ac_cv_prog_CPP=$CPP
3763 fi
3764 echo "$as_me:$LINENO: result: $CPP" >&5
3765 echo "${ECHO_T}$CPP" >&6
3766 ac_preproc_ok=false
3767 for ac_c_preproc_warn_flag in '' yes
3768 do
3769 # Use a header file that comes with gcc, so configuring glibc
3770 # with a fresh cross-compiler works.
3771 # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
3772 # <limits.h> exists even on freestanding compilers.
3773 # On the NeXT, cc -E runs the code through the compiler's parser,
3774 # not just through cpp. "Syntax error" is here to catch this case.
3775 cat >conftest.$ac_ext <<_ACEOF
3776 /* confdefs.h. */
3777 _ACEOF
3778 cat confdefs.h >>conftest.$ac_ext
3779 cat >>conftest.$ac_ext <<_ACEOF
3780 /* end confdefs.h. */
3781 #ifdef __STDC__
3782 # include <limits.h>
3783 #else
3784 # include <assert.h>
3785 #endif
3786 Syntax error
3787 _ACEOF
3788 if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
3789 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
3790 ac_status=$?
3791 grep -v '^ *+' conftest.er1 >conftest.err
3792 rm -f conftest.er1
3793 cat conftest.err >&5
3794 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3795 (exit $ac_status); } >/dev/null; then
3796 if test -s conftest.err; then
3797 ac_cpp_err=$ac_c_preproc_warn_flag
3798 ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
3799 else
3800 ac_cpp_err=
3801 fi
3802 else
3803 ac_cpp_err=yes
3804 fi
3805 if test -z "$ac_cpp_err"; then
3806 :
3807 else
3808 echo "$as_me: failed program was:" >&5
3809 sed 's/^/| /' conftest.$ac_ext >&5
3810
3811 # Broken: fails on valid input.
3812 continue
3813 fi
3814 rm -f conftest.err conftest.$ac_ext
3815
3816 # OK, works on sane cases. Now check whether non-existent headers
3817 # can be detected and how.
3818 cat >conftest.$ac_ext <<_ACEOF
3819 /* confdefs.h. */
3820 _ACEOF
3821 cat confdefs.h >>conftest.$ac_ext
3822 cat >>conftest.$ac_ext <<_ACEOF
3823 /* end confdefs.h. */
3824 #include <ac_nonexistent.h>
3825 _ACEOF
3826 if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
3827 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
3828 ac_status=$?
3829 grep -v '^ *+' conftest.er1 >conftest.err
3830 rm -f conftest.er1
3831 cat conftest.err >&5
3832 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3833 (exit $ac_status); } >/dev/null; then
3834 if test -s conftest.err; then
3835 ac_cpp_err=$ac_c_preproc_warn_flag
3836 ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
3837 else
3838 ac_cpp_err=
3839 fi
3840 else
3841 ac_cpp_err=yes
3842 fi
3843 if test -z "$ac_cpp_err"; then
3844 # Broken: success on invalid input.
3845 continue
3846 else
3847 echo "$as_me: failed program was:" >&5
3848 sed 's/^/| /' conftest.$ac_ext >&5
3849
3850 # Passes both tests.
3851 ac_preproc_ok=:
3852 break
3853 fi
3854 rm -f conftest.err conftest.$ac_ext
3855
3856 done
3857 # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
3858 rm -f conftest.err conftest.$ac_ext
3859 if $ac_preproc_ok; then
3860 :
3861 else
3862 { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
3863 See \`config.log' for more details." >&5
3864 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
3865 See \`config.log' for more details." >&2;}
3866 { (exit 1); exit 1; }; }
3867 fi
3868
3869 ac_ext=c
3870 ac_cpp='$CPP $CPPFLAGS'
3871 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
3872 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
3873 ac_compiler_gnu=$ac_cv_c_compiler_gnu
3874
3875
3876 echo "$as_me:$LINENO: checking for egrep" >&5
3877 echo $ECHO_N "checking for egrep... $ECHO_C" >&6
3878 if test "${ac_cv_prog_egrep+set}" = set; then
3879 echo $ECHO_N "(cached) $ECHO_C" >&6
3880 else
3881 if echo a | (grep -E '(a|b)') >/dev/null 2>&1
3882 then ac_cv_prog_egrep='grep -E'
3883 else ac_cv_prog_egrep='egrep'
3884 fi
3885 fi
3886 echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
3887 echo "${ECHO_T}$ac_cv_prog_egrep" >&6
3888 EGREP=$ac_cv_prog_egrep
3889
3890
3891 cat >conftest.$ac_ext <<_ACEOF
3892 /* confdefs.h. */
3893 _ACEOF
3894 cat confdefs.h >>conftest.$ac_ext
3895 cat >>conftest.$ac_ext <<_ACEOF
3896 /* end confdefs.h. */
3897 #include </usr/include/sys/socket.h>
3898
3899 _ACEOF
3900 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
3901 $EGREP "MSG_MAXIOVLEN" >/dev/null 2>&1; then
3902 cat >>confdefs.h <<\_ACEOF
3903 #define ENET_BUFFER_MAXIMUM MSG_MAXIOVLEN
3904 _ACEOF
3905
3906 fi
3907 rm -f conftest*
3908
3909 cat >conftest.$ac_ext <<_ACEOF
3910 /* confdefs.h. */
3911 _ACEOF
3912 cat confdefs.h >>conftest.$ac_ext
3913 cat >>conftest.$ac_ext <<_ACEOF
3914 /* end confdefs.h. */
3915 #include <socket.h>
3916
3917 _ACEOF
3918 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
3919 $EGREP "MSG_MAXIOVLEN" >/dev/null 2>&1; then
3920 cat >>confdefs.h <<\_ACEOF
3921 #define ENET_BUFFER_MAXIMUM MSG_MAXIOVLEN
3922 _ACEOF
3923
3924 fi
3925 rm -f conftest*
3926
3927
3928 ac_config_files="$ac_config_files Makefile include/Makefile include/enet/Makefile"
3929 cat >confcache <<\_ACEOF
3930 # This file is a shell script that caches the results of configure
3931 # tests run on this system so they can be shared between configure
3932 # scripts and configure runs, see configure's option --config-cache.
3933 # It is not useful on other systems. If it contains results you don't
3934 # want to keep, you may remove or edit it.
3935 #
3936 # config.status only pays attention to the cache file if you give it
3937 # the --recheck option to rerun configure.
3938 #
3939 # `ac_cv_env_foo' variables (set or unset) will be overridden when
3940 # loading this file, other *unset* `ac_cv_foo' will be assigned the
3941 # following values.
3942
3943 _ACEOF
3944
3945 # The following way of writing the cache mishandles newlines in values,
3946 # but we know of no workaround that is simple, portable, and efficient.
3947 # So, don't put newlines in cache variables' values.
3948 # Ultrix sh set writes to stderr and can't be redirected directly,
3949 # and sets the high bit in the cache file unless we assign to the vars.
3950 {
3951 (set) 2>&1 |
3952 case `(ac_space=' '; set | grep ac_space) 2>&1` in
3953 *ac_space=\ *)
3954 # `set' does not quote correctly, so add quotes (double-quote
3955 # substitution turns \\\\ into \\, and sed turns \\ into \).
3956 sed -n \
3957 "s/'/'\\\\''/g;
3958 s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
3959 ;;
3960 *)
3961 # `set' quotes correctly as required by POSIX, so do not add quotes.
3962 sed -n \
3963 "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
3964 ;;
3965 esac;
3966 } |
3967 sed '
3968 t clear
3969 : clear
3970 s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
3971 t end
3972 /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
3973 : end' >>confcache
3974 if diff $cache_file confcache >/dev/null 2>&1; then :; else
3975 if test -w $cache_file; then
3976 test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
3977 cat confcache >$cache_file
3978 else
3979 echo "not updating unwritable cache $cache_file"
3980 fi
3981 fi
3982 rm -f confcache
3983
3984 test "x$prefix" = xNONE && prefix=$ac_default_prefix
3985 # Let make expand exec_prefix.
3986 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
3987
3988 # VPATH may cause trouble with some makes, so we remove $(srcdir),
3989 # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
3990 # trailing colons and then remove the whole line if VPATH becomes empty
3991 # (actually we leave an empty line to preserve line numbers).
3992 if test "x$srcdir" = x.; then
3993 ac_vpsub='/^[ ]*VPATH[ ]*=/{
3994 s/:*\$(srcdir):*/:/;
3995 s/:*\${srcdir}:*/:/;
3996 s/:*@srcdir@:*/:/;
3997 s/^\([^=]*=[ ]*\):*/\1/;
3998 s/:*$//;
3999 s/^[^=]*=[ ]*$//;
4000 }'
4001 fi
4002
4003 # Transform confdefs.h into DEFS.
4004 # Protect against shell expansion while executing Makefile rules.
4005 # Protect against Makefile macro expansion.
4006 #
4007 # If the first sed substitution is executed (which looks for macros that
4008 # take arguments), then we branch to the quote section. Otherwise,
4009 # look for a macro that doesn't take arguments.
4010 cat >confdef2opt.sed <<\_ACEOF
4011 t clear
4012 : clear
4013 s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g
4014 t quote
4015 s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g
4016 t quote
4017 d
4018 : quote
4019 s,[ `~#$^&*(){}\\|;'"<>?],\\&,g
4020 s,\[,\\&,g
4021 s,\],\\&,g
4022 s,\$,$$,g
4023 p
4024 _ACEOF
4025 # We use echo to avoid assuming a particular line-breaking character.
4026 # The extra dot is to prevent the shell from consuming trailing
4027 # line-breaks from the sub-command output. A line-break within
4028 # single-quotes doesn't work because, if this script is created in a
4029 # platform that uses two characters for line-breaks (e.g., DOS), tr
4030 # would break.
4031 ac_LF_and_DOT=`echo; echo .`
4032 DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'`
4033 rm -f confdef2opt.sed
4034
4035
4036 ac_libobjs=
4037 ac_ltlibobjs=
4038 for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
4039 # 1. Remove the extension, and $U if already installed.
4040 ac_i=`echo "$ac_i" |
4041 sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
4042 # 2. Add them.
4043 ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
4044 ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
4045 done
4046 LIBOBJS=$ac_libobjs
4047
4048 LTLIBOBJS=$ac_ltlibobjs
4049
4050
4051 if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
4052 { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
4053 Usually this means the macro was only invoked conditionally." >&5
4054 echo "$as_me: error: conditional \"AMDEP\" was never defined.
4055 Usually this means the macro was only invoked conditionally." >&2;}
4056 { (exit 1); exit 1; }; }
4057 fi
4058 if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
4059 { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
4060 Usually this means the macro was only invoked conditionally." >&5
4061 echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
4062 Usually this means the macro was only invoked conditionally." >&2;}
4063 { (exit 1); exit 1; }; }
4064 fi
4065
4066 : ${CONFIG_STATUS=./config.status}
4067 ac_clean_files_save=$ac_clean_files
4068 ac_clean_files="$ac_clean_files $CONFIG_STATUS"
4069 { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
4070 echo "$as_me: creating $CONFIG_STATUS" >&6;}
4071 cat >$CONFIG_STATUS <<_ACEOF
4072 #! $SHELL
4073 # Generated by $as_me.
4074 # Run this file to recreate the current configuration.
4075 # Compiler output produced by configure, useful for debugging
4076 # configure, is in config.log if it exists.
4077
4078 debug=false
4079 ac_cs_recheck=false
4080 ac_cs_silent=false
4081 SHELL=\${CONFIG_SHELL-$SHELL}
4082 _ACEOF
4083
4084 cat >>$CONFIG_STATUS <<\_ACEOF
4085 ## --------------------- ##
4086 ## M4sh Initialization. ##
4087 ## --------------------- ##
4088
4089 # Be Bourne compatible
4090 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
4091 emulate sh
4092 NULLCMD=:
4093 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
4094 # is contrary to our usage. Disable this feature.
4095 alias -g '${1+"$@"}'='"$@"'
4096 elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
4097 set -o posix
4098 fi
4099 DUALCASE=1; export DUALCASE # for MKS sh
4100
4101 # Support unset when possible.
4102 if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
4103 as_unset=unset
4104 else
4105 as_unset=false
4106 fi
4107
4108
4109 # Work around bugs in pre-3.0 UWIN ksh.
4110 $as_unset ENV MAIL MAILPATH
4111 PS1='$ '
4112 PS2='> '
4113 PS4='+ '
4114
4115 # NLS nuisances.
4116 for as_var in \
4117 LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
4118 LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
4119 LC_TELEPHONE LC_TIME
4120 do
4121 if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
4122 eval $as_var=C; export $as_var
4123 else
4124 $as_unset $as_var
4125 fi
4126 done
4127
4128 # Required to use basename.
4129 if expr a : '\(a\)' >/dev/null 2>&1; then
4130 as_expr=expr
4131 else
4132 as_expr=false
4133 fi
4134
4135 if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
4136 as_basename=basename
4137 else
4138 as_basename=false
4139 fi
4140
4141
4142 # Name of the executable.
4143 as_me=`$as_basename "$0" ||
4144 $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
4145 X"$0" : 'X\(//\)$' \| \
4146 X"$0" : 'X\(/\)$' \| \
4147 . : '\(.\)' 2>/dev/null ||
4148 echo X/"$0" |
4149 sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
4150 /^X\/\(\/\/\)$/{ s//\1/; q; }
4151 /^X\/\(\/\).*/{ s//\1/; q; }
4152 s/.*/./; q'`
4153
4154
4155 # PATH needs CR, and LINENO needs CR and PATH.
4156 # Avoid depending upon Character Ranges.
4157 as_cr_letters='abcdefghijklmnopqrstuvwxyz'
4158 as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
4159 as_cr_Letters=$as_cr_letters$as_cr_LETTERS
4160 as_cr_digits='0123456789'
4161 as_cr_alnum=$as_cr_Letters$as_cr_digits
4162
4163 # The user is always right.
4164 if test "${PATH_SEPARATOR+set}" != set; then
4165 echo "#! /bin/sh" >conf$$.sh
4166 echo "exit 0" >>conf$$.sh
4167 chmod +x conf$$.sh
4168 if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
4169 PATH_SEPARATOR=';'
4170 else
4171 PATH_SEPARATOR=:
4172 fi
4173 rm -f conf$$.sh
4174 fi
4175
4176
4177 as_lineno_1=$LINENO
4178 as_lineno_2=$LINENO
4179 as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
4180 test "x$as_lineno_1" != "x$as_lineno_2" &&
4181 test "x$as_lineno_3" = "x$as_lineno_2" || {
4182 # Find who we are. Look in the path if we contain no path at all
4183 # relative or not.
4184 case $0 in
4185 *[\\/]* ) as_myself=$0 ;;
4186 *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
4187 for as_dir in $PATH
4188 do
4189 IFS=$as_save_IFS
4190 test -z "$as_dir" && as_dir=.
4191 test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
4192 done
4193
4194 ;;
4195 esac
4196 # We did not find ourselves, most probably we were run as `sh COMMAND'
4197 # in which case we are not to be found in the path.
4198 if test "x$as_myself" = x; then
4199 as_myself=$0
4200 fi
4201 if test ! -f "$as_myself"; then
4202 { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
4203 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
4204 { (exit 1); exit 1; }; }
4205 fi
4206 case $CONFIG_SHELL in
4207 '')
4208 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
4209 for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
4210 do
4211 IFS=$as_save_IFS
4212 test -z "$as_dir" && as_dir=.
4213 for as_base in sh bash ksh sh5; do
4214 case $as_dir in
4215 /*)
4216 if ("$as_dir/$as_base" -c '
4217 as_lineno_1=$LINENO
4218 as_lineno_2=$LINENO
4219 as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
4220 test "x$as_lineno_1" != "x$as_lineno_2" &&
4221 test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
4222 $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
4223 $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
4224 CONFIG_SHELL=$as_dir/$as_base
4225 export CONFIG_SHELL
4226 exec "$CONFIG_SHELL" "$0" ${1+"$@"}
4227 fi;;
4228 esac
4229 done
4230 done
4231 ;;
4232 esac
4233
4234 # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
4235 # uniformly replaced by the line number. The first 'sed' inserts a
4236 # line-number line before each line; the second 'sed' does the real
4237 # work. The second script uses 'N' to pair each line-number line
4238 # with the numbered line, and appends trailing '-' during
4239 # substitution so that $LINENO is not a special case at line end.
4240 # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
4241 # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
4242 sed '=' <$as_myself |
4243 sed '
4244 N
4245 s,$,-,
4246 : loop
4247 s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
4248 t loop
4249 s,-$,,
4250 s,^['$as_cr_digits']*\n,,
4251 ' >$as_me.lineno &&
4252 chmod +x $as_me.lineno ||
4253 { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
4254 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
4255 { (exit 1); exit 1; }; }
4256
4257 # Don't try to exec as it changes $[0], causing all sort of problems
4258 # (the dirname of $[0] is not the place where we might find the
4259 # original and so on. Autoconf is especially sensible to this).
4260 . ./$as_me.lineno
4261 # Exit status is that of the last command.
4262 exit
4263 }
4264
4265
4266 case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
4267 *c*,-n*) ECHO_N= ECHO_C='
4268 ' ECHO_T=' ' ;;
4269 *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
4270 *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
4271 esac
4272
4273 if expr a : '\(a\)' >/dev/null 2>&1; then
4274 as_expr=expr
4275 else
4276 as_expr=false
4277 fi
4278
4279 rm -f conf$$ conf$$.exe conf$$.file
4280 echo >conf$$.file
4281 if ln -s conf$$.file conf$$ 2>/dev/null; then
4282 # We could just check for DJGPP; but this test a) works b) is more generic
4283 # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
4284 if test -f conf$$.exe; then
4285 # Don't use ln at all; we don't have any links
4286 as_ln_s='cp -p'
4287 else
4288 as_ln_s='ln -s'
4289 fi
4290 elif ln conf$$.file conf$$ 2>/dev/null; then
4291 as_ln_s=ln
4292 else
4293 as_ln_s='cp -p'
4294 fi
4295 rm -f conf$$ conf$$.exe conf$$.file
4296
4297 if mkdir -p . 2>/dev/null; then
4298 as_mkdir_p=:
4299 else
4300 test -d ./-p && rmdir ./-p
4301 as_mkdir_p=false
4302 fi
4303
4304 as_executable_p="test -f"
4305
4306 # Sed expression to map a string onto a valid CPP name.
4307 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
4308
4309 # Sed expression to map a string onto a valid variable name.
4310 as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
4311
4312
4313 # IFS
4314 # We need space, tab and new line, in precisely that order.
4315 as_nl='
4316 '
4317 IFS=" $as_nl"
4318
4319 # CDPATH.
4320 $as_unset CDPATH
4321
4322 exec 6>&1
4323
4324 # Open the log real soon, to keep \$[0] and so on meaningful, and to
4325 # report actual input values of CONFIG_FILES etc. instead of their
4326 # values after options handling. Logging --version etc. is OK.
4327 exec 5>>config.log
4328 {
4329 echo
4330 sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
4331 ## Running $as_me. ##
4332 _ASBOX
4333 } >&5
4334 cat >&5 <<_CSEOF
4335
4336 This file was extended by libenet $as_me 1.0, which was
4337 generated by GNU Autoconf 2.59. Invocation command line was
4338
4339 CONFIG_FILES = $CONFIG_FILES
4340 CONFIG_HEADERS = $CONFIG_HEADERS
4341 CONFIG_LINKS = $CONFIG_LINKS
4342 CONFIG_COMMANDS = $CONFIG_COMMANDS
4343 $ $0 $@
4344
4345 _CSEOF
4346 echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
4347 echo >&5
4348 _ACEOF
4349
4350 # Files that config.status was made for.
4351 if test -n "$ac_config_files"; then
4352 echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
4353 fi
4354
4355 if test -n "$ac_config_headers"; then
4356 echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
4357 fi
4358
4359 if test -n "$ac_config_links"; then
4360 echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
4361 fi
4362
4363 if test -n "$ac_config_commands"; then
4364 echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
4365 fi
4366
4367 cat >>$CONFIG_STATUS <<\_ACEOF
4368
4369 ac_cs_usage="\
4370 \`$as_me' instantiates files from templates according to the
4371 current configuration.
4372
4373 Usage: $0 [OPTIONS] [FILE]...
4374
4375 -h, --help print this help, then exit
4376 -V, --version print version number, then exit
4377 -q, --quiet do not print progress messages
4378 -d, --debug don't remove temporary files
4379 --recheck update $as_me by reconfiguring in the same conditions
4380 --file=FILE[:TEMPLATE]
4381 instantiate the configuration file FILE
4382
4383 Configuration files:
4384 $config_files
4385
4386 Configuration commands:
4387 $config_commands
4388
4389 Report bugs to <bug-autoconf@gnu.org>."
4390 _ACEOF
4391
4392 cat >>$CONFIG_STATUS <<_ACEOF
4393 ac_cs_version="\\
4394 libenet config.status 1.0
4395 configured by $0, generated by GNU Autoconf 2.59,
4396 with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
4397
4398 Copyright (C) 2003 Free Software Foundation, Inc.
4399 This config.status script is free software; the Free Software Foundation
4400 gives unlimited permission to copy, distribute and modify it."
4401 srcdir=$srcdir
4402 INSTALL="$INSTALL"
4403 _ACEOF
4404
4405 cat >>$CONFIG_STATUS <<\_ACEOF
4406 # If no file are specified by the user, then we need to provide default
4407 # value. By we need to know if files were specified by the user.
4408 ac_need_defaults=:
4409 while test $# != 0
4410 do
4411 case $1 in
4412 --*=*)
4413 ac_option=`expr "x$1" : 'x\([^=]*\)='`
4414 ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
4415 ac_shift=:
4416 ;;
4417 -*)
4418 ac_option=$1
4419 ac_optarg=$2
4420 ac_shift=shift
4421 ;;
4422 *) # This is not an option, so the user has probably given explicit
4423 # arguments.
4424 ac_option=$1
4425 ac_need_defaults=false;;
4426 esac
4427
4428 case $ac_option in
4429 # Handling of the options.
4430 _ACEOF
4431 cat >>$CONFIG_STATUS <<\_ACEOF
4432 -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
4433 ac_cs_recheck=: ;;
4434 --version | --vers* | -V )
4435 echo "$ac_cs_version"; exit 0 ;;
4436 --he | --h)
4437 # Conflict between --help and --header
4438 { { echo "$as_me:$LINENO: error: ambiguous option: $1
4439 Try \`$0 --help' for more information." >&5
4440 echo "$as_me: error: ambiguous option: $1
4441 Try \`$0 --help' for more information." >&2;}
4442 { (exit 1); exit 1; }; };;
4443 --help | --hel | -h )
4444 echo "$ac_cs_usage"; exit 0 ;;
4445 --debug | --d* | -d )
4446 debug=: ;;
4447 --file | --fil | --fi | --f )
4448 $ac_shift
4449 CONFIG_FILES="$CONFIG_FILES $ac_optarg"
4450 ac_need_defaults=false;;
4451 --header | --heade | --head | --hea )
4452 $ac_shift
4453 CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
4454 ac_need_defaults=false;;
4455 -q | -quiet | --quiet | --quie | --qui | --qu | --q \
4456 | -silent | --silent | --silen | --sile | --sil | --si | --s)
4457 ac_cs_silent=: ;;
4458
4459 # This is an error.
4460 -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
4461 Try \`$0 --help' for more information." >&5
4462 echo "$as_me: error: unrecognized option: $1
4463 Try \`$0 --help' for more information." >&2;}
4464 { (exit 1); exit 1; }; } ;;
4465
4466 *) ac_config_targets="$ac_config_targets $1" ;;
4467
4468 esac
4469 shift
4470 done
4471
4472 ac_configure_extra_args=
4473
4474 if $ac_cs_silent; then
4475 exec 6>/dev/null
4476 ac_configure_extra_args="$ac_configure_extra_args --silent"
4477 fi
4478
4479 _ACEOF
4480 cat >>$CONFIG_STATUS <<_ACEOF
4481 if \$ac_cs_recheck; then
4482 echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
4483 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
4484 fi
4485
4486 _ACEOF
4487
4488 cat >>$CONFIG_STATUS <<_ACEOF
4489 #
4490 # INIT-COMMANDS section.
4491 #
4492
4493 AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
4494
4495 _ACEOF
4496
4497
4498
4499 cat >>$CONFIG_STATUS <<\_ACEOF
4500 for ac_config_target in $ac_config_targets
4501 do
4502 case "$ac_config_target" in
4503 # Handling of arguments.
4504 "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
4505 "include/Makefile" ) CONFIG_FILES="$CONFIG_FILES include/Makefile" ;;
4506 "include/enet/Makefile" ) CONFIG_FILES="$CONFIG_FILES include/enet/Makefile" ;;
4507 "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
4508 *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
4509 echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
4510 { (exit 1); exit 1; }; };;
4511 esac
4512 done
4513
4514 # If the user did not use the arguments to specify the items to instantiate,
4515 # then the envvar interface is used. Set only those that are not.
4516 # We use the long form for the default assignment because of an extremely
4517 # bizarre bug on SunOS 4.1.3.
4518 if $ac_need_defaults; then
4519 test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
4520 test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
4521 fi
4522
4523 # Have a temporary directory for convenience. Make it in the build tree
4524 # simply because there is no reason to put it here, and in addition,
4525 # creating and moving files from /tmp can sometimes cause problems.
4526 # Create a temporary directory, and hook for its removal unless debugging.
4527 $debug ||
4528 {
4529 trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
4530 trap '{ (exit 1); exit 1; }' 1 2 13 15
4531 }
4532
4533 # Create a (secure) tmp directory for tmp files.
4534
4535 {
4536 tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
4537 test -n "$tmp" && test -d "$tmp"
4538 } ||
4539 {
4540 tmp=./confstat$$-$RANDOM
4541 (umask 077 && mkdir $tmp)
4542 } ||
4543 {
4544 echo "$me: cannot create a temporary directory in ." >&2
4545 { (exit 1); exit 1; }
4546 }
4547
4548 _ACEOF
4549
4550 cat >>$CONFIG_STATUS <<_ACEOF
4551
4552 #
4553 # CONFIG_FILES section.
4554 #
4555
4556 # No need to generate the scripts if there are no CONFIG_FILES.
4557 # This happens for instance when ./config.status config.h
4558 if test -n "\$CONFIG_FILES"; then
4559 # Protect against being on the right side of a sed subst in config.status.
4560 sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
4561 s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
4562 s,@SHELL@,$SHELL,;t t
4563 s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
4564 s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
4565 s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
4566 s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
4567 s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
4568 s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
4569 s,@exec_prefix@,$exec_prefix,;t t
4570 s,@prefix@,$prefix,;t t
4571 s,@program_transform_name@,$program_transform_name,;t t
4572 s,@bindir@,$bindir,;t t
4573 s,@sbindir@,$sbindir,;t t
4574 s,@libexecdir@,$libexecdir,;t t
4575 s,@datadir@,$datadir,;t t
4576 s,@sysconfdir@,$sysconfdir,;t t
4577 s,@sharedstatedir@,$sharedstatedir,;t t
4578 s,@localstatedir@,$localstatedir,;t t
4579 s,@libdir@,$libdir,;t t
4580 s,@includedir@,$includedir,;t t
4581 s,@oldincludedir@,$oldincludedir,;t t
4582 s,@infodir@,$infodir,;t t
4583 s,@mandir@,$mandir,;t t
4584 s,@build_alias@,$build_alias,;t t
4585 s,@host_alias@,$host_alias,;t t
4586 s,@target_alias@,$target_alias,;t t
4587 s,@DEFS@,$DEFS,;t t
4588 s,@ECHO_C@,$ECHO_C,;t t
4589 s,@ECHO_N@,$ECHO_N,;t t
4590 s,@ECHO_T@,$ECHO_T,;t t
4591 s,@LIBS@,$LIBS,;t t
4592 s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
4593 s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
4594 s,@INSTALL_DATA@,$INSTALL_DATA,;t t
4595 s,@CYGPATH_W@,$CYGPATH_W,;t t
4596 s,@PACKAGE@,$PACKAGE,;t t
4597 s,@VERSION@,$VERSION,;t t
4598 s,@ACLOCAL@,$ACLOCAL,;t t
4599 s,@AUTOCONF@,$AUTOCONF,;t t
4600 s,@AUTOMAKE@,$AUTOMAKE,;t t
4601 s,@AUTOHEADER@,$AUTOHEADER,;t t
4602 s,@MAKEINFO@,$MAKEINFO,;t t
4603 s,@install_sh@,$install_sh,;t t
4604 s,@STRIP@,$STRIP,;t t
4605 s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t
4606 s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t
4607 s,@mkdir_p@,$mkdir_p,;t t
4608 s,@AWK@,$AWK,;t t
4609 s,@SET_MAKE@,$SET_MAKE,;t t
4610 s,@am__leading_dot@,$am__leading_dot,;t t
4611 s,@AMTAR@,$AMTAR,;t t
4612 s,@am__tar@,$am__tar,;t t
4613 s,@am__untar@,$am__untar,;t t
4614 s,@CC@,$CC,;t t
4615 s,@CFLAGS@,$CFLAGS,;t t
4616 s,@LDFLAGS@,$LDFLAGS,;t t
4617 s,@CPPFLAGS@,$CPPFLAGS,;t t
4618 s,@ac_ct_CC@,$ac_ct_CC,;t t
4619 s,@EXEEXT@,$EXEEXT,;t t
4620 s,@OBJEXT@,$OBJEXT,;t t
4621 s,@DEPDIR@,$DEPDIR,;t t
4622 s,@am__include@,$am__include,;t t
4623 s,@am__quote@,$am__quote,;t t
4624 s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t
4625 s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t
4626 s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t
4627 s,@CCDEPMODE@,$CCDEPMODE,;t t
4628 s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t
4629 s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t
4630 s,@RANLIB@,$RANLIB,;t t
4631 s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
4632 s,@CPP@,$CPP,;t t
4633 s,@EGREP@,$EGREP,;t t
4634 s,@LIBOBJS@,$LIBOBJS,;t t
4635 s,@LTLIBOBJS@,$LTLIBOBJS,;t t
4636 CEOF
4637
4638 _ACEOF
4639
4640 cat >>$CONFIG_STATUS <<\_ACEOF
4641 # Split the substitutions into bite-sized pieces for seds with
4642 # small command number limits, like on Digital OSF/1 and HP-UX.
4643 ac_max_sed_lines=48
4644 ac_sed_frag=1 # Number of current file.
4645 ac_beg=1 # First line for current file.
4646 ac_end=$ac_max_sed_lines # Line after last line for current file.
4647 ac_more_lines=:
4648 ac_sed_cmds=
4649 while $ac_more_lines; do
4650 if test $ac_beg -gt 1; then
4651 sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
4652 else
4653 sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
4654 fi
4655 if test ! -s $tmp/subs.frag; then
4656 ac_more_lines=false
4657 else
4658 # The purpose of the label and of the branching condition is to
4659 # speed up the sed processing (if there are no `@' at all, there
4660 # is no need to browse any of the substitutions).
4661 # These are the two extra sed commands mentioned above.
4662 (echo ':t
4663 /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
4664 if test -z "$ac_sed_cmds"; then
4665 ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
4666 else
4667 ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
4668 fi
4669 ac_sed_frag=`expr $ac_sed_frag + 1`
4670 ac_beg=$ac_end
4671 ac_end=`expr $ac_end + $ac_max_sed_lines`
4672 fi
4673 done
4674 if test -z "$ac_sed_cmds"; then
4675 ac_sed_cmds=cat
4676 fi
4677 fi # test -n "$CONFIG_FILES"
4678
4679 _ACEOF
4680 cat >>$CONFIG_STATUS <<\_ACEOF
4681 for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
4682 # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
4683 case $ac_file in
4684 - | *:- | *:-:* ) # input from stdin
4685 cat >$tmp/stdin
4686 ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
4687 ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
4688 *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
4689 ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
4690 * ) ac_file_in=$ac_file.in ;;
4691 esac
4692
4693 # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
4694 ac_dir=`(dirname "$ac_file") 2>/dev/null ||
4695 $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
4696 X"$ac_file" : 'X\(//\)[^/]' \| \
4697 X"$ac_file" : 'X\(//\)$' \| \
4698 X"$ac_file" : 'X\(/\)' \| \
4699 . : '\(.\)' 2>/dev/null ||
4700 echo X"$ac_file" |
4701 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
4702 /^X\(\/\/\)[^/].*/{ s//\1/; q; }
4703 /^X\(\/\/\)$/{ s//\1/; q; }
4704 /^X\(\/\).*/{ s//\1/; q; }
4705 s/.*/./; q'`
4706 { if $as_mkdir_p; then
4707 mkdir -p "$ac_dir"
4708 else
4709 as_dir="$ac_dir"
4710 as_dirs=
4711 while test ! -d "$as_dir"; do
4712 as_dirs="$as_dir $as_dirs"
4713 as_dir=`(dirname "$as_dir") 2>/dev/null ||
4714 $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
4715 X"$as_dir" : 'X\(//\)[^/]' \| \
4716 X"$as_dir" : 'X\(//\)$' \| \
4717 X"$as_dir" : 'X\(/\)' \| \
4718 . : '\(.\)' 2>/dev/null ||
4719 echo X"$as_dir" |
4720 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
4721 /^X\(\/\/\)[^/].*/{ s//\1/; q; }
4722 /^X\(\/\/\)$/{ s//\1/; q; }
4723 /^X\(\/\).*/{ s//\1/; q; }
4724 s/.*/./; q'`
4725 done
4726 test ! -n "$as_dirs" || mkdir $as_dirs
4727 fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
4728 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
4729 { (exit 1); exit 1; }; }; }
4730
4731 ac_builddir=.
4732
4733 if test "$ac_dir" != .; then
4734 ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
4735 # A "../" for each directory in $ac_dir_suffix.
4736 ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
4737 else
4738 ac_dir_suffix= ac_top_builddir=
4739 fi
4740
4741 case $srcdir in
4742 .) # No --srcdir option. We are building in place.
4743 ac_srcdir=.
4744 if test -z "$ac_top_builddir"; then
4745 ac_top_srcdir=.
4746 else
4747 ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
4748 fi ;;
4749 [\\/]* | ?:[\\/]* ) # Absolute path.
4750 ac_srcdir=$srcdir$ac_dir_suffix;
4751 ac_top_srcdir=$srcdir ;;
4752 *) # Relative path.
4753 ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
4754 ac_top_srcdir=$ac_top_builddir$srcdir ;;
4755 esac
4756
4757 # Do not use `cd foo && pwd` to compute absolute paths, because
4758 # the directories may not exist.
4759 case `pwd` in
4760 .) ac_abs_builddir="$ac_dir";;
4761 *)
4762 case "$ac_dir" in
4763 .) ac_abs_builddir=`pwd`;;
4764 [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
4765 *) ac_abs_builddir=`pwd`/"$ac_dir";;
4766 esac;;
4767 esac
4768 case $ac_abs_builddir in
4769 .) ac_abs_top_builddir=${ac_top_builddir}.;;
4770 *)
4771 case ${ac_top_builddir}. in
4772 .) ac_abs_top_builddir=$ac_abs_builddir;;
4773 [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
4774 *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
4775 esac;;
4776 esac
4777 case $ac_abs_builddir in
4778 .) ac_abs_srcdir=$ac_srcdir;;
4779 *)
4780 case $ac_srcdir in
4781 .) ac_abs_srcdir=$ac_abs_builddir;;
4782 [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
4783 *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
4784 esac;;
4785 esac
4786 case $ac_abs_builddir in
4787 .) ac_abs_top_srcdir=$ac_top_srcdir;;
4788 *)
4789 case $ac_top_srcdir in
4790 .) ac_abs_top_srcdir=$ac_abs_builddir;;
4791 [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
4792 *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
4793 esac;;
4794 esac
4795
4796
4797 case $INSTALL in
4798 [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
4799 *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
4800 esac
4801
4802 # Let's still pretend it is `configure' which instantiates (i.e., don't
4803 # use $as_me), people would be surprised to read:
4804 # /* config.h. Generated by config.status. */
4805 if test x"$ac_file" = x-; then
4806 configure_input=
4807 else
4808 configure_input="$ac_file. "
4809 fi
4810 configure_input=$configure_input"Generated from `echo $ac_file_in |
4811 sed 's,.*/,,'` by configure."
4812
4813 # First look for the input files in the build tree, otherwise in the
4814 # src tree.
4815 ac_file_inputs=`IFS=:
4816 for f in $ac_file_in; do
4817 case $f in
4818 -) echo $tmp/stdin ;;
4819 [\\/$]*)
4820 # Absolute (can't be DOS-style, as IFS=:)
4821 test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
4822 echo "$as_me: error: cannot find input file: $f" >&2;}
4823 { (exit 1); exit 1; }; }
4824 echo "$f";;
4825 *) # Relative
4826 if test -f "$f"; then
4827 # Build tree
4828 echo "$f"
4829 elif test -f "$srcdir/$f"; then
4830 # Source tree
4831 echo "$srcdir/$f"
4832 else
4833 # /dev/null tree
4834 { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
4835 echo "$as_me: error: cannot find input file: $f" >&2;}
4836 { (exit 1); exit 1; }; }
4837 fi;;
4838 esac
4839 done` || { (exit 1); exit 1; }
4840
4841 if test x"$ac_file" != x-; then
4842 { echo "$as_me:$LINENO: creating $ac_file" >&5
4843 echo "$as_me: creating $ac_file" >&6;}
4844 rm -f "$ac_file"
4845 fi
4846 _ACEOF
4847 cat >>$CONFIG_STATUS <<_ACEOF
4848 sed "$ac_vpsub
4849 $extrasub
4850 _ACEOF
4851 cat >>$CONFIG_STATUS <<\_ACEOF
4852 :t
4853 /@[a-zA-Z_][a-zA-Z_0-9]*@/!b
4854 s,@configure_input@,$configure_input,;t t
4855 s,@srcdir@,$ac_srcdir,;t t
4856 s,@abs_srcdir@,$ac_abs_srcdir,;t t
4857 s,@top_srcdir@,$ac_top_srcdir,;t t
4858 s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
4859 s,@builddir@,$ac_builddir,;t t
4860 s,@abs_builddir@,$ac_abs_builddir,;t t
4861 s,@top_builddir@,$ac_top_builddir,;t t
4862 s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
4863 s,@INSTALL@,$ac_INSTALL,;t t
4864 " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
4865 rm -f $tmp/stdin
4866 if test x"$ac_file" != x-; then
4867 mv $tmp/out $ac_file
4868 else
4869 cat $tmp/out
4870 rm -f $tmp/out
4871 fi
4872
4873 done
4874 _ACEOF
4875 cat >>$CONFIG_STATUS <<\_ACEOF
4876
4877 #
4878 # CONFIG_COMMANDS section.
4879 #
4880 for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
4881 ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
4882 ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
4883 ac_dir=`(dirname "$ac_dest") 2>/dev/null ||
4884 $as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
4885 X"$ac_dest" : 'X\(//\)[^/]' \| \
4886 X"$ac_dest" : 'X\(//\)$' \| \
4887 X"$ac_dest" : 'X\(/\)' \| \
4888 . : '\(.\)' 2>/dev/null ||
4889 echo X"$ac_dest" |
4890 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
4891 /^X\(\/\/\)[^/].*/{ s//\1/; q; }
4892 /^X\(\/\/\)$/{ s//\1/; q; }
4893 /^X\(\/\).*/{ s//\1/; q; }
4894 s/.*/./; q'`
4895 { if $as_mkdir_p; then
4896 mkdir -p "$ac_dir"
4897 else
4898 as_dir="$ac_dir"
4899 as_dirs=
4900 while test ! -d "$as_dir"; do
4901 as_dirs="$as_dir $as_dirs"
4902 as_dir=`(dirname "$as_dir") 2>/dev/null ||
4903 $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
4904 X"$as_dir" : 'X\(//\)[^/]' \| \
4905 X"$as_dir" : 'X\(//\)$' \| \
4906 X"$as_dir" : 'X\(/\)' \| \
4907 . : '\(.\)' 2>/dev/null ||
4908 echo X"$as_dir" |
4909 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
4910 /^X\(\/\/\)[^/].*/{ s//\1/; q; }
4911 /^X\(\/\/\)$/{ s//\1/; q; }
4912 /^X\(\/\).*/{ s//\1/; q; }
4913 s/.*/./; q'`
4914 done
4915 test ! -n "$as_dirs" || mkdir $as_dirs
4916 fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
4917 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
4918 { (exit 1); exit 1; }; }; }
4919
4920 ac_builddir=.
4921
4922 if test "$ac_dir" != .; then
4923 ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
4924 # A "../" for each directory in $ac_dir_suffix.
4925 ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
4926 else
4927 ac_dir_suffix= ac_top_builddir=
4928 fi
4929
4930 case $srcdir in
4931 .) # No --srcdir option. We are building in place.
4932 ac_srcdir=.
4933 if test -z "$ac_top_builddir"; then
4934 ac_top_srcdir=.
4935 else
4936 ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
4937 fi ;;
4938 [\\/]* | ?:[\\/]* ) # Absolute path.
4939 ac_srcdir=$srcdir$ac_dir_suffix;
4940 ac_top_srcdir=$srcdir ;;
4941 *) # Relative path.
4942 ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
4943 ac_top_srcdir=$ac_top_builddir$srcdir ;;
4944 esac
4945
4946 # Do not use `cd foo && pwd` to compute absolute paths, because
4947 # the directories may not exist.
4948 case `pwd` in
4949 .) ac_abs_builddir="$ac_dir";;
4950 *)
4951 case "$ac_dir" in
4952 .) ac_abs_builddir=`pwd`;;
4953 [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
4954 *) ac_abs_builddir=`pwd`/"$ac_dir";;
4955 esac;;
4956 esac
4957 case $ac_abs_builddir in
4958 .) ac_abs_top_builddir=${ac_top_builddir}.;;
4959 *)
4960 case ${ac_top_builddir}. in
4961 .) ac_abs_top_builddir=$ac_abs_builddir;;
4962 [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
4963 *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
4964 esac;;
4965 esac
4966 case $ac_abs_builddir in
4967 .) ac_abs_srcdir=$ac_srcdir;;
4968 *)
4969 case $ac_srcdir in
4970 .) ac_abs_srcdir=$ac_abs_builddir;;
4971 [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
4972 *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
4973 esac;;
4974 esac
4975 case $ac_abs_builddir in
4976 .) ac_abs_top_srcdir=$ac_top_srcdir;;
4977 *)
4978 case $ac_top_srcdir in
4979 .) ac_abs_top_srcdir=$ac_abs_builddir;;
4980 [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
4981 *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
4982 esac;;
4983 esac
4984
4985
4986 { echo "$as_me:$LINENO: executing $ac_dest commands" >&5
4987 echo "$as_me: executing $ac_dest commands" >&6;}
4988 case $ac_dest in
4989 depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do
4990 # Strip MF so we end up with the name of the file.
4991 mf=`echo "$mf" | sed -e 's/:.*$//'`
4992 # Check whether this is an Automake generated Makefile or not.
4993 # We used to match only the files named `Makefile.in', but
4994 # some people rename them; so instead we look at the file content.
4995 # Grep'ing the first line is not enough: some people post-process
4996 # each Makefile.in and add a new line on top of each file to say so.
4997 # So let's grep whole file.
4998 if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
4999 dirpart=`(dirname "$mf") 2>/dev/null ||
5000 $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
5001 X"$mf" : 'X\(//\)[^/]' \| \
5002 X"$mf" : 'X\(//\)$' \| \
5003 X"$mf" : 'X\(/\)' \| \
5004 . : '\(.\)' 2>/dev/null ||
5005 echo X"$mf" |
5006 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
5007 /^X\(\/\/\)[^/].*/{ s//\1/; q; }
5008 /^X\(\/\/\)$/{ s//\1/; q; }
5009 /^X\(\/\).*/{ s//\1/; q; }
5010 s/.*/./; q'`
5011 else
5012 continue
5013 fi
5014 # Extract the definition of DEPDIR, am__include, and am__quote
5015 # from the Makefile without running `make'.
5016 DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
5017 test -z "$DEPDIR" && continue
5018 am__include=`sed -n 's/^am__include = //p' < "$mf"`
5019 test -z "am__include" && continue
5020 am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
5021 # When using ansi2knr, U may be empty or an underscore; expand it
5022 U=`sed -n 's/^U = //p' < "$mf"`
5023 # Find all dependency output files, they are included files with
5024 # $(DEPDIR) in their names. We invoke sed twice because it is the
5025 # simplest approach to changing $(DEPDIR) to its actual value in the
5026 # expansion.
5027 for file in `sed -n "
5028 s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
5029 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
5030 # Make sure the directory exists.
5031 test -f "$dirpart/$file" && continue
5032 fdir=`(dirname "$file") 2>/dev/null ||
5033 $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
5034 X"$file" : 'X\(//\)[^/]' \| \
5035 X"$file" : 'X\(//\)$' \| \
5036 X"$file" : 'X\(/\)' \| \
5037 . : '\(.\)' 2>/dev/null ||
5038 echo X"$file" |
5039 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
5040 /^X\(\/\/\)[^/].*/{ s//\1/; q; }
5041 /^X\(\/\/\)$/{ s//\1/; q; }
5042 /^X\(\/\).*/{ s//\1/; q; }
5043 s/.*/./; q'`
5044 { if $as_mkdir_p; then
5045 mkdir -p $dirpart/$fdir
5046 else
5047 as_dir=$dirpart/$fdir
5048 as_dirs=
5049 while test ! -d "$as_dir"; do
5050 as_dirs="$as_dir $as_dirs"
5051 as_dir=`(dirname "$as_dir") 2>/dev/null ||
5052 $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
5053 X"$as_dir" : 'X\(//\)[^/]' \| \
5054 X"$as_dir" : 'X\(//\)$' \| \
5055 X"$as_dir" : 'X\(/\)' \| \
5056 . : '\(.\)' 2>/dev/null ||
5057 echo X"$as_dir" |
5058 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
5059 /^X\(\/\/\)[^/].*/{ s//\1/; q; }
5060 /^X\(\/\/\)$/{ s//\1/; q; }
5061 /^X\(\/\).*/{ s//\1/; q; }
5062 s/.*/./; q'`
5063 done
5064 test ! -n "$as_dirs" || mkdir $as_dirs
5065 fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5
5066 echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;}
5067 { (exit 1); exit 1; }; }; }
5068
5069 # echo "creating $dirpart/$file"
5070 echo '# dummy' > "$dirpart/$file"
5071 done
5072 done
5073 ;;
5074 esac
5075 done
5076 _ACEOF
5077
5078 cat >>$CONFIG_STATUS <<\_ACEOF
5079
5080 { (exit 0); exit 0; }
5081 _ACEOF
5082 chmod +x $CONFIG_STATUS
5083 ac_clean_files=$ac_clean_files_save
5084
5085
5086 # configure is writing to config.log, and then calls config.status.
5087 # config.status does its own redirection, appending to config.log.
5088 # Unfortunately, on DOS this fails, as config.log is still kept open
5089 # by configure, so config.status won't be able to write to it; its
5090 # output is simply discarded. So we exec the FD to /dev/null,
5091 # effectively closing config.log, so it can be properly (re)opened and
5092 # appended to by config.status. When coming back to configure, we
5093 # need to make the FD available again.
5094 if test "$no_create" != yes; then
5095 ac_cs_success=:
5096 ac_config_status_args=
5097 test "$silent" = yes &&
5098 ac_config_status_args="$ac_config_status_args --quiet"
5099 exec 5>/dev/null
5100 $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
5101 exec 5>>config.log
5102 # Use ||, not &&, to avoid exiting from the if with $? = 1, which
5103 # would make configure fail if this is the last instruction.
5104 $ac_cs_success || { (exit 1); exit 1; }
5105 fi
5106
0 AC_INIT(libenet, 1.0)
1 AM_INIT_AUTOMAKE(libenet.a, 1.0)
2
3 AC_PROG_CC
4 AC_PROG_RANLIB
5
6 AC_CHECK_FUNC(gethostbyaddr_r, [AC_DEFINE(HAS_GETHOSTBYADDR_R)])
7 AC_CHECK_FUNC(gethostbyname_r, [AC_DEFINE(HAS_GETHOSTBYNAME_R)])
8 AC_CHECK_FUNC(poll, [AC_DEFINE(HAS_POLL)])
9 AC_CHECK_FUNC(fcntl, [AC_DEFINE(HAS_FCNTL)])
10 AC_CHECK_FUNC(inet_pton, [AC_DEFINE(HAS_INET_PTON)])
11 AC_CHECK_FUNC(inet_ntop, [AC_DEFINE(HAS_INET_NTOP)])
12
13 AC_CHECK_MEMBER(struct msghdr.msg_flags, [AC_DEFINE(HAS_MSGHDR_FLAGS)], , [#include <sys/socket.h>])
14
15 AC_CHECK_TYPE(socklen_t, [AC_DEFINE(HAS_SOCKLEN_T)], ,
16 #include <sys/types.h>
17 #include <sys/socket.h>
18 )
19
20 AC_EGREP_HEADER(MSG_MAXIOVLEN, /usr/include/sys/socket.h, AC_DEFINE(ENET_BUFFER_MAXIMUM, [MSG_MAXIOVLEN]))
21 AC_EGREP_HEADER(MSG_MAXIOVLEN, socket.h, AC_DEFINE(ENET_BUFFER_MAXIMUM, [MSG_MAXIOVLEN]))
22
23 AC_OUTPUT([Makefile include/Makefile include/enet/Makefile])
0 #! /bin/sh
1 # depcomp - compile a program generating dependencies as side-effects
2
3 scriptversion=2004-05-31.23
4
5 # Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
6
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2, or (at your option)
10 # any later version.
11
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
16
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20 # 02111-1307, USA.
21
22 # As a special exception to the GNU General Public License, if you
23 # distribute this file as part of a program that contains a
24 # configuration script generated by Autoconf, you may include it under
25 # the same distribution terms that you use for the rest of that program.
26
27 # Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
28
29 case $1 in
30 '')
31 echo "$0: No command. Try \`$0 --help' for more information." 1>&2
32 exit 1;
33 ;;
34 -h | --h*)
35 cat <<\EOF
36 Usage: depcomp [--help] [--version] PROGRAM [ARGS]
37
38 Run PROGRAMS ARGS to compile a file, generating dependencies
39 as side-effects.
40
41 Environment variables:
42 depmode Dependency tracking mode.
43 source Source file read by `PROGRAMS ARGS'.
44 object Object file output by `PROGRAMS ARGS'.
45 DEPDIR directory where to store dependencies.
46 depfile Dependency file to output.
47 tmpdepfile Temporary file to use when outputing dependencies.
48 libtool Whether libtool is used (yes/no).
49
50 Report bugs to <bug-automake@gnu.org>.
51 EOF
52 exit 0
53 ;;
54 -v | --v*)
55 echo "depcomp $scriptversion"
56 exit 0
57 ;;
58 esac
59
60 if test -z "$depmode" || test -z "$source" || test -z "$object"; then
61 echo "depcomp: Variables source, object and depmode must be set" 1>&2
62 exit 1
63 fi
64
65 # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
66 depfile=${depfile-`echo "$object" |
67 sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
68 tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
69
70 rm -f "$tmpdepfile"
71
72 # Some modes work just like other modes, but use different flags. We
73 # parameterize here, but still list the modes in the big case below,
74 # to make depend.m4 easier to write. Note that we *cannot* use a case
75 # here, because this file can only contain one case statement.
76 if test "$depmode" = hp; then
77 # HP compiler uses -M and no extra arg.
78 gccflag=-M
79 depmode=gcc
80 fi
81
82 if test "$depmode" = dashXmstdout; then
83 # This is just like dashmstdout with a different argument.
84 dashmflag=-xM
85 depmode=dashmstdout
86 fi
87
88 case "$depmode" in
89 gcc3)
90 ## gcc 3 implements dependency tracking that does exactly what
91 ## we want. Yay! Note: for some reason libtool 1.4 doesn't like
92 ## it if -MD -MP comes after the -MF stuff. Hmm.
93 "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
94 stat=$?
95 if test $stat -eq 0; then :
96 else
97 rm -f "$tmpdepfile"
98 exit $stat
99 fi
100 mv "$tmpdepfile" "$depfile"
101 ;;
102
103 gcc)
104 ## There are various ways to get dependency output from gcc. Here's
105 ## why we pick this rather obscure method:
106 ## - Don't want to use -MD because we'd like the dependencies to end
107 ## up in a subdir. Having to rename by hand is ugly.
108 ## (We might end up doing this anyway to support other compilers.)
109 ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
110 ## -MM, not -M (despite what the docs say).
111 ## - Using -M directly means running the compiler twice (even worse
112 ## than renaming).
113 if test -z "$gccflag"; then
114 gccflag=-MD,
115 fi
116 "$@" -Wp,"$gccflag$tmpdepfile"
117 stat=$?
118 if test $stat -eq 0; then :
119 else
120 rm -f "$tmpdepfile"
121 exit $stat
122 fi
123 rm -f "$depfile"
124 echo "$object : \\" > "$depfile"
125 alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
126 ## The second -e expression handles DOS-style file names with drive letters.
127 sed -e 's/^[^:]*: / /' \
128 -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
129 ## This next piece of magic avoids the `deleted header file' problem.
130 ## The problem is that when a header file which appears in a .P file
131 ## is deleted, the dependency causes make to die (because there is
132 ## typically no way to rebuild the header). We avoid this by adding
133 ## dummy dependencies for each header file. Too bad gcc doesn't do
134 ## this for us directly.
135 tr ' ' '
136 ' < "$tmpdepfile" |
137 ## Some versions of gcc put a space before the `:'. On the theory
138 ## that the space means something, we add a space to the output as
139 ## well.
140 ## Some versions of the HPUX 10.20 sed can't process this invocation
141 ## correctly. Breaking it into two sed invocations is a workaround.
142 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
143 rm -f "$tmpdepfile"
144 ;;
145
146 hp)
147 # This case exists only to let depend.m4 do its work. It works by
148 # looking at the text of this script. This case will never be run,
149 # since it is checked for above.
150 exit 1
151 ;;
152
153 sgi)
154 if test "$libtool" = yes; then
155 "$@" "-Wp,-MDupdate,$tmpdepfile"
156 else
157 "$@" -MDupdate "$tmpdepfile"
158 fi
159 stat=$?
160 if test $stat -eq 0; then :
161 else
162 rm -f "$tmpdepfile"
163 exit $stat
164 fi
165 rm -f "$depfile"
166
167 if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
168 echo "$object : \\" > "$depfile"
169
170 # Clip off the initial element (the dependent). Don't try to be
171 # clever and replace this with sed code, as IRIX sed won't handle
172 # lines with more than a fixed number of characters (4096 in
173 # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
174 # the IRIX cc adds comments like `#:fec' to the end of the
175 # dependency line.
176 tr ' ' '
177 ' < "$tmpdepfile" \
178 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
179 tr '
180 ' ' ' >> $depfile
181 echo >> $depfile
182
183 # The second pass generates a dummy entry for each header file.
184 tr ' ' '
185 ' < "$tmpdepfile" \
186 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
187 >> $depfile
188 else
189 # The sourcefile does not contain any dependencies, so just
190 # store a dummy comment line, to avoid errors with the Makefile
191 # "include basename.Plo" scheme.
192 echo "#dummy" > "$depfile"
193 fi
194 rm -f "$tmpdepfile"
195 ;;
196
197 aix)
198 # The C for AIX Compiler uses -M and outputs the dependencies
199 # in a .u file. In older versions, this file always lives in the
200 # current directory. Also, the AIX compiler puts `$object:' at the
201 # start of each line; $object doesn't have directory information.
202 # Version 6 uses the directory in both cases.
203 stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
204 tmpdepfile="$stripped.u"
205 if test "$libtool" = yes; then
206 "$@" -Wc,-M
207 else
208 "$@" -M
209 fi
210 stat=$?
211
212 if test -f "$tmpdepfile"; then :
213 else
214 stripped=`echo "$stripped" | sed 's,^.*/,,'`
215 tmpdepfile="$stripped.u"
216 fi
217
218 if test $stat -eq 0; then :
219 else
220 rm -f "$tmpdepfile"
221 exit $stat
222 fi
223
224 if test -f "$tmpdepfile"; then
225 outname="$stripped.o"
226 # Each line is of the form `foo.o: dependent.h'.
227 # Do two passes, one to just change these to
228 # `$object: dependent.h' and one to simply `dependent.h:'.
229 sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
230 sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
231 else
232 # The sourcefile does not contain any dependencies, so just
233 # store a dummy comment line, to avoid errors with the Makefile
234 # "include basename.Plo" scheme.
235 echo "#dummy" > "$depfile"
236 fi
237 rm -f "$tmpdepfile"
238 ;;
239
240 icc)
241 # Intel's C compiler understands `-MD -MF file'. However on
242 # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
243 # ICC 7.0 will fill foo.d with something like
244 # foo.o: sub/foo.c
245 # foo.o: sub/foo.h
246 # which is wrong. We want:
247 # sub/foo.o: sub/foo.c
248 # sub/foo.o: sub/foo.h
249 # sub/foo.c:
250 # sub/foo.h:
251 # ICC 7.1 will output
252 # foo.o: sub/foo.c sub/foo.h
253 # and will wrap long lines using \ :
254 # foo.o: sub/foo.c ... \
255 # sub/foo.h ... \
256 # ...
257
258 "$@" -MD -MF "$tmpdepfile"
259 stat=$?
260 if test $stat -eq 0; then :
261 else
262 rm -f "$tmpdepfile"
263 exit $stat
264 fi
265 rm -f "$depfile"
266 # Each line is of the form `foo.o: dependent.h',
267 # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
268 # Do two passes, one to just change these to
269 # `$object: dependent.h' and one to simply `dependent.h:'.
270 sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
271 # Some versions of the HPUX 10.20 sed can't process this invocation
272 # correctly. Breaking it into two sed invocations is a workaround.
273 sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
274 sed -e 's/$/ :/' >> "$depfile"
275 rm -f "$tmpdepfile"
276 ;;
277
278 tru64)
279 # The Tru64 compiler uses -MD to generate dependencies as a side
280 # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
281 # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
282 # dependencies in `foo.d' instead, so we check for that too.
283 # Subdirectories are respected.
284 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
285 test "x$dir" = "x$object" && dir=
286 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
287
288 if test "$libtool" = yes; then
289 # Dependencies are output in .lo.d with libtool 1.4.
290 # With libtool 1.5 they are output both in $dir.libs/$base.o.d
291 # and in $dir.libs/$base.o.d and $dir$base.o.d. We process the
292 # latter, because the former will be cleaned when $dir.libs is
293 # erased.
294 tmpdepfile1="$dir.libs/$base.lo.d"
295 tmpdepfile2="$dir$base.o.d"
296 tmpdepfile3="$dir.libs/$base.d"
297 "$@" -Wc,-MD
298 else
299 tmpdepfile1="$dir$base.o.d"
300 tmpdepfile2="$dir$base.d"
301 tmpdepfile3="$dir$base.d"
302 "$@" -MD
303 fi
304
305 stat=$?
306 if test $stat -eq 0; then :
307 else
308 rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
309 exit $stat
310 fi
311
312 if test -f "$tmpdepfile1"; then
313 tmpdepfile="$tmpdepfile1"
314 elif test -f "$tmpdepfile2"; then
315 tmpdepfile="$tmpdepfile2"
316 else
317 tmpdepfile="$tmpdepfile3"
318 fi
319 if test -f "$tmpdepfile"; then
320 sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
321 # That's a tab and a space in the [].
322 sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
323 else
324 echo "#dummy" > "$depfile"
325 fi
326 rm -f "$tmpdepfile"
327 ;;
328
329 #nosideeffect)
330 # This comment above is used by automake to tell side-effect
331 # dependency tracking mechanisms from slower ones.
332
333 dashmstdout)
334 # Important note: in order to support this mode, a compiler *must*
335 # always write the preprocessed file to stdout, regardless of -o.
336 "$@" || exit $?
337
338 # Remove the call to Libtool.
339 if test "$libtool" = yes; then
340 while test $1 != '--mode=compile'; do
341 shift
342 done
343 shift
344 fi
345
346 # Remove `-o $object'.
347 IFS=" "
348 for arg
349 do
350 case $arg in
351 -o)
352 shift
353 ;;
354 $object)
355 shift
356 ;;
357 *)
358 set fnord "$@" "$arg"
359 shift # fnord
360 shift # $arg
361 ;;
362 esac
363 done
364
365 test -z "$dashmflag" && dashmflag=-M
366 # Require at least two characters before searching for `:'
367 # in the target name. This is to cope with DOS-style filenames:
368 # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
369 "$@" $dashmflag |
370 sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
371 rm -f "$depfile"
372 cat < "$tmpdepfile" > "$depfile"
373 tr ' ' '
374 ' < "$tmpdepfile" | \
375 ## Some versions of the HPUX 10.20 sed can't process this invocation
376 ## correctly. Breaking it into two sed invocations is a workaround.
377 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
378 rm -f "$tmpdepfile"
379 ;;
380
381 dashXmstdout)
382 # This case only exists to satisfy depend.m4. It is never actually
383 # run, as this mode is specially recognized in the preamble.
384 exit 1
385 ;;
386
387 makedepend)
388 "$@" || exit $?
389 # Remove any Libtool call
390 if test "$libtool" = yes; then
391 while test $1 != '--mode=compile'; do
392 shift
393 done
394 shift
395 fi
396 # X makedepend
397 shift
398 cleared=no
399 for arg in "$@"; do
400 case $cleared in
401 no)
402 set ""; shift
403 cleared=yes ;;
404 esac
405 case "$arg" in
406 -D*|-I*)
407 set fnord "$@" "$arg"; shift ;;
408 # Strip any option that makedepend may not understand. Remove
409 # the object too, otherwise makedepend will parse it as a source file.
410 -*|$object)
411 ;;
412 *)
413 set fnord "$@" "$arg"; shift ;;
414 esac
415 done
416 obj_suffix="`echo $object | sed 's/^.*\././'`"
417 touch "$tmpdepfile"
418 ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
419 rm -f "$depfile"
420 cat < "$tmpdepfile" > "$depfile"
421 sed '1,2d' "$tmpdepfile" | tr ' ' '
422 ' | \
423 ## Some versions of the HPUX 10.20 sed can't process this invocation
424 ## correctly. Breaking it into two sed invocations is a workaround.
425 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
426 rm -f "$tmpdepfile" "$tmpdepfile".bak
427 ;;
428
429 cpp)
430 # Important note: in order to support this mode, a compiler *must*
431 # always write the preprocessed file to stdout.
432 "$@" || exit $?
433
434 # Remove the call to Libtool.
435 if test "$libtool" = yes; then
436 while test $1 != '--mode=compile'; do
437 shift
438 done
439 shift
440 fi
441
442 # Remove `-o $object'.
443 IFS=" "
444 for arg
445 do
446 case $arg in
447 -o)
448 shift
449 ;;
450 $object)
451 shift
452 ;;
453 *)
454 set fnord "$@" "$arg"
455 shift # fnord
456 shift # $arg
457 ;;
458 esac
459 done
460
461 "$@" -E |
462 sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
463 sed '$ s: \\$::' > "$tmpdepfile"
464 rm -f "$depfile"
465 echo "$object : \\" > "$depfile"
466 cat < "$tmpdepfile" >> "$depfile"
467 sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
468 rm -f "$tmpdepfile"
469 ;;
470
471 msvisualcpp)
472 # Important note: in order to support this mode, a compiler *must*
473 # always write the preprocessed file to stdout, regardless of -o,
474 # because we must use -o when running libtool.
475 "$@" || exit $?
476 IFS=" "
477 for arg
478 do
479 case "$arg" in
480 "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
481 set fnord "$@"
482 shift
483 shift
484 ;;
485 *)
486 set fnord "$@" "$arg"
487 shift
488 shift
489 ;;
490 esac
491 done
492 "$@" -E |
493 sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
494 rm -f "$depfile"
495 echo "$object : \\" > "$depfile"
496 . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
497 echo " " >> "$depfile"
498 . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
499 rm -f "$tmpdepfile"
500 ;;
501
502 none)
503 exec "$@"
504 ;;
505
506 *)
507 echo "Unknown depmode $depmode" 1>&2
508 exit 1
509 ;;
510 esac
511
512 exit 0
513
514 # Local Variables:
515 # mode: shell-script
516 # sh-indentation: 2
517 # eval: (add-hook 'write-file-hooks 'time-stamp)
518 # time-stamp-start: "scriptversion="
519 # time-stamp-format: "%:y-%02m-%02d.%02H"
520 # time-stamp-end: "$"
521 # End:
0 * Why ENet?
1
2 ENet evolved specifically as a UDP networking layer for the multiplayer
3 first person shooter Cube. Cube necessitated low latency communcation with
4 data sent out very frequently, so TCP was an unsuitable choice due to its
5 high latency and stream orientation. UDP, however, lacks many sometimes
6 necessary features from TCP such as reliability, sequencing, unrestricted
7 packet sizes, and connection management. So UDP by itself was not suitable
8 as a network protocol either. No suitable freely available networking
9 libraries existed at the time of ENet's creation to fill this niche.
10
11 UDP and TCP could have been used together in Cube to benefit somewhat
12 from both of their features, however, the resulting combinations of protocols
13 still leaves much to be desired. TCP lacks multiple streams of communication
14 without resorting to opening many sockets and complicates delineation of
15 packets due to its buffering behavior. UDP lacks sequencing, connection
16 management, management of bandwidth resources, and imposes limitations on
17 the size of packets. A significant investment is required to integrate these
18 two protocols, and the end result is worse off in features and performance
19 than the uniform protocol presented by ENet.
20
21 ENet thus attempts to address these issues and provide a single, uniform
22 protocol layered over UDP to the developer with the best features of UDP and
23 TCP as well as some useful features neither provide, with a much cleaner
24 integration than any resulting from a mixture of UDP and TCP.
25
26 * Connection management
27
28 ENet provides a simple connection interface over which to communicate
29 with a foreign host. The liveness of the connection is actively monitored
30 by pinging the foreign host at frequent intervals, and also monitors the
31 network conditions from the local host to the foreign host such as the
32 mean round trip time and packet loss in this fashion.
33
34 * Sequencing
35
36 Rather than a single byte stream that complicates the delineation
37 of packets, ENet presents connections as multiple, properly sequenced packet
38 streams that simplify the transfer of various types of data.
39
40 ENet provides sequencing for all packets by assigning to each sent
41 packet a sequence number that is incremented as packets are sent. ENet
42 guarentees that no packet with a higher sequence number will be delivered
43 before a packet with a lower sequence number, thus ensuring packets are
44 delivered exactly in the order they are sent.
45
46 For unreliable packets, ENet will simply discard the lower sequence
47 number packet if a packet with a higher sequence number has already been
48 delivered. This allows the packets to be dispatched immediately as they
49 arrive, and reduce latency of unreliable packets to an absolute minimum.
50 For reliable packets, if a higher sequence number packet arrives, but the
51 preceding packets in the sequence have not yet arrived, ENet will stall
52 delivery of the higher sequence number packets until its predecessors
53 have arrived.
54
55 * Channels
56
57 Since ENet will stall delivery of reliable packets to ensure proper
58 sequencing, and consequently any packets of higher sequence number whether
59 reliable or unreliable, in the event the reliable packet's predecessors
60 have not yet arrived, this can introduce latency into the delivery of other
61 packets which may not need to be as strictly ordered with respect to the
62 packet that stalled their delivery.
63
64 To combat this latency and reduce the ordering restrictions on packets,
65 ENet provides multiple channels of communication over a given connection.
66 Each channel is independently sequenced, and so the delivery status of
67 a packet in one channel will not stall the delivery of other packets
68 in another channel.
69
70 * Reliability
71
72 ENet provides optional reliability of packet delivery by ensuring the
73 foreign host acknowledges receipt of all reliable packets. ENet will attempt
74 to resend the packet up to a reasonable amount of times, if no acknowledgement
75 of the packet's receipt happens within a specified timeout. Retry timeouts
76 are progressive and become more lenient with every failed attempt to allow
77 for temporary turbulence in network conditions.
78
79 * Fragmentation and reassembly
80
81 ENet will send and deliver packets regardless of size. Large packets are
82 fragmented into many smaller packets of suitable size, and reassembled on
83 the foreign host to recover the original packet for delivery. The process
84 is entirely transparent to the developer.
85
86 * Aggregation
87
88 ENet aggregates all protocol commands, including acknowledgements and
89 packet transfer, into larger protocol packets to ensure the proper utilization
90 of the connection and to limit the opportunities for packet loss that might
91 otherwise result in further delivery latency.
92
93 * Adaptability
94
95 ENet provides an in-flight data window for reliable packets to ensure
96 connections are not overwhelmed by volumes of packets. It also provides a
97 static bandwidth allocation mechanism to ensure the total volume of packets
98 sent and received to a host don't exceed the host's capabilities. Further,
99 ENet also provides a dynamic throttle that responds to deviations from normal
100 network connections to rectify various types of network congestion by further
101 limiting the volume of packets sent.
102
103 * Portability
104
105 ENet works on Windows and any other Unix or Unix-like platform providing
106 a BSD sockets interface. The library has a small and stable code base that
107 can easily be extended to support other platforms and integrates easily.
108
109 * Freedom
110
111 ENet demands no royalties and doesn't carry a viral license that would
112 restrict you in how you might use it in your programs. ENet is licensed under
113 a short-and-sweet MIT-style license, which gives you the freedom to do anything
114 you want with it (well, almost anything).
115
116
0 /FAQ.dox/1.1.1.1/Tue Mar 14 23:32:27 2006//
1 /design.dox/1.1.1.1/Tue Mar 14 23:32:27 2006//
2 /install.dox/1.1.1.1/Tue Mar 14 23:32:27 2006//
3 /license.dox/1.1.1.1/Tue Mar 14 23:32:27 2006//
4 /tutorial.dox/1.3/Tue Mar 14 23:32:27 2006//
5 /mainpage.dox/1.10/Wed Mar 15 00:09:41 2006//
6 D
0 :pserver:anonymous@bespin.org:/var/lib/cvs/enet
0 /**
1 @page FAQ Frequently Answered Questions
2
3 @section Q1 Is ENet thread safe?
4
5 ENet does not use any significant global variables, the vast majority
6 of state is encapsulated in the ENetHost structure. As such, as long
7 as the application guards access to this structure, then ENet should
8 operate fine in a multithreaded environment.
9
10 @section Q2 Isn't ENet just re-inventing TCP?! What's the point?
11
12 In a perfect world, that would be true. But as many have found, using
13 TCP either in lieu of or in conjunction with UDP can lead to all kinds
14 of nightmares. TCP is a good, solid protocol, however it simply isn't
15 up to the task of real-time games. Too much of TCP's implementation
16 dictates a policy that isn't practical for games. If you want to use
17 TCP, then do so -- this library is for people that either don't want
18 to use TCP or have tried and ended up being discouraged with the
19 performance.
20
21 */
22
23
0 /**
1 @page Features Features and Architecture
2
3 ENet evolved specifically as a UDP networking layer for the
4 multiplayer first person shooter Cube. Cube necessitated low latency
5 communcation with data sent out very frequently, so TCP was an
6 unsuitable choice due to its high latency and stream orientation. UDP,
7 however, lacks many sometimes necessary features from TCP such as
8 reliability, sequencing, unrestricted packet sizes, and connection
9 management. So UDP by itself was not suitable as a network protocol
10 either. No suitable freely available networking libraries existed at
11 the time of ENet's creation to fill this niche.
12
13 UDP and TCP could have been used together in Cube to benefit somewhat
14 from both of their features, however, the resulting combinations of
15 protocols still leaves much to be desired. TCP lacks multiple streams
16 of communication without resorting to opening many sockets and
17 complicates delineation of packets due to its buffering behavior. UDP
18 lacks sequencing, connection management, management of bandwidth
19 resources, and imposes limitations on the size of packets. A
20 significant investment is required to integrate these two protocols,
21 and the end result is worse off in features and performance than the
22 uniform protocol presented by ENet.
23
24 ENet thus attempts to address these issues and provide a single,
25 uniform protocol layered over UDP to the developer with the best
26 features of UDP and TCP as well as some useful features neither
27 provide, with a much cleaner integration than any resulting from a
28 mixture of UDP and TCP.
29
30 @section CM Connection Management
31
32 ENet provides a simple connection interface over which to communicate
33 with a foreign host. The liveness of the connection is actively
34 monitored by pinging the foreign host at frequent intervals, and also
35 monitors the network conditions from the local host to the foreign
36 host such as the mean round trip time and packet loss in this fashion.
37
38 @section Sequencing Sequencing
39
40 Rather than a single byte stream that complicates the delineation of
41 packets, ENet presents connections as multiple, properly sequenced
42 packet streams that simplify the transfer of various types of data.
43
44 ENet provides sequencing for all packets by assigning to each sent
45 packet a sequence number that is incremented as packets are sent. ENet
46 guarentees that no packet with a higher sequence number will be
47 delivered before a packet with a lower sequence number, thus ensuring
48 packets are delivered exactly in the order they are sent.
49
50 For unreliable packets, ENet will simply discard the lower sequence
51 number packet if a packet with a higher sequence number has already
52 been delivered. This allows the packets to be dispatched immediately
53 as they arrive, and reduce latency of unreliable packets to an
54 absolute minimum. For reliable packets, if a higher sequence number
55 packet arrives, but the preceding packets in the sequence have not yet
56 arrived, ENet will stall delivery of the higher sequence number
57 packets until its predecessors have arrived.
58
59 @section Channels Channels
60
61 Since ENet will stall delivery of reliable packets to ensure proper
62 sequencing, and consequently any packets of higher sequence number
63 whether reliable or unreliable, in the event the reliable packet's
64 predecessors have not yet arrived, this can introduce latency into the
65 delivery of other packets which may not need to be as strictly ordered
66 with respect to the packet that stalled their delivery.
67
68 To combat this latency and reduce the ordering restrictions on
69 packets, ENet provides multiple channels of communication over a given
70 connection. Each channel is independently sequenced, and so the
71 delivery status of a packet in one channel will not stall the delivery
72 of other packets in another channel.
73
74 @section Reliability Reliability
75
76 ENet provides optional reliability of packet delivery by ensuring the
77 foreign host acknowledges receipt of all reliable packets. ENet will
78 attempt to resend the packet up to a reasonable amount of times, if no
79 acknowledgement of the packet's receipt happens within a specified
80 timeout. Retry timeouts are progressive and become more lenient with
81 every failed attempt to allow for temporary turbulence in network
82 conditions.
83
84 @section FaR Fragmentation and Reassembly
85
86 ENet will send and deliver packets regardless of size. Large packets
87 are fragmented into many smaller packets of suitable size, and
88 reassembled on the foreign host to recover the original packet for
89 delivery. The process is entirely transparent to the developer.
90
91 @section Aggregation Aggregation
92
93 ENet aggregates all protocol commands, including acknowledgements and
94 packet transfer, into larger protocol packets to ensure the proper
95 utilization of the connection and to limit the opportunities for
96 packet loss that might otherwise result in further delivery latency.
97
98 @section Adaptability Adaptability
99
100 ENet provides an in-flight data window for reliable packets to ensure
101 connections are not overwhelmed by volumes of packets. It also
102 provides a static bandwidth allocation mechanism to ensure the total
103 volume of packets sent and received to a host don't exceed the host's
104 capabilities. Further, ENet also provides a dynamic throttle that
105 responds to deviations from normal network connections to rectify
106 various types of network congestion by further limiting the volume of
107 packets sent.
108
109 @section Portability Portability
110
111 ENet works on Windows and any other Unix or Unix-like platform
112 providing a BSD sockets interface. The library has a small and stable
113 code base that can easily be extended to support other platforms and
114 integrates easily. ENet makes no assumptions about the underlying
115 platform's endianess or word size.
116
117 @section Freedom Freedom
118
119 ENet demands no royalties and doesn't carry a viral license that would
120 restrict you in how you might use it in your programs. ENet is
121 licensed under a short-and-sweet MIT-style license, which gives you
122 the freedom to do anything you want with it (well, almost anything).
123
124 */
125
0 /**
1 @page Installation Installation
2
3 ENet should be trivially simple to integrate with most applications.
4 First, make sure you download the latest source distribution here @ref
5 SourceDistro.
6
7 @section Unix Unix-like Operating Systems
8
9 [to be completed]
10
11 @subsection SolarisBSD Solaris and BSD
12
13 When building ENet under Solaris, you must specify the -lsocket and
14 -lnsl parameters to your compiler to ensure that the sockets library
15 is linked in.
16
17 @section Windows Microsoft Windows
18
19 Using MSVC 6 under Windows simply drag all the ENet source files into
20 your main project or, better yet, create a new static library project
21 and make your executable dependent (Project|Dependencies) on ENet.
22 There is also an enet.dsp provided.
23
24 You will have to link to the Winsock2 libraries, so make sure to add
25 ws2_32.lib to your library list (Project Settings | Link |
26 Object/library modules).
27
28 @subsection DLL DLL
29
30 If you wish to build ENet as a DLL you must first define ENET_DLL
31 within the project (Project Settings | C/C++ | Preprocessor |
32 Preprocessor definitions) or, more invasively, simply define ENET_DLL
33 at the top of enet.h.
34
35 */
36
0 /**
1 @page License License
2
3 Copyright (c) 2002 Lee Salzman
4
5 Permission is hereby granted, free of charge, to any person obtaining
6 a copy of this software and associated documentation files (the
7 "Software"), to deal in the Software without restriction, including
8 without limitation the rights to use, copy, modify, merge, publish,
9 distribute, sublicense, and/or sell copies of the Software, and to
10 permit persons to whom the Software is furnished to do so, subject to
11 the following conditions:
12
13 The above copyright notice and this permission notice shall be
14 included in all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
24 */
25
0 /** @mainpage enet
1 <center>http://enet.bespin.org</center>
2 <hr>
3
4 ENet's purpose is to provide a relatively thin, simple and robust
5 network communication layer on top of UDP (User Datagram Protocol).
6 The primary feature it provides is optional reliable, in-order
7 delivery of packets.
8
9 ENet is NOT intended to be a general purpose high level networking
10 library that handles authentication, lobbying, server discovery,
11 compression, encryption and other high level, often application level
12 or dependent tasks.
13
14 @ref Features
15
16 @ref SourceDistro
17
18 @ref Installation
19
20 @ref Tutorial
21
22 @ref MailingList
23
24 @ref FAQ
25
26 @ref License
27
28 */
29
30 /**
31 @page SourceDistro Source Distribution
32
33 You can retrieve the source to ENet by downloading it in either .tar.gz form
34 or accessing the cvs distribution directly.
35
36 The most recent stable release (1.0) can be downloaded <a href="http://enet.bespin.org/download/enet-1.0.tar.gz">here</a>.
37
38 To access ENet via anonymous CVS, you must use the CVSROOT
39 :pserver:anonymous\@bespin.org:/var/lib/cvs/enet with an empty
40 password.
41
42 @code
43 $ cvs -z3 -d :pserver:anonymous@bespin.org:/var/lib/cvs/enet login
44 @endcode
45 Hit the return key when prompted for a password.
46 @code
47 $ cvs -z3 -d :pserver:anonymous@bespin.org:/var/lib/cvs/enet co -l .
48 $ cvs -z3 co enet
49 @endcode
50
51 This will create a CVS directory in the current directory, and with
52 the second command will proceed to check the enet module out of CVS.
53 Any problems with CVS access or request for write access should be
54 sent via email to @ref MailingList.
55
56 */
57
58 /**
59 @page MailingList ENet Mailing List
60
61 The <a
62 href="http://lists.cubik.org/mailman/listinfo/enet-discuss">
63 enet-discuss</a> list is for discussion of ENet, including bug reports
64 or feature requests.
65
66 */
0 /**
1 @page Tutorial Tutorial
2
3 @ref Initialization
4
5 @ref CreateServer
6
7 @ref CreateClient
8
9 @ref ManageHost
10
11 @ref SendingPacket
12
13 @ref Disconnecting
14
15 @ref Connecting
16
17 @section Initialization Initialization
18
19 Before using ENet, you must call enet_initialize() to initialize the
20 library. Upon program exit, you should call enet_deinitialize() so
21 that the library may clean up any used resources.
22
23 @code
24 int
25 main (int argc, char ** argv)
26 {
27 if (enet_initialize () != 0)
28 {
29 fprintf (stderr, "An error occurred while initializing ENet.\n");
30 return EXIT_FAILURE;
31 }
32 atexit (enet_deinitialize);
33 ...
34 ...
35 ...
36 }
37 @endcode
38
39 @section CreateServer Creating an ENet server
40
41 Servers in ENet are constructed with enet_host_create(). You must
42 specify an address on which to receive data and new connections, as
43 well as the maximum allowable numbers of connected peers. You may
44 optionally specify the incoming and outgoing bandwidth of the server
45 in bytes per second so that ENet may try to statically manage
46 bandwidth resources among connected peers in addition to its dynamic
47 throttling algorithm; specifying 0 for these two options will cause
48 ENet to rely entirely upon its dynamic throttling algorithm to manage
49 bandwidth.
50
51 When done with a host, the host may be destroyed with
52 enet_host_destroy(). All connected peers to the host will be reset,
53 and the resources used by the host will be freed.
54
55 @code
56 ENetAddress address;
57 ENetHost * server;
58
59 /* Bind the server to the default localhost. */
60 /* A specific host address can be specified by */
61 /* enet_address_set_host (& address, "x.x.x.x"); */
62
63 address.host = ENET_HOST_ANY;
64 /* Bind the server to port 1234. */
65 address.port = 1234;
66
67 server = enet_host_create (& address /* the address to bind the server host to */,
68 32 /* allow up to 32 clients and/or outgoing connections */,
69 0 /* assume any amount of incoming bandwidth */,
70 0 /* assume any amount of outgoing bandwidth */);
71 if (server == NULL)
72 {
73 fprintf (stderr,
74 "An error occurred while trying to create an ENet server host.\n");
75 exit (EXIT_FAILURE);
76 }
77 ...
78 ...
79 ...
80 enet_host_destroy(server);
81 @endcode
82
83 @section CreateClient Creating an ENet client
84
85 Clients in ENet are similarly constructed with enet_host_create() when
86 no address is specified to bind the host to. Bandwidth may be
87 specified for the client host as in the above example. The peer count
88 controls the maximum number of connections to other server hosts that
89 may be simultaneously open.
90
91 @code
92 ENetHost * client;
93
94 client = enet_host_create (NULL /* create a client host */,
95 1 /* only allow 1 outgoing connection */,
96 57600 / 8 /* 56K modem with 56 Kbps downstream bandwidth */,
97 14400 / 8 /* 56K modem with 14 Kbps upstream bandwidth */);
98
99 if (client == NULL)
100 {
101 fprintf (stderr,
102 "An error occurred while trying to create an ENet client host.\n");
103 exit (EXIT_FAILURE);
104 }
105 ...
106 ...
107 ...
108 enet_host_destroy(client);
109 @endcode
110
111 @section ManageHost Managing an ENet host
112
113 ENet uses a polled event model to notify the programmer of significant
114 events. ENet hosts are polled for events with enet_host_service(),
115 where an optional timeout value in milliseconds may be specified to
116 control how long ENet will poll; if a timeout of 0 is specified,
117 enet_host_service() will return immediately if there are no events to
118 dispatch. enet_host_service() will return 1 if an event was dispatched
119 within the specified timeout.
120
121 Currently there are only four types of significant events in ENet:
122
123 An event of type ENET_EVENT_TYPE_NONE is returned if no event occurred
124 within the specified time limit. enet_host_service() will return 0
125 with this event.
126
127 An event of type ENET_EVENT_TYPE_CONNECT is returned when either a new client
128 host has connected to the server host or when an attempt to establish a
129 connection with a foreign host has succeeded. Only the "peer" field of the
130 event structure is valid for this event and contains the newly connected peer.
131
132 An event of type ENET_EVENT_TYPE_RECEIVE is returned when a packet is received
133 from a connected peer. The "peer" field contains the peer the packet was
134 received from, "channelID" is the channel on which the packet was sent, and
135 "packet" is the packet that was sent. The packet contained in the "packet"
136 field must be destroyed with enet_packet_destroy() when you are done
137 inspecting its contents.
138
139 An event of type ENET_EVENT_TYPE_DISCONNECT is returned when a connected peer
140 has either explicitly disconnected or timed out. Only the "peer" field of the
141 event structure is valid for this event and contains the peer that
142 disconnected. Only the "data" field of the peer is still valid on a
143 disconnect event and must be explicitly reset.
144
145 @code
146 ENetEvent event;
147
148 /* Wait up to 1000 milliseconds for an event. */
149 while (enet_host_service (client, & event, 1000) > 0)
150 {
151 switch (event.type)
152 {
153 case ENET_EVENT_TYPE_CONNECT:
154 printf ("A new client connected from %x:%u.\n",
155 event.peer -> address.host,
156 event.peer -> address.port);
157
158 /* Store any relevant client information here. */
159 event.peer -> data = "Client information";
160
161 break;
162
163 case ENET_EVENT_TYPE_RECEIVE:
164 printf ("A packet of length %u containing %s was received from %s on channel %u.\n",
165 event.packet -> dataLength,
166 event.packet -> data,
167 event.peer -> data,
168 event.channelID);
169
170 /* Clean up the packet now that we're done using it. */
171 enet_packet_destroy (event.packet);
172
173 break;
174
175 case ENET_EVENT_TYPE_DISCONNECT:
176 printf ("%s disconected.\n", event.peer -> data);
177
178 /* Reset the peer's client information. */
179
180 event.peer -> data = NULL;
181 }
182 }
183 ...
184 ...
185 ...
186 @endcode
187
188 @section SendingPacket Sending a packet to an ENet peer
189
190 Packets in ENet are created with enet_packet_create(), where the size
191 of the packet must be specified. Optionally, initial data may be
192 specified to copy into the packet.
193
194 Certain flags may also be supplied to enet_packet_create() to control
195 various packet features:
196
197 ENET_PACKET_FLAG_RELIABLE specifies that the packet must use reliable
198 delivery. A reliable packet is guarenteed to be delivered, and a
199 number of retry attempts will be made until an acknowledgement is
200 received from the foreign host the packet is sent to. If a certain
201 number of retry attempts is reached without any acknowledgement, ENet
202 will assume the peer has disconnected and forcefully reset the
203 connection. If this flag is not specified, the packet is assumed an
204 unreliable packet, and no retry attempts will be made nor
205 acknowledgements generated.
206
207 A packet may be resized (extended or truncated) with
208 enet_packet_resize().
209
210 A packet is sent to a foreign host with
211 enet_peer_send(). enet_peer_send() accepts a channel id over which to
212 send the packet to a given peer. Once the packet is handed over to
213 ENet with enet_peer_send(), ENet will handle its deallocation and
214 enet_packet_destroy() should not be used upon it.
215
216 One may also use enet_host_broadcast() to send a packet to all
217 connected peers on a given host over a specified channel id, as with
218 enet_peer_send().
219
220 Queued packets will be sent on a call to enet_host_service().
221 Alternatively, enet_host_flush() will send out queued packets without
222 dispatching any events.
223
224 @code
225 /* Create a reliable packet of size 7 containing "packet\0" */
226 ENetPacket * packet = enet_packet_create ("packet",
227 strlen ("packet") + 1,
228 ENET_PACKET_FLAG_RELIABLE);
229
230 /* Extend the packet so and append the string "foo", so it now */
231 /* contains "packetfoo\0" */
232 enet_packet_resize (packet, strlen ("packetfoo") + 1);
233 strcpy (& packet -> data [strlen ("packet")], "foo");
234
235 /* Send the packet to the peer over channel id 0. */
236 /* One could also broadcast the packet by */
237 /* enet_host_broadcast (host, 0, packet); */
238 enet_peer_send (peer, 0, packet);
239 ...
240 ...
241 ...
242 /* One could just use enet_host_service() instead. */
243 enet_host_flush (host);
244 @endcode
245
246 @section Disconnecting Disconnecting an ENet peer
247
248 Peers may be gently disconnected with enet_peer_disconnect(). A
249 disconnect request will be sent to the foreign host, and ENet will
250 wait for an acknowledgement from the foreign host before finally
251 disconnecting. An event of type ENET_EVENT_TYPE_DISCONNECT will be
252 generated once the disconnection succeeds. Normally timeouts apply to
253 the disconnect acknowledgement, and so if no acknowledgement is
254 received after a length of time the peer will be forcefully
255 disconnected.
256
257 enet_peer_reset() will forcefully disconnect a peer. The foreign host
258 will get no notification of a disconnect and will time out on the
259 foreign host. No event is generated.
260
261 @code
262 ENetEvent event;
263
264 enet_peer_disconnect (peer, 0);
265
266 /* Allow up to 3 seconds for the disconnect to succeed
267 * and drop any packets received packets.
268 */
269 while (enet_host_service (client, & event, 3000) > 0)
270 {
271 switch (event.type)
272 {
273 case ENET_EVENT_TYPE_RECEIVE:
274 enet_packet_destroy (event.packet);
275 break;
276
277 case ENET_EVENT_TYPE_DISCONNECT:
278 puts ("Disconnection succeeded.");
279 return;
280 ...
281 ...
282 ...
283 }
284 }
285
286 /* We've arrived here, so the disconnect attempt didn't */
287 /* succeed yet. Force the connection down. */
288 enet_peer_reset (peer);
289 ...
290 ...
291 ...
292 @endcode
293
294 @section Connecting Connecting to an ENet host
295
296 A connection to a foreign host is initiated with enet_host_connect().
297 It accepts the address of a foreign host to connect to, and the number
298 of channels that should be allocated for communication. If N channels
299 are allocated for use, their channel ids will be numbered 0 through
300 N-1. A peer representing the connection attempt is returned, or NULL
301 if there were no available peers over which to initiate the
302 connection. When the connection attempt succeeds, an event of type
303 ENET_EVENT_TYPE_CONNECT will be generated. If the connection attempt
304 times out or otherwise fails, an event of type
305 ENET_EVENT_TYPE_DISCONNECT will be generated.
306
307 @code
308 ENetAddress address;
309 ENetEvent event;
310 ENetPeer *peer;
311
312 /* Connect to some.server.net:1234. */
313 enet_address_set_host (& address, "some.server.net");
314 address.port = 1234;
315
316 /* Initiate the connection, allocating the two channels 0 and 1. */
317 peer = enet_host_connect (client, & address, 2);
318
319 if (peer == NULL)
320 {
321 fprintf (stderr,
322 "No available peers for initiating an ENet connection.\n");
323 exit (EXIT_FAILURE);
324 }
325
326 /* Wait up to 5 seconds for the connection attempt to succeed. */
327 if (enet_host_service (client, & event, 5000) > 0 &&
328 event.type == ENET_EVENT_TYPE_CONNECT)
329 {
330 puts ("Connection to some.server.net:1234 succeeded.");
331 ...
332 ...
333 ...
334 }
335 else
336 {
337 /* Either the 5 seconds are up or a disconnect event was */
338 /* received. Reset the peer in the event the 5 seconds */
339 /* had run out without any significant event. */
340 enet_peer_reset (peer);
341
342 puts ("Connection to some.server.net:1234 failed.");
343 }
344 ...
345 ...
346 ...
347 @endcode
348 */
0 # Microsoft Developer Studio Project File - Name="enet" - Package Owner=<4>
1 # Microsoft Developer Studio Generated Build File, Format Version 6.00
2 # ** DO NOT EDIT **
3
4 # TARGTYPE "Win32 (x86) Static Library" 0x0104
5
6 CFG=enet - Win32 Debug
7 !MESSAGE This is not a valid makefile. To build this project using NMAKE,
8 !MESSAGE use the Export Makefile command and run
9 !MESSAGE
10 !MESSAGE NMAKE /f "enet.mak".
11 !MESSAGE
12 !MESSAGE You can specify a configuration when running NMAKE
13 !MESSAGE by defining the macro CFG on the command line. For example:
14 !MESSAGE
15 !MESSAGE NMAKE /f "enet.mak" CFG="enet - Win32 Debug"
16 !MESSAGE
17 !MESSAGE Possible choices for configuration are:
18 !MESSAGE
19 !MESSAGE "enet - Win32 Release" (based on "Win32 (x86) Static Library")
20 !MESSAGE "enet - Win32 Debug" (based on "Win32 (x86) Static Library")
21 !MESSAGE
22
23 # Begin Project
24 # PROP AllowPerConfigDependencies 0
25 # PROP Scc_ProjName ""
26 # PROP Scc_LocalPath ""
27 CPP=cl.exe
28 RSC=rc.exe
29
30 !IF "$(CFG)" == "enet - Win32 Release"
31
32 # PROP BASE Use_MFC 0
33 # PROP BASE Use_Debug_Libraries 0
34 # PROP BASE Output_Dir "Release"
35 # PROP BASE Intermediate_Dir "Release"
36 # PROP BASE Target_Dir ""
37 # PROP Use_MFC 0
38 # PROP Use_Debug_Libraries 0
39 # PROP Output_Dir "Release"
40 # PROP Intermediate_Dir "Release"
41 # PROP Target_Dir ""
42 MTL=midl.exe
43 # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
44 # ADD CPP /nologo /W3 /O2 /I "include/enet" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c
45 # SUBTRACT CPP /YX
46 # ADD BASE RSC /l 0x409 /d "NDEBUG"
47 # ADD RSC /l 0x409 /d "NDEBUG"
48 BSC32=bscmake.exe
49 # ADD BASE BSC32 /nologo
50 # ADD BSC32 /nologo
51 LIB32=link.exe -lib
52 # ADD BASE LIB32 /nologo
53 # ADD LIB32 /nologo
54
55 !ELSEIF "$(CFG)" == "enet - Win32 Debug"
56
57 # PROP BASE Use_MFC 0
58 # PROP BASE Use_Debug_Libraries 1
59 # PROP BASE Output_Dir "Debug"
60 # PROP BASE Intermediate_Dir "Debug"
61 # PROP BASE Target_Dir ""
62 # PROP Use_MFC 0
63 # PROP Use_Debug_Libraries 1
64 # PROP Output_Dir "\temp\enet\Debug"
65 # PROP Intermediate_Dir "\temp\enet\Debug"
66 # PROP Target_Dir ""
67 MTL=midl.exe
68 # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
69 # ADD CPP /nologo /G6 /MTd /W3 /ZI /Od /I "include/enet" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FR /FD /GZ /c
70 # SUBTRACT CPP /YX
71 # ADD BASE RSC /l 0x409 /d "_DEBUG"
72 # ADD RSC /l 0x409 /d "_DEBUG"
73 BSC32=bscmake.exe
74 # ADD BASE BSC32 /nologo
75 # ADD BSC32 /nologo
76 LIB32=link.exe -lib
77 # ADD BASE LIB32 /nologo
78 # ADD LIB32 /nologo
79
80 !ENDIF
81
82 # Begin Target
83
84 # Name "enet - Win32 Release"
85 # Name "enet - Win32 Debug"
86 # Begin Group "Source Files"
87
88 # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
89 # Begin Source File
90
91 SOURCE=.\host.c
92 # End Source File
93 # Begin Source File
94
95 SOURCE=.\list.c
96 # End Source File
97 # Begin Source File
98
99 SOURCE=.\callbacks.c
100 # End Source File
101 # Begin Source File
102
103 SOURCE=.\packet.c
104 # End Source File
105 # Begin Source File
106
107 SOURCE=.\peer.c
108 # End Source File
109 # Begin Source File
110
111 SOURCE=.\protocol.c
112 # End Source File
113 # Begin Source File
114
115 SOURCE=.\unix.c
116 # End Source File
117 # Begin Source File
118
119 SOURCE=.\win32.c
120 # End Source File
121 # End Group
122 # Begin Group "Header Files"
123
124 # PROP Default_Filter "h;hpp;hxx;hm;inl"
125 # Begin Source File
126
127 SOURCE=.\include\enet\enet.h
128 # End Source File
129 # Begin Source File
130
131 SOURCE=.\include\enet\list.h
132 # End Source File
133 # Begin Source File
134
135 SOURCE=.\include\enet\callbacks.h
136 # End Source File
137 # Begin Source File
138
139 SOURCE=.\include\enet\protocol.h
140 # End Source File
141 # Begin Source File
142
143 SOURCE=.\include\enet\time.h
144 # End Source File
145 # Begin Source File
146
147 SOURCE=.\include\enet\types.h
148 # End Source File
149 # Begin Source File
150
151 SOURCE=.\include\enet\unix.h
152 # End Source File
153 # Begin Source File
154
155 SOURCE=.\include\enet\utility.h
156 # End Source File
157 # Begin Source File
158
159 SOURCE=.\include\enet\win32.h
160 # End Source File
161 # End Group
162 # End Target
163 # End Project
0 /**
1 @file host.c
2 @brief ENet host management functions
3 */
4 #define ENET_BUILDING_LIB 1
5 #include <string.h>
6 #include "enet/enet.h"
7
8 /** @defgroup host ENet host functions
9 @{
10 */
11
12 /** Creates a host for communicating to peers.
13
14 @param address the address at which other peers may connect to this host. If NULL, then no peers may connect to the host.
15 @param peerCount the maximum number of peers that should be allocated for the host.
16 @param incomingBandwidth downstream bandwidth of the host in bytes/second; if 0, ENet will assume unlimited bandwidth.
17 @param outgoingBandwidth upstream bandwidth of the host in bytes/second; if 0, ENet will assume unlimited bandwidth.
18
19 @returns the host on success and NULL on failure
20
21 @remarks ENet will strategically drop packets on specific sides of a connection between hosts
22 to ensure the host's bandwidth is not overwhelmed. The bandwidth parameters also determine
23 the window size of a connection which limits the amount of reliable packets that may be in transit
24 at any given time.
25 */
26 ENetHost *
27 enet_host_create (const ENetAddress * address, size_t peerCount, enet_uint32 incomingBandwidth, enet_uint32 outgoingBandwidth)
28 {
29 ENetHost * host = (ENetHost *) enet_malloc (sizeof (ENetHost));
30 ENetPeer * currentPeer;
31
32 host -> peers = (ENetPeer *) enet_malloc (peerCount * sizeof (ENetPeer));
33 memset (host -> peers, 0, peerCount * sizeof (ENetPeer));
34
35 host -> socket = enet_socket_create (ENET_SOCKET_TYPE_DATAGRAM, address);
36 if (host -> socket == ENET_SOCKET_NULL)
37 {
38 enet_free (host -> peers);
39 enet_free (host);
40
41 return NULL;
42 }
43
44 if (address != NULL)
45 host -> address = * address;
46
47 host -> incomingBandwidth = incomingBandwidth;
48 host -> outgoingBandwidth = outgoingBandwidth;
49 host -> bandwidthThrottleEpoch = 0;
50 host -> recalculateBandwidthLimits = 0;
51 host -> mtu = ENET_HOST_DEFAULT_MTU;
52 host -> peerCount = peerCount;
53 host -> lastServicedPeer = host -> peers;
54 host -> commandCount = 0;
55 host -> bufferCount = 0;
56 host -> receivedAddress.host = ENET_HOST_ANY;
57 host -> receivedAddress.port = 0;
58 host -> receivedDataLength = 0;
59
60 for (currentPeer = host -> peers;
61 currentPeer < & host -> peers [host -> peerCount];
62 ++ currentPeer)
63 {
64 currentPeer -> host = host;
65 currentPeer -> incomingPeerID = currentPeer - host -> peers;
66 currentPeer -> data = NULL;
67
68 enet_list_clear (& currentPeer -> acknowledgements);
69 enet_list_clear (& currentPeer -> sentReliableCommands);
70 enet_list_clear (& currentPeer -> sentUnreliableCommands);
71 enet_list_clear (& currentPeer -> outgoingReliableCommands);
72 enet_list_clear (& currentPeer -> outgoingUnreliableCommands);
73
74 enet_peer_reset (currentPeer);
75 }
76
77 return host;
78 }
79
80 /** Destroys the host and all resources associated with it.
81 @param host pointer to the host to destroy
82 */
83 void
84 enet_host_destroy (ENetHost * host)
85 {
86 ENetPeer * currentPeer;
87
88 enet_socket_destroy (host -> socket);
89
90 for (currentPeer = host -> peers;
91 currentPeer < & host -> peers [host -> peerCount];
92 ++ currentPeer)
93 {
94 enet_peer_reset (currentPeer);
95 }
96
97 enet_free (host -> peers);
98 enet_free (host);
99 }
100
101 /** Initiates a connection to a foreign host.
102 @param host host seeking the connection
103 @param address destination for the connection
104 @param channelCount number of channels to allocate
105 @returns a peer representing the foreign host on success, NULL on failure
106 @remarks The peer returned will have not completed the connection until enet_host_service()
107 notifies of an ENET_EVENT_TYPE_CONNECT event for the peer.
108 */
109 ENetPeer *
110 enet_host_connect (ENetHost * host, const ENetAddress * address, size_t channelCount)
111 {
112 ENetPeer * currentPeer;
113 ENetChannel * channel;
114 ENetProtocol command;
115
116 if (channelCount < ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT)
117 channelCount = ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT;
118 else
119 if (channelCount > ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT)
120 channelCount = ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT;
121
122 for (currentPeer = host -> peers;
123 currentPeer < & host -> peers [host -> peerCount];
124 ++ currentPeer)
125 {
126 if (currentPeer -> state == ENET_PEER_STATE_DISCONNECTED)
127 break;
128 }
129
130 if (currentPeer >= & host -> peers [host -> peerCount])
131 return NULL;
132
133 currentPeer -> state = ENET_PEER_STATE_CONNECTING;
134 currentPeer -> address = * address;
135 currentPeer -> channels = (ENetChannel *) enet_malloc (channelCount * sizeof (ENetChannel));
136 currentPeer -> channelCount = channelCount;
137 currentPeer -> challenge = (enet_uint32) enet_rand ();
138
139 if (host -> outgoingBandwidth == 0)
140 currentPeer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE;
141 else
142 currentPeer -> windowSize = (host -> outgoingBandwidth /
143 ENET_PEER_WINDOW_SIZE_SCALE) *
144 ENET_PROTOCOL_MINIMUM_WINDOW_SIZE;
145
146 if (currentPeer -> windowSize < ENET_PROTOCOL_MINIMUM_WINDOW_SIZE)
147 currentPeer -> windowSize = ENET_PROTOCOL_MINIMUM_WINDOW_SIZE;
148 else
149 if (currentPeer -> windowSize > ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE)
150 currentPeer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE;
151
152 for (channel = currentPeer -> channels;
153 channel < & currentPeer -> channels [channelCount];
154 ++ channel)
155 {
156 channel -> outgoingReliableSequenceNumber = 0;
157 channel -> outgoingUnreliableSequenceNumber = 0;
158 channel -> incomingReliableSequenceNumber = 0;
159 channel -> incomingUnreliableSequenceNumber = 0;
160
161 enet_list_clear (& channel -> incomingReliableCommands);
162 enet_list_clear (& channel -> incomingUnreliableCommands);
163 }
164
165 command.header.command = ENET_PROTOCOL_COMMAND_CONNECT;
166 command.header.channelID = 0xFF;
167 command.header.flags = ENET_PROTOCOL_FLAG_ACKNOWLEDGE;
168 command.header.commandLength = sizeof (ENetProtocolConnect);
169 command.connect.outgoingPeerID = ENET_HOST_TO_NET_16 (currentPeer -> incomingPeerID);
170 command.connect.mtu = ENET_HOST_TO_NET_16 (currentPeer -> mtu);
171 command.connect.windowSize = ENET_HOST_TO_NET_32 (currentPeer -> windowSize);
172 command.connect.channelCount = ENET_HOST_TO_NET_32 (channelCount);
173 command.connect.incomingBandwidth = ENET_HOST_TO_NET_32 (host -> incomingBandwidth);
174 command.connect.outgoingBandwidth = ENET_HOST_TO_NET_32 (host -> outgoingBandwidth);
175 command.connect.packetThrottleInterval = ENET_HOST_TO_NET_32 (currentPeer -> packetThrottleInterval);
176 command.connect.packetThrottleAcceleration = ENET_HOST_TO_NET_32 (currentPeer -> packetThrottleAcceleration);
177 command.connect.packetThrottleDeceleration = ENET_HOST_TO_NET_32 (currentPeer -> packetThrottleDeceleration);
178
179 enet_peer_queue_outgoing_command (currentPeer, & command, NULL, 0, 0);
180
181 return currentPeer;
182 }
183
184 /** Queues a packet to be sent to all peers associated with the host.
185 @param host host on which to broadcast the packet
186 @param channelID channel on which to broadcast
187 @param packet packet to broadcast
188 */
189 void
190 enet_host_broadcast (ENetHost * host, enet_uint8 channelID, ENetPacket * packet)
191 {
192 ENetPeer * currentPeer;
193
194 for (currentPeer = host -> peers;
195 currentPeer < & host -> peers [host -> peerCount];
196 ++ currentPeer)
197 {
198 if (currentPeer -> state != ENET_PEER_STATE_CONNECTED)
199 continue;
200
201 enet_peer_send (currentPeer, channelID, packet);
202 }
203
204 if (packet -> referenceCount == 0)
205 enet_packet_destroy (packet);
206 }
207
208 /** Adjusts the bandwidth limits of a host.
209 @param host host to adjust
210 @param incomingBandwidth new incoming bandwidth
211 @param outgoingBandwidth new outgoing bandwidth
212 @remarks the incoming and outgoing bandwidth parameters are identical in function to those
213 specified in enet_host_create().
214 */
215 void
216 enet_host_bandwidth_limit (ENetHost * host, enet_uint32 incomingBandwidth, enet_uint32 outgoingBandwidth)
217 {
218 host -> incomingBandwidth = incomingBandwidth;
219 host -> outgoingBandwidth = outgoingBandwidth;
220 host -> recalculateBandwidthLimits = 1;
221 }
222
223 void
224 enet_host_bandwidth_throttle (ENetHost * host)
225 {
226 enet_uint32 timeCurrent = enet_time_get (),
227 elapsedTime = timeCurrent - host -> bandwidthThrottleEpoch,
228 peersTotal = 0,
229 dataTotal = 0,
230 peersRemaining,
231 bandwidth,
232 throttle = 0,
233 bandwidthLimit = 0;
234 int needsAdjustment;
235 ENetPeer * peer;
236 ENetProtocol command;
237
238 if (elapsedTime < ENET_HOST_BANDWIDTH_THROTTLE_INTERVAL)
239 return;
240
241 for (peer = host -> peers;
242 peer < & host -> peers [host -> peerCount];
243 ++ peer)
244 {
245 if (peer -> state != ENET_PEER_STATE_CONNECTED)
246 continue;
247
248 ++ peersTotal;
249 dataTotal += peer -> outgoingDataTotal;
250 }
251
252 if (peersTotal == 0)
253 return;
254
255 peersRemaining = peersTotal;
256 needsAdjustment = 1;
257
258 if (host -> outgoingBandwidth == 0)
259 bandwidth = ~0;
260 else
261 bandwidth = (host -> outgoingBandwidth * elapsedTime) / 1000;
262
263 while (peersRemaining > 0 && needsAdjustment != 0)
264 {
265 needsAdjustment = 0;
266
267 if (dataTotal < bandwidth)
268 throttle = ENET_PEER_PACKET_THROTTLE_SCALE;
269 else
270 throttle = (bandwidth * ENET_PEER_PACKET_THROTTLE_SCALE) / dataTotal;
271
272 for (peer = host -> peers;
273 peer < & host -> peers [host -> peerCount];
274 ++ peer)
275 {
276 enet_uint32 peerBandwidth;
277
278 if (peer -> state != ENET_PEER_STATE_CONNECTED ||
279 peer -> incomingBandwidth == 0 ||
280 peer -> outgoingBandwidthThrottleEpoch == timeCurrent)
281 continue;
282
283 peerBandwidth = (peer -> incomingBandwidth * elapsedTime) / 1000;
284 if ((throttle * peer -> outgoingDataTotal) / ENET_PEER_PACKET_THROTTLE_SCALE <= peerBandwidth)
285 continue;
286
287 peer -> packetThrottleLimit = (peerBandwidth *
288 ENET_PEER_PACKET_THROTTLE_SCALE) / peer -> outgoingDataTotal;
289
290 if (peer -> packetThrottleLimit == 0)
291 peer -> packetThrottleLimit = 1;
292
293 if (peer -> packetThrottle > peer -> packetThrottleLimit)
294 peer -> packetThrottle = peer -> packetThrottleLimit;
295
296 peer -> outgoingBandwidthThrottleEpoch = timeCurrent;
297
298
299 needsAdjustment = 1;
300 -- peersRemaining;
301 bandwidth -= peerBandwidth;
302 dataTotal -= peerBandwidth;
303 }
304 }
305
306 if (peersRemaining > 0)
307 for (peer = host -> peers;
308 peer < & host -> peers [host -> peerCount];
309 ++ peer)
310 {
311 if (peer -> state != ENET_PEER_STATE_CONNECTED ||
312 peer -> outgoingBandwidthThrottleEpoch == timeCurrent)
313 continue;
314
315 peer -> packetThrottleLimit = throttle;
316
317 if (peer -> packetThrottle > peer -> packetThrottleLimit)
318 peer -> packetThrottle = peer -> packetThrottleLimit;
319 }
320
321 if (host -> recalculateBandwidthLimits)
322 {
323 host -> recalculateBandwidthLimits = 0;
324
325 peersRemaining = peersTotal;
326 bandwidth = host -> incomingBandwidth;
327 needsAdjustment = 1;
328
329 if (bandwidth == 0)
330 bandwidthLimit = 0;
331 else
332 while (peersRemaining > 0 && needsAdjustment != 0)
333 {
334 needsAdjustment = 0;
335 bandwidthLimit = bandwidth / peersRemaining;
336
337 for (peer = host -> peers;
338 peer < & host -> peers [host -> peerCount];
339 ++ peer)
340 {
341 if (peer -> state != ENET_PEER_STATE_CONNECTED ||
342 peer -> incomingBandwidthThrottleEpoch == timeCurrent)
343 continue;
344
345 if (peer -> outgoingBandwidth > 0 &&
346 bandwidthLimit > peer -> outgoingBandwidth)
347 continue;
348
349 peer -> incomingBandwidthThrottleEpoch = timeCurrent;
350
351 needsAdjustment = 1;
352 -- peersRemaining;
353 bandwidth -= peer -> outgoingBandwidth;
354 }
355 }
356
357 for (peer = host -> peers;
358 peer < & host -> peers [host -> peerCount];
359 ++ peer)
360 {
361 if (peer -> state != ENET_PEER_STATE_CONNECTED)
362 continue;
363
364 command.header.command = ENET_PROTOCOL_COMMAND_BANDWIDTH_LIMIT;
365 command.header.channelID = 0xFF;
366 command.header.flags = ENET_PROTOCOL_FLAG_ACKNOWLEDGE;
367 command.header.commandLength = sizeof (ENetProtocolBandwidthLimit);
368 command.bandwidthLimit.outgoingBandwidth = ENET_HOST_TO_NET_32 (host -> outgoingBandwidth);
369
370 if (peer -> incomingBandwidthThrottleEpoch == timeCurrent)
371 command.bandwidthLimit.incomingBandwidth = ENET_HOST_TO_NET_32 (peer -> outgoingBandwidth);
372 else
373 command.bandwidthLimit.incomingBandwidth = ENET_HOST_TO_NET_32 (bandwidthLimit);
374
375 enet_peer_queue_outgoing_command (peer, & command, NULL, 0, 0);
376 }
377 }
378
379 host -> bandwidthThrottleEpoch = timeCurrent;
380
381 for (peer = host -> peers;
382 peer < & host -> peers [host -> peerCount];
383 ++ peer)
384 {
385 peer -> incomingDataTotal = 0;
386 peer -> outgoingDataTotal = 0;
387 }
388 }
389
390 /** @} */
Binary diff not shown
0 D/enet////
1 /Makefile.am/1.1.1.1/Tue Mar 14 23:32:27 2006//
0 :pserver:anonymous@bespin.org:/var/lib/cvs/enet
0 # Makefile.in generated by automake 1.9.3 from Makefile.am.
1 # include/Makefile. Generated from Makefile.in by configure.
2
3 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
4 # 2003, 2004 Free Software Foundation, Inc.
5 # This Makefile.in is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12 # PARTICULAR PURPOSE.
13
14
15 srcdir = .
16 top_srcdir = ..
17
18 pkgdatadir = $(datadir)/libenet.a
19 pkglibdir = $(libdir)/libenet.a
20 pkgincludedir = $(includedir)/libenet.a
21 top_builddir = ..
22 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
23 INSTALL = /usr/bin/install -c
24 install_sh_DATA = $(install_sh) -c -m 644
25 install_sh_PROGRAM = $(install_sh) -c
26 install_sh_SCRIPT = $(install_sh) -c
27 INSTALL_HEADER = $(INSTALL_DATA)
28 transform = $(program_transform_name)
29 NORMAL_INSTALL = :
30 PRE_INSTALL = :
31 POST_INSTALL = :
32 NORMAL_UNINSTALL = :
33 PRE_UNINSTALL = :
34 POST_UNINSTALL = :
35 subdir = include
36 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
37 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
38 am__aclocal_m4_deps = $(top_srcdir)/configure.in
39 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
40 $(ACLOCAL_M4)
41 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
42 CONFIG_CLEAN_FILES =
43 SOURCES =
44 DIST_SOURCES =
45 RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
46 html-recursive info-recursive install-data-recursive \
47 install-exec-recursive install-info-recursive \
48 install-recursive installcheck-recursive installdirs-recursive \
49 pdf-recursive ps-recursive uninstall-info-recursive \
50 uninstall-recursive
51 ETAGS = etags
52 CTAGS = ctags
53 DIST_SUBDIRS = $(SUBDIRS)
54 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
55 ACLOCAL = aclocal-1.9
56 AMDEP_FALSE = #
57 AMDEP_TRUE =
58 AMTAR = tar
59 AUTOCONF = autoconf
60 AUTOHEADER = autoheader
61 AUTOMAKE = automake-1.9
62 AWK = gawk
63 CC = gcc
64 CCDEPMODE = depmode=gcc3
65 CFLAGS = -g -O2
66 CPP = gcc -E
67 CPPFLAGS =
68 CYGPATH_W = echo
69 DEFS = -DPACKAGE_NAME=\"libenet\" -DPACKAGE_TARNAME=\"libenet\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"libenet\ 1.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"libenet.a\" -DVERSION=\"1.0\" -DHAS_GETHOSTBYADDR_R=1 -DHAS_GETHOSTBYNAME_R=1 -DHAS_POLL=1 -DHAS_FCNTL=1 -DHAS_INET_PTON=1 -DHAS_INET_NTOP=1 -DHAS_MSGHDR_FLAGS=1 -DHAS_SOCKLEN_T=1
70 DEPDIR = .deps
71 ECHO_C =
72 ECHO_N = -n
73 ECHO_T =
74 EGREP = grep -E
75 EXEEXT =
76 INSTALL_DATA = ${INSTALL} -m 644
77 INSTALL_PROGRAM = ${INSTALL}
78 INSTALL_SCRIPT = ${INSTALL}
79 INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s
80 LDFLAGS =
81 LIBOBJS =
82 LIBS =
83 LTLIBOBJS =
84 MAKEINFO = makeinfo
85 OBJEXT = o
86 PACKAGE = libenet.a
87 PACKAGE_BUGREPORT =
88 PACKAGE_NAME = libenet
89 PACKAGE_STRING = libenet 1.0
90 PACKAGE_TARNAME = libenet
91 PACKAGE_VERSION = 1.0
92 PATH_SEPARATOR = :
93 RANLIB = ranlib
94 SET_MAKE =
95 SHELL = /bin/sh
96 STRIP =
97 VERSION = 1.0
98 ac_ct_CC = gcc
99 ac_ct_RANLIB = ranlib
100 ac_ct_STRIP =
101 am__fastdepCC_FALSE = #
102 am__fastdepCC_TRUE =
103 am__include = include
104 am__leading_dot = .
105 am__quote =
106 am__tar = ${AMTAR} chof - "$$tardir"
107 am__untar = ${AMTAR} xf -
108 bindir = ${exec_prefix}/bin
109 build_alias =
110 datadir = ${prefix}/share
111 exec_prefix = ${prefix}
112 host_alias =
113 includedir = ${prefix}/include
114 infodir = ${prefix}/info
115 install_sh = /home/poul/blockattack-1.3.0/enet-1.0/install-sh
116 libdir = ${exec_prefix}/lib
117 libexecdir = ${exec_prefix}/libexec
118 localstatedir = ${prefix}/var
119 mandir = ${prefix}/man
120 mkdir_p = mkdir -p --
121 oldincludedir = /usr/include
122 prefix = /usr/local
123 program_transform_name = s,x,x,
124 sbindir = ${exec_prefix}/sbin
125 sharedstatedir = ${prefix}/com
126 sysconfdir = ${prefix}/etc
127 target_alias =
128 SUBDIRS = enet
129 all: all-recursive
130
131 .SUFFIXES:
132 $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
133 @for dep in $?; do \
134 case '$(am__configure_deps)' in \
135 *$$dep*) \
136 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
137 && exit 0; \
138 exit 1;; \
139 esac; \
140 done; \
141 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/Makefile'; \
142 cd $(top_srcdir) && \
143 $(AUTOMAKE) --foreign include/Makefile
144 .PRECIOUS: Makefile
145 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
146 @case '$?' in \
147 *config.status*) \
148 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
149 *) \
150 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
151 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
152 esac;
153
154 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
155 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
156
157 $(top_srcdir)/configure: $(am__configure_deps)
158 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
159 $(ACLOCAL_M4): $(am__aclocal_m4_deps)
160 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
161 uninstall-info-am:
162
163 # This directory's subdirectories are mostly independent; you can cd
164 # into them and run `make' without going through this Makefile.
165 # To change the values of `make' variables: instead of editing Makefiles,
166 # (1) if the variable is set in `config.status', edit `config.status'
167 # (which will cause the Makefiles to be regenerated when you run `make');
168 # (2) otherwise, pass the desired values on the `make' command line.
169 $(RECURSIVE_TARGETS):
170 @set fnord $$MAKEFLAGS; amf=$$2; \
171 dot_seen=no; \
172 target=`echo $@ | sed s/-recursive//`; \
173 list='$(SUBDIRS)'; for subdir in $$list; do \
174 echo "Making $$target in $$subdir"; \
175 if test "$$subdir" = "."; then \
176 dot_seen=yes; \
177 local_target="$$target-am"; \
178 else \
179 local_target="$$target"; \
180 fi; \
181 (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
182 || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
183 done; \
184 if test "$$dot_seen" = "no"; then \
185 $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
186 fi; test -z "$$fail"
187
188 mostlyclean-recursive clean-recursive distclean-recursive \
189 maintainer-clean-recursive:
190 @set fnord $$MAKEFLAGS; amf=$$2; \
191 dot_seen=no; \
192 case "$@" in \
193 distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
194 *) list='$(SUBDIRS)' ;; \
195 esac; \
196 rev=''; for subdir in $$list; do \
197 if test "$$subdir" = "."; then :; else \
198 rev="$$subdir $$rev"; \
199 fi; \
200 done; \
201 rev="$$rev ."; \
202 target=`echo $@ | sed s/-recursive//`; \
203 for subdir in $$rev; do \
204 echo "Making $$target in $$subdir"; \
205 if test "$$subdir" = "."; then \
206 local_target="$$target-am"; \
207 else \
208 local_target="$$target"; \
209 fi; \
210 (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
211 || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
212 done && test -z "$$fail"
213 tags-recursive:
214 list='$(SUBDIRS)'; for subdir in $$list; do \
215 test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
216 done
217 ctags-recursive:
218 list='$(SUBDIRS)'; for subdir in $$list; do \
219 test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
220 done
221
222 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
223 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
224 unique=`for i in $$list; do \
225 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
226 done | \
227 $(AWK) ' { files[$$0] = 1; } \
228 END { for (i in files) print i; }'`; \
229 mkid -fID $$unique
230 tags: TAGS
231
232 TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
233 $(TAGS_FILES) $(LISP)
234 tags=; \
235 here=`pwd`; \
236 if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
237 include_option=--etags-include; \
238 empty_fix=.; \
239 else \
240 include_option=--include; \
241 empty_fix=; \
242 fi; \
243 list='$(SUBDIRS)'; for subdir in $$list; do \
244 if test "$$subdir" = .; then :; else \
245 test ! -f $$subdir/TAGS || \
246 tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
247 fi; \
248 done; \
249 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
250 unique=`for i in $$list; do \
251 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
252 done | \
253 $(AWK) ' { files[$$0] = 1; } \
254 END { for (i in files) print i; }'`; \
255 if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
256 test -n "$$unique" || unique=$$empty_fix; \
257 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
258 $$tags $$unique; \
259 fi
260 ctags: CTAGS
261 CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
262 $(TAGS_FILES) $(LISP)
263 tags=; \
264 here=`pwd`; \
265 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
266 unique=`for i in $$list; do \
267 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
268 done | \
269 $(AWK) ' { files[$$0] = 1; } \
270 END { for (i in files) print i; }'`; \
271 test -z "$(CTAGS_ARGS)$$tags$$unique" \
272 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
273 $$tags $$unique
274
275 GTAGS:
276 here=`$(am__cd) $(top_builddir) && pwd` \
277 && cd $(top_srcdir) \
278 && gtags -i $(GTAGS_ARGS) $$here
279
280 distclean-tags:
281 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
282
283 distdir: $(DISTFILES)
284 @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
285 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
286 list='$(DISTFILES)'; for file in $$list; do \
287 case $$file in \
288 $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
289 $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
290 esac; \
291 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
292 dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
293 if test "$$dir" != "$$file" && test "$$dir" != "."; then \
294 dir="/$$dir"; \
295 $(mkdir_p) "$(distdir)$$dir"; \
296 else \
297 dir=''; \
298 fi; \
299 if test -d $$d/$$file; then \
300 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
301 cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
302 fi; \
303 cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
304 else \
305 test -f $(distdir)/$$file \
306 || cp -p $$d/$$file $(distdir)/$$file \
307 || exit 1; \
308 fi; \
309 done
310 list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
311 if test "$$subdir" = .; then :; else \
312 test -d "$(distdir)/$$subdir" \
313 || $(mkdir_p) "$(distdir)/$$subdir" \
314 || exit 1; \
315 distdir=`$(am__cd) $(distdir) && pwd`; \
316 top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
317 (cd $$subdir && \
318 $(MAKE) $(AM_MAKEFLAGS) \
319 top_distdir="$$top_distdir" \
320 distdir="$$distdir/$$subdir" \
321 distdir) \
322 || exit 1; \
323 fi; \
324 done
325 check-am: all-am
326 check: check-recursive
327 all-am: Makefile
328 installdirs: installdirs-recursive
329 installdirs-am:
330 install: install-recursive
331 install-exec: install-exec-recursive
332 install-data: install-data-recursive
333 uninstall: uninstall-recursive
334
335 install-am: all-am
336 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
337
338 installcheck: installcheck-recursive
339 install-strip:
340 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
341 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
342 `test -z '$(STRIP)' || \
343 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
344 mostlyclean-generic:
345
346 clean-generic:
347
348 distclean-generic:
349 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
350
351 maintainer-clean-generic:
352 @echo "This command is intended for maintainers to use"
353 @echo "it deletes files that may require special tools to rebuild."
354 clean: clean-recursive
355
356 clean-am: clean-generic mostlyclean-am
357
358 distclean: distclean-recursive
359 -rm -f Makefile
360 distclean-am: clean-am distclean-generic distclean-tags
361
362 dvi: dvi-recursive
363
364 dvi-am:
365
366 html: html-recursive
367
368 info: info-recursive
369
370 info-am:
371
372 install-data-am:
373
374 install-exec-am:
375
376 install-info: install-info-recursive
377
378 install-man:
379
380 installcheck-am:
381
382 maintainer-clean: maintainer-clean-recursive
383 -rm -f Makefile
384 maintainer-clean-am: distclean-am maintainer-clean-generic
385
386 mostlyclean: mostlyclean-recursive
387
388 mostlyclean-am: mostlyclean-generic
389
390 pdf: pdf-recursive
391
392 pdf-am:
393
394 ps: ps-recursive
395
396 ps-am:
397
398 uninstall-am: uninstall-info-am
399
400 uninstall-info: uninstall-info-recursive
401
402 .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
403 clean clean-generic clean-recursive ctags ctags-recursive \
404 distclean distclean-generic distclean-recursive distclean-tags \
405 distdir dvi dvi-am html html-am info info-am install \
406 install-am install-data install-data-am install-exec \
407 install-exec-am install-info install-info-am install-man \
408 install-strip installcheck installcheck-am installdirs \
409 installdirs-am maintainer-clean maintainer-clean-generic \
410 maintainer-clean-recursive mostlyclean mostlyclean-generic \
411 mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
412 uninstall uninstall-am uninstall-info-am
413
414 # Tell versions [3.59,3.63) of GNU make to not export all variables.
415 # Otherwise a system limit (for SysV at least) may be exceeded.
416 .NOEXPORT:
0 # Makefile.in generated by automake 1.9.3 from Makefile.am.
1 # @configure_input@
2
3 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
4 # 2003, 2004 Free Software Foundation, Inc.
5 # This Makefile.in is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12 # PARTICULAR PURPOSE.
13
14 @SET_MAKE@
15 srcdir = @srcdir@
16 top_srcdir = @top_srcdir@
17 VPATH = @srcdir@
18 pkgdatadir = $(datadir)/@PACKAGE@
19 pkglibdir = $(libdir)/@PACKAGE@
20 pkgincludedir = $(includedir)/@PACKAGE@
21 top_builddir = ..
22 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
23 INSTALL = @INSTALL@
24 install_sh_DATA = $(install_sh) -c -m 644
25 install_sh_PROGRAM = $(install_sh) -c
26 install_sh_SCRIPT = $(install_sh) -c
27 INSTALL_HEADER = $(INSTALL_DATA)
28 transform = $(program_transform_name)
29 NORMAL_INSTALL = :
30 PRE_INSTALL = :
31 POST_INSTALL = :
32 NORMAL_UNINSTALL = :
33 PRE_UNINSTALL = :
34 POST_UNINSTALL = :
35 subdir = include
36 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
37 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
38 am__aclocal_m4_deps = $(top_srcdir)/configure.in
39 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
40 $(ACLOCAL_M4)
41 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
42 CONFIG_CLEAN_FILES =
43 SOURCES =
44 DIST_SOURCES =
45 RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
46 html-recursive info-recursive install-data-recursive \
47 install-exec-recursive install-info-recursive \
48 install-recursive installcheck-recursive installdirs-recursive \
49 pdf-recursive ps-recursive uninstall-info-recursive \
50 uninstall-recursive
51 ETAGS = etags
52 CTAGS = ctags
53 DIST_SUBDIRS = $(SUBDIRS)
54 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
55 ACLOCAL = @ACLOCAL@
56 AMDEP_FALSE = @AMDEP_FALSE@
57 AMDEP_TRUE = @AMDEP_TRUE@
58 AMTAR = @AMTAR@
59 AUTOCONF = @AUTOCONF@
60 AUTOHEADER = @AUTOHEADER@
61 AUTOMAKE = @AUTOMAKE@
62 AWK = @AWK@
63 CC = @CC@
64 CCDEPMODE = @CCDEPMODE@
65 CFLAGS = @CFLAGS@
66 CPP = @CPP@
67 CPPFLAGS = @CPPFLAGS@
68 CYGPATH_W = @CYGPATH_W@
69 DEFS = @DEFS@
70 DEPDIR = @DEPDIR@
71 ECHO_C = @ECHO_C@
72 ECHO_N = @ECHO_N@
73 ECHO_T = @ECHO_T@
74 EGREP = @EGREP@
75 EXEEXT = @EXEEXT@
76 INSTALL_DATA = @INSTALL_DATA@
77 INSTALL_PROGRAM = @INSTALL_PROGRAM@
78 INSTALL_SCRIPT = @INSTALL_SCRIPT@
79 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
80 LDFLAGS = @LDFLAGS@
81 LIBOBJS = @LIBOBJS@
82 LIBS = @LIBS@
83 LTLIBOBJS = @LTLIBOBJS@
84 MAKEINFO = @MAKEINFO@
85 OBJEXT = @OBJEXT@
86 PACKAGE = @PACKAGE@
87 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
88 PACKAGE_NAME = @PACKAGE_NAME@
89 PACKAGE_STRING = @PACKAGE_STRING@
90 PACKAGE_TARNAME = @PACKAGE_TARNAME@
91 PACKAGE_VERSION = @PACKAGE_VERSION@
92 PATH_SEPARATOR = @PATH_SEPARATOR@
93 RANLIB = @RANLIB@
94 SET_MAKE = @SET_MAKE@
95 SHELL = @SHELL@
96 STRIP = @STRIP@
97 VERSION = @VERSION@
98 ac_ct_CC = @ac_ct_CC@
99 ac_ct_RANLIB = @ac_ct_RANLIB@
100 ac_ct_STRIP = @ac_ct_STRIP@
101 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
102 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
103 am__include = @am__include@
104 am__leading_dot = @am__leading_dot@
105 am__quote = @am__quote@
106 am__tar = @am__tar@
107 am__untar = @am__untar@
108 bindir = @bindir@
109 build_alias = @build_alias@
110 datadir = @datadir@
111 exec_prefix = @exec_prefix@
112 host_alias = @host_alias@
113 includedir = @includedir@
114 infodir = @infodir@
115 install_sh = @install_sh@
116 libdir = @libdir@
117 libexecdir = @libexecdir@
118 localstatedir = @localstatedir@
119 mandir = @mandir@
120 mkdir_p = @mkdir_p@
121 oldincludedir = @oldincludedir@
122 prefix = @prefix@
123 program_transform_name = @program_transform_name@
124 sbindir = @sbindir@
125 sharedstatedir = @sharedstatedir@
126 sysconfdir = @sysconfdir@
127 target_alias = @target_alias@
128 SUBDIRS = enet
129 all: all-recursive
130
131 .SUFFIXES:
132 $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
133 @for dep in $?; do \
134 case '$(am__configure_deps)' in \
135 *$$dep*) \
136 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
137 && exit 0; \
138 exit 1;; \
139 esac; \
140 done; \
141 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/Makefile'; \
142 cd $(top_srcdir) && \
143 $(AUTOMAKE) --foreign include/Makefile
144 .PRECIOUS: Makefile
145 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
146 @case '$?' in \
147 *config.status*) \
148 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
149 *) \
150 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
151 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
152 esac;
153
154 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
155 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
156
157 $(top_srcdir)/configure: $(am__configure_deps)
158 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
159 $(ACLOCAL_M4): $(am__aclocal_m4_deps)
160 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
161 uninstall-info-am:
162
163 # This directory's subdirectories are mostly independent; you can cd
164 # into them and run `make' without going through this Makefile.
165 # To change the values of `make' variables: instead of editing Makefiles,
166 # (1) if the variable is set in `config.status', edit `config.status'
167 # (which will cause the Makefiles to be regenerated when you run `make');
168 # (2) otherwise, pass the desired values on the `make' command line.
169 $(RECURSIVE_TARGETS):
170 @set fnord $$MAKEFLAGS; amf=$$2; \
171 dot_seen=no; \
172 target=`echo $@ | sed s/-recursive//`; \
173 list='$(SUBDIRS)'; for subdir in $$list; do \
174 echo "Making $$target in $$subdir"; \
175 if test "$$subdir" = "."; then \
176 dot_seen=yes; \
177 local_target="$$target-am"; \
178 else \
179 local_target="$$target"; \
180 fi; \
181 (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
182 || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
183 done; \
184 if test "$$dot_seen" = "no"; then \
185 $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
186 fi; test -z "$$fail"
187
188 mostlyclean-recursive clean-recursive distclean-recursive \
189 maintainer-clean-recursive:
190 @set fnord $$MAKEFLAGS; amf=$$2; \
191 dot_seen=no; \
192 case "$@" in \
193 distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
194 *) list='$(SUBDIRS)' ;; \
195 esac; \
196 rev=''; for subdir in $$list; do \
197 if test "$$subdir" = "."; then :; else \
198 rev="$$subdir $$rev"; \
199 fi; \
200 done; \
201 rev="$$rev ."; \
202 target=`echo $@ | sed s/-recursive//`; \
203 for subdir in $$rev; do \
204 echo "Making $$target in $$subdir"; \
205 if test "$$subdir" = "."; then \
206 local_target="$$target-am"; \
207 else \
208 local_target="$$target"; \
209 fi; \
210 (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
211 || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
212 done && test -z "$$fail"
213 tags-recursive:
214 list='$(SUBDIRS)'; for subdir in $$list; do \
215 test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
216 done
217 ctags-recursive:
218 list='$(SUBDIRS)'; for subdir in $$list; do \
219 test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
220 done
221
222 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
223 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
224 unique=`for i in $$list; do \
225 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
226 done | \
227 $(AWK) ' { files[$$0] = 1; } \
228 END { for (i in files) print i; }'`; \
229 mkid -fID $$unique
230 tags: TAGS
231
232 TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
233 $(TAGS_FILES) $(LISP)
234 tags=; \
235 here=`pwd`; \
236 if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
237 include_option=--etags-include; \
238 empty_fix=.; \
239 else \
240 include_option=--include; \
241 empty_fix=; \
242 fi; \
243 list='$(SUBDIRS)'; for subdir in $$list; do \
244 if test "$$subdir" = .; then :; else \
245 test ! -f $$subdir/TAGS || \
246 tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
247 fi; \
248 done; \
249 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
250 unique=`for i in $$list; do \
251 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
252 done | \
253 $(AWK) ' { files[$$0] = 1; } \
254 END { for (i in files) print i; }'`; \
255 if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
256 test -n "$$unique" || unique=$$empty_fix; \
257 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
258 $$tags $$unique; \
259 fi
260 ctags: CTAGS
261 CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
262 $(TAGS_FILES) $(LISP)
263 tags=; \
264 here=`pwd`; \
265 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
266 unique=`for i in $$list; do \
267 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
268 done | \
269 $(AWK) ' { files[$$0] = 1; } \
270 END { for (i in files) print i; }'`; \
271 test -z "$(CTAGS_ARGS)$$tags$$unique" \
272 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
273 $$tags $$unique
274
275 GTAGS:
276 here=`$(am__cd) $(top_builddir) && pwd` \
277 && cd $(top_srcdir) \
278 && gtags -i $(GTAGS_ARGS) $$here
279
280 distclean-tags:
281 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
282
283 distdir: $(DISTFILES)
284 @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
285 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
286 list='$(DISTFILES)'; for file in $$list; do \
287 case $$file in \
288 $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
289 $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
290 esac; \
291 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
292 dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
293 if test "$$dir" != "$$file" && test "$$dir" != "."; then \
294 dir="/$$dir"; \
295 $(mkdir_p) "$(distdir)$$dir"; \
296 else \
297 dir=''; \
298 fi; \
299 if test -d $$d/$$file; then \
300 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
301 cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
302 fi; \
303 cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
304 else \
305 test -f $(distdir)/$$file \
306 || cp -p $$d/$$file $(distdir)/$$file \
307 || exit 1; \
308 fi; \
309 done
310 list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
311 if test "$$subdir" = .; then :; else \
312 test -d "$(distdir)/$$subdir" \
313 || $(mkdir_p) "$(distdir)/$$subdir" \
314 || exit 1; \
315 distdir=`$(am__cd) $(distdir) && pwd`; \
316 top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
317 (cd $$subdir && \
318 $(MAKE) $(AM_MAKEFLAGS) \
319 top_distdir="$$top_distdir" \
320 distdir="$$distdir/$$subdir" \
321 distdir) \
322 || exit 1; \
323 fi; \
324 done
325 check-am: all-am
326 check: check-recursive
327 all-am: Makefile
328 installdirs: installdirs-recursive
329 installdirs-am:
330 install: install-recursive
331 install-exec: install-exec-recursive
332 install-data: install-data-recursive
333 uninstall: uninstall-recursive
334
335 install-am: all-am
336 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
337
338 installcheck: installcheck-recursive
339 install-strip:
340 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
341 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
342 `test -z '$(STRIP)' || \
343 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
344 mostlyclean-generic:
345
346 clean-generic:
347
348 distclean-generic:
349 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
350
351 maintainer-clean-generic:
352 @echo "This command is intended for maintainers to use"
353 @echo "it deletes files that may require special tools to rebuild."
354 clean: clean-recursive
355
356 clean-am: clean-generic mostlyclean-am
357
358 distclean: distclean-recursive
359 -rm -f Makefile
360 distclean-am: clean-am distclean-generic distclean-tags
361
362 dvi: dvi-recursive
363
364 dvi-am:
365
366 html: html-recursive
367
368 info: info-recursive
369
370 info-am:
371
372 install-data-am:
373
374 install-exec-am:
375
376 install-info: install-info-recursive
377
378 install-man:
379
380 installcheck-am:
381
382 maintainer-clean: maintainer-clean-recursive
383 -rm -f Makefile
384 maintainer-clean-am: distclean-am maintainer-clean-generic
385
386 mostlyclean: mostlyclean-recursive
387
388 mostlyclean-am: mostlyclean-generic
389
390 pdf: pdf-recursive
391
392 pdf-am:
393
394 ps: ps-recursive
395
396 ps-am:
397
398 uninstall-am: uninstall-info-am
399
400 uninstall-info: uninstall-info-recursive
401
402 .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
403 clean clean-generic clean-recursive ctags ctags-recursive \
404 distclean distclean-generic distclean-recursive distclean-tags \
405 distdir dvi dvi-am html html-am info info-am install \
406 install-am install-data install-data-am install-exec \
407 install-exec-am install-info install-info-am install-man \
408 install-strip installcheck installcheck-am installdirs \
409 installdirs-am maintainer-clean maintainer-clean-generic \
410 maintainer-clean-recursive mostlyclean mostlyclean-generic \
411 mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
412 uninstall uninstall-am uninstall-info-am
413
414 # Tell versions [3.59,3.63) of GNU make to not export all variables.
415 # Otherwise a system limit (for SysV at least) may be exceeded.
416 .NOEXPORT:
0 /Makefile.am/1.1.1.1/Tue Mar 14 23:32:27 2006//
1 /callbacks.h/1.1.1.1/Tue Mar 14 23:32:27 2006//
2 /enet.h/1.8/Tue Mar 14 23:32:27 2006//
3 /list.h/1.1.1.1/Tue Mar 14 23:32:27 2006//
4 /protocol.h/1.2/Tue Mar 14 23:32:27 2006//
5 /time.h/1.1.1.1/Tue Mar 14 23:32:27 2006//
6 /types.h/1.1.1.1/Tue Mar 14 23:32:27 2006//
7 /unix.h/1.1.1.1/Tue Mar 14 23:32:27 2006//
8 /utility.h/1.1.1.1/Tue Mar 14 23:32:27 2006//
9 /win32.h/1.3/Tue Mar 14 23:32:27 2006//
10 D
0 :pserver:anonymous@bespin.org:/var/lib/cvs/enet
0 # Makefile.in generated by automake 1.9.3 from Makefile.am.
1 # include/enet/Makefile. Generated from Makefile.in by configure.
2
3 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
4 # 2003, 2004 Free Software Foundation, Inc.
5 # This Makefile.in is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12 # PARTICULAR PURPOSE.
13
14
15
16 srcdir = .
17 top_srcdir = ../..
18
19 pkgdatadir = $(datadir)/libenet.a
20 pkglibdir = $(libdir)/libenet.a
21 pkgincludedir = $(includedir)/libenet.a
22 top_builddir = ../..
23 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
24 INSTALL = /usr/bin/install -c
25 install_sh_DATA = $(install_sh) -c -m 644
26 install_sh_PROGRAM = $(install_sh) -c
27 install_sh_SCRIPT = $(install_sh) -c
28 INSTALL_HEADER = $(INSTALL_DATA)
29 transform = $(program_transform_name)
30 NORMAL_INSTALL = :
31 PRE_INSTALL = :
32 POST_INSTALL = :
33 NORMAL_UNINSTALL = :
34 PRE_UNINSTALL = :
35 POST_UNINSTALL = :
36 subdir = include/enet
37 DIST_COMMON = $(libenetinclude_HEADERS) $(srcdir)/Makefile.am \
38 $(srcdir)/Makefile.in
39 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
40 am__aclocal_m4_deps = $(top_srcdir)/configure.in
41 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
42 $(ACLOCAL_M4)
43 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
44 CONFIG_CLEAN_FILES =
45 SOURCES =
46 DIST_SOURCES =
47 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
48 am__vpath_adj = case $$p in \
49 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
50 *) f=$$p;; \
51 esac;
52 am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
53 am__installdirs = "$(DESTDIR)$(libenetincludedir)"
54 libenetincludeHEADERS_INSTALL = $(INSTALL_HEADER)
55 HEADERS = $(libenetinclude_HEADERS)
56 ETAGS = etags
57 CTAGS = ctags
58 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
59 ACLOCAL = aclocal-1.9
60 AMDEP_FALSE = #
61 AMDEP_TRUE =
62 AMTAR = tar
63 AUTOCONF = autoconf
64 AUTOHEADER = autoheader
65 AUTOMAKE = automake-1.9
66 AWK = gawk
67 CC = gcc
68 CCDEPMODE = depmode=gcc3
69 CFLAGS = -g -O2
70 CPP = gcc -E
71 CPPFLAGS =
72 CYGPATH_W = echo
73 DEFS = -DPACKAGE_NAME=\"libenet\" -DPACKAGE_TARNAME=\"libenet\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"libenet\ 1.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"libenet.a\" -DVERSION=\"1.0\" -DHAS_GETHOSTBYADDR_R=1 -DHAS_GETHOSTBYNAME_R=1 -DHAS_POLL=1 -DHAS_FCNTL=1 -DHAS_INET_PTON=1 -DHAS_INET_NTOP=1 -DHAS_MSGHDR_FLAGS=1 -DHAS_SOCKLEN_T=1
74 DEPDIR = .deps
75 ECHO_C =
76 ECHO_N = -n
77 ECHO_T =
78 EGREP = grep -E
79 EXEEXT =
80 INSTALL_DATA = ${INSTALL} -m 644
81 INSTALL_PROGRAM = ${INSTALL}
82 INSTALL_SCRIPT = ${INSTALL}
83 INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s
84 LDFLAGS =
85 LIBOBJS =
86 LIBS =
87 LTLIBOBJS =
88 MAKEINFO = makeinfo
89 OBJEXT = o
90 PACKAGE = libenet.a
91 PACKAGE_BUGREPORT =
92 PACKAGE_NAME = libenet
93 PACKAGE_STRING = libenet 1.0
94 PACKAGE_TARNAME = libenet
95 PACKAGE_VERSION = 1.0
96 PATH_SEPARATOR = :
97 RANLIB = ranlib
98 SET_MAKE =
99 SHELL = /bin/sh
100 STRIP =
101 VERSION = 1.0
102 ac_ct_CC = gcc
103 ac_ct_RANLIB = ranlib
104 ac_ct_STRIP =
105 am__fastdepCC_FALSE = #
106 am__fastdepCC_TRUE =
107 am__include = include
108 am__leading_dot = .
109 am__quote =
110 am__tar = ${AMTAR} chof - "$$tardir"
111 am__untar = ${AMTAR} xf -
112 bindir = ${exec_prefix}/bin
113 build_alias =
114 datadir = ${prefix}/share
115 exec_prefix = ${prefix}
116 host_alias =
117 includedir = ${prefix}/include
118 infodir = ${prefix}/info
119 install_sh = /home/poul/blockattack-1.3.0/enet-1.0/install-sh
120 libdir = ${exec_prefix}/lib
121 libexecdir = ${exec_prefix}/libexec
122 localstatedir = ${prefix}/var
123 mandir = ${prefix}/man
124 mkdir_p = mkdir -p --
125 oldincludedir = /usr/include
126 prefix = /usr/local
127 program_transform_name = s,x,x,
128 sbindir = ${exec_prefix}/sbin
129 sharedstatedir = ${prefix}/com
130 sysconfdir = ${prefix}/etc
131 target_alias =
132 libenetincludedir = $(includedir)/enet
133 libenetinclude_HEADERS = \
134 types.h \
135 list.h \
136 utility.h \
137 time.h \
138 callbacks.h \
139 unix.h \
140 win32.h \
141 protocol.h \
142 enet.h
143
144 all: all-am
145
146 .SUFFIXES:
147 $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
148 @for dep in $?; do \
149 case '$(am__configure_deps)' in \
150 *$$dep*) \
151 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
152 && exit 0; \
153 exit 1;; \
154 esac; \
155 done; \
156 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/enet/Makefile'; \
157 cd $(top_srcdir) && \
158 $(AUTOMAKE) --foreign include/enet/Makefile
159 .PRECIOUS: Makefile
160 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
161 @case '$?' in \
162 *config.status*) \
163 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
164 *) \
165 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
166 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
167 esac;
168
169 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
170 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
171
172 $(top_srcdir)/configure: $(am__configure_deps)
173 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
174 $(ACLOCAL_M4): $(am__aclocal_m4_deps)
175 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
176 uninstall-info-am:
177 install-libenetincludeHEADERS: $(libenetinclude_HEADERS)
178 @$(NORMAL_INSTALL)
179 test -z "$(libenetincludedir)" || $(mkdir_p) "$(DESTDIR)$(libenetincludedir)"
180 @list='$(libenetinclude_HEADERS)'; for p in $$list; do \
181 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
182 f=$(am__strip_dir) \
183 echo " $(libenetincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(libenetincludedir)/$$f'"; \
184 $(libenetincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(libenetincludedir)/$$f"; \
185 done
186
187 uninstall-libenetincludeHEADERS:
188 @$(NORMAL_UNINSTALL)
189 @list='$(libenetinclude_HEADERS)'; for p in $$list; do \
190 f=$(am__strip_dir) \
191 echo " rm -f '$(DESTDIR)$(libenetincludedir)/$$f'"; \
192 rm -f "$(DESTDIR)$(libenetincludedir)/$$f"; \
193 done
194
195 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
196 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
197 unique=`for i in $$list; do \
198 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
199 done | \
200 $(AWK) ' { files[$$0] = 1; } \
201 END { for (i in files) print i; }'`; \
202 mkid -fID $$unique
203 tags: TAGS
204
205 TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
206 $(TAGS_FILES) $(LISP)
207 tags=; \
208 here=`pwd`; \
209 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
210 unique=`for i in $$list; do \
211 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
212 done | \
213 $(AWK) ' { files[$$0] = 1; } \
214 END { for (i in files) print i; }'`; \
215 if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
216 test -n "$$unique" || unique=$$empty_fix; \
217 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
218 $$tags $$unique; \
219 fi
220 ctags: CTAGS
221 CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
222 $(TAGS_FILES) $(LISP)
223 tags=; \
224 here=`pwd`; \
225 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
226 unique=`for i in $$list; do \
227 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
228 done | \
229 $(AWK) ' { files[$$0] = 1; } \
230 END { for (i in files) print i; }'`; \
231 test -z "$(CTAGS_ARGS)$$tags$$unique" \
232 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
233 $$tags $$unique
234
235 GTAGS:
236 here=`$(am__cd) $(top_builddir) && pwd` \
237 && cd $(top_srcdir) \
238 && gtags -i $(GTAGS_ARGS) $$here
239
240 distclean-tags:
241 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
242
243 distdir: $(DISTFILES)
244 @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
245 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
246 list='$(DISTFILES)'; for file in $$list; do \
247 case $$file in \
248 $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
249 $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
250 esac; \
251 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
252 dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
253 if test "$$dir" != "$$file" && test "$$dir" != "."; then \
254 dir="/$$dir"; \
255 $(mkdir_p) "$(distdir)$$dir"; \
256 else \
257 dir=''; \
258 fi; \
259 if test -d $$d/$$file; then \
260 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
261 cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
262 fi; \
263 cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
264 else \
265 test -f $(distdir)/$$file \
266 || cp -p $$d/$$file $(distdir)/$$file \
267 || exit 1; \
268 fi; \
269 done
270 check-am: all-am
271 check: check-am
272 all-am: Makefile $(HEADERS)
273 installdirs:
274 for dir in "$(DESTDIR)$(libenetincludedir)"; do \
275 test -z "$$dir" || $(mkdir_p) "$$dir"; \
276 done
277 install: install-am
278 install-exec: install-exec-am
279 install-data: install-data-am
280 uninstall: uninstall-am
281
282 install-am: all-am
283 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
284
285 installcheck: installcheck-am
286 install-strip:
287 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
288 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
289 `test -z '$(STRIP)' || \
290 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
291 mostlyclean-generic:
292
293 clean-generic:
294
295 distclean-generic:
296 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
297
298 maintainer-clean-generic:
299 @echo "This command is intended for maintainers to use"
300 @echo "it deletes files that may require special tools to rebuild."
301 clean: clean-am
302
303 clean-am: clean-generic mostlyclean-am
304
305 distclean: distclean-am
306 -rm -f Makefile
307 distclean-am: clean-am distclean-generic distclean-tags
308
309 dvi: dvi-am
310
311 dvi-am:
312
313 html: html-am
314
315 info: info-am
316
317 info-am:
318
319 install-data-am: install-libenetincludeHEADERS
320
321 install-exec-am:
322
323 install-info: install-info-am
324
325 install-man:
326
327 installcheck-am:
328
329 maintainer-clean: maintainer-clean-am
330 -rm -f Makefile
331 maintainer-clean-am: distclean-am maintainer-clean-generic
332
333 mostlyclean: mostlyclean-am
334
335 mostlyclean-am: mostlyclean-generic
336
337 pdf: pdf-am
338
339 pdf-am:
340
341 ps: ps-am
342
343 ps-am:
344
345 uninstall-am: uninstall-info-am uninstall-libenetincludeHEADERS
346
347 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
348 ctags distclean distclean-generic distclean-tags distdir dvi \
349 dvi-am html html-am info info-am install install-am \
350 install-data install-data-am install-exec install-exec-am \
351 install-info install-info-am install-libenetincludeHEADERS \
352 install-man install-strip installcheck installcheck-am \
353 installdirs maintainer-clean maintainer-clean-generic \
354 mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
355 uninstall uninstall-am uninstall-info-am \
356 uninstall-libenetincludeHEADERS
357
358 # Tell versions [3.59,3.63) of GNU make to not export all variables.
359 # Otherwise a system limit (for SysV at least) may be exceeded.
360 .NOEXPORT:
0 libenetincludedir = $(includedir)/enet
1 libenetinclude_HEADERS = \
2 types.h \
3 list.h \
4 utility.h \
5 time.h \
6 callbacks.h \
7 unix.h \
8 win32.h \
9 protocol.h \
10 enet.h
11
0 # Makefile.in generated by automake 1.9.3 from Makefile.am.
1 # @configure_input@
2
3 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
4 # 2003, 2004 Free Software Foundation, Inc.
5 # This Makefile.in is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12 # PARTICULAR PURPOSE.
13
14 @SET_MAKE@
15
16 srcdir = @srcdir@
17 top_srcdir = @top_srcdir@
18 VPATH = @srcdir@
19 pkgdatadir = $(datadir)/@PACKAGE@
20 pkglibdir = $(libdir)/@PACKAGE@
21 pkgincludedir = $(includedir)/@PACKAGE@
22 top_builddir = ../..
23 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
24 INSTALL = @INSTALL@
25 install_sh_DATA = $(install_sh) -c -m 644
26 install_sh_PROGRAM = $(install_sh) -c
27 install_sh_SCRIPT = $(install_sh) -c
28 INSTALL_HEADER = $(INSTALL_DATA)
29 transform = $(program_transform_name)
30 NORMAL_INSTALL = :
31 PRE_INSTALL = :
32 POST_INSTALL = :
33 NORMAL_UNINSTALL = :
34 PRE_UNINSTALL = :
35 POST_UNINSTALL = :
36 subdir = include/enet
37 DIST_COMMON = $(libenetinclude_HEADERS) $(srcdir)/Makefile.am \
38 $(srcdir)/Makefile.in
39 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
40 am__aclocal_m4_deps = $(top_srcdir)/configure.in
41 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
42 $(ACLOCAL_M4)
43 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
44 CONFIG_CLEAN_FILES =
45 SOURCES =
46 DIST_SOURCES =
47 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
48 am__vpath_adj = case $$p in \
49 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
50 *) f=$$p;; \
51 esac;
52 am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
53 am__installdirs = "$(DESTDIR)$(libenetincludedir)"
54 libenetincludeHEADERS_INSTALL = $(INSTALL_HEADER)
55 HEADERS = $(libenetinclude_HEADERS)
56 ETAGS = etags
57 CTAGS = ctags
58 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
59 ACLOCAL = @ACLOCAL@
60 AMDEP_FALSE = @AMDEP_FALSE@
61 AMDEP_TRUE = @AMDEP_TRUE@
62 AMTAR = @AMTAR@
63 AUTOCONF = @AUTOCONF@
64 AUTOHEADER = @AUTOHEADER@
65 AUTOMAKE = @AUTOMAKE@
66 AWK = @AWK@
67 CC = @CC@
68 CCDEPMODE = @CCDEPMODE@
69 CFLAGS = @CFLAGS@
70 CPP = @CPP@
71 CPPFLAGS = @CPPFLAGS@
72 CYGPATH_W = @CYGPATH_W@
73 DEFS = @DEFS@
74 DEPDIR = @DEPDIR@
75 ECHO_C = @ECHO_C@
76 ECHO_N = @ECHO_N@
77 ECHO_T = @ECHO_T@
78 EGREP = @EGREP@
79 EXEEXT = @EXEEXT@
80 INSTALL_DATA = @INSTALL_DATA@
81 INSTALL_PROGRAM = @INSTALL_PROGRAM@
82 INSTALL_SCRIPT = @INSTALL_SCRIPT@
83 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
84 LDFLAGS = @LDFLAGS@
85 LIBOBJS = @LIBOBJS@
86 LIBS = @LIBS@
87 LTLIBOBJS = @LTLIBOBJS@
88 MAKEINFO = @MAKEINFO@
89 OBJEXT = @OBJEXT@
90 PACKAGE = @PACKAGE@
91 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
92 PACKAGE_NAME = @PACKAGE_NAME@
93 PACKAGE_STRING = @PACKAGE_STRING@
94 PACKAGE_TARNAME = @PACKAGE_TARNAME@
95 PACKAGE_VERSION = @PACKAGE_VERSION@
96 PATH_SEPARATOR = @PATH_SEPARATOR@
97 RANLIB = @RANLIB@
98 SET_MAKE = @SET_MAKE@
99 SHELL = @SHELL@
100 STRIP = @STRIP@
101 VERSION = @VERSION@
102 ac_ct_CC = @ac_ct_CC@
103 ac_ct_RANLIB = @ac_ct_RANLIB@
104 ac_ct_STRIP = @ac_ct_STRIP@
105 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
106 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
107 am__include = @am__include@
108 am__leading_dot = @am__leading_dot@
109 am__quote = @am__quote@
110 am__tar = @am__tar@
111 am__untar = @am__untar@
112 bindir = @bindir@
113 build_alias = @build_alias@
114 datadir = @datadir@
115 exec_prefix = @exec_prefix@
116 host_alias = @host_alias@
117 includedir = @includedir@
118 infodir = @infodir@
119 install_sh = @install_sh@
120 libdir = @libdir@
121 libexecdir = @libexecdir@
122 localstatedir = @localstatedir@
123 mandir = @mandir@
124 mkdir_p = @mkdir_p@
125 oldincludedir = @oldincludedir@
126 prefix = @prefix@
127 program_transform_name = @program_transform_name@
128 sbindir = @sbindir@
129 sharedstatedir = @sharedstatedir@
130 sysconfdir = @sysconfdir@
131 target_alias = @target_alias@
132 libenetincludedir = $(includedir)/enet
133 libenetinclude_HEADERS = \
134 types.h \
135 list.h \
136 utility.h \
137 time.h \
138 callbacks.h \
139 unix.h \
140 win32.h \
141 protocol.h \
142 enet.h
143
144 all: all-am
145
146 .SUFFIXES:
147 $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
148 @for dep in $?; do \
149 case '$(am__configure_deps)' in \
150 *$$dep*) \
151 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
152 && exit 0; \
153 exit 1;; \
154 esac; \
155 done; \
156 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/enet/Makefile'; \
157 cd $(top_srcdir) && \
158 $(AUTOMAKE) --foreign include/enet/Makefile
159 .PRECIOUS: Makefile
160 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
161 @case '$?' in \
162 *config.status*) \
163 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
164 *) \
165 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
166 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
167 esac;
168
169 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
170 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
171
172 $(top_srcdir)/configure: $(am__configure_deps)
173 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
174 $(ACLOCAL_M4): $(am__aclocal_m4_deps)
175 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
176 uninstall-info-am:
177 install-libenetincludeHEADERS: $(libenetinclude_HEADERS)
178 @$(NORMAL_INSTALL)
179 test -z "$(libenetincludedir)" || $(mkdir_p) "$(DESTDIR)$(libenetincludedir)"
180 @list='$(libenetinclude_HEADERS)'; for p in $$list; do \
181 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
182 f=$(am__strip_dir) \
183 echo " $(libenetincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(libenetincludedir)/$$f'"; \
184 $(libenetincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(libenetincludedir)/$$f"; \
185 done
186
187 uninstall-libenetincludeHEADERS:
188 @$(NORMAL_UNINSTALL)
189 @list='$(libenetinclude_HEADERS)'; for p in $$list; do \
190 f=$(am__strip_dir) \
191 echo " rm -f '$(DESTDIR)$(libenetincludedir)/$$f'"; \
192 rm -f "$(DESTDIR)$(libenetincludedir)/$$f"; \
193 done
194
195 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
196 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
197 unique=`for i in $$list; do \
198 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
199 done | \
200 $(AWK) ' { files[$$0] = 1; } \
201 END { for (i in files) print i; }'`; \
202 mkid -fID $$unique
203 tags: TAGS
204
205 TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
206 $(TAGS_FILES) $(LISP)
207 tags=; \
208 here=`pwd`; \
209 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
210 unique=`for i in $$list; do \
211 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
212 done | \
213 $(AWK) ' { files[$$0] = 1; } \
214 END { for (i in files) print i; }'`; \
215 if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
216 test -n "$$unique" || unique=$$empty_fix; \
217 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
218 $$tags $$unique; \
219 fi
220 ctags: CTAGS
221 CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
222 $(TAGS_FILES) $(LISP)
223 tags=; \
224 here=`pwd`; \
225 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
226 unique=`for i in $$list; do \
227 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
228 done | \
229 $(AWK) ' { files[$$0] = 1; } \
230 END { for (i in files) print i; }'`; \
231 test -z "$(CTAGS_ARGS)$$tags$$unique" \
232 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
233 $$tags $$unique
234
235 GTAGS:
236 here=`$(am__cd) $(top_builddir) && pwd` \
237 && cd $(top_srcdir) \
238 && gtags -i $(GTAGS_ARGS) $$here
239
240 distclean-tags:
241 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
242
243 distdir: $(DISTFILES)
244 @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
245 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
246 list='$(DISTFILES)'; for file in $$list; do \
247 case $$file in \
248 $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
249 $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
250 esac; \
251 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
252 dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
253 if test "$$dir" != "$$file" && test "$$dir" != "."; then \
254 dir="/$$dir"; \
255 $(mkdir_p) "$(distdir)$$dir"; \
256 else \
257 dir=''; \
258 fi; \
259 if test -d $$d/$$file; then \
260 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
261 cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
262 fi; \
263 cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
264 else \
265 test -f $(distdir)/$$file \
266 || cp -p $$d/$$file $(distdir)/$$file \
267 || exit 1; \
268 fi; \
269 done
270 check-am: all-am
271 check: check-am
272 all-am: Makefile $(HEADERS)
273 installdirs:
274 for dir in "$(DESTDIR)$(libenetincludedir)"; do \
275 test -z "$$dir" || $(mkdir_p) "$$dir"; \
276 done
277 install: install-am
278 install-exec: install-exec-am
279 install-data: install-data-am
280 uninstall: uninstall-am
281
282 install-am: all-am
283 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
284
285 installcheck: installcheck-am
286 install-strip:
287 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
288 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
289 `test -z '$(STRIP)' || \
290 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
291 mostlyclean-generic:
292
293 clean-generic:
294
295 distclean-generic:
296 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
297
298 maintainer-clean-generic:
299 @echo "This command is intended for maintainers to use"
300 @echo "it deletes files that may require special tools to rebuild."
301 clean: clean-am
302
303 clean-am: clean-generic mostlyclean-am
304
305 distclean: distclean-am
306 -rm -f Makefile
307 distclean-am: clean-am distclean-generic distclean-tags
308
309 dvi: dvi-am
310
311 dvi-am:
312
313 html: html-am
314
315 info: info-am
316
317 info-am:
318
319 install-data-am: install-libenetincludeHEADERS
320
321 install-exec-am:
322
323 install-info: install-info-am
324
325 install-man:
326
327 installcheck-am:
328
329 maintainer-clean: maintainer-clean-am
330 -rm -f Makefile
331 maintainer-clean-am: distclean-am maintainer-clean-generic
332
333 mostlyclean: mostlyclean-am
334
335 mostlyclean-am: mostlyclean-generic
336
337 pdf: pdf-am
338
339 pdf-am:
340
341 ps: ps-am
342
343 ps-am:
344
345 uninstall-am: uninstall-info-am uninstall-libenetincludeHEADERS
346
347 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
348 ctags distclean distclean-generic distclean-tags distdir dvi \
349 dvi-am html html-am info info-am install install-am \
350 install-data install-data-am install-exec install-exec-am \
351 install-info install-info-am install-libenetincludeHEADERS \
352 install-man install-strip installcheck installcheck-am \
353 installdirs maintainer-clean maintainer-clean-generic \
354 mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
355 uninstall uninstall-am uninstall-info-am \
356 uninstall-libenetincludeHEADERS
357
358 # Tell versions [3.59,3.63) of GNU make to not export all variables.
359 # Otherwise a system limit (for SysV at least) may be exceeded.
360 .NOEXPORT:
0 /**
1 @file callbacks.h
2 @brief ENet callbacks
3 */
4 #ifndef __ENET_CALLBACKS_H__
5 #define __ENET_CALLBACKS_H__
6
7 #include <stdlib.h>
8
9 typedef struct
10 {
11 void * (ENET_CALLBACK * malloc) (size_t size);
12 void (ENET_CALLBACK * free) (void * memory);
13 int (ENET_CALLBACK * rand) (void);
14 } ENetCallbacks;
15
16 /** @defgroup callbacks ENet internal callbacks
17 @{
18 @ingroup private
19 */
20 extern void * enet_malloc (size_t);
21 extern void enet_free (void *);
22 extern int enet_rand (void);
23
24 /** @} */
25
26 #endif /* __ENET_CALLBACKS_H__ */
27
0 /**
1 @file enet.h
2 @brief ENet public header file
3 */
4 #ifndef __ENET_ENET_H__
5 #define __ENET_ENET_H__
6
7 #ifdef __cplusplus
8 extern "C"
9 {
10 #endif
11
12 #include <stdlib.h>
13
14 #ifdef WIN32
15 #include "enet/win32.h"
16 #else
17 #include "enet/unix.h"
18 #endif
19
20 #include "enet/types.h"
21 #include "enet/protocol.h"
22 #include "enet/list.h"
23 #include "enet/callbacks.h"
24
25 typedef enum
26 {
27 ENET_VERSION = 1
28 } ENetVersion;
29
30 typedef enum
31 {
32 ENET_SOCKET_TYPE_STREAM = 1,
33 ENET_SOCKET_TYPE_DATAGRAM = 2
34 } ENetSocketType;
35
36 typedef enum
37 {
38 ENET_SOCKET_WAIT_NONE = 0,
39 ENET_SOCKET_WAIT_SEND = (1 << 0),
40 ENET_SOCKET_WAIT_RECEIVE = (1 << 1)
41 } ENetSocketWait;
42
43 enum
44 {
45 ENET_HOST_ANY = 0, /**< specifies the default server host */
46 ENET_HOST_BROADCAST = 0xFFFFFFFF /**< specifies a subnet-wide broadcast */
47 };
48
49 /**
50 * Portable internet address structure.
51 *
52 * The host must be specified in network byte-order, and the port must be in host
53 * byte-order. The constant ENET_HOST_ANY may be used to specify the default
54 * server host. The constant ENET_HOST_BROADCAST may be used to specify the
55 * broadcast address (255.255.255.255). This makes sense for enet_host_connect,
56 * but not for enet_host_create. Once a server responds to a broadcast, the
57 * address is updated from ENET_HOST_BROADCAST to the server's actual IP address.
58 */
59 typedef struct _ENetAddress
60 {
61 enet_uint32 host;
62 enet_uint16 port;
63 } ENetAddress;
64
65 /**
66 * Packet flag bit constants.
67 *
68 * The host must be specified in network byte-order, and the port must be in
69 * host byte-order. The constant ENET_HOST_ANY may be used to specify the
70 * default server host.
71
72 @sa ENetPacket
73 */
74 typedef enum
75 {
76 /** packet must be received by the target peer and resend attempts should be
77 * made until the packet is delivered */
78 ENET_PACKET_FLAG_RELIABLE = (1 << 0),
79 /** packet will not be sequenced with other packets
80 * not supported for reliable packets
81 */
82 ENET_PACKET_FLAG_UNSEQUENCED = (1 << 1)
83 } ENetPacketFlag;
84
85 /**
86 * ENet packet structure.
87 *
88 * An ENet data packet that may be sent to or received from a peer. The shown
89 * fields should only be read and never modified. The data field contains the
90 * allocated data for the packet. The dataLength fields specifies the length
91 * of the allocated data. The flags field is either 0 (specifying no flags),
92 * or a bitwise-or of any combination of the following flags:
93 *
94 * ENET_PACKET_FLAG_RELIABLE - packet must be received by the target peer
95 * and resend attempts should be made until the packet is delivered
96
97 @sa ENetPacketFlag
98 */
99 typedef struct _ENetPacket
100 {
101 size_t referenceCount; /**< internal use only */
102 enet_uint32 flags; /**< bitwise or of ENetPacketFlag constants */
103 enet_uint8 * data; /**< allocated data for packet */
104 size_t dataLength; /**< length of data */
105 } ENetPacket;
106
107 typedef struct _ENetAcknowledgement
108 {
109 ENetListNode acknowledgementList;
110 enet_uint32 sentTime;
111 ENetProtocol command;
112 } ENetAcknowledgement;
113
114 typedef struct _ENetOutgoingCommand
115 {
116 ENetListNode outgoingCommandList;
117 enet_uint32 reliableSequenceNumber;
118 enet_uint32 unreliableSequenceNumber;
119 enet_uint32 sentTime;
120 enet_uint32 roundTripTimeout;
121 enet_uint32 roundTripTimeoutLimit;
122 enet_uint32 fragmentOffset;
123 enet_uint16 fragmentLength;
124 ENetProtocol command;
125 ENetPacket * packet;
126 } ENetOutgoingCommand;
127
128 typedef struct _ENetIncomingCommand
129 {
130 ENetListNode incomingCommandList;
131 enet_uint32 reliableSequenceNumber;
132 enet_uint32 unreliableSequenceNumber;
133 ENetProtocol command;
134 enet_uint32 fragmentCount;
135 enet_uint32 fragmentsRemaining;
136 enet_uint32 * fragments;
137 ENetPacket * packet;
138 } ENetIncomingCommand;
139
140 typedef enum
141 {
142 ENET_PEER_STATE_DISCONNECTED = 0,
143 ENET_PEER_STATE_CONNECTING = 1,
144 ENET_PEER_STATE_ACKNOWLEDGING_CONNECT = 2,
145 ENET_PEER_STATE_CONNECTION_PENDING = 3,
146 ENET_PEER_STATE_CONNECTED = 4,
147 ENET_PEER_STATE_DISCONNECTING = 5,
148 ENET_PEER_STATE_ACKNOWLEDGING_DISCONNECT = 6,
149 ENET_PEER_STATE_ZOMBIE = 7
150 } ENetPeerState;
151
152 #ifndef ENET_BUFFER_MAXIMUM
153 #define ENET_BUFFER_MAXIMUM (1 + 2 * ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS)
154 #endif
155
156 enum
157 {
158 ENET_HOST_RECEIVE_BUFFER_SIZE = 256 * 1024,
159 ENET_HOST_BANDWIDTH_THROTTLE_INTERVAL = 1000,
160 ENET_HOST_DEFAULT_MTU = 1400,
161
162 ENET_PEER_DEFAULT_ROUND_TRIP_TIME = 500,
163 ENET_PEER_DEFAULT_PACKET_THROTTLE = 32,
164 ENET_PEER_PACKET_THROTTLE_SCALE = 32,
165 ENET_PEER_PACKET_THROTTLE_COUNTER = 7,
166 ENET_PEER_PACKET_THROTTLE_ACCELERATION = 2,
167 ENET_PEER_PACKET_THROTTLE_DECELERATION = 2,
168 ENET_PEER_PACKET_THROTTLE_INTERVAL = 5000,
169 ENET_PEER_PACKET_LOSS_SCALE = (1 << 16),
170 ENET_PEER_PACKET_LOSS_INTERVAL = 10000,
171 ENET_PEER_WINDOW_SIZE_SCALE = 64 * 1024,
172 ENET_PEER_TIMEOUT_LIMIT = 32,
173 ENET_PEER_TIMEOUT_MINIMUM = 5000,
174 ENET_PEER_TIMEOUT_MAXIMUM = 30000,
175 ENET_PEER_PING_INTERVAL = 500,
176 ENET_PEER_UNSEQUENCED_WINDOW_SIZE = 4 * 32,
177 };
178
179 typedef struct _ENetChannel
180 {
181 enet_uint32 outgoingReliableSequenceNumber;
182 enet_uint32 outgoingUnreliableSequenceNumber;
183 enet_uint32 incomingReliableSequenceNumber;
184 enet_uint32 incomingUnreliableSequenceNumber;
185 ENetList incomingReliableCommands;
186 ENetList incomingUnreliableCommands;
187 } ENetChannel;
188
189 /**
190 * An ENet peer which data packets may be sent or received from.
191 *
192 * No fields should be modified unless otherwise specified.
193 */
194 typedef struct _ENetPeer
195 {
196 struct _ENetHost * host;
197 enet_uint16 outgoingPeerID;
198 enet_uint16 incomingPeerID;
199 enet_uint32 challenge;
200 ENetAddress address; /**< Internet address of the peer */
201 void * data; /**< Application private data, may be freely modified */
202 ENetPeerState state;
203 ENetChannel * channels;
204 size_t channelCount; /**< Number of channels allocated for communication with peer */
205 enet_uint32 incomingBandwidth; /**< Downstream bandwidth of the client in bytes/second */
206 enet_uint32 outgoingBandwidth; /**< Upstream bandwidth of the client in bytes/second */
207 enet_uint32 incomingBandwidthThrottleEpoch;
208 enet_uint32 outgoingBandwidthThrottleEpoch;
209 enet_uint32 incomingDataTotal;
210 enet_uint32 outgoingDataTotal;
211 enet_uint32 lastSendTime;
212 enet_uint32 lastReceiveTime;
213 enet_uint32 nextTimeout;
214 enet_uint32 earliestTimeout;
215 enet_uint32 packetLossEpoch;
216 enet_uint32 packetsSent;
217 enet_uint32 packetsLost;
218 enet_uint32 packetLoss; /**< mean packet loss of reliable packets as a ratio with respect to the constant ENET_PEER_PACKET_LOSS_SCALE */
219 enet_uint32 packetLossVariance;
220 enet_uint32 packetThrottle;
221 enet_uint32 packetThrottleLimit;
222 enet_uint32 packetThrottleCounter;
223 enet_uint32 packetThrottleEpoch;
224 enet_uint32 packetThrottleAcceleration;
225 enet_uint32 packetThrottleDeceleration;
226 enet_uint32 packetThrottleInterval;
227 enet_uint32 lastRoundTripTime;
228 enet_uint32 lowestRoundTripTime;
229 enet_uint32 lastRoundTripTimeVariance;
230 enet_uint32 highestRoundTripTimeVariance;
231 enet_uint32 roundTripTime; /**< mean round trip time (RTT), in milliseconds, between sending a reliable packet and receiving its acknowledgement */
232 enet_uint32 roundTripTimeVariance;
233 enet_uint16 mtu;
234 enet_uint32 windowSize;
235 enet_uint32 reliableDataInTransit;
236 enet_uint32 outgoingReliableSequenceNumber;
237 ENetList acknowledgements;
238 ENetList sentReliableCommands;
239 ENetList sentUnreliableCommands;
240 ENetList outgoingReliableCommands;
241 ENetList outgoingUnreliableCommands;
242 enet_uint32 incomingUnsequencedGroup;
243 enet_uint32 outgoingUnsequencedGroup;
244 enet_uint32 unsequencedWindow [ENET_PEER_UNSEQUENCED_WINDOW_SIZE / 32];
245 enet_uint32 disconnectData;
246 } ENetPeer;
247
248 /** An ENet host for communicating with peers.
249 *
250 * No fields should be modified.
251
252 @sa enet_host_create()
253 @sa enet_host_destroy()
254 @sa enet_host_connect()
255 @sa enet_host_service()
256 @sa enet_host_flush()
257 @sa enet_host_broadcast()
258 @sa enet_host_bandwidth_limit()
259 @sa enet_host_bandwidth_throttle()
260 */
261 typedef struct _ENetHost
262 {
263 ENetSocket socket;
264 ENetAddress address; /**< Internet address of the host */
265 enet_uint32 incomingBandwidth; /**< downstream bandwidth of the host */
266 enet_uint32 outgoingBandwidth; /**< upstream bandwidth of the host */
267 enet_uint32 bandwidthThrottleEpoch;
268 enet_uint32 mtu;
269 int recalculateBandwidthLimits;
270 ENetPeer * peers; /**< array of peers allocated for this host */
271 size_t peerCount; /**< number of peers allocated for this host */
272 ENetPeer * lastServicedPeer;
273 size_t packetSize;
274 ENetProtocol commands [ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS];
275 size_t commandCount;
276 ENetBuffer buffers [ENET_BUFFER_MAXIMUM];
277 size_t bufferCount;
278 ENetAddress receivedAddress;
279 enet_uint8 receivedData [ENET_PROTOCOL_MAXIMUM_MTU];
280 size_t receivedDataLength;
281 } ENetHost;
282
283 /**
284 * An ENet event type, as specified in @ref ENetEvent.
285 */
286 typedef enum
287 {
288 /** no event occurred within the specified time limit */
289 ENET_EVENT_TYPE_NONE = 0,
290
291 /** a connection request initiated by enet_host_connect has completed.
292 * The peer field contains the peer which successfully connected.
293 */
294 ENET_EVENT_TYPE_CONNECT = 1,
295
296 /** a peer has disconnected. This event is generated on a successful
297 * completion of a disconnect initiated by enet_pper_disconnect, if
298 * a peer has timed out, or if a connection request intialized by
299 * enet_host_connect has timed out. The peer field contains the peer
300 * which disconnected. The data field contains user supplied data
301 * describing the disconnection, or 0, if none is available.
302 */
303 ENET_EVENT_TYPE_DISCONNECT = 2,
304
305 /** a packet has been received from a peer. The peer field specifies the
306 * peer which sent the packet. The channelID field specifies the channel
307 * number upon which the packet was received. The packet field contains
308 * the packet that was received; this packet must be destroyed with
309 * enet_packet_destroy after use.
310 */
311 ENET_EVENT_TYPE_RECEIVE = 3
312 } ENetEventType;
313
314 /**
315 * An ENet event as returned by enet_host_service().
316
317 @sa enet_host_service
318 */
319 typedef struct _ENetEvent
320 {
321 ENetEventType type; /**< type of the event */
322 ENetPeer * peer; /**< peer that generated a connect, disconnect or receive event */
323 enet_uint8 channelID; /**< channel on the peer that generated the event, if appropriate */
324 enet_uint32 data; /**< data associated with the event, if appropriate */
325 ENetPacket * packet; /**< packet associated with the event, if appropriate */
326 } ENetEvent;
327
328 /** @defgroup global ENet global functions
329 @{
330 */
331
332 /**
333 Initializes ENet globally. Must be called prior to using any functions in
334 ENet.
335 @returns 0 on success, < 0 on failure
336 */
337 ENET_API int enet_initialize (void);
338
339 ENET_API int enet_initialize_with_callbacks (ENetVersion version, const ENetCallbacks * inits);
340
341 /**
342 Shuts down ENet globally. Should be called when a program that has
343 initialized ENet exits.
344 */
345 ENET_API void enet_deinitialize (void);
346
347 /** @} */
348
349 /** @defgroup private ENet private implementation functions */
350
351 /**
352 Returns the wall-time in milliseconds. Its initial value is unspecified
353 unless otherwise set.
354 */
355 ENET_API enet_uint32 enet_time_get (void);
356 /**
357 Sets the current wall-time in milliseconds.
358 */
359 ENET_API void enet_time_set (enet_uint32);
360
361 /** @defgroup socket ENet socket functions
362 @{
363 @ingroup private
364 */
365 extern ENetSocket enet_socket_create (ENetSocketType, const ENetAddress *);
366 extern ENetSocket enet_socket_accept (ENetSocket, ENetAddress *);
367 extern int enet_socket_connect (ENetSocket, const ENetAddress *);
368 extern int enet_socket_send (ENetSocket, const ENetAddress *, const ENetBuffer *, size_t);
369 extern int enet_socket_receive (ENetSocket, ENetAddress *, ENetBuffer *, size_t);
370 extern int enet_socket_wait (ENetSocket, enet_uint32 *, enet_uint32);
371 extern void enet_socket_destroy (ENetSocket);
372
373 /** @} */
374
375 /** @defgroup Address ENet address functions
376 @{
377 */
378 /** Attempts to resolve the host named by the parameter hostName and sets
379 the host field in the address parameter if successful.
380 @param address destination to store resolved address
381 @param hostName host name to lookup
382 @retval 0 on success
383 @retval < 0 on failure
384 @returns the address of the given hostName in address on success
385 */
386 ENET_API int enet_address_set_host (ENetAddress *address, const char *hostName );
387
388 /** Attempts to do a reserve lookup of the host field in the address parameter.
389 @param address address used for reverse lookup
390 @param hostName destination for name, must not be NULL
391 @param nameLength maximum length of hostName.
392 @returns the null-terminated name of the host in hostName on success
393 @retval 0 on success
394 @retval < 0 on failure
395 */
396 ENET_API int enet_address_get_host (const ENetAddress *address, char *hostName, size_t nameLength );
397
398 /** @} */
399
400 ENET_API ENetPacket * enet_packet_create (const void *dataContents, size_t dataLength, enet_uint32 flags);
401 ENET_API void enet_packet_destroy (ENetPacket *packet );
402 ENET_API int enet_packet_resize (ENetPacket *packet, size_t dataLength );
403
404 ENET_API ENetHost * enet_host_create (const ENetAddress *address, size_t peerCount, enet_uint32 incomingBandwidth, enet_uint32 outgoingBandwidth );
405 ENET_API void enet_host_destroy (ENetHost *host );
406 ENET_API ENetPeer * enet_host_connect (ENetHost *host, const ENetAddress *address, size_t channelCount );
407 ENET_API int enet_host_service (ENetHost *, ENetEvent *, enet_uint32);
408 ENET_API void enet_host_flush (ENetHost *);
409 ENET_API void enet_host_broadcast (ENetHost *, enet_uint8, ENetPacket *);
410 ENET_API void enet_host_bandwidth_limit (ENetHost *, enet_uint32, enet_uint32);
411 extern void enet_host_bandwidth_throttle (ENetHost *);
412
413 ENET_API int enet_peer_send (ENetPeer *, enet_uint8, ENetPacket *);
414 ENET_API ENetPacket * enet_peer_receive (ENetPeer *, enet_uint8);
415 ENET_API void enet_peer_ping (ENetPeer *);
416 ENET_API void enet_peer_reset (ENetPeer *);
417 ENET_API void enet_peer_disconnect (ENetPeer *, enet_uint32);
418 ENET_API void enet_peer_disconnect_now (ENetPeer *, enet_uint32);
419 ENET_API void enet_peer_throttle_configure (ENetPeer *, enet_uint32, enet_uint32, enet_uint32);
420 extern int enet_peer_throttle (ENetPeer *, enet_uint32);
421 extern void enet_peer_reset_queues (ENetPeer *);
422 extern ENetOutgoingCommand * enet_peer_queue_outgoing_command (ENetPeer *, const ENetProtocol *, ENetPacket *, enet_uint32, enet_uint16);
423 extern ENetIncomingCommand * enet_peer_queue_incoming_command (ENetPeer *, const ENetProtocol *, ENetPacket *, enet_uint32);
424 extern ENetAcknowledgement * enet_peer_queue_acknowledgement (ENetPeer *, const ENetProtocol *, enet_uint32);
425
426 #ifdef __cplusplus
427 }
428 #endif
429
430 #endif /* __ENET_ENET_H__ */
431
0 /**
1 @file list.h
2 @brief ENet list management
3 */
4 #ifndef __ENET_LIST_H__
5 #define __ENET_LIST_H__
6
7 #include <stdlib.h>
8
9 typedef struct _ENetListNode
10 {
11 struct _ENetListNode * next;
12 struct _ENetListNode * previous;
13 } ENetListNode;
14
15 typedef ENetListNode * ENetListIterator;
16
17 typedef struct _ENetList
18 {
19 ENetListNode sentinel;
20 } ENetList;
21
22 extern void enet_list_clear (ENetList *);
23
24 extern ENetListIterator enet_list_insert (ENetListIterator, void *);
25 extern void * enet_list_remove (ENetListIterator);
26
27 extern size_t enet_list_size (ENetList *);
28
29 #define enet_list_begin(list) ((list) -> sentinel.next)
30 #define enet_list_end(list) (& (list) -> sentinel)
31
32 #define enet_list_empty(list) (enet_list_begin (list) == enet_list_end (list))
33
34 #define enet_list_next(iterator) ((iterator) -> next)
35 #define enet_list_previous(iterator) ((iterator) -> previous)
36
37 #define enet_list_front(list) ((void *) (list) -> sentinel.next)
38 #define enet_list_back(list) ((void *) (list) -> sentinel.previous)
39
40 #endif /* __ENET_LIST_H__ */
41
0 /**
1 @file protocol.h
2 @brief ENet protocol
3 */
4 #ifndef __ENET_PROTOCOL_H__
5 #define __ENET_PROTOCOL_H__
6
7 #include "enet/types.h"
8
9 enum
10 {
11 ENET_PROTOCOL_MINIMUM_MTU = 576,
12 ENET_PROTOCOL_MAXIMUM_MTU = 4096,
13 ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS = 32,
14 ENET_PROTOCOL_MINIMUM_WINDOW_SIZE = 4096,
15 ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE = 32768,
16 ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT = 1,
17 ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT = 255
18 };
19
20 typedef enum
21 {
22 ENET_PROTOCOL_COMMAND_NONE = 0,
23 ENET_PROTOCOL_COMMAND_ACKNOWLEDGE = 1,
24 ENET_PROTOCOL_COMMAND_CONNECT = 2,
25 ENET_PROTOCOL_COMMAND_VERIFY_CONNECT = 3,
26 ENET_PROTOCOL_COMMAND_DISCONNECT = 4,
27 ENET_PROTOCOL_COMMAND_PING = 5,
28 ENET_PROTOCOL_COMMAND_SEND_RELIABLE = 6,
29 ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE = 7,
30 ENET_PROTOCOL_COMMAND_SEND_FRAGMENT = 8,
31 ENET_PROTOCOL_COMMAND_BANDWIDTH_LIMIT = 9,
32 ENET_PROTOCOL_COMMAND_THROTTLE_CONFIGURE = 10,
33 ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED = 11
34 } ENetProtocolCommand;
35
36 typedef enum
37 {
38 ENET_PROTOCOL_FLAG_ACKNOWLEDGE = (1 << 0),
39 ENET_PROTOCOL_FLAG_UNSEQUENCED = (1 << 1)
40 } ENetProtocolFlag;
41
42 typedef struct
43 {
44 enet_uint16 peerID;
45 enet_uint8 flags;
46 enet_uint8 commandCount;
47 enet_uint32 sentTime;
48 enet_uint32 challenge;
49 } ENetProtocolHeader;
50
51 typedef struct
52 {
53 enet_uint8 command;
54 enet_uint8 channelID;
55 enet_uint8 flags;
56 enet_uint8 reserved;
57 enet_uint32 commandLength;
58 enet_uint32 reliableSequenceNumber;
59 } ENetProtocolCommandHeader;
60
61 typedef struct
62 {
63 ENetProtocolCommandHeader header;
64 enet_uint32 receivedReliableSequenceNumber;
65 enet_uint32 receivedSentTime;
66 } ENetProtocolAcknowledge;
67
68 typedef struct
69 {
70 ENetProtocolCommandHeader header;
71 enet_uint16 outgoingPeerID;
72 enet_uint16 mtu;
73 enet_uint32 windowSize;
74 enet_uint32 channelCount;
75 enet_uint32 incomingBandwidth;
76 enet_uint32 outgoingBandwidth;
77 enet_uint32 packetThrottleInterval;
78 enet_uint32 packetThrottleAcceleration;
79 enet_uint32 packetThrottleDeceleration;
80 } ENetProtocolConnect;
81
82 typedef struct
83 {
84 ENetProtocolCommandHeader header;
85 enet_uint16 outgoingPeerID;
86 enet_uint16 mtu;
87 enet_uint32 windowSize;
88 enet_uint32 channelCount;
89 enet_uint32 incomingBandwidth;
90 enet_uint32 outgoingBandwidth;
91 enet_uint32 packetThrottleInterval;
92 enet_uint32 packetThrottleAcceleration;
93 enet_uint32 packetThrottleDeceleration;
94 } ENetProtocolVerifyConnect;
95
96 typedef struct
97 {
98 ENetProtocolCommandHeader header;
99 enet_uint32 incomingBandwidth;
100 enet_uint32 outgoingBandwidth;
101 } ENetProtocolBandwidthLimit;
102
103 typedef struct
104 {
105 ENetProtocolCommandHeader header;
106 enet_uint32 packetThrottleInterval;
107 enet_uint32 packetThrottleAcceleration;
108 enet_uint32 packetThrottleDeceleration;
109 } ENetProtocolThrottleConfigure;
110
111 typedef struct
112 {
113 ENetProtocolCommandHeader header;
114 enet_uint32 data;
115 } ENetProtocolDisconnect;
116
117 typedef struct
118 {
119 ENetProtocolCommandHeader header;
120 } ENetProtocolPing;
121
122 typedef struct
123 {
124 ENetProtocolCommandHeader header;
125 } ENetProtocolSendReliable;
126
127 typedef struct
128 {
129 ENetProtocolCommandHeader header;
130 enet_uint32 unreliableSequenceNumber;
131 } ENetProtocolSendUnreliable;
132
133 typedef struct
134 {
135 ENetProtocolCommandHeader header;
136 enet_uint32 unsequencedGroup;
137 } ENetProtocolSendUnsequenced;
138
139 typedef struct
140 {
141 ENetProtocolCommandHeader header;
142 enet_uint32 startSequenceNumber;
143 enet_uint32 fragmentCount;
144 enet_uint32 fragmentNumber;
145 enet_uint32 totalLength;
146 enet_uint32 fragmentOffset;
147 } ENetProtocolSendFragment;
148
149 typedef union
150 {
151 ENetProtocolCommandHeader header;
152 ENetProtocolAcknowledge acknowledge;
153 ENetProtocolConnect connect;
154 ENetProtocolVerifyConnect verifyConnect;
155 ENetProtocolDisconnect disconnect;
156 ENetProtocolPing ping;
157 ENetProtocolSendReliable sendReliable;
158 ENetProtocolSendUnreliable sendUnreliable;
159 ENetProtocolSendUnsequenced sendUnsequenced;
160 ENetProtocolSendFragment sendFragment;
161 ENetProtocolBandwidthLimit bandwidthLimit;
162 ENetProtocolThrottleConfigure throttleConfigure;
163 } ENetProtocol;
164
165 #endif /* __ENET_PROTOCOL_H__ */
166
0 /**
1 @file time.h
2 @brief ENet time constants and macros
3 */
4 #ifndef __ENET_TIME_H__
5 #define __ENET_TIME_H__
6
7 #define ENET_TIME_OVERFLOW 86400000
8
9 #define ENET_TIME_LESS(a, b) ((a) - (b) >= ENET_TIME_OVERFLOW)
10 #define ENET_TIME_GREATER(a, b) ((b) - (a) >= ENET_TIME_OVERFLOW)
11 #define ENET_TIME_LESS_EQUAL(a, b) (! ENET_TIME_GREATER (a, b))
12 #define ENET_TIME_GREATER_EQUAL(a, b) (! ENET_TIME_LESS (a, b))
13
14 #define ENET_TIME_DIFFERENCE(a, b) ((a) - (b) >= ENET_TIME_OVERFLOW ? (b) - (a) : (a) - (b))
15
16 #endif /* __ENET_TIME_H__ */
17
0 /**
1 @file types.h
2 @brief type definitions for ENet
3 */
4 #ifndef __ENET_TYPES_H__
5 #define __ENET_TYPES_H__
6
7 typedef unsigned char enet_uint8; /**< unsigned 8-bit type */
8 typedef unsigned short enet_uint16; /**< unsigned 16-bit type */
9 typedef unsigned int enet_uint32; /**< unsigned 32-bit type */
10
11 #endif /* __ENET_TYPES_H__ */
12
0 /**
1 @file unix.h
2 @brief ENet Unix header
3 */
4 #ifndef __ENET_UNIX_H__
5 #define __ENET_UNIX_H__
6
7 #include <stdlib.h>
8 #include <sys/types.h>
9 #include <netinet/in.h>
10
11 typedef int ENetSocket;
12
13 enum
14 {
15 ENET_SOCKET_NULL = -1
16 };
17
18 #define ENET_HOST_TO_NET_16(value) (htons (value)) /**< macro that converts host to net byte-order of a 16-bit value */
19 #define ENET_HOST_TO_NET_32(value) (htonl (value)) /**< macro that converts host to net byte-order of a 32-bit value */
20
21 #define ENET_NET_TO_HOST_16(value) (ntohs (value)) /**< macro that converts net to host byte-order of a 16-bit value */
22 #define ENET_NET_TO_HOST_32(value) (ntohl (value)) /**< macro that converts net to host byte-order of a 32-bit value */
23
24 typedef struct
25 {
26 void * data;
27 size_t dataLength;
28 } ENetBuffer;
29
30 #define ENET_CALLBACK
31
32 #define ENET_API extern
33
34 #endif /* __ENET_UNIX_H__ */
35
0 /**
1 @file utility.h
2 @brief ENet utility header
3 */
4 #ifndef __ENET_UTILITY_H__
5 #define __ENET_UTILITY_H__
6
7 #define ENET_MAX(x, y) ((x) > (y) ? (x) : (y))
8 #define ENET_MIN(x, y) ((x) < (y) ? (x) : (y))
9
10 #endif /* __ENET_UTILITY_H__ */
11
0 /**
1 @file win32.h
2 @brief ENet Win32 header
3 */
4 #ifndef __ENET_WIN32_H__
5 #define __ENET_WIN32_H__
6
7 #ifdef ENET_BUILDING_LIB
8 #pragma warning (disable: 4996) // 'strncpy' was declared deprecated
9 #pragma warning (disable: 4267) // size_t to int conversion
10 #pragma warning (disable: 4244) // 64bit to 32bit int
11 #pragma warning (disable: 4018) // signed/unsigned mismatch
12 #endif
13
14 #include <stdlib.h>
15 #include <winsock2.h>
16
17 typedef SOCKET ENetSocket;
18
19 enum
20 {
21 ENET_SOCKET_NULL = INVALID_SOCKET
22 };
23
24 #define ENET_HOST_TO_NET_16(value) (htons (value))
25 #define ENET_HOST_TO_NET_32(value) (htonl (value))
26
27 #define ENET_NET_TO_HOST_16(value) (ntohs (value))
28 #define ENET_NET_TO_HOST_32(value) (ntohl (value))
29
30 typedef struct
31 {
32 size_t dataLength;
33 void * data;
34 } ENetBuffer;
35
36 #define ENET_CALLBACK __cdecl
37
38 #if defined ENET_DLL
39 #if defined ENET_BUILDING_LIB
40 #define ENET_API __declspec( dllexport )
41 #else
42 #define ENET_API __declspec( dllimport )
43 #endif /* ENET_BUILDING_LIB */
44 #else /* !ENET_DLL */
45 #define ENET_API extern
46 #endif /* ENET_DLL */
47
48 #endif /* __ENET_WIN32_H__ */
49
50
0 #!/bin/sh
1 #
2 # install - install a program, script, or datafile
3 # This comes from X11R5 (mit/util/scripts/install.sh).
4 #
5 # Copyright 1991 by the Massachusetts Institute of Technology
6 #
7 # Permission to use, copy, modify, distribute, and sell this software and its
8 # documentation for any purpose is hereby granted without fee, provided that
9 # the above copyright notice appear in all copies and that both that
10 # copyright notice and this permission notice appear in supporting
11 # documentation, and that the name of M.I.T. not be used in advertising or
12 # publicity pertaining to distribution of the software without specific,
13 # written prior permission. M.I.T. makes no representations about the
14 # suitability of this software for any purpose. It is provided "as is"
15 # without express or implied warranty.
16 #
17 # Calling this script install-sh is preferred over install.sh, to prevent
18 # `make' implicit rules from creating a file called install from it
19 # when there is no Makefile.
20 #
21 # This script is compatible with the BSD install script, but was written
22 # from scratch. It can only install one file at a time, a restriction
23 # shared with many OS's install programs.
24
25
26 # set DOITPROG to echo to test this script
27
28 # Don't use :- since 4.3BSD and earlier shells don't like it.
29 doit="${DOITPROG-}"
30
31
32 # put in absolute paths if you don't have them in your path; or use env. vars.
33
34 mvprog="${MVPROG-mv}"
35 cpprog="${CPPROG-cp}"
36 chmodprog="${CHMODPROG-chmod}"
37 chownprog="${CHOWNPROG-chown}"
38 chgrpprog="${CHGRPPROG-chgrp}"
39 stripprog="${STRIPPROG-strip}"
40 rmprog="${RMPROG-rm}"
41 mkdirprog="${MKDIRPROG-mkdir}"
42
43 transformbasename=""
44 transform_arg=""
45 instcmd="$mvprog"
46 chmodcmd="$chmodprog 0755"
47 chowncmd=""
48 chgrpcmd=""
49 stripcmd=""
50 rmcmd="$rmprog -f"
51 mvcmd="$mvprog"
52 src=""
53 dst=""
54 dir_arg=""
55
56 while [ x"$1" != x ]; do
57 case $1 in
58 -c) instcmd="$cpprog"
59 shift
60 continue;;
61
62 -d) dir_arg=true
63 shift
64 continue;;
65
66 -m) chmodcmd="$chmodprog $2"
67 shift
68 shift
69 continue;;
70
71 -o) chowncmd="$chownprog $2"
72 shift
73 shift
74 continue;;
75
76 -g) chgrpcmd="$chgrpprog $2"
77 shift
78 shift
79 continue;;
80
81 -s) stripcmd="$stripprog"
82 shift
83 continue;;
84
85 -t=*) transformarg=`echo $1 | sed 's/-t=//'`
86 shift
87 continue;;
88
89 -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
90 shift
91 continue;;
92
93 *) if [ x"$src" = x ]
94 then
95 src=$1
96 else
97 # this colon is to work around a 386BSD /bin/sh bug
98 :
99 dst=$1
100 fi
101 shift
102 continue;;
103 esac
104 done
105
106 if [ x"$src" = x ]
107 then
108 echo "install: no input file specified"
109 exit 1
110 else
111 true
112 fi
113
114 if [ x"$dir_arg" != x ]; then
115 dst=$src
116 src=""
117
118 if [ -d $dst ]; then
119 instcmd=:
120 chmodcmd=""
121 else
122 instcmd=mkdir
123 fi
124 else
125
126 # Waiting for this to be detected by the "$instcmd $src $dsttmp" command
127 # might cause directories to be created, which would be especially bad
128 # if $src (and thus $dsttmp) contains '*'.
129
130 if [ -f $src -o -d $src ]
131 then
132 true
133 else
134 echo "install: $src does not exist"
135 exit 1
136 fi
137
138 if [ x"$dst" = x ]
139 then
140 echo "install: no destination specified"
141 exit 1
142 else
143 true
144 fi
145
146 # If destination is a directory, append the input filename; if your system
147 # does not like double slashes in filenames, you may need to add some logic
148
149 if [ -d $dst ]
150 then
151 dst="$dst"/`basename $src`
152 else
153 true
154 fi
155 fi
156
157 ## this sed command emulates the dirname command
158 dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
159
160 # Make sure that the destination directory exists.
161 # this part is taken from Noah Friedman's mkinstalldirs script
162
163 # Skip lots of stat calls in the usual case.
164 if [ ! -d "$dstdir" ]; then
165 defaultIFS='
166 '
167 IFS="${IFS-${defaultIFS}}"
168
169 oIFS="${IFS}"
170 # Some sh's can't handle IFS=/ for some reason.
171 IFS='%'
172 set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
173 IFS="${oIFS}"
174
175 pathcomp=''
176
177 while [ $# -ne 0 ] ; do
178 pathcomp="${pathcomp}${1}"
179 shift
180
181 if [ ! -d "${pathcomp}" ] ;
182 then
183 $mkdirprog "${pathcomp}"
184 else
185 true
186 fi
187
188 pathcomp="${pathcomp}/"
189 done
190 fi
191
192 if [ x"$dir_arg" != x ]
193 then
194 $doit $instcmd $dst &&
195
196 if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
197 if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
198 if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
199 if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
200 else
201
202 # If we're going to rename the final executable, determine the name now.
203
204 if [ x"$transformarg" = x ]
205 then
206 dstfile=`basename $dst`
207 else
208 dstfile=`basename $dst $transformbasename |
209 sed $transformarg`$transformbasename
210 fi
211
212 # don't allow the sed command to completely eliminate the filename
213
214 if [ x"$dstfile" = x ]
215 then
216 dstfile=`basename $dst`
217 else
218 true
219 fi
220
221 # Make a temp file name in the proper directory.
222
223 dsttmp=$dstdir/#inst.$$#
224
225 # Move or copy the file name to the temp name
226
227 $doit $instcmd $src $dsttmp &&
228
229 trap "rm -f ${dsttmp}" 0 &&
230
231 # and set any options; do chmod last to preserve setuid bits
232
233 # If any of these fail, we abort the whole thing. If we want to
234 # ignore errors from any of these, just make sure not to ignore
235 # errors from the above "$doit $instcmd $src $dsttmp" command.
236
237 if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
238 if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
239 if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
240 if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
241
242 # Now rename the file to the real destination.
243
244 $doit $rmcmd -f $dstdir/$dstfile &&
245 $doit $mvcmd $dsttmp $dstdir/$dstfile
246
247 fi &&
248
249
250 exit 0
Binary diff not shown
0 /**
1 @file list.c
2 @brief ENet linked list functions
3 */
4 #define ENET_BUILDING_LIB 1
5 #include "enet/list.h"
6
7 /**
8 @defgroup list ENet linked list utility functions
9 @ingroup private
10 @{
11 */
12 void
13 enet_list_clear (ENetList * list)
14 {
15 list -> sentinel.next = & list -> sentinel;
16 list -> sentinel.previous = & list -> sentinel;
17 }
18
19 ENetListIterator
20 enet_list_insert (ENetListIterator position, void * data)
21 {
22 ENetListIterator result = (ENetListIterator) data;
23
24 result -> previous = position -> previous;
25 result -> next = position;
26
27 result -> previous -> next = result;
28 position -> previous = result;
29
30 return result;
31 }
32
33 void *
34 enet_list_remove (ENetListIterator position)
35 {
36 position -> previous -> next = position -> next;
37 position -> next -> previous = position -> previous;
38
39 return position;
40 }
41
42 size_t
43 enet_list_size (ENetList * list)
44 {
45 size_t size = 0;
46 ENetListIterator position;
47
48 for (position = enet_list_begin (list);
49 position != enet_list_end (list);
50 position = enet_list_next (position))
51 ++ size;
52
53 return size;
54 }
55
56 /** @} */
Binary diff not shown
0 #! /bin/sh
1 # Common stub for a few missing GNU programs while installing.
2 # Copyright (C) 1996, 1997 Free Software Foundation, Inc.
3 # Franc,ois Pinard <pinard@iro.umontreal.ca>, 1996.
4
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
8 # any later version.
9
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
18 # 02111-1307, USA.
19
20 if test $# -eq 0; then
21 echo 1>&2 "Try \`$0 --help' for more information"
22 exit 1
23 fi
24
25 case "$1" in
26
27 -h|--h|--he|--hel|--help)
28 echo "\
29 $0 [OPTION]... PROGRAM [ARGUMENT]...
30
31 Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
32 error status if there is no known handling for PROGRAM.
33
34 Options:
35 -h, --help display this help and exit
36 -v, --version output version information and exit
37
38 Supported PROGRAM values:
39 aclocal touch file \`aclocal.m4'
40 autoconf touch file \`configure'
41 autoheader touch file \`config.h.in'
42 automake touch all \`Makefile.in' files
43 bison create \`y.tab.[ch]', if possible, from existing .[ch]
44 flex create \`lex.yy.c', if possible, from existing .c
45 lex create \`lex.yy.c', if possible, from existing .c
46 makeinfo touch the output file
47 yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
48 ;;
49
50 -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
51 echo "missing - GNU libit 0.0"
52 ;;
53
54 -*)
55 echo 1>&2 "$0: Unknown \`$1' option"
56 echo 1>&2 "Try \`$0 --help' for more information"
57 exit 1
58 ;;
59
60 aclocal)
61 echo 1>&2 "\
62 WARNING: \`$1' is missing on your system. You should only need it if
63 you modified \`acinclude.m4' or \`configure.in'. You might want
64 to install the \`Automake' and \`Perl' packages. Grab them from
65 any GNU archive site."
66 touch aclocal.m4
67 ;;
68
69 autoconf)
70 echo 1>&2 "\
71 WARNING: \`$1' is missing on your system. You should only need it if
72 you modified \`configure.in'. You might want to install the
73 \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
74 archive site."
75 touch configure
76 ;;
77
78 autoheader)
79 echo 1>&2 "\
80 WARNING: \`$1' is missing on your system. You should only need it if
81 you modified \`acconfig.h' or \`configure.in'. You might want
82 to install the \`Autoconf' and \`GNU m4' packages. Grab them
83 from any GNU archive site."
84 files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in`
85 test -z "$files" && files="config.h"
86 touch_files=
87 for f in $files; do
88 case "$f" in
89 *:*) touch_files="$touch_files "`echo "$f" |
90 sed -e 's/^[^:]*://' -e 's/:.*//'`;;
91 *) touch_files="$touch_files $f.in";;
92 esac
93 done
94 touch $touch_files
95 ;;
96
97 automake)
98 echo 1>&2 "\
99 WARNING: \`$1' is missing on your system. You should only need it if
100 you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'.
101 You might want to install the \`Automake' and \`Perl' packages.
102 Grab them from any GNU archive site."
103 find . -type f -name Makefile.am -print |
104 sed 's/\.am$/.in/' |
105 while read f; do touch "$f"; done
106 ;;
107
108 bison|yacc)
109 echo 1>&2 "\
110 WARNING: \`$1' is missing on your system. You should only need it if
111 you modified a \`.y' file. You may need the \`Bison' package
112 in order for those modifications to take effect. You can get
113 \`Bison' from any GNU archive site."
114 rm -f y.tab.c y.tab.h
115 if [ $# -ne 1 ]; then
116 eval LASTARG="\${$#}"
117 case "$LASTARG" in
118 *.y)
119 SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
120 if [ -f "$SRCFILE" ]; then
121 cp "$SRCFILE" y.tab.c
122 fi
123 SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
124 if [ -f "$SRCFILE" ]; then
125 cp "$SRCFILE" y.tab.h
126 fi
127 ;;
128 esac
129 fi
130 if [ ! -f y.tab.h ]; then
131 echo >y.tab.h
132 fi
133 if [ ! -f y.tab.c ]; then
134 echo 'main() { return 0; }' >y.tab.c
135 fi
136 ;;
137
138 lex|flex)
139 echo 1>&2 "\
140 WARNING: \`$1' is missing on your system. You should only need it if
141 you modified a \`.l' file. You may need the \`Flex' package
142 in order for those modifications to take effect. You can get
143 \`Flex' from any GNU archive site."
144 rm -f lex.yy.c
145 if [ $# -ne 1 ]; then
146 eval LASTARG="\${$#}"
147 case "$LASTARG" in
148 *.l)
149 SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
150 if [ -f "$SRCFILE" ]; then
151 cp "$SRCFILE" lex.yy.c
152 fi
153 ;;
154 esac
155 fi
156 if [ ! -f lex.yy.c ]; then
157 echo 'main() { return 0; }' >lex.yy.c
158 fi
159 ;;
160
161 makeinfo)
162 echo 1>&2 "\
163 WARNING: \`$1' is missing on your system. You should only need it if
164 you modified a \`.texi' or \`.texinfo' file, or any other file
165 indirectly affecting the aspect of the manual. The spurious
166 call might also be the consequence of using a buggy \`make' (AIX,
167 DU, IRIX). You might want to install the \`Texinfo' package or
168 the \`GNU make' package. Grab either from any GNU archive site."
169 file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
170 if test -z "$file"; then
171 file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
172 file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
173 fi
174 touch $file
175 ;;
176
177 *)
178 echo 1>&2 "\
179 WARNING: \`$1' is needed, and you do not seem to have it handy on your
180 system. You might have modified some files without having the
181 proper tools for further handling them. Check the \`README' file,
182 it often tells you about the needed prerequirements for installing
183 this package. You may also peek at any GNU archive site, in case
184 some other package would contain this missing \`$1' program."
185 exit 1
186 ;;
187 esac
188
189 exit 0
0 #! /bin/sh
1 # mkinstalldirs --- make directory hierarchy
2 # Author: Noah Friedman <friedman@prep.ai.mit.edu>
3 # Created: 1993-05-16
4 # Public domain
5
6 # $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $
7
8 errstatus=0
9
10 for file
11 do
12 set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
13 shift
14
15 pathcomp=
16 for d
17 do
18 pathcomp="$pathcomp$d"
19 case "$pathcomp" in
20 -* ) pathcomp=./$pathcomp ;;
21 esac
22
23 if test ! -d "$pathcomp"; then
24 echo "mkdir $pathcomp"
25
26 mkdir "$pathcomp" || lasterr=$?
27
28 if test ! -d "$pathcomp"; then
29 errstatus=$lasterr
30 fi
31 fi
32
33 pathcomp="$pathcomp/"
34 done
35 done
36
37 exit $errstatus
38
39 # mkinstalldirs ends here
0 /**
1 @file packet.c
2 @brief ENet packet management functions
3 */
4 #include <string.h>
5 #define ENET_BUILDING_LIB 1
6 #include "enet/enet.h"
7
8 /** @defgroup Packet ENet packet functions
9 @{
10 */
11
12 /** Creates a packet that may be sent to a peer.
13 @param dataContents initial contents of the packet's data; the packet's data will remain uninitialized if dataContents is NULL.
14 @param dataLength size of the data allocated for this packet
15 @param flags flags for this packet as described for the ENetPacket structure.
16 @returns the packet on success, NULL on failure
17 */
18 ENetPacket *
19 enet_packet_create (const void * data, size_t dataLength, enet_uint32 flags)
20 {
21 ENetPacket * packet = (ENetPacket *) enet_malloc (sizeof (ENetPacket));
22
23 packet -> data = (enet_uint8 *) enet_malloc (dataLength);
24
25 if (data != NULL)
26 memcpy (packet -> data, data, dataLength);
27
28 packet -> referenceCount = 0;
29 packet -> flags = flags;
30 packet -> dataLength = dataLength;
31
32 return packet;
33 }
34
35 /** Destroys the packet and deallocates its data.
36 @param packet packet to be destroyed
37 */
38 void
39 enet_packet_destroy (ENetPacket * packet)
40 {
41 enet_free (packet -> data);
42 enet_free (packet);
43 }
44
45 /** Attempts to resize the data in the packet to length specified in the
46 dataLength parameter
47 @param packet packet to resize
48 @param dataLength new size for the packet data
49 @returns 0 on success, < 0 on failure
50 */
51 int
52 enet_packet_resize (ENetPacket * packet, size_t dataLength)
53 {
54 enet_uint8 * newData;
55
56 if (dataLength <= packet -> dataLength)
57 {
58 packet -> dataLength = dataLength;
59
60 return 0;
61 }
62
63 newData = (enet_uint8 *) enet_malloc (dataLength);
64 memcpy (newData, packet -> data, packet -> dataLength);
65 enet_free (packet -> data);
66
67 packet -> data = newData;
68 packet -> dataLength = dataLength;
69
70 return 0;
71 }
72
73 /** @} */
Binary diff not shown
0 /**
1 @file peer.c
2 @brief ENet peer management functions
3 */
4 #include <string.h>
5 #define ENET_BUILDING_LIB 1
6 #include "enet/enet.h"
7
8 /** @defgroup peer ENet peer functions
9 @{
10 */
11
12 /** Configures throttle parameter for a peer.
13
14 Unreliable packets are dropped by ENet in response to the varying conditions
15 of the Internet connection to the peer. The throttle represents a probability
16 that an unreliable packet should not be dropped and thus sent by ENet to the peer.
17 The lowest mean round trip time from the sending of a reliable packet to the
18 receipt of its acknowledgement is measured over an amount of time specified by
19 the interval parameter in milliseconds. If a measured round trip time happens to
20 be significantly less than the mean round trip time measured over the interval,
21 then the throttle probability is increased to allow more traffic by an amount
22 specified in the acceleration parameter, which is a ratio to the ENET_PEER_PACKET_THROTTLE_SCALE
23 constant. If a measured round trip time happens to be significantly greater than
24 the mean round trip time measured over the interval, then the throttle probability
25 is decreased to limit traffic by an amount specified in the deceleration parameter, which
26 is a ratio to the ENET_PEER_PACKET_THROTTLE_SCALE constant. When the throttle has
27 a value of ENET_PEER_PACKET_THROTTLE_SCALE, on unreliable packets are dropped by
28 ENet, and so 100% of all unreliable packets will be sent. When the throttle has a
29 value of 0, all unreliable packets are dropped by ENet, and so 0% of all unreliable
30 packets will be sent. Intermediate values for the throttle represent intermediate
31 probabilities between 0% and 100% of unreliable packets being sent. The bandwidth
32 limits of the local and foreign hosts are taken into account to determine a
33 sensible limit for the throttle probability above which it should not raise even in
34 the best of conditions.
35
36 @param peer peer to configure
37 @param interval interval, in milliseconds, over which to measure lowest mean RTT; the default value is ENET_PEER_PACKET_THROTTLE_INTERVAL.
38 @param acceleration rate at which to increase the throttle probability as mean RTT declines
39 @param deceleration rate at which to decrease the throttle probability as mean RTT increases
40 */
41 void
42 enet_peer_throttle_configure (ENetPeer * peer, enet_uint32 interval, enet_uint32 acceleration, enet_uint32 deceleration)
43 {
44 ENetProtocol command;
45
46 peer -> packetThrottleInterval = interval;
47 peer -> packetThrottleAcceleration = acceleration;
48 peer -> packetThrottleDeceleration = deceleration;
49
50 command.header.command = ENET_PROTOCOL_COMMAND_THROTTLE_CONFIGURE;
51 command.header.channelID = 0xFF;
52 command.header.flags = ENET_PROTOCOL_FLAG_ACKNOWLEDGE;
53 command.header.commandLength = sizeof (ENetProtocolThrottleConfigure);
54
55 command.throttleConfigure.packetThrottleInterval = ENET_HOST_TO_NET_32 (interval);
56 command.throttleConfigure.packetThrottleAcceleration = ENET_HOST_TO_NET_32 (acceleration);
57 command.throttleConfigure.packetThrottleDeceleration = ENET_HOST_TO_NET_32 (deceleration);
58
59 enet_peer_queue_outgoing_command (peer, & command, NULL, 0, 0);
60 }
61
62 int
63 enet_peer_throttle (ENetPeer * peer, enet_uint32 rtt)
64 {
65 if (peer -> lastRoundTripTime <= peer -> lastRoundTripTimeVariance)
66 {
67 peer -> packetThrottle = peer -> packetThrottleLimit;
68 }
69 else
70 if (rtt < peer -> lastRoundTripTime)
71 {
72 peer -> packetThrottle += peer -> packetThrottleAcceleration;
73
74 if (peer -> packetThrottle > peer -> packetThrottleLimit)
75 peer -> packetThrottle = peer -> packetThrottleLimit;
76
77 return 1;
78 }
79 else
80 if (rtt > peer -> lastRoundTripTime + 2 * peer -> lastRoundTripTimeVariance)
81 {
82 if (peer -> packetThrottle > peer -> packetThrottleDeceleration)
83 peer -> packetThrottle -= peer -> packetThrottleDeceleration;
84 else
85 peer -> packetThrottle = 0;
86
87 return -1;
88 }
89
90 return 0;
91 }
92
93 /** Queues a packet to be sent.
94 @param peer destination for the packet
95 @param channelID channel on which to send
96 @param packet packet to send
97 @retval 0 on success
98 @retval < 0 on failure
99 */
100 int
101 enet_peer_send (ENetPeer * peer, enet_uint8 channelID, ENetPacket * packet)
102 {
103 ENetChannel * channel = & peer -> channels [channelID];
104 ENetProtocol command;
105 size_t fragmentLength;
106
107 if (peer -> state != ENET_PEER_STATE_CONNECTED ||
108 channelID >= peer -> channelCount)
109 return -1;
110
111 fragmentLength = peer -> mtu - sizeof (ENetProtocolHeader) - sizeof (ENetProtocolSendFragment);
112
113 if (packet -> dataLength > fragmentLength)
114 {
115 enet_uint32 fragmentCount = ENET_HOST_TO_NET_32 ((packet -> dataLength + fragmentLength - 1) / fragmentLength),
116 startSequenceNumber = ENET_HOST_TO_NET_32 (channel -> outgoingReliableSequenceNumber + 1),
117 fragmentNumber,
118 fragmentOffset;
119
120 packet -> flags = ENET_PACKET_FLAG_RELIABLE;
121
122 for (fragmentNumber = 0,
123 fragmentOffset = 0;
124 fragmentOffset < packet -> dataLength;
125 ++ fragmentNumber,
126 fragmentOffset += fragmentLength)
127 {
128 command.header.command = ENET_PROTOCOL_COMMAND_SEND_FRAGMENT;
129 command.header.channelID = channelID;
130 command.header.flags = ENET_PROTOCOL_FLAG_ACKNOWLEDGE;
131 command.header.commandLength = sizeof (ENetProtocolSendFragment);
132 command.sendFragment.startSequenceNumber = startSequenceNumber;
133 command.sendFragment.fragmentCount = fragmentCount;
134 command.sendFragment.fragmentNumber = ENET_HOST_TO_NET_32 (fragmentNumber);
135 command.sendFragment.totalLength = ENET_HOST_TO_NET_32 (packet -> dataLength);
136 command.sendFragment.fragmentOffset = ENET_NET_TO_HOST_32 (fragmentOffset);
137
138 if (packet -> dataLength - fragmentOffset < fragmentLength)
139 fragmentLength = packet -> dataLength - fragmentOffset;
140
141 enet_peer_queue_outgoing_command (peer, & command, packet, fragmentOffset, fragmentLength);
142 }
143
144 return 0;
145 }
146
147 command.header.channelID = channelID;
148
149 if (packet -> flags & ENET_PACKET_FLAG_RELIABLE)
150 {
151 command.header.command = ENET_PROTOCOL_COMMAND_SEND_RELIABLE;
152 command.header.flags = ENET_PROTOCOL_FLAG_ACKNOWLEDGE;
153 command.header.commandLength = sizeof (ENetProtocolSendReliable);
154 }
155 else
156 if (packet -> flags & ENET_PACKET_FLAG_UNSEQUENCED)
157 {
158 command.header.command = ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED;
159 command.header.flags = ENET_PROTOCOL_FLAG_UNSEQUENCED;
160 command.header.commandLength = sizeof (ENetProtocolSendUnsequenced);
161 command.sendUnsequenced.unsequencedGroup = ENET_HOST_TO_NET_32 (peer -> outgoingUnsequencedGroup + 1);
162 }
163 else
164 {
165 command.header.command = ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE;
166 command.header.flags = 0;
167 command.header.commandLength = sizeof (ENetProtocolSendUnreliable);
168 command.sendUnreliable.unreliableSequenceNumber = ENET_HOST_TO_NET_32 (channel -> outgoingUnreliableSequenceNumber + 1);
169 }
170
171 enet_peer_queue_outgoing_command (peer, & command, packet, 0, packet -> dataLength);
172
173 return 0;
174 }
175
176 /** Attempts to dequeue any incoming queued packet.
177 @param peer peer to dequeue packets from
178 @param channelID channel on which to receive
179 @returns a pointer to the packet, or NULL if there are no available incoming queued packets
180 */
181 ENetPacket *
182 enet_peer_receive (ENetPeer * peer, enet_uint8 channelID)
183 {
184 ENetChannel * channel = & peer -> channels [channelID];
185 ENetIncomingCommand * incomingCommand = NULL;
186 ENetPacket * packet;
187
188 if (enet_list_empty (& channel -> incomingUnreliableCommands) == 0)
189 {
190 incomingCommand = (ENetIncomingCommand *) enet_list_front (& channel -> incomingUnreliableCommands);
191
192 if (incomingCommand -> unreliableSequenceNumber > 0)
193 {
194 if (incomingCommand -> reliableSequenceNumber > channel -> incomingReliableSequenceNumber)
195 incomingCommand = NULL;
196 else
197 channel -> incomingUnreliableSequenceNumber = incomingCommand -> unreliableSequenceNumber;
198 }
199 }
200
201 if (incomingCommand == NULL &&
202 enet_list_empty (& channel -> incomingReliableCommands) == 0)
203 {
204 do
205 {
206 incomingCommand = (ENetIncomingCommand *) enet_list_front (& channel -> incomingReliableCommands);
207
208 if (incomingCommand -> fragmentsRemaining > 0 ||
209 incomingCommand -> reliableSequenceNumber > channel -> incomingReliableSequenceNumber + 1)
210 return NULL;
211
212 if (incomingCommand -> reliableSequenceNumber <= channel -> incomingReliableSequenceNumber)
213 {
214 -- incomingCommand -> packet -> referenceCount;
215
216 if (incomingCommand -> packet -> referenceCount == 0)
217 enet_packet_destroy (incomingCommand -> packet);
218
219 if (incomingCommand -> fragments != NULL)
220 enet_free (incomingCommand -> fragments);
221
222 enet_list_remove (& incomingCommand -> incomingCommandList);
223
224 enet_free (incomingCommand);
225
226 incomingCommand = NULL;
227 }
228 } while (incomingCommand == NULL &&
229 enet_list_empty (& channel -> incomingReliableCommands) == 0);
230
231 if (incomingCommand == NULL)
232 return NULL;
233
234 channel -> incomingReliableSequenceNumber = incomingCommand -> reliableSequenceNumber;
235
236 if (incomingCommand -> fragmentCount > 0)
237 channel -> incomingReliableSequenceNumber += incomingCommand -> fragmentCount - 1;
238 }
239
240 if (incomingCommand == NULL)
241 return NULL;
242
243 enet_list_remove (& incomingCommand -> incomingCommandList);
244
245 packet = incomingCommand -> packet;
246
247 -- packet -> referenceCount;
248
249 if (incomingCommand -> fragments != NULL)
250 enet_free (incomingCommand -> fragments);
251
252 enet_free (incomingCommand);
253
254 return packet;
255 }
256
257 static void
258 enet_peer_reset_outgoing_commands (ENetList * queue)
259 {
260 ENetOutgoingCommand * outgoingCommand;
261
262 while (enet_list_empty (queue) == 0)
263 {
264 outgoingCommand = (ENetOutgoingCommand *) enet_list_remove (enet_list_begin (queue));
265
266 if (outgoingCommand -> packet != NULL)
267 {
268 -- outgoingCommand -> packet -> referenceCount;
269
270 if (outgoingCommand -> packet -> referenceCount == 0)
271 enet_packet_destroy (outgoingCommand -> packet);
272 }
273
274 enet_free (outgoingCommand);
275 }
276 }
277
278 static void
279 enet_peer_reset_incoming_commands (ENetList * queue)
280 {
281 ENetIncomingCommand * incomingCommand;
282
283 while (enet_list_empty (queue) == 0)
284 {
285 incomingCommand = (ENetIncomingCommand *) enet_list_remove (enet_list_begin (queue));
286
287 if (incomingCommand -> packet != NULL)
288 {
289 -- incomingCommand -> packet -> referenceCount;
290
291 if (incomingCommand -> packet -> referenceCount == 0)
292 enet_packet_destroy (incomingCommand -> packet);
293 }
294
295 if (incomingCommand -> fragments != NULL)
296 enet_free (incomingCommand -> fragments);
297
298 enet_free (incomingCommand);
299 }
300 }
301
302 void
303 enet_peer_reset_queues (ENetPeer * peer)
304 {
305 ENetChannel * channel;
306
307 while (enet_list_empty (& peer -> acknowledgements) == 0)
308 enet_free (enet_list_remove (enet_list_begin (& peer -> acknowledgements)));
309
310 enet_peer_reset_outgoing_commands (& peer -> sentReliableCommands);
311 enet_peer_reset_outgoing_commands (& peer -> sentUnreliableCommands);
312 enet_peer_reset_outgoing_commands (& peer -> outgoingReliableCommands);
313 enet_peer_reset_outgoing_commands (& peer -> outgoingUnreliableCommands);
314
315 if (peer -> channels != NULL && peer -> channelCount > 0)
316 {
317 for (channel = peer -> channels;
318 channel < & peer -> channels [peer -> channelCount];
319 ++ channel)
320 {
321 enet_peer_reset_incoming_commands (& channel -> incomingReliableCommands);
322 enet_peer_reset_incoming_commands (& channel -> incomingUnreliableCommands);
323 }
324
325 enet_free (peer -> channels);
326 }
327
328 peer -> channels = NULL;
329 peer -> channelCount = 0;
330 }
331
332 /** Forcefully disconnects a peer.
333 @param peer peer to forcefully disconnect
334 @remarks The foreign host represented by the peer is not notified of the disconnection and will timeout
335 on its connection to the local host.
336 */
337 void
338 enet_peer_reset (ENetPeer * peer)
339 {
340 peer -> outgoingPeerID = 0xFFFF;
341 peer -> challenge = 0;
342
343 peer -> address.host = ENET_HOST_ANY;
344 peer -> address.port = 0;
345
346 peer -> state = ENET_PEER_STATE_DISCONNECTED;
347
348 peer -> incomingBandwidth = 0;
349 peer -> outgoingBandwidth = 0;
350 peer -> incomingBandwidthThrottleEpoch = 0;
351 peer -> outgoingBandwidthThrottleEpoch = 0;
352 peer -> incomingDataTotal = 0;
353 peer -> outgoingDataTotal = 0;
354 peer -> lastSendTime = 0;
355 peer -> lastReceiveTime = 0;
356 peer -> nextTimeout = 0;
357 peer -> earliestTimeout = 0;
358 peer -> packetLossEpoch = 0;
359 peer -> packetsSent = 0;
360 peer -> packetsLost = 0;
361 peer -> packetLoss = 0;
362 peer -> packetLossVariance = 0;
363 peer -> packetThrottle = ENET_PEER_DEFAULT_PACKET_THROTTLE;
364 peer -> packetThrottleLimit = ENET_PEER_PACKET_THROTTLE_SCALE;
365 peer -> packetThrottleCounter = 0;
366 peer -> packetThrottleEpoch = 0;
367 peer -> packetThrottleAcceleration = ENET_PEER_PACKET_THROTTLE_ACCELERATION;
368 peer -> packetThrottleDeceleration = ENET_PEER_PACKET_THROTTLE_DECELERATION;
369 peer -> packetThrottleInterval = ENET_PEER_PACKET_THROTTLE_INTERVAL;
370 peer -> lastRoundTripTime = ENET_PEER_DEFAULT_ROUND_TRIP_TIME;
371 peer -> lowestRoundTripTime = ENET_PEER_DEFAULT_ROUND_TRIP_TIME;
372 peer -> lastRoundTripTimeVariance = 0;
373 peer -> highestRoundTripTimeVariance = 0;
374 peer -> roundTripTime = ENET_PEER_DEFAULT_ROUND_TRIP_TIME;
375 peer -> roundTripTimeVariance = 0;
376 peer -> mtu = peer -> host -> mtu;
377 peer -> reliableDataInTransit = 0;
378 peer -> outgoingReliableSequenceNumber = 0;
379 peer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE;
380 peer -> incomingUnsequencedGroup = 0;
381 peer -> outgoingUnsequencedGroup = 0;
382 peer -> disconnectData = 0;
383
384 memset (peer -> unsequencedWindow, 0, sizeof (peer -> unsequencedWindow));
385
386 enet_peer_reset_queues (peer);
387 }
388
389 /** Sends a ping request to a peer.
390 @param peer destination for the ping request
391 @remarks ping requests factor into the mean round trip time as designated by the
392 roundTripTime field in the ENetPeer structure. Enet automatically pings all connected
393 peers at regular intervals, however, this function may be called to ensure more
394 frequent ping requests.
395 */
396 void
397 enet_peer_ping (ENetPeer * peer)
398 {
399 ENetProtocol command;
400
401 if (peer -> state != ENET_PEER_STATE_CONNECTED)
402 return;
403
404 command.header.command = ENET_PROTOCOL_COMMAND_PING;
405 command.header.channelID = 0xFF;
406 command.header.flags = ENET_PROTOCOL_FLAG_ACKNOWLEDGE;
407 command.header.commandLength = sizeof (ENetProtocolPing);
408
409 enet_peer_queue_outgoing_command (peer, & command, NULL, 0, 0);
410 }
411
412 /** Force an immediate disconnection from a peer.
413 @param peer peer to disconnect
414 @param data data describing the disconnection
415 @remarks No ENET_EVENT_DISCONNECT event will be generated. The foreign peer is not
416 guarenteed to receive the disconnect notification, and is reset immediately upon
417 return from this function.
418 */
419 void
420 enet_peer_disconnect_now (ENetPeer * peer, enet_uint32 data)
421 {
422 ENetProtocol command;
423
424 if (peer -> state == ENET_PEER_STATE_DISCONNECTED)
425 return;
426
427 if (peer -> state != ENET_PEER_STATE_ZOMBIE &&
428 peer -> state != ENET_PEER_STATE_DISCONNECTING)
429 {
430 enet_peer_reset_queues (peer);
431
432 command.header.command = ENET_PROTOCOL_COMMAND_DISCONNECT;
433 command.header.channelID = 0xFF;
434 command.header.flags = ENET_PROTOCOL_FLAG_UNSEQUENCED;
435 command.header.commandLength = sizeof (ENetProtocolDisconnect);
436 command.disconnect.data = data;
437
438 enet_peer_queue_outgoing_command (peer, & command, NULL, 0, 0);
439
440 enet_host_flush (peer -> host);
441 }
442
443 enet_peer_reset (peer);
444 }
445
446 /** Request a disconnection from a peer.
447 @param peer peer to request a disconnection
448 @param data data describing the disconnection
449 @remarks An ENET_EVENT_DISCONNECT event will be generated by enet_host_service()
450 once the disconnection is complete.
451 */
452 void
453 enet_peer_disconnect (ENetPeer * peer, enet_uint32 data)
454 {
455 ENetProtocol command;
456
457 if (peer -> state == ENET_PEER_STATE_DISCONNECTING ||
458 peer -> state == ENET_PEER_STATE_DISCONNECTED ||
459 peer -> state == ENET_PEER_STATE_ZOMBIE)
460 return;
461
462 enet_peer_reset_queues (peer);
463
464 command.header.command = ENET_PROTOCOL_COMMAND_DISCONNECT;
465 command.header.channelID = 0xFF;
466 command.header.flags = ENET_PROTOCOL_FLAG_UNSEQUENCED;
467 command.header.commandLength = sizeof (ENetProtocolDisconnect);
468 command.disconnect.data = data;
469
470 if (peer -> state == ENET_PEER_STATE_CONNECTED)
471 command.header.flags = ENET_PROTOCOL_FLAG_ACKNOWLEDGE;
472
473 enet_peer_queue_outgoing_command (peer, & command, NULL, 0, 0);
474
475 if (peer -> state == ENET_PEER_STATE_CONNECTED)
476 peer -> state = ENET_PEER_STATE_DISCONNECTING;
477 else
478 {
479 enet_host_flush (peer -> host);
480 enet_peer_reset (peer);
481 }
482 }
483
484 ENetAcknowledgement *
485 enet_peer_queue_acknowledgement (ENetPeer * peer, const ENetProtocol * command, enet_uint32 sentTime)
486 {
487 ENetAcknowledgement * acknowledgement;
488
489 peer -> outgoingDataTotal += sizeof (ENetProtocolAcknowledge);
490
491 acknowledgement = (ENetAcknowledgement *) enet_malloc (sizeof (ENetAcknowledgement));
492
493 acknowledgement -> sentTime = sentTime;
494 acknowledgement -> command = * command;
495
496 enet_list_insert (enet_list_end (& peer -> acknowledgements), acknowledgement);
497
498 return acknowledgement;
499 }
500
501 ENetOutgoingCommand *
502 enet_peer_queue_outgoing_command (ENetPeer * peer, const ENetProtocol * command, ENetPacket * packet, enet_uint32 offset, enet_uint16 length)
503 {
504 ENetChannel * channel = & peer -> channels [command -> header.channelID];
505 ENetOutgoingCommand * outgoingCommand;
506
507 peer -> outgoingDataTotal += command -> header.commandLength + length;
508
509 outgoingCommand = (ENetOutgoingCommand *) enet_malloc (sizeof (ENetOutgoingCommand));
510
511 if (command -> header.channelID == 0xFF)
512 {
513 ++ peer -> outgoingReliableSequenceNumber;
514
515 outgoingCommand -> reliableSequenceNumber = peer -> outgoingReliableSequenceNumber;
516 outgoingCommand -> unreliableSequenceNumber = 0;
517 }
518 else
519 if (command -> header.flags & ENET_PROTOCOL_FLAG_ACKNOWLEDGE)
520 {
521 ++ channel -> outgoingReliableSequenceNumber;
522
523 outgoingCommand -> reliableSequenceNumber = channel -> outgoingReliableSequenceNumber;
524 outgoingCommand -> unreliableSequenceNumber = 0;
525 }
526 else
527 if (command -> header.flags & ENET_PROTOCOL_FLAG_UNSEQUENCED)
528 {
529 ++ peer -> outgoingUnsequencedGroup;
530
531 outgoingCommand -> reliableSequenceNumber = 0;
532 outgoingCommand -> unreliableSequenceNumber = 0;
533 }
534 else
535 {
536 ++ channel -> outgoingUnreliableSequenceNumber;
537
538 outgoingCommand -> reliableSequenceNumber = channel -> outgoingReliableSequenceNumber;
539 outgoingCommand -> unreliableSequenceNumber = channel -> outgoingUnreliableSequenceNumber;
540 }
541
542 outgoingCommand -> sentTime = 0;
543 outgoingCommand -> roundTripTimeout = 0;
544 outgoingCommand -> roundTripTimeoutLimit = 0;
545 outgoingCommand -> fragmentOffset = offset;
546 outgoingCommand -> fragmentLength = length;
547 outgoingCommand -> packet = packet;
548 outgoingCommand -> command = * command;
549 outgoingCommand -> command.header.reliableSequenceNumber = ENET_HOST_TO_NET_32 (outgoingCommand -> reliableSequenceNumber);
550
551 if (packet != NULL)
552 ++ packet -> referenceCount;
553
554 if (command -> header.flags & ENET_PROTOCOL_FLAG_ACKNOWLEDGE)
555 enet_list_insert (enet_list_end (& peer -> outgoingReliableCommands), outgoingCommand);
556 else
557 enet_list_insert (enet_list_end (& peer -> outgoingUnreliableCommands), outgoingCommand);
558
559 return outgoingCommand;
560 }
561
562 ENetIncomingCommand *
563 enet_peer_queue_incoming_command (ENetPeer * peer, const ENetProtocol * command, ENetPacket * packet, enet_uint32 fragmentCount)
564 {
565 ENetChannel * channel = & peer -> channels [command -> header.channelID];
566 enet_uint32 unreliableSequenceNumber = 0;
567 ENetIncomingCommand * incomingCommand;
568 ENetListIterator currentCommand;
569
570 switch (command -> header.command)
571 {
572 case ENET_PROTOCOL_COMMAND_SEND_FRAGMENT:
573 case ENET_PROTOCOL_COMMAND_SEND_RELIABLE:
574 for (currentCommand = enet_list_previous (enet_list_end (& channel -> incomingReliableCommands));
575 currentCommand != enet_list_end (& channel -> incomingReliableCommands);
576 currentCommand = enet_list_previous (currentCommand))
577 {
578 incomingCommand = (ENetIncomingCommand *) currentCommand;
579
580 if (incomingCommand -> reliableSequenceNumber <= command -> header.reliableSequenceNumber)
581 {
582 if (incomingCommand -> reliableSequenceNumber < command -> header.reliableSequenceNumber)
583 break;
584
585 goto freePacket;
586 }
587 }
588 break;
589
590 case ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE:
591 unreliableSequenceNumber = ENET_NET_TO_HOST_32 (command -> sendUnreliable.unreliableSequenceNumber);
592
593 if (command -> header.reliableSequenceNumber < channel -> incomingReliableSequenceNumber)
594 goto freePacket;
595
596 if (unreliableSequenceNumber <= channel -> incomingUnreliableSequenceNumber)
597 goto freePacket;
598
599 for (currentCommand = enet_list_previous (enet_list_end (& channel -> incomingUnreliableCommands));
600 currentCommand != enet_list_end (& channel -> incomingUnreliableCommands);
601 currentCommand = enet_list_previous (currentCommand))
602 {
603 incomingCommand = (ENetIncomingCommand *) currentCommand;
604
605 if (incomingCommand -> unreliableSequenceNumber <= unreliableSequenceNumber)
606 {
607 if (incomingCommand -> unreliableSequenceNumber < unreliableSequenceNumber)
608 break;
609
610 goto freePacket;
611 }
612 }
613 break;
614
615 case ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED:
616 currentCommand = enet_list_end (& channel -> incomingUnreliableCommands);
617 break;
618
619 default:
620 goto freePacket;
621 }
622
623 incomingCommand = (ENetIncomingCommand *) enet_malloc (sizeof (ENetIncomingCommand));
624
625 incomingCommand -> reliableSequenceNumber = command -> header.reliableSequenceNumber;
626 incomingCommand -> unreliableSequenceNumber = unreliableSequenceNumber;
627 incomingCommand -> command = * command;
628 incomingCommand -> fragmentCount = fragmentCount;
629 incomingCommand -> fragmentsRemaining = fragmentCount;
630 incomingCommand -> packet = packet;
631 incomingCommand -> fragments = NULL;
632
633 if (fragmentCount > 0)
634 {
635 incomingCommand -> fragments = (enet_uint32 *) enet_malloc ((fragmentCount + 31) / 32 * sizeof (enet_uint32));
636 memset (incomingCommand -> fragments, 0, (fragmentCount + 31) / 32 * sizeof (enet_uint32));
637 }
638
639 if (packet != NULL)
640 ++ packet -> referenceCount;
641
642 enet_list_insert (enet_list_next (currentCommand), incomingCommand);
643
644 return incomingCommand;
645
646 freePacket:
647 if (packet != NULL)
648 {
649 if (packet -> referenceCount == 0)
650 enet_packet_destroy (packet);
651 }
652
653 return NULL;
654 }
655
656 /** @} */
Binary diff not shown
0 /**
1 @file protocol.c
2 @brief ENet protocol functions
3 */
4 #include <stdio.h>
5 #include <string.h>
6 #define ENET_BUILDING_LIB 1
7 #include "enet/utility.h"
8 #include "enet/time.h"
9 #include "enet/enet.h"
10
11 static enet_uint32 timeCurrent;
12
13 static int
14 enet_protocol_dispatch_incoming_commands (ENetHost * host, ENetEvent * event)
15 {
16 ENetPeer * currentPeer = host -> lastServicedPeer;
17 ENetChannel * channel;
18
19 do
20 {
21 ++ currentPeer;
22
23 if (currentPeer >= & host -> peers [host -> peerCount])
24 currentPeer = host -> peers;
25
26 switch (currentPeer -> state)
27 {
28 case ENET_PEER_STATE_CONNECTION_PENDING:
29 currentPeer -> state = ENET_PEER_STATE_CONNECTED;
30
31 event -> type = ENET_EVENT_TYPE_CONNECT;
32 event -> peer = currentPeer;
33
34 return 1;
35
36 case ENET_PEER_STATE_ZOMBIE:
37 host -> recalculateBandwidthLimits = 1;
38
39 event -> type = ENET_EVENT_TYPE_DISCONNECT;
40 event -> peer = currentPeer;
41 event -> data = currentPeer -> disconnectData;
42
43 enet_peer_reset (currentPeer);
44
45 host -> lastServicedPeer = currentPeer;
46
47 return 1;
48 }
49
50 if (currentPeer -> state != ENET_PEER_STATE_CONNECTED)
51 continue;
52
53 for (channel = currentPeer -> channels;
54 channel < & currentPeer -> channels [currentPeer -> channelCount];
55 ++ channel)
56 {
57 if (enet_list_empty (& channel -> incomingReliableCommands) &&
58 enet_list_empty (& channel -> incomingUnreliableCommands))
59 continue;
60
61 event -> packet = enet_peer_receive (currentPeer, channel - currentPeer -> channels);
62 if (event -> packet == NULL)
63 continue;
64
65 event -> type = ENET_EVENT_TYPE_RECEIVE;
66 event -> peer = currentPeer;
67 event -> channelID = (enet_uint8) (channel - currentPeer -> channels);
68
69 host -> lastServicedPeer = currentPeer;
70
71 return 1;
72 }
73 } while (currentPeer != host -> lastServicedPeer);
74
75 return 0;
76 }
77
78 static void
79 enet_protocol_notify_connect (ENetHost * host, ENetPeer * peer, ENetEvent * event)
80 {
81 host -> recalculateBandwidthLimits = 1;
82
83 if (event == NULL)
84 peer -> state = ENET_PEER_STATE_CONNECTION_PENDING;
85 else
86 {
87 peer -> state = ENET_PEER_STATE_CONNECTED;
88
89 event -> type = ENET_EVENT_TYPE_CONNECT;
90 event -> peer = peer;
91 }
92 }
93
94 static void
95 enet_protocol_notify_disconnect (ENetHost * host, ENetPeer * peer, ENetEvent * event)
96 {
97 if (peer -> state >= ENET_PEER_STATE_CONNECTION_PENDING)
98 host -> recalculateBandwidthLimits = 1;
99
100 if (peer -> state < ENET_PEER_STATE_CONNECTED)
101 enet_peer_reset (peer);
102 else
103 if (event == NULL)
104 peer -> state = ENET_PEER_STATE_ZOMBIE;
105 else
106 {
107 event -> type = ENET_EVENT_TYPE_DISCONNECT;
108 event -> peer = peer;
109 event -> data = 0;
110
111 enet_peer_reset (peer);
112 }
113 }
114
115 static void
116 enet_protocol_remove_sent_unreliable_commands (ENetPeer * peer)
117 {
118 ENetOutgoingCommand * outgoingCommand;
119
120 while (enet_list_empty (& peer -> sentUnreliableCommands) == 0)
121 {
122 outgoingCommand = (ENetOutgoingCommand *) enet_list_front (& peer -> sentUnreliableCommands);
123
124 enet_list_remove (& outgoingCommand -> outgoingCommandList);
125
126 if (outgoingCommand -> packet != NULL)
127 {
128 -- outgoingCommand -> packet -> referenceCount;
129
130 if (outgoingCommand -> packet -> referenceCount == 0)
131 enet_packet_destroy (outgoingCommand -> packet);
132 }
133
134 enet_free (outgoingCommand);
135 }
136 }
137
138 static ENetProtocolCommand
139 enet_protocol_remove_sent_reliable_command (ENetPeer * peer, enet_uint32 reliableSequenceNumber, enet_uint8 channelID)
140 {
141 ENetOutgoingCommand * outgoingCommand;
142 ENetListIterator currentCommand;
143 ENetProtocolCommand commandNumber;
144
145 for (currentCommand = enet_list_begin (& peer -> sentReliableCommands);
146 currentCommand != enet_list_end (& peer -> sentReliableCommands);
147 currentCommand = enet_list_next (currentCommand))
148 {
149 outgoingCommand = (ENetOutgoingCommand *) currentCommand;
150
151 if (outgoingCommand -> reliableSequenceNumber == reliableSequenceNumber &&
152 outgoingCommand -> command.header.channelID == channelID)
153 break;
154 }
155
156 if (currentCommand == enet_list_end (& peer -> sentReliableCommands))
157 return ENET_PROTOCOL_COMMAND_NONE;
158
159 commandNumber = outgoingCommand -> command.header.command;
160
161 enet_list_remove (& outgoingCommand -> outgoingCommandList);
162
163 if (outgoingCommand -> packet != NULL)
164 {
165 peer -> reliableDataInTransit -= outgoingCommand -> fragmentLength;
166
167 -- outgoingCommand -> packet -> referenceCount;
168
169 if (outgoingCommand -> packet -> referenceCount == 0)
170 enet_packet_destroy (outgoingCommand -> packet);
171 }
172
173 enet_free (outgoingCommand);
174
175 if (enet_list_empty (& peer -> sentReliableCommands))
176 return commandNumber;
177
178 outgoingCommand = (ENetOutgoingCommand *) enet_list_front (& peer -> sentReliableCommands);
179
180 peer -> nextTimeout = outgoingCommand -> sentTime + outgoingCommand -> roundTripTimeout;
181
182 return commandNumber;
183 }
184
185 static ENetPeer *
186 enet_protocol_handle_connect (ENetHost * host, const ENetProtocolHeader * header, const ENetProtocol * command)
187 {
188 enet_uint16 mtu;
189 enet_uint32 windowSize;
190 ENetChannel * channel;
191 size_t channelCount;
192 ENetPeer * currentPeer;
193 ENetProtocol verifyCommand;
194
195 if (command -> header.commandLength < sizeof (ENetProtocolConnect))
196 return NULL;
197
198 channelCount = ENET_NET_TO_HOST_32 (command -> connect.channelCount);
199
200 if (channelCount < ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT ||
201 channelCount > ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT)
202 return NULL;
203
204 for (currentPeer = host -> peers;
205 currentPeer < & host -> peers [host -> peerCount];
206 ++ currentPeer)
207 {
208 if (currentPeer -> state != ENET_PEER_STATE_DISCONNECTED &&
209 currentPeer -> address.host == host -> receivedAddress.host &&
210 currentPeer -> address.port == host -> receivedAddress.port &&
211 currentPeer -> challenge == header -> challenge)
212 return NULL;
213 }
214
215 for (currentPeer = host -> peers;
216 currentPeer < & host -> peers [host -> peerCount];
217 ++ currentPeer)
218 {
219 if (currentPeer -> state == ENET_PEER_STATE_DISCONNECTED)
220 break;
221 }
222
223 if (currentPeer >= & host -> peers [host -> peerCount])
224 return NULL;
225
226 currentPeer -> state = ENET_PEER_STATE_ACKNOWLEDGING_CONNECT;
227 currentPeer -> challenge = header -> challenge;
228 currentPeer -> address = host -> receivedAddress;
229 currentPeer -> outgoingPeerID = ENET_NET_TO_HOST_16 (command -> connect.outgoingPeerID);
230 currentPeer -> incomingBandwidth = ENET_NET_TO_HOST_32 (command -> connect.incomingBandwidth);
231 currentPeer -> outgoingBandwidth = ENET_NET_TO_HOST_32 (command -> connect.outgoingBandwidth);
232 currentPeer -> packetThrottleInterval = ENET_NET_TO_HOST_32 (command -> connect.packetThrottleInterval);
233 currentPeer -> packetThrottleAcceleration = ENET_NET_TO_HOST_32 (command -> connect.packetThrottleAcceleration);
234 currentPeer -> packetThrottleDeceleration = ENET_NET_TO_HOST_32 (command -> connect.packetThrottleDeceleration);
235 currentPeer -> channels = (ENetChannel *) enet_malloc (channelCount * sizeof (ENetChannel));
236 currentPeer -> channelCount = channelCount;
237
238 for (channel = currentPeer -> channels;
239 channel < & currentPeer -> channels [channelCount];
240 ++ channel)
241 {
242 channel -> outgoingReliableSequenceNumber = 0;
243 channel -> outgoingUnreliableSequenceNumber = 0;
244 channel -> incomingReliableSequenceNumber = 0;
245 channel -> incomingUnreliableSequenceNumber = 0;
246
247 enet_list_clear (& channel -> incomingReliableCommands);
248 enet_list_clear (& channel -> incomingUnreliableCommands);
249 }
250
251 mtu = ENET_NET_TO_HOST_16 (command -> connect.mtu);
252
253 if (mtu < ENET_PROTOCOL_MINIMUM_MTU)
254 mtu = ENET_PROTOCOL_MINIMUM_MTU;
255 else
256 if (mtu > ENET_PROTOCOL_MAXIMUM_MTU)
257 mtu = ENET_PROTOCOL_MAXIMUM_MTU;
258
259 currentPeer -> mtu = mtu;
260
261 if (host -> outgoingBandwidth == 0 &&
262 currentPeer -> incomingBandwidth == 0)
263 currentPeer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE;
264 else
265 currentPeer -> windowSize = (ENET_MIN (host -> outgoingBandwidth, currentPeer -> incomingBandwidth) /
266 ENET_PEER_WINDOW_SIZE_SCALE) *
267 ENET_PROTOCOL_MINIMUM_WINDOW_SIZE;
268
269 if (currentPeer -> windowSize < ENET_PROTOCOL_MINIMUM_WINDOW_SIZE)
270 currentPeer -> windowSize = ENET_PROTOCOL_MINIMUM_WINDOW_SIZE;
271 else
272 if (currentPeer -> windowSize > ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE)
273 currentPeer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE;
274
275 if (host -> incomingBandwidth == 0)
276 windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE;
277 else
278 windowSize = (host -> incomingBandwidth / ENET_PEER_WINDOW_SIZE_SCALE) *
279 ENET_PROTOCOL_MINIMUM_WINDOW_SIZE;
280
281 if (windowSize > ENET_NET_TO_HOST_32 (command -> connect.windowSize))
282 windowSize = ENET_NET_TO_HOST_32 (command -> connect.windowSize);
283
284 if (windowSize < ENET_PROTOCOL_MINIMUM_WINDOW_SIZE)
285 windowSize = ENET_PROTOCOL_MINIMUM_WINDOW_SIZE;
286 else
287 if (windowSize > ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE)
288 windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE;
289
290 verifyCommand.header.command = ENET_PROTOCOL_COMMAND_VERIFY_CONNECT;
291 verifyCommand.header.channelID = 0xFF;
292 verifyCommand.header.flags = ENET_PROTOCOL_FLAG_ACKNOWLEDGE;
293 verifyCommand.header.commandLength = sizeof (ENetProtocolVerifyConnect);
294 verifyCommand.verifyConnect.outgoingPeerID = ENET_HOST_TO_NET_16 (currentPeer -> incomingPeerID);
295 verifyCommand.verifyConnect.mtu = ENET_HOST_TO_NET_16 (currentPeer -> mtu);
296 verifyCommand.verifyConnect.windowSize = ENET_HOST_TO_NET_32 (windowSize);
297 verifyCommand.verifyConnect.channelCount = ENET_HOST_TO_NET_32 (channelCount);
298 verifyCommand.verifyConnect.incomingBandwidth = ENET_HOST_TO_NET_32 (host -> incomingBandwidth);
299 verifyCommand.verifyConnect.outgoingBandwidth = ENET_HOST_TO_NET_32 (host -> outgoingBandwidth);
300 verifyCommand.verifyConnect.packetThrottleInterval = ENET_HOST_TO_NET_32 (currentPeer -> packetThrottleInterval);
301 verifyCommand.verifyConnect.packetThrottleAcceleration = ENET_HOST_TO_NET_32 (currentPeer -> packetThrottleAcceleration);
302 verifyCommand.verifyConnect.packetThrottleDeceleration = ENET_HOST_TO_NET_32 (currentPeer -> packetThrottleDeceleration);
303
304 enet_peer_queue_outgoing_command (currentPeer, & verifyCommand, NULL, 0, 0);
305
306 return currentPeer;
307 }
308
309 static void
310 enet_protocol_handle_send_reliable (ENetHost * host, ENetPeer * peer, const ENetProtocol * command)
311 {
312 ENetPacket * packet;
313
314 if (command -> header.commandLength <= sizeof (ENetProtocolSendReliable) ||
315 command -> header.channelID >= peer -> channelCount ||
316 peer -> state != ENET_PEER_STATE_CONNECTED)
317 return;
318
319 packet = enet_packet_create ((const enet_uint8 *) command + sizeof (ENetProtocolSendReliable),
320 command -> header.commandLength - sizeof (ENetProtocolSendReliable),
321 ENET_PACKET_FLAG_RELIABLE);
322
323 enet_peer_queue_incoming_command (peer, command, packet, 0);
324 }
325
326 static void
327 enet_protocol_handle_send_unsequenced (ENetHost * host, ENetPeer * peer, const ENetProtocol * command)
328 {
329 ENetPacket * packet;
330 enet_uint32 unsequencedGroup, index;
331
332 if (command -> header.commandLength <= sizeof (ENetProtocolSendUnsequenced) ||
333 command -> header.channelID >= peer -> channelCount ||
334 peer -> state != ENET_PEER_STATE_CONNECTED)
335 return;
336
337 unsequencedGroup = ENET_NET_TO_HOST_32 (command -> sendUnsequenced.unsequencedGroup);
338 index = unsequencedGroup % ENET_PEER_UNSEQUENCED_WINDOW_SIZE;
339
340 if (unsequencedGroup >= peer -> incomingUnsequencedGroup + ENET_PEER_UNSEQUENCED_WINDOW_SIZE)
341 {
342 peer -> incomingUnsequencedGroup = unsequencedGroup - index;
343
344 memset (peer -> unsequencedWindow, 0, sizeof (peer -> unsequencedWindow));
345 }
346 else
347 if (unsequencedGroup < peer -> incomingUnsequencedGroup ||
348 peer -> unsequencedWindow [index / 32] & (1 << (index % 32)))
349 return;
350
351 peer -> unsequencedWindow [index / 32] |= 1 << (index % 32);
352
353
354 packet = enet_packet_create ((const enet_uint8 *) command + sizeof (ENetProtocolSendUnsequenced),
355 command -> header.commandLength - sizeof (ENetProtocolSendUnsequenced),
356 ENET_PACKET_FLAG_UNSEQUENCED);
357
358 enet_peer_queue_incoming_command (peer, command, packet, 0);
359 }
360
361 static void
362 enet_protocol_handle_send_unreliable (ENetHost * host, ENetPeer * peer, const ENetProtocol * command)
363 {
364 ENetPacket * packet;
365
366 if (command -> header.commandLength <= sizeof (ENetProtocolSendUnreliable) ||
367 command -> header.channelID >= peer -> channelCount ||
368 peer -> state != ENET_PEER_STATE_CONNECTED)
369 return;
370
371 packet = enet_packet_create ((const enet_uint8 *) command + sizeof (ENetProtocolSendUnreliable),
372 command -> header.commandLength - sizeof (ENetProtocolSendUnreliable),
373 0);
374
375 enet_peer_queue_incoming_command (peer, command, packet, 0);
376 }
377
378 static void
379 enet_protocol_handle_send_fragment (ENetHost * host, ENetPeer * peer, const ENetProtocol * command)
380 {
381 enet_uint32 fragmentNumber,
382 fragmentCount,
383 fragmentOffset,
384 fragmentLength,
385 startSequenceNumber,
386 totalLength;
387 ENetChannel * channel;
388 ENetListIterator currentCommand;
389 ENetIncomingCommand * startCommand;
390
391 if (command -> header.commandLength <= sizeof (ENetProtocolSendFragment) ||
392 command -> header.channelID >= peer -> channelCount ||
393 peer -> state != ENET_PEER_STATE_CONNECTED)
394 return;
395
396 startSequenceNumber = ENET_NET_TO_HOST_32 (command -> sendFragment.startSequenceNumber);
397 fragmentNumber = ENET_NET_TO_HOST_32 (command -> sendFragment.fragmentNumber);
398 fragmentCount = ENET_NET_TO_HOST_32 (command -> sendFragment.fragmentCount);
399 fragmentOffset = ENET_NET_TO_HOST_32 (command -> sendFragment.fragmentOffset);
400 totalLength = ENET_NET_TO_HOST_32 (command -> sendFragment.totalLength);
401 fragmentLength = command -> header.commandLength - sizeof (ENetProtocolSendFragment);
402
403 if (fragmentOffset >= totalLength ||
404 fragmentOffset + fragmentLength > totalLength ||
405 fragmentNumber >= fragmentCount)
406 return;
407
408 channel = & peer -> channels [command -> header.channelID];
409
410 if (startSequenceNumber <= channel -> incomingReliableSequenceNumber)
411 return;
412
413 for (currentCommand = enet_list_previous (enet_list_end (& channel -> incomingReliableCommands));
414 currentCommand != enet_list_end (& channel -> incomingReliableCommands);
415 currentCommand = enet_list_previous (currentCommand))
416 {
417 startCommand = (ENetIncomingCommand *) currentCommand;
418
419 if (startCommand -> command.header.command == ENET_PROTOCOL_COMMAND_SEND_FRAGMENT &&
420 startCommand -> command.sendFragment.startSequenceNumber == startSequenceNumber)
421 break;
422 }
423
424 if (currentCommand == enet_list_end (& channel -> incomingReliableCommands))
425 {
426 ENetProtocol hostCommand = * command;
427
428 hostCommand.header.reliableSequenceNumber = startSequenceNumber;
429 hostCommand.sendFragment.startSequenceNumber = startSequenceNumber;
430 hostCommand.sendFragment.fragmentNumber = fragmentNumber;
431 hostCommand.sendFragment.fragmentCount = fragmentCount;
432 hostCommand.sendFragment.fragmentOffset = fragmentOffset;
433 hostCommand.sendFragment.totalLength = totalLength;
434
435 startCommand = enet_peer_queue_incoming_command (peer,
436 & hostCommand,
437 enet_packet_create (NULL, totalLength, ENET_PACKET_FLAG_RELIABLE),
438 fragmentCount);
439 }
440 else
441 if (totalLength != startCommand -> packet -> dataLength ||
442 fragmentCount != startCommand -> fragmentCount)
443 return;
444
445 if ((startCommand -> fragments [fragmentNumber / 32] & (1 << (fragmentNumber % 32))) == 0)
446 {
447 -- startCommand -> fragmentsRemaining;
448
449 startCommand -> fragments [fragmentNumber / 32] |= (1 << (fragmentNumber % 32));
450
451 if (fragmentOffset + fragmentLength > startCommand -> packet -> dataLength)
452 fragmentLength = startCommand -> packet -> dataLength - fragmentOffset;
453
454 memcpy (startCommand -> packet -> data + fragmentOffset,
455 (enet_uint8 *) command + sizeof (ENetProtocolSendFragment),
456 fragmentLength);
457 }
458 }
459
460 static void
461 enet_protocol_handle_ping (ENetHost * host, ENetPeer * peer, const ENetProtocol * command)
462 {
463 if (command -> header.commandLength < sizeof (ENetProtocolPing))
464 return;
465 }
466
467 static void
468 enet_protocol_handle_bandwidth_limit (ENetHost * host, ENetPeer * peer, const ENetProtocol * command)
469 {
470 if (command -> header.commandLength < sizeof (ENetProtocolBandwidthLimit))
471 return;
472
473 peer -> incomingBandwidth = ENET_NET_TO_HOST_32 (command -> bandwidthLimit.incomingBandwidth);
474 peer -> outgoingBandwidth = ENET_NET_TO_HOST_32 (command -> bandwidthLimit.outgoingBandwidth);
475
476 if (peer -> incomingBandwidth == 0 &&
477 host -> outgoingBandwidth == 0)
478 peer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE;
479 else
480 peer -> windowSize = (ENET_MIN (peer -> incomingBandwidth, host -> outgoingBandwidth) /
481 ENET_PEER_WINDOW_SIZE_SCALE) * ENET_PROTOCOL_MINIMUM_WINDOW_SIZE;
482
483 if (peer -> windowSize < ENET_PROTOCOL_MINIMUM_WINDOW_SIZE)
484 peer -> windowSize = ENET_PROTOCOL_MINIMUM_WINDOW_SIZE;
485 else
486 if (peer -> windowSize > ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE)
487 peer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE;
488 }
489
490 static void
491 enet_protocol_handle_throttle_configure (ENetHost * host, ENetPeer * peer, const ENetProtocol * command)
492 {
493 if (command -> header.commandLength < sizeof (ENetProtocolThrottleConfigure))
494 return;
495
496 peer -> packetThrottleInterval = ENET_NET_TO_HOST_32 (command -> throttleConfigure.packetThrottleInterval);
497 peer -> packetThrottleAcceleration = ENET_NET_TO_HOST_32 (command -> throttleConfigure.packetThrottleAcceleration);
498 peer -> packetThrottleDeceleration = ENET_NET_TO_HOST_32 (command -> throttleConfigure.packetThrottleDeceleration);
499 }
500
501 static void
502 enet_protocol_handle_disconnect (ENetHost * host, ENetPeer * peer, const ENetProtocol * command)
503 {
504 if (command -> header.commandLength < sizeof (ENetProtocolDisconnect))
505 return;
506
507 enet_peer_reset_queues (peer);
508
509 if (peer -> state != ENET_PEER_STATE_CONNECTED)
510 {
511 if (peer -> state == ENET_PEER_STATE_CONNECTION_PENDING) host -> recalculateBandwidthLimits = 1;
512
513 enet_peer_reset (peer);
514 }
515 else
516 if (command -> header.flags & ENET_PROTOCOL_FLAG_ACKNOWLEDGE)
517 peer -> state = ENET_PEER_STATE_ACKNOWLEDGING_DISCONNECT;
518 else
519 peer -> state = ENET_PEER_STATE_ZOMBIE;
520
521 peer -> disconnectData = command -> disconnect.data;
522 }
523
524 static int
525 enet_protocol_handle_acknowledge (ENetHost * host, ENetEvent * event, ENetPeer * peer, const ENetProtocol * command)
526 {
527 enet_uint32 roundTripTime,
528 receivedSentTime,
529 receivedReliableSequenceNumber;
530 ENetProtocolCommand commandNumber;
531
532 if (command -> header.commandLength < sizeof (ENetProtocolAcknowledge))
533 return 0;
534
535 receivedSentTime = ENET_NET_TO_HOST_32 (command -> acknowledge.receivedSentTime);
536
537 if (ENET_TIME_LESS (timeCurrent, receivedSentTime))
538 return 0;
539
540 peer -> lastReceiveTime = timeCurrent;
541 peer -> earliestTimeout = 0;
542
543 roundTripTime = ENET_TIME_DIFFERENCE (timeCurrent, receivedSentTime);
544
545 enet_peer_throttle (peer, roundTripTime);
546
547 peer -> roundTripTimeVariance -= peer -> roundTripTimeVariance / 4;
548
549 if (roundTripTime >= peer -> roundTripTime)
550 {
551 peer -> roundTripTime += (roundTripTime - peer -> roundTripTime) / 8;
552 peer -> roundTripTimeVariance += (roundTripTime - peer -> roundTripTime) / 4;
553 }
554 else
555 {
556 peer -> roundTripTime -= (peer -> roundTripTime - roundTripTime) / 8;
557 peer -> roundTripTimeVariance += (peer -> roundTripTime - roundTripTime) / 4;
558 }
559
560 if (peer -> roundTripTime < peer -> lowestRoundTripTime)
561 peer -> lowestRoundTripTime = peer -> roundTripTime;
562
563 if (peer -> roundTripTimeVariance > peer -> highestRoundTripTimeVariance)
564 peer -> highestRoundTripTimeVariance = peer -> roundTripTimeVariance;
565
566 if (peer -> packetThrottleEpoch == 0 ||
567 ENET_TIME_DIFFERENCE(timeCurrent, peer -> packetThrottleEpoch) >= peer -> packetThrottleInterval)
568 {
569 peer -> lastRoundTripTime = peer -> lowestRoundTripTime;
570 peer -> lastRoundTripTimeVariance = peer -> highestRoundTripTimeVariance;
571 peer -> lowestRoundTripTime = peer -> roundTripTime;
572 peer -> highestRoundTripTimeVariance = peer -> roundTripTimeVariance;
573 peer -> packetThrottleEpoch = timeCurrent;
574 }
575
576 receivedReliableSequenceNumber = ENET_NET_TO_HOST_32 (command -> acknowledge.receivedReliableSequenceNumber);
577
578 commandNumber = enet_protocol_remove_sent_reliable_command (peer, receivedReliableSequenceNumber, command -> header.channelID);
579
580 switch (peer -> state)
581 {
582 case ENET_PEER_STATE_ACKNOWLEDGING_CONNECT:
583 if (commandNumber != ENET_PROTOCOL_COMMAND_VERIFY_CONNECT)
584 return 0;
585
586 enet_protocol_notify_connect (host, peer, event);
587
588 return 1;
589
590 case ENET_PEER_STATE_DISCONNECTING:
591 if (commandNumber != ENET_PROTOCOL_COMMAND_DISCONNECT)
592 return 0;
593
594 enet_protocol_notify_disconnect (host, peer, event);
595
596 return 1;
597 }
598
599 return 0;
600 }
601
602 static void
603 enet_protocol_handle_verify_connect (ENetHost * host, ENetEvent * event, ENetPeer * peer, const ENetProtocol * command)
604 {
605 enet_uint16 mtu;
606 enet_uint32 windowSize;
607
608 if (event == NULL ||
609 command -> header.commandLength < sizeof (ENetProtocolVerifyConnect) ||
610 peer -> state != ENET_PEER_STATE_CONNECTING)
611 return;
612
613 if (ENET_NET_TO_HOST_32 (command -> verifyConnect.channelCount) != peer -> channelCount ||
614 ENET_NET_TO_HOST_32 (command -> verifyConnect.packetThrottleInterval) != peer -> packetThrottleInterval ||
615 ENET_NET_TO_HOST_32 (command -> verifyConnect.packetThrottleAcceleration) != peer -> packetThrottleAcceleration ||
616 ENET_NET_TO_HOST_32 (command -> verifyConnect.packetThrottleDeceleration) != peer -> packetThrottleDeceleration)
617 {
618 peer -> state = ENET_PEER_STATE_ZOMBIE;
619
620 return;
621 }
622
623 peer -> outgoingPeerID = ENET_NET_TO_HOST_16 (command -> verifyConnect.outgoingPeerID);
624
625 mtu = ENET_NET_TO_HOST_16 (command -> verifyConnect.mtu);
626
627 if (mtu < ENET_PROTOCOL_MINIMUM_MTU)
628 mtu = ENET_PROTOCOL_MINIMUM_MTU;
629 else
630 if (mtu > ENET_PROTOCOL_MAXIMUM_MTU)
631 mtu = ENET_PROTOCOL_MAXIMUM_MTU;
632
633 if (mtu < peer -> mtu)
634 peer -> mtu = mtu;
635
636 windowSize = ENET_NET_TO_HOST_32 (command -> verifyConnect.windowSize);
637
638 if (windowSize < ENET_PROTOCOL_MINIMUM_WINDOW_SIZE)
639 windowSize = ENET_PROTOCOL_MINIMUM_WINDOW_SIZE;
640
641 if (windowSize > ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE)
642 windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE;
643
644 if (windowSize < peer -> windowSize)
645 peer -> windowSize = windowSize;
646
647 peer -> incomingBandwidth = ENET_NET_TO_HOST_32 (command -> verifyConnect.incomingBandwidth);
648 peer -> outgoingBandwidth = ENET_NET_TO_HOST_32 (command -> verifyConnect.outgoingBandwidth);
649
650 enet_protocol_notify_connect (host, peer, event);
651 }
652
653 static int
654 enet_protocol_handle_incoming_commands (ENetHost * host, ENetEvent * event)
655 {
656 ENetProtocolHeader * header;
657 ENetProtocol * command;
658 ENetPeer * peer;
659 enet_uint8 * currentData;
660 size_t commandCount;
661
662 if (host -> receivedDataLength < sizeof (ENetProtocolHeader))
663 return 0;
664
665 header = (ENetProtocolHeader *) host -> receivedData;
666
667 header -> peerID = ENET_NET_TO_HOST_16 (header -> peerID);
668 header -> sentTime = ENET_NET_TO_HOST_32 (header -> sentTime);
669
670 if (header -> peerID == 0xFFFF)
671 peer = NULL;
672 else
673 if (header -> peerID >= host -> peerCount)
674 return 0;
675 else
676 {
677 peer = & host -> peers [header -> peerID];
678
679 if (peer -> state == ENET_PEER_STATE_DISCONNECTED ||
680 peer -> state == ENET_PEER_STATE_ZOMBIE ||
681 (host -> receivedAddress.host != peer -> address.host &&
682 peer -> address.host != ENET_HOST_BROADCAST) ||
683 header -> challenge != peer -> challenge)
684 return 0;
685 else
686 {
687 peer -> address.host = host -> receivedAddress.host;
688 peer -> address.port = host -> receivedAddress.port;
689 }
690 }
691
692 if (peer != NULL)
693 peer -> incomingDataTotal += host -> receivedDataLength;
694
695 commandCount = header -> commandCount;
696 currentData = host -> receivedData + sizeof (ENetProtocolHeader);
697
698 while (commandCount > 0 &&
699 currentData < & host -> receivedData [host -> receivedDataLength])
700 {
701 command = (ENetProtocol *) currentData;
702
703 if (currentData + sizeof (ENetProtocolCommandHeader) > & host -> receivedData [host -> receivedDataLength])
704 break;
705
706 command -> header.commandLength = ENET_NET_TO_HOST_32 (command -> header.commandLength);
707
708 if (command -> header.commandLength <= 0 ||
709 command -> header.commandLength > & host -> receivedData [host -> receivedDataLength] - currentData)
710 break;
711
712 -- commandCount;
713 currentData += command -> header.commandLength;
714
715 if (peer == NULL && command -> header.command != ENET_PROTOCOL_COMMAND_CONNECT)
716 break;
717
718 command -> header.reliableSequenceNumber = ENET_NET_TO_HOST_32 (command -> header.reliableSequenceNumber);
719
720 switch (command -> header.command)
721 {
722 case ENET_PROTOCOL_COMMAND_ACKNOWLEDGE:
723 enet_protocol_handle_acknowledge (host, event, peer, command);
724
725 break;
726
727 case ENET_PROTOCOL_COMMAND_CONNECT:
728 peer = enet_protocol_handle_connect (host, header, command);
729
730 break;
731
732 case ENET_PROTOCOL_COMMAND_VERIFY_CONNECT:
733 enet_protocol_handle_verify_connect (host, event, peer, command);
734
735 break;
736
737 case ENET_PROTOCOL_COMMAND_DISCONNECT:
738 enet_protocol_handle_disconnect (host, peer, command);
739
740 break;
741
742 case ENET_PROTOCOL_COMMAND_PING:
743 enet_protocol_handle_ping (host, peer, command);
744
745 break;
746
747 case ENET_PROTOCOL_COMMAND_SEND_RELIABLE:
748 enet_protocol_handle_send_reliable (host, peer, command);
749
750 break;
751
752 case ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE:
753 enet_protocol_handle_send_unreliable (host, peer, command);
754
755 break;
756
757 case ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED:
758 enet_protocol_handle_send_unsequenced (host, peer, command);
759
760 break;
761
762 case ENET_PROTOCOL_COMMAND_SEND_FRAGMENT:
763 enet_protocol_handle_send_fragment (host, peer, command);
764
765 break;
766
767 case ENET_PROTOCOL_COMMAND_BANDWIDTH_LIMIT:
768 enet_protocol_handle_bandwidth_limit (host, peer, command);
769
770 break;
771
772 case ENET_PROTOCOL_COMMAND_THROTTLE_CONFIGURE:
773 enet_protocol_handle_throttle_configure (host, peer, command);
774
775 break;
776
777 default:
778 break;
779 }
780
781 if (peer != NULL &&
782 (command -> header.flags & ENET_PROTOCOL_FLAG_ACKNOWLEDGE) != 0)
783 {
784 switch (peer -> state)
785 {
786 case ENET_PEER_STATE_DISCONNECTING:
787 break;
788
789 case ENET_PEER_STATE_ACKNOWLEDGING_DISCONNECT:
790 if (command -> header.command != ENET_PROTOCOL_COMMAND_DISCONNECT)
791 break;
792
793 default:
794 enet_peer_queue_acknowledgement (peer, command, header -> sentTime);
795
796 break;
797 }
798 }
799 }
800
801 if (event != NULL && event -> type != ENET_EVENT_TYPE_NONE)
802 return 1;
803
804 return 0;
805 }
806
807 static int
808 enet_protocol_receive_incoming_commands (ENetHost * host, ENetEvent * event)
809 {
810 for (;;)
811 {
812 int receivedLength;
813 ENetBuffer buffer;
814
815 buffer.data = host -> receivedData;
816 buffer.dataLength = sizeof (host -> receivedData);
817
818 receivedLength = enet_socket_receive (host -> socket,
819 & host -> receivedAddress,
820 & buffer,
821 1);
822
823 if (receivedLength < 0)
824 return -1;
825
826 if (receivedLength == 0)
827 return 0;
828
829 host -> receivedDataLength = receivedLength;
830
831 switch (enet_protocol_handle_incoming_commands (host, event))
832 {
833 case 1:
834 return 1;
835
836 case -1:
837 return -1;
838
839 default:
840 break;
841 }
842 }
843
844 return -1;
845 }
846
847 static void
848 enet_protocol_send_acknowledgements (ENetHost * host, ENetPeer * peer)
849 {
850 ENetProtocol * command = & host -> commands [host -> commandCount];
851 ENetBuffer * buffer = & host -> buffers [host -> bufferCount];
852 ENetAcknowledgement * acknowledgement;
853 ENetListIterator currentAcknowledgement;
854
855 currentAcknowledgement = enet_list_begin (& peer -> acknowledgements);
856
857 while (currentAcknowledgement != enet_list_end (& peer -> acknowledgements))
858 {
859 if (command >= & host -> commands [sizeof (host -> commands) / sizeof (ENetProtocol)] ||
860 buffer >= & host -> buffers [sizeof (host -> buffers) / sizeof (ENetBuffer)] ||
861 peer -> mtu - host -> packetSize < sizeof (ENetProtocolAcknowledge))
862 break;
863
864 acknowledgement = (ENetAcknowledgement *) currentAcknowledgement;
865
866 currentAcknowledgement = enet_list_next (currentAcknowledgement);
867
868 buffer -> data = command;
869 buffer -> dataLength = sizeof (ENetProtocolAcknowledge);
870
871 host -> packetSize += buffer -> dataLength;
872
873 command -> header.command = ENET_PROTOCOL_COMMAND_ACKNOWLEDGE;
874 command -> header.channelID = acknowledgement -> command.header.channelID;
875 command -> header.flags = 0;
876 command -> header.commandLength = ENET_HOST_TO_NET_32 (sizeof (ENetProtocolAcknowledge));
877 command -> acknowledge.receivedReliableSequenceNumber = ENET_HOST_TO_NET_32 (acknowledgement -> command.header.reliableSequenceNumber);
878 command -> acknowledge.receivedSentTime = ENET_HOST_TO_NET_32 (acknowledgement -> sentTime);
879
880 if (acknowledgement -> command.header.command == ENET_PROTOCOL_COMMAND_DISCONNECT)
881 peer -> state = ENET_PEER_STATE_ZOMBIE;
882
883 enet_list_remove (& acknowledgement -> acknowledgementList);
884 enet_free (acknowledgement);
885
886 ++ command;
887 ++ buffer;
888 }
889
890 host -> commandCount = command - host -> commands;
891 host -> bufferCount = buffer - host -> buffers;
892 }
893
894 static void
895 enet_protocol_send_unreliable_outgoing_commands (ENetHost * host, ENetPeer * peer)
896 {
897 ENetProtocol * command = & host -> commands [host -> commandCount];
898 ENetBuffer * buffer = & host -> buffers [host -> bufferCount];
899 ENetOutgoingCommand * outgoingCommand;
900 ENetListIterator currentCommand;
901
902 currentCommand = enet_list_begin (& peer -> outgoingUnreliableCommands);
903
904 while (currentCommand != enet_list_end (& peer -> outgoingUnreliableCommands))
905 {
906 outgoingCommand = (ENetOutgoingCommand *) currentCommand;
907
908 if (command >= & host -> commands [sizeof (host -> commands) / sizeof (ENetProtocol)] ||
909 buffer + 1 >= & host -> buffers [sizeof (host -> buffers) / sizeof (ENetBuffer)] ||
910 peer -> mtu - host -> packetSize < outgoingCommand -> command.header.commandLength ||
911 (outgoingCommand -> packet != NULL &&
912 peer -> mtu - host -> packetSize < outgoingCommand -> command.header.commandLength +
913 outgoingCommand -> packet -> dataLength))
914 break;
915
916 currentCommand = enet_list_next (currentCommand);
917
918 if (outgoingCommand -> packet != NULL)
919 {
920 peer -> packetThrottleCounter += ENET_PEER_PACKET_THROTTLE_COUNTER;
921 peer -> packetThrottleCounter %= ENET_PEER_PACKET_THROTTLE_SCALE;
922
923 if (peer -> packetThrottleCounter > peer -> packetThrottle)
924 {
925 -- outgoingCommand -> packet -> referenceCount;
926
927 if (outgoingCommand -> packet -> referenceCount == 0)
928 enet_packet_destroy (outgoingCommand -> packet);
929
930 enet_list_remove (& outgoingCommand -> outgoingCommandList);
931 enet_free (outgoingCommand);
932
933 continue;
934 }
935 }
936
937 buffer -> data = command;
938 buffer -> dataLength = outgoingCommand -> command.header.commandLength;
939
940 host -> packetSize += buffer -> dataLength;
941
942 * command = outgoingCommand -> command;
943
944 enet_list_remove (& outgoingCommand -> outgoingCommandList);
945
946 if (outgoingCommand -> packet != NULL)
947 {
948 ++ buffer;
949
950 buffer -> data = outgoingCommand -> packet -> data;
951 buffer -> dataLength = outgoingCommand -> packet -> dataLength;
952
953 command -> header.commandLength += buffer -> dataLength;
954
955 host -> packetSize += buffer -> dataLength;
956
957 enet_list_insert (enet_list_end (& peer -> sentUnreliableCommands), outgoingCommand);
958 }
959 else
960 enet_free (outgoingCommand);
961
962 command -> header.commandLength = ENET_HOST_TO_NET_32 (command -> header.commandLength);
963
964 ++ command;
965 ++ buffer;
966 }
967
968 host -> commandCount = command - host -> commands;
969 host -> bufferCount = buffer - host -> buffers;
970 }
971
972 static int
973 enet_protocol_check_timeouts (ENetHost * host, ENetPeer * peer, ENetEvent * event)
974 {
975 ENetOutgoingCommand * outgoingCommand;
976 ENetListIterator currentCommand;
977
978 currentCommand = enet_list_begin (& peer -> sentReliableCommands);
979
980 while (currentCommand != enet_list_end (& peer -> sentReliableCommands))
981 {
982 outgoingCommand = (ENetOutgoingCommand *) currentCommand;
983
984 currentCommand = enet_list_next (currentCommand);
985
986 if (ENET_TIME_DIFFERENCE (timeCurrent, outgoingCommand -> sentTime) < outgoingCommand -> roundTripTimeout)
987 continue;
988
989 if(peer -> earliestTimeout == 0 ||
990 ENET_TIME_LESS(outgoingCommand -> sentTime, peer -> earliestTimeout))
991 peer -> earliestTimeout = outgoingCommand -> sentTime;
992
993 if (peer -> earliestTimeout != 0 &&
994 (ENET_TIME_DIFFERENCE(timeCurrent, peer -> earliestTimeout) >= ENET_PEER_TIMEOUT_MAXIMUM ||
995 (outgoingCommand -> roundTripTimeout >= outgoingCommand -> roundTripTimeoutLimit &&
996 ENET_TIME_DIFFERENCE(timeCurrent, peer -> earliestTimeout) >= ENET_PEER_TIMEOUT_MINIMUM)))
997 {
998 enet_protocol_notify_disconnect (host, peer, event);
999
1000 return 1;
1001 }
1002
1003 if (outgoingCommand -> packet != NULL)
1004 peer -> reliableDataInTransit -= outgoingCommand -> fragmentLength;
1005
1006 ++ peer -> packetsLost;
1007
1008 outgoingCommand -> roundTripTimeout *= 2;
1009
1010 enet_list_insert (enet_list_begin (& peer -> outgoingReliableCommands),
1011 enet_list_remove (& outgoingCommand -> outgoingCommandList));
1012
1013 if (currentCommand == enet_list_begin (& peer -> sentReliableCommands) &&
1014 enet_list_empty (& peer -> sentReliableCommands) == 0)
1015 {
1016 outgoingCommand = (ENetOutgoingCommand *) currentCommand;
1017
1018 peer -> nextTimeout = outgoingCommand -> sentTime + outgoingCommand -> roundTripTimeout;
1019 }
1020 }
1021
1022 return 0;
1023 }
1024
1025 static void
1026 enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer)
1027 {
1028 ENetProtocol * command = & host -> commands [host -> commandCount];
1029 ENetBuffer * buffer = & host -> buffers [host -> bufferCount];
1030 ENetOutgoingCommand * outgoingCommand;
1031 ENetListIterator currentCommand;
1032
1033 currentCommand = enet_list_begin (& peer -> outgoingReliableCommands);
1034
1035 while (currentCommand != enet_list_end (& peer -> outgoingReliableCommands))
1036 {
1037 outgoingCommand = (ENetOutgoingCommand *) currentCommand;
1038
1039 if (command >= & host -> commands [sizeof (host -> commands) / sizeof (ENetProtocol)] ||
1040 buffer + 1 >= & host -> buffers [sizeof (host -> buffers) / sizeof (ENetBuffer)] ||
1041 peer -> mtu - host -> packetSize < outgoingCommand -> command.header.commandLength)
1042 break;
1043
1044 currentCommand = enet_list_next (currentCommand);
1045
1046 if (outgoingCommand -> packet != NULL)
1047 {
1048 if ((enet_uint16) (peer -> mtu - host -> packetSize) <
1049 (enet_uint16) (outgoingCommand -> command.header.commandLength +
1050 outgoingCommand -> fragmentLength) ||
1051 peer -> reliableDataInTransit + outgoingCommand -> fragmentLength > peer -> windowSize)
1052 break;
1053 }
1054
1055 if (outgoingCommand -> roundTripTimeout == 0)
1056 {
1057 outgoingCommand -> roundTripTimeout = peer -> roundTripTime + 4 * peer -> roundTripTimeVariance;
1058 outgoingCommand -> roundTripTimeoutLimit = ENET_PEER_TIMEOUT_LIMIT * outgoingCommand -> roundTripTimeout;
1059 }
1060
1061 if (enet_list_empty (& peer -> sentReliableCommands))
1062 peer -> nextTimeout = timeCurrent + outgoingCommand -> roundTripTimeout;
1063
1064 enet_list_insert (enet_list_end (& peer -> sentReliableCommands),
1065 enet_list_remove (& outgoingCommand -> outgoingCommandList));
1066
1067 outgoingCommand -> sentTime = timeCurrent;
1068
1069 buffer -> data = command;
1070 buffer -> dataLength = outgoingCommand -> command.header.commandLength;
1071
1072 host -> packetSize += buffer -> dataLength;
1073
1074 * command = outgoingCommand -> command;
1075
1076 if (outgoingCommand -> packet != NULL)
1077 {
1078 ++ buffer;
1079
1080 buffer -> data = outgoingCommand -> packet -> data + outgoingCommand -> fragmentOffset;
1081 buffer -> dataLength = outgoingCommand -> fragmentLength;
1082
1083 command -> header.commandLength += outgoingCommand -> fragmentLength;
1084
1085 host -> packetSize += outgoingCommand -> fragmentLength;
1086
1087 peer -> reliableDataInTransit += outgoingCommand -> fragmentLength;
1088 }
1089
1090 command -> header.commandLength = ENET_HOST_TO_NET_32 (command -> header.commandLength);
1091
1092 ++ peer -> packetsSent;
1093
1094 ++ command;
1095 ++ buffer;
1096 }
1097
1098 host -> commandCount = command - host -> commands;
1099 host -> bufferCount = buffer - host -> buffers;
1100 }
1101
1102 static int
1103 enet_protocol_send_outgoing_commands (ENetHost * host, ENetEvent * event, int checkForTimeouts)
1104 {
1105 size_t packetsSent = 1;
1106 ENetProtocolHeader header;
1107 ENetPeer * currentPeer;
1108 int sentLength;
1109
1110 while (packetsSent > 0)
1111 for (currentPeer = host -> peers,
1112 packetsSent = 0;
1113 currentPeer < & host -> peers [host -> peerCount];
1114 ++ currentPeer)
1115 {
1116 if (currentPeer -> state == ENET_PEER_STATE_DISCONNECTED ||
1117 currentPeer -> state == ENET_PEER_STATE_ZOMBIE)
1118 continue;
1119
1120 host -> commandCount = 0;
1121 host -> bufferCount = 1;
1122 host -> packetSize = sizeof (ENetProtocolHeader);
1123
1124 if (enet_list_empty (& currentPeer -> acknowledgements) == 0)
1125 enet_protocol_send_acknowledgements (host, currentPeer);
1126
1127 if (host -> commandCount < sizeof (host -> commands) / sizeof (ENetProtocol))
1128 {
1129 if (checkForTimeouts != 0 &&
1130 enet_list_empty (& currentPeer -> sentReliableCommands) == 0 &&
1131 ENET_TIME_GREATER_EQUAL (timeCurrent, currentPeer -> nextTimeout) &&
1132 enet_protocol_check_timeouts (host, currentPeer, event) == 1)
1133 return 1;
1134 }
1135 if (enet_list_empty (& currentPeer -> outgoingReliableCommands) == 0)
1136 enet_protocol_send_reliable_outgoing_commands (host, currentPeer);
1137 else
1138 if (enet_list_empty (& currentPeer -> sentReliableCommands) &&
1139 ENET_TIME_DIFFERENCE (timeCurrent, currentPeer -> lastReceiveTime) >= ENET_PEER_PING_INTERVAL &&
1140 currentPeer -> mtu - host -> packetSize >= sizeof (ENetProtocolPing))
1141 {
1142 enet_peer_ping (currentPeer);
1143 enet_protocol_send_reliable_outgoing_commands (host, currentPeer);
1144 }
1145
1146 if (host -> commandCount < sizeof (host -> commands) / sizeof (ENetProtocol) &&
1147 enet_list_empty (& currentPeer -> outgoingUnreliableCommands) == 0)
1148 enet_protocol_send_unreliable_outgoing_commands (host, currentPeer);
1149
1150 if (host -> commandCount == 0)
1151 continue;
1152
1153 if (currentPeer -> packetLossEpoch == 0)
1154 currentPeer -> packetLossEpoch = timeCurrent;
1155 else
1156 if (ENET_TIME_DIFFERENCE (timeCurrent, currentPeer -> packetLossEpoch) >= ENET_PEER_PACKET_LOSS_INTERVAL &&
1157 currentPeer -> packetsSent > 0)
1158 {
1159 enet_uint32 packetLoss = currentPeer -> packetsLost * ENET_PEER_PACKET_LOSS_SCALE / currentPeer -> packetsSent;
1160
1161 #ifdef ENET_DEBUG
1162 #ifdef WIN32
1163 printf (
1164 #else
1165 fprintf (stderr,
1166 #endif
1167 "peer %u: %f%%+-%f%% packet loss, %u+-%u ms round trip time, %f%% throttle, %u/%u outgoing, %u/%u incoming\n", currentPeer -> incomingPeerID, currentPeer -> packetLoss / (float) ENET_PEER_PACKET_LOSS_SCALE, currentPeer -> packetLossVariance / (float) ENET_PEER_PACKET_LOSS_SCALE, currentPeer -> roundTripTime, currentPeer -> roundTripTimeVariance, currentPeer -> packetThrottle / (float) ENET_PEER_PACKET_THROTTLE_SCALE, enet_list_size (& currentPeer -> outgoingReliableCommands), enet_list_size (& currentPeer -> outgoingUnreliableCommands), currentPeer -> channels != NULL ? enet_list_size (& currentPeer -> channels -> incomingReliableCommands) : 0, enet_list_size (& currentPeer -> channels -> incomingUnreliableCommands));
1168 #endif
1169
1170 currentPeer -> packetLossVariance -= currentPeer -> packetLossVariance / 4;
1171
1172 if (packetLoss >= currentPeer -> packetLoss)
1173 {
1174 currentPeer -> packetLoss += (packetLoss - currentPeer -> packetLoss) / 8;
1175 currentPeer -> packetLossVariance += (packetLoss - currentPeer -> packetLoss) / 4;
1176 }
1177 else
1178 {
1179 currentPeer -> packetLoss -= (currentPeer -> packetLoss - packetLoss) / 8;
1180 currentPeer -> packetLossVariance += (currentPeer -> packetLoss - packetLoss) / 4;
1181 }
1182
1183 currentPeer -> packetLossEpoch = timeCurrent;
1184 currentPeer -> packetsSent = 0;
1185 currentPeer -> packetsLost = 0;
1186 }
1187
1188 header.peerID = ENET_HOST_TO_NET_16 (currentPeer -> outgoingPeerID);
1189 header.flags = 0;
1190 header.commandCount = host -> commandCount;
1191 header.sentTime = ENET_HOST_TO_NET_32 (timeCurrent);
1192 header.challenge = currentPeer -> challenge;
1193
1194 host -> buffers -> data = & header;
1195 host -> buffers -> dataLength = sizeof (ENetProtocolHeader);
1196
1197 currentPeer -> lastSendTime = timeCurrent;
1198
1199 ++ packetsSent;
1200
1201 sentLength = enet_socket_send (host -> socket, & currentPeer -> address, host -> buffers, host -> bufferCount);
1202
1203 enet_protocol_remove_sent_unreliable_commands (currentPeer);
1204
1205 if (sentLength < 0)
1206 return -1;
1207 }
1208
1209 return 0;
1210 }
1211
1212 /** Sends any queued packets on the host specified to its designated peers.
1213
1214 @param host host to flush
1215 @remarks this function need only be used in circumstances where one wishes to send queued packets earlier than in a call to enet_host_service().
1216 @ingroup host
1217 */
1218 void
1219 enet_host_flush (ENetHost * host)
1220 {
1221 timeCurrent = enet_time_get ();
1222
1223 enet_protocol_send_outgoing_commands (host, NULL, 0);
1224 }
1225
1226 /** Waits for events on the host specified and shuttles packets between
1227 the host and its peers.
1228
1229 @param host host to service
1230 @param event an event structure where event details will be placed if one occurs
1231 if event == NULL then no events will be delivered
1232 @param timeout number of milliseconds that ENet should wait for events
1233 @retval > 0 if an event occurred within the specified time limit
1234 @retval 0 if no event occurred
1235 @retval < 0 on failure
1236 @remarks enet_host_service should be called fairly regularly for adequate performance
1237 @ingroup host
1238 */
1239 int
1240 enet_host_service (ENetHost * host, ENetEvent * event, enet_uint32 timeout)
1241 {
1242 enet_uint32 waitCondition;
1243
1244 if (event != NULL)
1245 {
1246 event -> type = ENET_EVENT_TYPE_NONE;
1247 event -> peer = NULL;
1248 event -> packet = NULL;
1249
1250 switch (enet_protocol_dispatch_incoming_commands (host, event))
1251 {
1252 case 1:
1253 return 1;
1254
1255 case -1:
1256 perror ("Error dispatching incoming packets");
1257
1258 return -1;
1259
1260 default:
1261 break;
1262 }
1263 }
1264
1265 timeCurrent = enet_time_get ();
1266
1267 timeout += timeCurrent;
1268
1269 do
1270 {
1271 if (ENET_TIME_DIFFERENCE (timeCurrent, host -> bandwidthThrottleEpoch) >= ENET_HOST_BANDWIDTH_THROTTLE_INTERVAL)
1272 enet_host_bandwidth_throttle (host);
1273
1274 switch (enet_protocol_send_outgoing_commands (host, event, 1))
1275 {
1276 case 1:
1277 return 1;
1278
1279 case -1:
1280 perror ("Error sending outgoing packets");
1281
1282 return -1;
1283
1284 default:
1285 break;
1286 }
1287
1288 switch (enet_protocol_receive_incoming_commands (host, event))
1289 {
1290 case 1:
1291 return 1;
1292
1293 case -1:
1294 perror ("Error receiving incoming packets");
1295
1296 return -1;
1297
1298 default:
1299 break;
1300 }
1301
1302 switch (enet_protocol_send_outgoing_commands (host, event, 1))
1303 {
1304 case 1:
1305 return 1;
1306
1307 case -1:
1308 perror ("Error sending outgoing packets");
1309
1310 return -1;
1311
1312 default:
1313 break;
1314 }
1315
1316 if (event != NULL)
1317 {
1318 switch (enet_protocol_dispatch_incoming_commands (host, event))
1319 {
1320 case 1:
1321 return 1;
1322
1323 case -1:
1324 perror ("Error dispatching incoming packets");
1325
1326 return -1;
1327
1328 default:
1329 break;
1330 }
1331 }
1332
1333 timeCurrent = enet_time_get ();
1334
1335 if (ENET_TIME_GREATER_EQUAL (timeCurrent, timeout))
1336 return 0;
1337
1338 waitCondition = ENET_SOCKET_WAIT_RECEIVE;
1339
1340 if (enet_socket_wait (host -> socket, & waitCondition, ENET_TIME_DIFFERENCE (timeout, timeCurrent)) != 0)
1341 return -1;
1342
1343 timeCurrent = enet_time_get ();
1344 } while (waitCondition == ENET_SOCKET_WAIT_RECEIVE);
1345
1346 return 0;
1347 }
1348
Binary diff not shown
0 * Using ENet
1
2 Before using ENet, you must call enet_initialize() to initialize the
3 library. Upon program exit, you should call enet_deinitialize() so that
4 the library may clean up any used resources.
5
6 i.e.
7
8 int
9 main (int argc, char ** argv)
10 {
11 if (enet_initialize () != 0)
12 {
13 fprintf (stderror, "An error occurred while initializing ENet.\n");
14 return EXIT_FAILURE;
15 }
16 atexit (enet_deinitialize);
17 ...
18 ...
19 ...
20 }
21
22 * Creating an ENet server
23
24 Servers in ENet are constructed with enet_host_create(). You must specify
25 an address on which to receive data and new connections, as well as the maximum
26 allowable numbers of connected peers. You may optionally specify the incoming
27 and outgoing bandwidth of the server in bytes per second so that ENet may try
28 to statically manage bandwidth resources among connected peers in addition to
29 its dynamic throttling algorithm; specifying 0 for these two options will cause
30 ENet to rely entirely upon its dynamic throttling algorithm to manage
31 bandwidth.
32
33 When done with a host, the host may be destroyed with enet_host_destroy().
34 All connected peers to the host will be reset, and the resources used by
35 the host will be freed.
36
37 i.e.
38
39 ENetAddress address;
40 ENetHost * server;
41
42 /* Bind the server to the default localhost.
43 * A specific host address can be specified by
44 * enet_address_set_host (& address, "x.x.x.x");
45 */
46 address.host = ENET_HOST_ANY;
47 /* Bind the server to port 1234. */
48 address.port = 1234;
49
50 server = enet_host_create (& address /* the address to bind the server host to */,
51 32 /* allow up to 32 clients and/or outgoing connections */,
52 0 /* assume any amount of incoming bandwidth */,
53 0 /* assume any amount of outgoing bandwidth */);
54 if (server == NULL)
55 {
56 fprintf (stderr,
57 "An error occurred while trying to create an ENet server host.\n");
58 exit (EXIT_FAILURE);
59 }
60 ...
61 ...
62 ...
63 enet_host_destroy(server);
64
65 * Creating an ENet client
66
67 Clients in ENet are similarly constructed with enet_host_create() when no
68 address is specified to bind the host to. Bandwidth may be specified for the
69 client host as in the above example. The peer count controls the maximum number
70 of connections to other server hosts that may be simultaneously open.
71
72 i.e.
73
74 ENetHost * client;
75
76 clienet = enet_host_create (NULL /* create a client host */,
77 1 /* only allow 1 outgoing connection */,
78 57600 / 8 /* 56K modem with 56 Kbps downstream bandwidth */,
79 14400 / 8 /* 56K modem with 14 Kbps upstream bandwidth */);
80
81 if (client == NULL)
82 {
83 fprintf (stderr,
84 "An error occurred while trying to create an ENet client host.\n");
85 exit (EXIT_FAILURE);
86 }
87 ...
88 ...
89 ...
90 enet_host_destroy(client);
91
92 * Managing an ENet host
93
94 ENet uses a polled event model to notify the programmer of significant
95 events. ENet hosts are polled for events with enet_host_service(), where an
96 optional timeout value in milliseconds may be specified to control how long
97 ENet will poll; if a timeout of 0 is specified, enet_host_service() will
98 return immediately if there are no events to dispatch. enet_host_service()
99 will return 1 if an event was dispatched within the specified timeout.
100
101 Currently there are only four types of significant events in ENet:
102
103 An event of type ENET_EVENT_TYPE_NONE is returned if no event occurred
104 within the specified time limit. enet_host_service() will return 0
105 with this event.
106
107 An event of type ENET_EVENT_TYPE_CONNECT is returned when either a new client
108 host has connected to the server host or when an attempt to establish a
109 connection with a foreign host has succeeded. Only the "peer" field of the
110 event structure is valid for this event and contains the newly connected peer.
111
112 An event of type ENET_EVENT_TYPE_RECEIVE is returned when a packet is received
113 from a connected peer. The "peer" field contains the peer the packet was
114 received from, "channelID" is the channel on which the packet was sent, and
115 "packet" is the packet that was sent. The packet contained in the "packet"
116 field must be destroyed with enet_packet_destroy() when you are done
117 inspecting its contents.
118
119 An event of type ENET_EVENT_TYPE_DISCONNECT is returned when a connected peer
120 has either explicitly disconnected or timed out. Only the "peer" field of the
121 event structure is valid for this event and contains the peer that
122 disconnected. Only the "data" field of the peer is still valid on a
123 disconnect event and must be explicitly reset.
124
125 i.e.
126
127 ENetEvent event;
128
129 /* Wait up to 1000 milliseconds for an event. */
130 while (enet_host_service (client, & event, 1000) > 0)
131 {
132 switch (event.type)
133 {
134 case ENET_EVENT_TYPE_CONNECT:
135 printf ("A new client connected from %x:%u.\n",
136 event.peer -> address.host,
137 event.peer -> address.port);
138
139 /* Store any relevant client information here. */
140 event.peer -> data = "Client information";
141
142 break;
143
144 case ENET_EVENT_TYPE_RECEIVE:
145 printf ("A packet of length %u containing %s was received from %s on channel %u.\n",
146 event.packet -> dataLength,
147 event.packet -> data,
148 event.peer -> data,
149 event.channelID);
150
151 /* Clean up the packet now that we're done using it. */
152 enet_packet_destroy (event.packet);
153
154 break;
155
156 case ENET_EVENT_TYPE_DISCONNECT:
157 printf ("%s disconected.\n", event.peer -> data);
158
159 /* Reset the peer's client information. */
160
161 event.peer -> data = NULL;
162 }
163 }
164 ...
165 ...
166 ...
167
168 * Sending a packet to an ENet peer
169
170 Packets in ENet are created with enet_packet_create(), where the size of
171 the packet must be specified. Optionally, initial data may be specified to
172 copy into the packet.
173
174 Certain flags may also be supplied to enet_packet_create() to control
175 various packet features:
176
177 ENET_PACKET_FLAG_RELIABLE specifies that the packet must use reliable delivery.
178 A reliable packet is guarenteed to be delivered, and a number of retry attempts
179 will be made until an acknowledgement is received from the foreign host the
180 packet is sent to. If a certain number of retry attempts is reached without
181 any acknowledgement, ENet will assume the peer has disconnected and forcefully
182 reset the connection. If this flag is not specified, the packet is assumed
183 an unreliable packet, and no retry attempts will be made nor acknowledgements
184 generated.
185
186 A packet may be resized (extended or truncated) with enet_packet_resize().
187
188 A packet is sent to a foreign host with enet_peer_send(). enet_peer_send()
189 accepts a channel id over which to send the packet to a given peer. Once the
190 packet is handed over to ENet with enet_peer_send(), ENet will handle its
191 deallocation and enet_packet_destroy() should not be used upon it.
192
193 One may also use enet_host_broadcast() to send a packet to all connected
194 peers on a given host over a specified channel id, as with enet_peer_send().
195
196 Queued packets will be sent on a call to enet_host_service().
197 Alternatively, enet_host_flush() will send out queued packets without
198 dispatching any events.
199
200 i.e.
201
202 /* Create a reliable packet of size 7 containing "packet\0" */
203 ENetPacket * packet = enet_packet_create ("packet",
204 strlen ("packet") + 1,
205 ENET_PACKET_FLAG_RELIABLE);
206
207 /* Extend the packet so and append the string "foo", so it now
208 * contains "packetfoo\0"
209 *
210 enet_packet_resize (packet, strlen ("packetfoo") + 1);
211 strcpy (& packet -> data [strlen ("packet")], "foo");
212
213 /* Send the packet to the peer over channel id 3.
214 * One could also broadcast the packet by
215 * enet_host_broadcast (host, 3, packet);
216 */
217 enet_peer_send (peer, 3, packet);
218 ...
219 ...
220 ...
221 /* One could just use enet_host_service() instead. */
222 enet_host_flush (host);
223
224 * Disconnecting an ENet peer
225
226 Peers may be gently disconnected with enet_peer_disconnect(). A disconnect
227 request will be sent to the foreign host, and ENet will wait for an
228 acknowledgement from the foreign host before finally disconnecting. An
229 event of type ENET_EVENT_TYPE_DISCONNECT will be generated once the
230 disconnection succeeds. Normally timeouts apply to the disconnect
231 acknowledgement, and so if no acknowledgement is received after a length
232 of time the peer will be forcefully disconnected.
233
234 enet_peer_reset() will forcefully disconnect a peer. The foreign host
235 will get no notification of a disconnect and will time out on the foreign
236 host. No event is generated.
237
238 i.e.
239 ENetEvent event;
240
241 enet_peer_disconnect (& client -> peers [0]);
242
243 /* Allow up to 3 seconds for the disconnect to succeed
244 * and drop any packets received packets.
245 */
246 while (enet_host_service (client, & event, 3000) > 0)
247 {
248 switch (event.type)
249 {
250 case ENET_EVENT_TYPE_RECEIVE:
251 enet_packet_destroy (event.packet);
252 break;
253
254 case ENET_EVENT_TYPE_DISCONNECT:
255 puts ("Disconnection succeeded.");
256 return;
257 ...
258 ...
259 ...
260 }
261 }
262
263 /* We've arrived here, so the disconnect attempt didn't succeed yet.
264 * Force the connection down.
265 */
266 enet_peer_reset (& client -> peers [0]);
267 ...
268 ...
269 ...
270
271 * Connecting to an ENet host
272
273 A connection to a foregin host is initiated with enet_host_connect().
274 It accepts the address of a foreign host to connect to, and the number of
275 channels that should be allocated for communication. If N channels are
276 allocated for use, their channel ids will be numbered 0 through N-1.
277 A peer representing the connection attempt is returned, or NULL if there
278 were no available peers over which to initiate the connection. When the
279 connection attempt succeeds, an event of type ENET_EVENT_TYPE_CONNECT will
280 be generated. If the connection attempt times out or otherwise fails, an
281 event of type ENET_EVENT_TYPE_DISCONNECT will be generated.
282
283 i.e.
284 ENetAddress address;
285 ENetEvent event;
286 ENetPeer *peer;
287
288 /* Connect to some.server.net:1234. */
289 enet_address_set_host (& address, "some.server.net");
290 address.port = 1234;
291
292 /* Initiate the connection, allocating the two channels 0 and 1. */
293 peer = enet_host_connect (client, & address, 2);
294
295 if (peer == NULL)
296 {
297 fprintf (stderr,
298 "No available peers for initiating an ENet connection.\n");
299 exit (EXIT_FAILURE);
300 }
301
302 /* Wait up to 5 seconds for the connection attempt to succeed.
303 if (enet_host_service (client, & event, 5000) > 0 &&
304 event.type == ENET_EVENT_TYPE_CONNECT)
305 {
306 puts ("Connection to some.server.net:1234 succeeded.");
307 ...
308 ...
309 ...
310 }
311 else
312 {
313 /* Either the 5 seconds are up or a disconnect event was
314 * received. Reset the peer in the event the 5 seconds
315 * had run out without any significant event.
316 */
317 enet_peer_reset (peer);
318
319 puts ("Connection to some.server.net:1234 failed.");
320 }
321 ...
322 ...
323 ...
324
0 /**
1 @file unix.c
2 @brief ENet Unix system specific functions
3 */
4 #ifndef WIN32
5
6 #include <sys/types.h>
7 #include <sys/socket.h>
8 #include <sys/ioctl.h>
9 #include <sys/time.h>
10 #include <arpa/inet.h>
11 #include <netdb.h>
12 #include <unistd.h>
13 #include <string.h>
14 #include <errno.h>
15 #include <time.h>
16
17 #define ENET_BUILDING_LIB 1
18 #include "enet/enet.h"
19
20 #ifdef HAS_FCNTL
21 #include <fcntl.h>
22 #endif
23
24 #ifdef __APPLE__
25 #undef HAS_POLL
26 #endif
27
28 #ifdef HAS_POLL
29 #include <sys/poll.h>
30 #endif
31
32 #ifndef HAS_SOCKLEN_T
33 typedef int socklen_t;
34 #endif
35
36 #ifndef MSG_NOSIGNAL
37 #define MSG_NOSIGNAL 0
38 #endif
39
40 static enet_uint32 timeBase = 0;
41
42 int
43 enet_initialize (void)
44 {
45 return 0;
46 }
47
48 void
49 enet_deinitialize (void)
50 {
51 }
52
53 enet_uint32
54 enet_time_get (void)
55 {
56 struct timeval timeVal;
57
58 gettimeofday (& timeVal, NULL);
59
60 return timeVal.tv_sec * 1000 + timeVal.tv_usec / 1000 - timeBase;
61 }
62
63 void
64 enet_time_set (enet_uint32 newTimeBase)
65 {
66 struct timeval timeVal;
67
68 gettimeofday (& timeVal, NULL);
69
70 timeBase = timeVal.tv_sec * 1000 + timeVal.tv_usec / 1000 - newTimeBase;
71 }
72
73 int
74 enet_address_set_host (ENetAddress * address, const char * name)
75 {
76 struct hostent * hostEntry = NULL;
77 #ifdef HAS_GETHOSTBYNAME_R
78 struct hostent hostData;
79 char buffer [2048];
80 int errnum;
81
82 #ifdef linux
83 gethostbyname_r (name, & hostData, buffer, sizeof (buffer), & hostEntry, & errnum);
84 #else
85 hostEntry = gethostbyname_r (name, & hostData, buffer, sizeof (buffer), & errnum);
86 #endif
87 #else
88 hostEntry = gethostbyname (name);
89 #endif
90
91 if (hostEntry == NULL ||
92 hostEntry -> h_addrtype != AF_INET)
93 {
94 #ifdef HAS_INET_PTON
95 if (! inet_pton (AF_INET, name, & address -> host))
96 #else
97 if (! inet_aton (name, (struct in_addr *) & address -> host))
98 #endif
99 return -1;
100 return 0;
101 }
102
103 address -> host = * (enet_uint32 *) hostEntry -> h_addr_list [0];
104
105 return 0;
106 }
107
108 int
109 enet_address_get_host (const ENetAddress * address, char * name, size_t nameLength)
110 {
111 struct in_addr in;
112 struct hostent * hostEntry = NULL;
113 #ifdef HAS_GETHOSTBYADDR_R
114 struct hostent hostData;
115 char buffer [2048];
116 int errnum;
117
118 in.s_addr = address -> host;
119
120 #ifdef linux
121 gethostbyaddr_r ((char *) & in, sizeof (struct in_addr), AF_INET, & hostData, buffer, sizeof (buffer), & hostEntry, & errnum);
122 #else
123 hostEntry = gethostbyaddr_r ((char *) & in, sizeof (struct in_addr), AF_INET, & hostData, buffer, sizeof (buffer), & errnum);
124 #endif
125 #else
126 in.s_addr = address -> host;
127
128 hostEntry = gethostbyaddr ((char *) & in, sizeof (struct in_addr), AF_INET);
129 #endif
130
131 if (hostEntry == NULL)
132 {
133 #ifdef HAS_INET_NTOP
134 if (inet_ntop (AF_INET, & address -> host, name, nameLength) == NULL)
135 #else
136 char * addr = inet_ntoa (* (struct in_addr *) & address -> host);
137 if (addr != NULL)
138 strncpy (name, addr, nameLength);
139 else
140 #endif
141 return -1;
142 return 0;
143 }
144
145 strncpy (name, hostEntry -> h_name, nameLength);
146
147 return 0;
148 }
149
150 ENetSocket
151 enet_socket_create (ENetSocketType type, const ENetAddress * address)
152 {
153 ENetSocket newSocket = socket (PF_INET, type == ENET_SOCKET_TYPE_DATAGRAM ? SOCK_DGRAM : SOCK_STREAM, 0);
154 int receiveBufferSize = ENET_HOST_RECEIVE_BUFFER_SIZE,
155 allowBroadcasting = 1;
156 #ifndef HAS_FCNTL
157 int nonBlocking = 1;
158 #endif
159 struct sockaddr_in sin;
160
161 if (newSocket == ENET_SOCKET_NULL)
162 return ENET_SOCKET_NULL;
163
164 if (type == ENET_SOCKET_TYPE_DATAGRAM)
165 {
166 #ifdef HAS_FCNTL
167 fcntl (newSocket, F_SETFL, O_NONBLOCK | fcntl (newSocket, F_GETFL));
168 #else
169 ioctl (newSocket, FIONBIO, & nonBlocking);
170 #endif
171
172 setsockopt (newSocket, SOL_SOCKET, SO_RCVBUF, (char *) & receiveBufferSize, sizeof (int));
173 setsockopt (newSocket, SOL_SOCKET, SO_BROADCAST, (char *) & allowBroadcasting, sizeof (int));
174 }
175
176 if (address == NULL)
177 return newSocket;
178
179 memset (& sin, 0, sizeof (struct sockaddr_in));
180
181 sin.sin_family = AF_INET;
182 sin.sin_port = ENET_HOST_TO_NET_16 (address -> port);
183 sin.sin_addr.s_addr = address -> host;
184
185 if (bind (newSocket,
186 (struct sockaddr *) & sin,
187 sizeof (struct sockaddr_in)) == -1 ||
188 (type == ENET_SOCKET_TYPE_STREAM &&
189 listen (newSocket, SOMAXCONN) == -1))
190 {
191 close (newSocket);
192
193 return ENET_SOCKET_NULL;
194 }
195
196 return newSocket;
197 }
198
199 int
200 enet_socket_connect (ENetSocket socket, const ENetAddress * address)
201 {
202 struct sockaddr_in sin;
203
204 memset (& sin, 0, sizeof (struct sockaddr_in));
205
206 sin.sin_family = AF_INET;
207 sin.sin_port = ENET_HOST_TO_NET_16 (address -> port);
208 sin.sin_addr.s_addr = address -> host;
209
210 return connect (socket, (struct sockaddr *) & sin, sizeof (struct sockaddr_in));
211 }
212
213 ENetSocket
214 enet_socket_accept (ENetSocket socket, ENetAddress * address)
215 {
216 int result;
217 struct sockaddr_in sin;
218 socklen_t sinLength = sizeof (struct sockaddr_in);
219
220 result = accept (socket,
221 address != NULL ? (struct sockaddr *) & sin : NULL,
222 address != NULL ? & sinLength : NULL);
223
224 if (result == -1)
225 return ENET_SOCKET_NULL;
226
227 if (address != NULL)
228 {
229 address -> host = (enet_uint32) sin.sin_addr.s_addr;
230 address -> port = ENET_NET_TO_HOST_16 (sin.sin_port);
231 }
232
233 return result;
234 }
235
236 void
237 enet_socket_destroy (ENetSocket socket)
238 {
239 close (socket);
240 }
241
242 int
243 enet_socket_send (ENetSocket socket,
244 const ENetAddress * address,
245 const ENetBuffer * buffers,
246 size_t bufferCount)
247 {
248 struct msghdr msgHdr;
249 struct sockaddr_in sin;
250 int sentLength;
251
252 memset (& msgHdr, 0, sizeof (struct msghdr));
253
254 if (address != NULL)
255 {
256 sin.sin_family = AF_INET;
257 sin.sin_port = ENET_HOST_TO_NET_16 (address -> port);
258 sin.sin_addr.s_addr = address -> host;
259
260 msgHdr.msg_name = & sin;
261 msgHdr.msg_namelen = sizeof (struct sockaddr_in);
262 }
263
264 msgHdr.msg_iov = (struct iovec *) buffers;
265 msgHdr.msg_iovlen = bufferCount;
266
267 sentLength = sendmsg (socket, & msgHdr, MSG_NOSIGNAL);
268
269 if (sentLength == -1)
270 {
271 if (errno == EWOULDBLOCK)
272 return 0;
273
274 return -1;
275 }
276
277 return sentLength;
278 }
279
280 int
281 enet_socket_receive (ENetSocket socket,
282 ENetAddress * address,
283 ENetBuffer * buffers,
284 size_t bufferCount)
285 {
286 struct msghdr msgHdr;
287 struct sockaddr_in sin;
288 int recvLength;
289
290 memset (& msgHdr, 0, sizeof (struct msghdr));
291
292 if (address != NULL)
293 {
294 msgHdr.msg_name = & sin;
295 msgHdr.msg_namelen = sizeof (struct sockaddr_in);
296 }
297
298 msgHdr.msg_iov = (struct iovec *) buffers;
299 msgHdr.msg_iovlen = bufferCount;
300
301 recvLength = recvmsg (socket, & msgHdr, MSG_NOSIGNAL);
302
303 if (recvLength == -1)
304 {
305 if (errno == EWOULDBLOCK)
306 return 0;
307
308 return -1;
309 }
310
311 #ifdef HAS_MSGHDR_FLAGS
312 if (msgHdr.msg_flags & MSG_TRUNC)
313 return -1;
314 #endif
315
316 if (address != NULL)
317 {
318 address -> host = (enet_uint32) sin.sin_addr.s_addr;
319 address -> port = ENET_NET_TO_HOST_16 (sin.sin_port);
320 }
321
322 return recvLength;
323 }
324
325 int
326 enet_socket_wait (ENetSocket socket, enet_uint32 * condition, enet_uint32 timeout)
327 {
328 #ifdef HAS_POLL
329 struct pollfd pollSocket;
330 int pollCount;
331
332 pollSocket.fd = socket;
333 pollSocket.events = 0;
334
335 if (* condition & ENET_SOCKET_WAIT_SEND)
336 pollSocket.events |= POLLOUT;
337
338 if (* condition & ENET_SOCKET_WAIT_RECEIVE)
339 pollSocket.events |= POLLIN;
340
341 pollCount = poll (& pollSocket, 1, timeout);
342
343 if (pollCount < 0)
344 return -1;
345
346 * condition = ENET_SOCKET_WAIT_NONE;
347
348 if (pollCount == 0)
349 return 0;
350
351 if (pollSocket.revents & POLLOUT)
352 * condition |= ENET_SOCKET_WAIT_SEND;
353
354 if (pollSocket.revents & POLLIN)
355 * condition |= ENET_SOCKET_WAIT_RECEIVE;
356
357 return 0;
358 #else
359 fd_set readSet, writeSet;
360 struct timeval timeVal;
361 int selectCount;
362
363 timeVal.tv_sec = timeout / 1000;
364 timeVal.tv_usec = (timeout % 1000) * 1000;
365
366 FD_ZERO (& readSet);
367 FD_ZERO (& writeSet);
368
369 if (* condition & ENET_SOCKET_WAIT_SEND)
370 FD_SET (socket, & writeSet);
371
372 if (* condition & ENET_SOCKET_WAIT_RECEIVE)
373 FD_SET (socket, & readSet);
374
375 selectCount = select (socket + 1, & readSet, & writeSet, NULL, & timeVal);
376
377 if (selectCount < 0)
378 return -1;
379
380 * condition = ENET_SOCKET_WAIT_NONE;
381
382 if (selectCount == 0)
383 return 0;
384
385 if (FD_ISSET (socket, & writeSet))
386 * condition |= ENET_SOCKET_WAIT_SEND;
387
388 if (FD_ISSET (socket, & readSet))
389 * condition |= ENET_SOCKET_WAIT_RECEIVE;
390
391 return 0;
392 #endif
393 }
394
395 #endif
396
Binary diff not shown
0 /**
1 @file win32.c
2 @brief ENet Win32 system specific functions
3 */
4 #ifdef WIN32
5
6 #include <time.h>
7 #define ENET_BUILDING_LIB 1
8 #include "enet/enet.h"
9
10 static enet_uint32 timeBase = 0;
11
12 int
13 enet_initialize (void)
14 {
15 WORD versionRequested = MAKEWORD (1, 1);
16 WSADATA wsaData;
17
18 if (WSAStartup (versionRequested, & wsaData))
19 return -1;
20
21 if (LOBYTE (wsaData.wVersion) != 1||
22 HIBYTE (wsaData.wVersion) != 1)
23 {
24 WSACleanup ();
25
26 return -1;
27 }
28
29 timeBeginPeriod (1);
30
31 return 0;
32 }
33
34 void
35 enet_deinitialize (void)
36 {
37 timeEndPeriod (1);
38
39 WSACleanup ();
40 }
41
42 enet_uint32
43 enet_time_get (void)
44 {
45 return (enet_uint32) timeGetTime () - timeBase;
46 }
47
48 void
49 enet_time_set (enet_uint32 newTimeBase)
50 {
51 timeBase = (enet_uint32) timeGetTime () - newTimeBase;
52 }
53
54 int
55 enet_address_set_host (ENetAddress * address, const char * name)
56 {
57 struct hostent * hostEntry;
58
59 hostEntry = gethostbyname (name);
60 if (hostEntry == NULL ||
61 hostEntry -> h_addrtype != AF_INET)
62 {
63 unsigned long host = inet_addr (name);
64 if (host == INADDR_NONE)
65 return -1;
66 address -> host = host;
67 return 0;
68 }
69
70 address -> host = * (enet_uint32 *) hostEntry -> h_addr_list [0];
71
72 return 0;
73 }
74
75 int
76 enet_address_get_host (const ENetAddress * address, char * name, size_t nameLength)
77 {
78 struct in_addr in;
79 struct hostent * hostEntry;
80
81 in.s_addr = address -> host;
82
83 hostEntry = gethostbyaddr ((char *) & in, sizeof (struct in_addr), AF_INET);
84 if (hostEntry == NULL)
85 {
86 char * addr = inet_ntoa (* (struct in_addr *) & address -> host);
87 if (addr == NULL)
88 return -1;
89 strncpy (name, addr, nameLength);
90 return 0;
91 }
92
93 strncpy (name, hostEntry -> h_name, nameLength);
94
95 return 0;
96 }
97
98 ENetSocket
99 enet_socket_create (ENetSocketType type, const ENetAddress * address)
100 {
101 ENetSocket newSocket = socket (PF_INET, type == ENET_SOCKET_TYPE_DATAGRAM ? SOCK_DGRAM : SOCK_STREAM, 0);
102 u_long nonBlocking = 1;
103 int receiveBufferSize = ENET_HOST_RECEIVE_BUFFER_SIZE,
104 allowBroadcasting = 1;
105 struct sockaddr_in sin;
106
107 if (newSocket == ENET_SOCKET_NULL)
108 return ENET_SOCKET_NULL;
109
110 if (type == ENET_SOCKET_TYPE_DATAGRAM)
111 {
112 ioctlsocket (newSocket, FIONBIO, & nonBlocking);
113
114 setsockopt (newSocket, SOL_SOCKET, SO_RCVBUF, (char *) & receiveBufferSize, sizeof (int));
115 setsockopt (newSocket, SOL_SOCKET, SO_BROADCAST, (char *) & allowBroadcasting, sizeof (int));
116 }
117
118 memset (& sin, 0, sizeof (struct sockaddr_in));
119
120 sin.sin_family = AF_INET;
121
122 if (address != NULL)
123 {
124 sin.sin_port = ENET_HOST_TO_NET_16 (address -> port);
125 sin.sin_addr.s_addr = address -> host;
126 }
127 else
128 {
129 sin.sin_port = 0;
130 sin.sin_addr.s_addr = INADDR_ANY;
131 }
132
133 if (bind (newSocket,
134 (struct sockaddr *) & sin,
135 sizeof (struct sockaddr_in)) == SOCKET_ERROR ||
136 (type == ENET_SOCKET_TYPE_STREAM &&
137 address != NULL &&
138 listen (newSocket, SOMAXCONN) == SOCKET_ERROR))
139 {
140 closesocket (newSocket);
141
142 return ENET_SOCKET_NULL;
143 }
144
145 return newSocket;
146 }
147
148 int
149 enet_socket_connect (ENetSocket socket, const ENetAddress * address)
150 {
151 struct sockaddr_in sin;
152
153 memset (& sin, 0, sizeof (struct sockaddr_in));
154
155 sin.sin_family = AF_INET;
156 sin.sin_port = ENET_HOST_TO_NET_16 (address -> port);
157 sin.sin_addr.s_addr = address -> host;
158
159 return connect (socket, (struct sockaddr *) & sin, sizeof (struct sockaddr_in));
160 }
161
162 ENetSocket
163 enet_socket_accept (ENetSocket socket, ENetAddress * address)
164 {
165 SOCKET result;
166 struct sockaddr_in sin;
167 int sinLength = sizeof (struct sockaddr_in);
168
169 result = accept (socket,
170 address != NULL ? (struct sockaddr *) & sin : NULL,
171 address != NULL ? & sinLength : NULL);
172
173 if (result == INVALID_SOCKET)
174 return ENET_SOCKET_NULL;
175
176 if (address != NULL)
177 {
178 address -> host = (enet_uint32) sin.sin_addr.s_addr;
179 address -> port = ENET_NET_TO_HOST_16 (sin.sin_port);
180 }
181
182 return result;
183 }
184
185 void
186 enet_socket_destroy (ENetSocket socket)
187 {
188 closesocket (socket);
189 }
190
191 int
192 enet_socket_send (ENetSocket socket,
193 const ENetAddress * address,
194 const ENetBuffer * buffers,
195 size_t bufferCount)
196 {
197 struct sockaddr_in sin;
198 DWORD sentLength;
199
200 if (address != NULL)
201 {
202 sin.sin_family = AF_INET;
203 sin.sin_port = ENET_HOST_TO_NET_16 (address -> port);
204 sin.sin_addr.s_addr = address -> host;
205 }
206
207 if (WSASendTo (socket,
208 (LPWSABUF) buffers,
209 (DWORD) bufferCount,
210 & sentLength,
211 0,
212 address != NULL ? (struct sockaddr *) & sin : 0,
213 address != NULL ? sizeof (struct sockaddr_in) : 0,
214 NULL,
215 NULL) == SOCKET_ERROR)
216 {
217 if (WSAGetLastError () == WSAEWOULDBLOCK)
218 return 0;
219
220 return -1;
221 }
222
223 return (int) sentLength;
224 }
225
226 int
227 enet_socket_receive (ENetSocket socket,
228 ENetAddress * address,
229 ENetBuffer * buffers,
230 size_t bufferCount)
231 {
232 INT sinLength = sizeof (struct sockaddr_in);
233 DWORD flags = 0,
234 recvLength;
235 struct sockaddr_in sin;
236
237 if (WSARecvFrom (socket,
238 (LPWSABUF) buffers,
239 (DWORD) bufferCount,
240 & recvLength,
241 & flags,
242 address != NULL ? (struct sockaddr *) & sin : NULL,
243 address != NULL ? & sinLength : NULL,
244 NULL,
245 NULL) == SOCKET_ERROR)
246 {
247 switch (WSAGetLastError ())
248 {
249 case WSAEWOULDBLOCK:
250 case WSAECONNRESET:
251 return 0;
252 }
253
254 return -1;
255 }
256
257 if (flags & MSG_PARTIAL)
258 return -1;
259
260 if (address != NULL)
261 {
262 address -> host = (enet_uint32) sin.sin_addr.s_addr;
263 address -> port = ENET_NET_TO_HOST_16 (sin.sin_port);
264 }
265
266 return (int) recvLength;
267 }
268
269 int
270 enet_socket_wait (ENetSocket socket, enet_uint32 * condition, enet_uint32 timeout)
271 {
272 fd_set readSet, writeSet;
273 struct timeval timeVal;
274 int selectCount;
275
276 timeVal.tv_sec = timeout / 1000;
277 timeVal.tv_usec = (timeout % 1000) * 1000;
278
279 FD_ZERO (& readSet);
280 FD_ZERO (& writeSet);
281
282 if (* condition & ENET_SOCKET_WAIT_SEND)
283 FD_SET (socket, & writeSet);
284
285 if (* condition & ENET_SOCKET_WAIT_RECEIVE)
286 FD_SET (socket, & readSet);
287
288 selectCount = select (socket + 1, & readSet, & writeSet, NULL, & timeVal);
289
290 if (selectCount < 0)
291 return -1;
292
293 * condition = ENET_SOCKET_WAIT_NONE;
294
295 if (selectCount == 0)
296 return 0;
297
298 if (FD_ISSET (socket, & writeSet))
299 * condition |= ENET_SOCKET_WAIT_SEND;
300
301 if (FD_ISSET (socket, & readSet))
302 * condition |= ENET_SOCKET_WAIT_RECEIVE;
303
304 return 0;
305 }
306
307 #endif
308
Binary diff not shown
0 /*
1 highscore.cpp
2 Copyright (C) 2005 Poul Sander
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 Poul Sander
19 Rævehøjvej 36, V. 1111
20 2800 Kgs. Lyngby
21 DENMARK
22 poul.sander@tdcadsl.dk
23 */
24
25 #include "highscore.h"
26
27 #ifdef WIN32
28 //Returns path to "my Documents" in windows:
29 string getMyDocumentsPath()
30 {
31 TCHAR pszPath[MAX_PATH];
32 if (SUCCEEDED(SHGetSpecialFolderPath(NULL, pszPath, CSIDL_PERSONAL, FALSE))) {
33 // pszPath is now the path that you want
34 cout << "MyDocuments Located: " << pszPath << endl;
35 string theResult= pszPath;
36 return theResult;
37 }
38 else
39 {
40 cout << "Warning: My Documents not found!" << endl;
41 string theResult ="";
42 return theResult;
43 }
44 }
45
46 #endif
47
48 Highscore::Highscore(int type)
49 {
50 #if defined(__unix__)
51 string home = getenv("HOME");
52 string filename1 = home+"/.gamesaves/blockattack/endless.dat";
53 string filename2 = home+"/.gamesaves/blockattack/timetrial.dat";
54 #elif defined(_WIN32)
55 string home = getMyDocumentsPath();
56 string filename1, filename2;
57 if(&home!=NULL)
58 {
59 filename1 = home+"/My Games/blockattack/endless.dat";
60 filename2 = home+"/My Games/blockattack/timetrial.dat";
61 }
62 else
63 {
64 filename1 = "endless.dat";
65 filename2 = "timetrial.dat";
66 }
67 #else
68 string filename1 = "endless.dat";
69 string filename2 = "timetrial.dat";
70 #endif
71 ourType = type;
72 if(type == 1) filename = (char*)malloc(filename1.length()+1);
73 if(type == 2) filename = (char*)malloc(filename2.length()+1);
74 if(filename == NULL){cout << "Out of memory" << endl; exit(1);}
75 if(type == 1) memcpy(filename,filename1.c_str(),filename1.length()+1);
76 if(type == 2) memcpy(filename,filename2.c_str(),filename2.length()+1);
77 ifstream scorefile(filename, ios::binary);
78 if(scorefile)
79 {
80 for(int i = 0; i<top; i++)
81 {
82 scorefile.read(tabel[i].name,30*sizeof(char));
83 scorefile.read(reinterpret_cast<char*>(&tabel[i].score), sizeof(int));
84 }
85 }
86 else
87 {
88 for(int i = 0; i<top; i++)
89 {
90 strcpy(tabel[i].name,"Poul Sander \0");
91 tabel[i].score = 2000 - i*100;
92 }
93 }
94 scorefile.close();
95 free(filename);
96 writeFile();
97 }
98
99 void Highscore::writeFile()
100 {
101 #if defined(__unix__)
102 string home = getenv("HOME");
103 string filename1 = home+"/.gamesaves/blockattack/endless.dat";
104 string filename2 = home+"/.gamesaves/blockattack/timetrial.dat";
105 #elif defined(_WIN32)
106 string home = getMyDocumentsPath();
107 string filename1, filename2;
108 if(&home!=NULL)
109 {
110 filename1 = home+"/My Games/blockattack/endless.dat";
111 filename2 = home+"/My Games/blockattack/timetrial.dat";
112 }
113 else
114 {
115 filename1 = "endless.dat";
116 filename2 = "timetrial.dat";
117 }
118 #else
119 string filename1 = "endless.dat";
120 string filename2 = "timetrial.dat";
121 #endif
122 if(ourType == 1) filename = (char*)malloc(filename1.length()+1);
123 if(ourType == 2) filename = (char*)malloc(filename2.length()+1);
124 if(filename == NULL){cout << "Out of memory" << endl; exit(1);}
125 if(ourType == 1) memcpy(filename,filename1.c_str(),filename1.length()+1);
126 if(ourType == 2) memcpy(filename,filename2.c_str(),filename2.length()+1);
127
128 ofstream outfile;
129 outfile.open(Highscore::filename, ios::binary |ios::trunc);
130 if(!outfile)
131 {
132 cout << "Error writing to file: " << &filename << endl;
133 exit(1);
134 }
135 for(int i = 0;i<top;i++)
136 {
137 outfile.write(tabel[i].name,30*sizeof(char));
138 outfile.write(reinterpret_cast<char*>(&tabel[i].score),sizeof(int));
139 }
140 outfile.close();
141 free(filename);
142 }
143
144 bool Highscore::isHighScore(int newScore)
145 {
146 if(newScore>tabel[top-1].score)
147 return true;
148 else
149 return false;
150 }
151
152 void Highscore::addScore(char newName[], int newScore)
153 {
154 int ranking = top-1;
155 while((tabel[ranking-1].score<newScore) && (ranking != 0))
156 ranking--;
157 for(int i=top-1; i>ranking; i--)
158 {
159 tabel[i].score = tabel[i-1].score;
160 strcpy(tabel[i].name," \0");
161 strcpy(tabel[i].name,tabel[i-1].name);
162 }
163 tabel[ranking].score = newScore;
164 strcpy(tabel[ranking].name," \0");
165 strcpy(tabel[ranking].name,newName);
166 Highscore::writeFile();
167 }
168
169 int Highscore::getScoreNumber(int room)
170 {
171 return tabel[room].score;
172 }
173
174 char* Highscore::getScoreName(int room)
175 {
176 return &tabel[room].name[0];
177 }
0 /*
1 highscore.cpp
2 Copyright (C) 2005 Poul Sander
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 Poul Sander
19 Rævehøjvej 36, V. 1111
20 2800 Kgs. Lyngby
21 DENMARK
22 poul.sander@tdcadsl.dk
23 */
24
25 #include "highscore.h"
26
27 #ifdef WIN32
28 //Returns path to "my Documents" in windows:
29 string getMyDocumentsPath()
30 {
31 TCHAR pszPath[MAX_PATH];
32 if (SUCCEEDED(SHGetSpecialFolderPath(NULL, pszPath, CSIDL_PERSONAL, FALSE))) {
33 // pszPath is now the path that you want
34 cout << "MyDocuments Located: " << pszPath << endl;
35 string theResult= pszPath;
36 return theResult;
37 }
38 else
39 {
40 cout << "Warning: My Documents not found!" << endl;
41 string theResult ="";
42 return theResult;
43 }
44 }
45
46 #endif
47
48 Highscore::Highscore(int type)
49 {
50 #if defined(__unix__)
51 string home = getenv("HOME");
52 string filename1 = home+"/.gamesaves/blockattack/endless.dat";
53 string filename2 = home+"/.gamesaves/blockattack/timetrial.dat";
54 #elif defined(_WIN32)
55 string home = getMyDocumentsPath();
56 string filename1, filename2;
57 if(&home!=NULL)
58 {
59 filename1 = home+"/My Games/blockattack/endless.dat";
60 filename2 = home+"/My Games/blockattack/timetrial.dat";
61 }
62 else
63 {
64 filename1 = "endless.dat";
65 filename2 = "timetrial.dat";
66 }
67 #else
68 string filename1 = "endless.dat";
69 string filename2 = "timetrial.dat";
70 #endif
71 ourType = type;
72 if(type == 1) filename = (char*)malloc(filename1.length()+1);
73 if(type == 2) filename = (char*)malloc(filename2.length()+1);
74 if(filename == NULL){cout << "Out of memory" << endl; exit(1);}
75 if(type == 1) memcpy(filename,filename1.c_str(),filename1.length()+1);
76 if(type == 2) memcpy(filename,filename2.c_str(),filename2.length()+1);
77 ifstream scorefile(filename, ios::binary);
78 if(scorefile)
79 {
80 for(int i = 0; i<top; i++)
81 {
82 scorefile.read(tabel[i].name,30*sizeof(char));
83 scorefile.read(reinterpret_cast<char*>(&tabel[i].score), sizeof(int));
84 }
85 }
86 else
87 {
88 for(int i = 0; i<top; i++)
89 {
90 strcpy(tabel[i].name,"Poul Sander \0");
91 tabel[i].score = 2000 - i*100;
92 }
93 }
94 scorefile.close();
95 free(filename);
96 writeFile();
97 }
98
99 void Highscore::writeFile()
100 {
101 #if defined(__unix__)
102 string home = getenv("HOME");
103 string filename1 = home+"/.gamesaves/blockattack/endless.dat";
104 string filename2 = home+"/.gamesaves/blockattack/timetrial.dat";
105 #elif defined(_WIN32)
106 string home = getenv("APPDATA");
107 string filename1, filename2;
108 if(&home!=NULL)
109 {
110 filename1 = home+"/gamesaves/blockattack/endless.dat";
111 filename2 = home+"/gamesaves/blockattack/timetrial.dat";
112 }
113 else
114 {
115 filename1 = "endless.dat";
116 filename2 = "timetrial.dat";
117 }
118 #else
119 string filename1 = "endless.dat";
120 string filename2 = "timetrial.dat";
121 #endif
122 if(ourType == 1) filename = (char*)malloc(filename1.length()+1);
123 if(ourType == 2) filename = (char*)malloc(filename2.length()+1);
124 if(filename == NULL){cout << "Out of memory" << endl; exit(1);}
125 if(ourType == 1) memcpy(filename,filename1.c_str(),filename1.length()+1);
126 if(ourType == 2) memcpy(filename,filename2.c_str(),filename2.length()+1);
127
128 ofstream outfile;
129 outfile.open(Highscore::filename, ios::binary |ios::trunc);
130 if(!outfile)
131 {
132 cout << "Error writing to file: " << &filename << endl;
133 exit(1);
134 }
135 for(int i = 0;i<top;i++)
136 {
137 outfile.write(tabel[i].name,30*sizeof(char));
138 outfile.write(reinterpret_cast<char*>(&tabel[i].score),sizeof(int));
139 }
140 outfile.close();
141 free(filename);
142 }
143
144 bool Highscore::isHighScore(int newScore)
145 {
146 if(newScore>tabel[top-1].score)
147 return true;
148 else
149 return false;
150 }
151
152 void Highscore::addScore(char newName[], int newScore)
153 {
154 int ranking = top-1;
155 while((tabel[ranking-1].score<newScore) && (ranking != 0))
156 ranking--;
157 for(int i=top-1; i>ranking; i--)
158 {
159 tabel[i].score = tabel[i-1].score;
160 strcpy(tabel[i].name," \0");
161 strcpy(tabel[i].name,tabel[i-1].name);
162 }
163 tabel[ranking].score = newScore;
164 strcpy(tabel[ranking].name," \0");
165 strcpy(tabel[ranking].name,newName);
166 Highscore::writeFile();
167 }
168
169 int Highscore::getScoreNumber(int room)
170 {
171 return tabel[room].score;
172 }
173
174 char* Highscore::getScoreName(int room)
175 {
176 return &tabel[room].name[0];
177 }
0 /*
1 highscore.h
2 Copyright (C) 2005 Poul Sander
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 Poul Sander
19 Rævehøjvej 36, V. 1111
20 2800 Kgs. Lyngby
21 DENMARK
22 poul.sander@tdcadsl.dk
23 */
24
25 #include <iostream>
26 #include <fstream>
27 #include <cstring>
28 #include <string>
29 #include <stdlib.h>
30
31 #ifdef _WIN32
32 #ifndef CSIDL_PERSONAL
33 #define CSIDL_PERSONAL 0x0005
34 #endif
35 #define _WIN32_IE 0x0400
36 #include "windows.h"
37 #include <shlobj.h>
38 #endif
39
40 using namespace std;
41
42 const int top = 10;
43
44 struct record
45 {
46 char name[30];
47 int score;
48 };
49
50 class Highscore
51 {
52 private:
53 record tabel[top];
54 char* filename;
55 int ourType; //This is ugly, remove me, plz!
56 void writeFile();
57 public:
58
59 Highscore()
60 {
61 }
62
63 Highscore(int type);
64
65 bool isHighScore(int);
66 void addScore(char[],int);
67 int getScoreNumber(int);
68 char* getScoreName(int);
69 };
0 /*
1 joypad.cpp - Enables joypad support
2 Copyright (C) 2005 Poul Sander
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 Poul Sander
19 Rævehøjvej 36, V. 1111
20 2800 Kgs. Lyngby
21 DENMARK
22 poul.sander@tdcadsl.dk
23 */
24
25 #include "joypad.h"
26
27 bool Joypad_init()
28 {
29 if(0==SDL_InitSubSystem(SDL_INIT_JOYSTICK))
30 return true;
31 else
32 return false;
33 }
34
35 Joypad_status Joypad_getStatus(SDL_Joystick *joystick)
36 {
37 Joypad_status status;
38 for(int i=0; i<NRofPADS; i++)
39 {
40 //cout << SDL_JoystickNumAxes(joystick) << endl;
41 if(i*2>=SDL_JoystickNumAxes(joystick))
42 {
43 status.padDown[i]=false;
44 status.padUp[i] = false;
45 status.padLeft[i] = false;
46 status.padRight[i] = false;
47 }
48 else
49 {
50 //cout << SDL_JoystickGetAxis(joystick,i*2+1)<< endl;
51 if(SDL_JoystickGetAxis(joystick,i*2)<(-8000))
52 status.padLeft[i]=1;
53 else
54 status.padLeft[i]=0;
55 if(SDL_JoystickGetAxis(joystick,i*2)>(8000))
56 status.padRight[i]=1;
57 else
58 status.padRight[i]=0;
59 if(SDL_JoystickGetAxis(joystick,i*2+1)<(-8000))
60 status.padUp[i]=1;
61 else
62 status.padUp[i]=0;
63 if(SDL_JoystickGetAxis(joystick,i*2+1)>(8000))
64 status.padDown[i]=1;
65 else
66 status.padDown[i]=0;
67 }
68 }//NRofPADS
69 for(int i=0; i<NRofBUTTONS; i++)
70 {
71 if(i>=SDL_JoystickNumButtons(joystick))
72 status.button[i]=false;
73 else
74 if(1==SDL_JoystickGetButton(joystick,i))
75 status.button[i] = true;
76 else
77 status.button[i] = false;
78 }
79 return status;
80 }
81
82 Joypad::Joypad()
83 {
84 up=false;
85 down=false;
86 left=false;
87 right=false;
88 but1=false;
89 but2=false;
90 upREL=true;
91 downREL=true;
92 leftREL=true;
93 rightREL=true;
94 but1REL=true;
95 but2REL=true;
96 int joynum = 0;
97 while((SDL_JoystickOpened(joynum))&&(joynum<Joypad_number))
98 joynum++;
99 if(joynum>=Joypad_number)
100 working = false;
101 else
102 {
103 joystick=SDL_JoystickOpen(joynum);
104 if(joystick==NULL)
105 working =false;
106 else
107 working=true;
108 }
109 }
110
111 Joypad::~Joypad()
112 {
113 SDL_JoystickClose(joystick);
114 }
115
116 void Joypad::update()
117 {
118 SDL_JoystickUpdate();
119 Joypad_status status = Joypad_getStatus(joystick);
120 if((upREL)&&((status.padUp[0])||(status.padUp[1])||(status.padUp[2])||(status.padUp[3])))
121 {
122 up=true;
123 upREL=false;
124 }
125 else
126 up=false;
127 if((downREL)&&((status.padDown[0])||(status.padDown[1])||(status.padDown[2])||(status.padDown[3])))
128 {
129 down=true;
130 downREL=false;
131 }
132 else
133 down=false;
134 if((leftREL)&&((status.padLeft[0])||(status.padLeft[1])||(status.padLeft[2])||(status.padLeft[3])))
135 {
136 left=true;
137 leftREL=false;
138 }
139 else
140 left=false;
141 if((rightREL)&&((status.padRight[0])||(status.padRight[1])||(status.padRight[2])||(status.padRight[3])))
142 {
143 right=true;
144 rightREL=false;
145 }
146 else
147 right=false;
148 if((but1REL)&&((status.button[0])||(status.button[2])||(status.button[4])||(status.button[6])))
149 {
150 but1=true;
151 but1REL=false;
152 }
153 else
154 but1=false;
155 if((but2REL)&&((status.button[1])||(status.button[3])||(status.button[5])||(status.button[7])))
156 {
157 but2=true;
158 but2REL=false;
159 }
160 else
161 but2=false;
162 //Now testing for up
163 if(!((status.padUp[0])||(status.padUp[1])||(status.padUp[2])||(status.padUp[3])))
164 upREL = true;
165 if(!((status.padDown[0])||(status.padDown[1])||(status.padDown[2])||(status.padDown[3])))
166 downREL = true;
167 if(!((status.padLeft[0])||(status.padLeft[1])||(status.padLeft[2])||(status.padLeft[3])))
168 leftREL = true;
169 if(!((status.padRight[0])||(status.padRight[1])||(status.padRight[2])||(status.padRight[3])))
170 rightREL= true;
171 if(!((status.button[0])||(status.button[2])||(status.button[4])||(status.button[6])))
172 but1REL = true;
173 if(!((status.button[1])||(status.button[3])||(status.button[5])||(status.button[7])))
174 but2REL = true;
175 }
0 /*
1 joypad.h - Enables joypad support
2 Copyright (C) 2005 Poul Sander
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 Poul Sander
19 Rævehøjvej 36, V. 1111
20 2800 Kgs. Lyngby
21 DENMARK
22 poul.sander@tdcadsl.dk
23 */
24
25 //headerfile joypad.h
26
27 #include <SDL.h>
28 #include <stdlib.h>
29 #include <iostream>
30
31 #define NRofPADS 4
32 #define NRofBUTTONS 12
33
34 using namespace std;
35
36 struct Joypad_status{
37 bool padLeft[NRofPADS];
38 bool padRight[NRofPADS];
39 bool padUp[NRofPADS];
40 bool padDown[NRofPADS];
41 bool button[NRofBUTTONS];
42 };
43
44 //Contains the init code
45 bool Joypad_init();
46
47 //How many joypads are availble?
48 #define Joypad_number SDL_NumJoysticks()
49
50 //Open a joystick
51 #define Joypad_open(X) SDL_JoystickOpen(X)
52
53 //Returns the status of the joypad
54 Joypad_status Joypad_getStatus(SDL_Joystick);
55
56 class Joypad{
57 private:
58 SDL_Joystick *joystick;
59 static int Joy_count;
60 public:
61 bool up,down,left,right,but1,but2;
62 bool upREL,downREL,leftREL,rightREL,but1REL,but2REL;
63 bool working;
64
65 Joypad();
66 ~Joypad();
67
68 void update();
69 };
0 /*
1 listFiles.cpp
2 Copyright (C) 2005 Poul Sander
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 Poul Sander
19 Rævehøjvej 36, V. 1111
20 2800 Kgs. Lyngby
21 DENMARK
22 poul.sander@tdcadsl.dk
23 */
24
25 /*
26 listFiles.cpp
27 */
28
29 #include "listFiles.h"
30
31 /*ListFiles::ListFiles()
32 {
33
34 }
35
36 ListFiles::~ListFiles()
37 {
38
39 }*/
40
41
42 void ListFiles::setDictory(string dictory)
43 {
44 for(int i=0;i<MAX_NR_OF_FILES;i++)
45 filenames[i]="";
46 #if defined(_WIN32)
47 DWORD dwError;
48 dictory+="/*";
49 hFind = FindFirstFile(dictory.c_str(), &FindFileData);
50 if (hFind == INVALID_HANDLE_VALUE)
51 {
52 printf ("Invalid file handle. Error is %u\n", GetLastError());
53 }
54 else
55 {
56 nrOfFiles=0;
57 filenames[nrOfFiles] = FindFileData.cFileName;
58 printf("File: %s\n",FindFileData.cFileName);
59 while ((FindNextFile(hFind, &FindFileData) != 0)&&(nrOfFiles<MAX_NR_OF_FILES-1))
60 {
61 nrOfFiles++;
62 filenames[nrOfFiles] = FindFileData.cFileName;
63 printf("File: %s\n",FindFileData.cFileName);
64 }
65
66 dwError = GetLastError();
67 FindClose(hFind);
68 if (dwError != ERROR_NO_MORE_FILES)
69 {
70 printf ("FindNextFile error. Error is %s\n", dwError);
71 }
72 }
73 #elif defined(__unix__)
74 DIR *DirectoryPointer;
75 struct dirent *dp;
76 nrOfFiles=0;
77 printf("Will look in: %s\n",dictory.c_str());
78 DirectoryPointer = opendir(dictory.c_str());
79 while((dp=readdir(DirectoryPointer))&&(nrOfFiles<MAX_NR_OF_FILES-1))
80 {
81 nrOfFiles++;
82 filenames[nrOfFiles] = (string)(char*)dp->d_name;
83 }
84 closedir(DirectoryPointer);
85
86
87 #endif
88 startFileNr=FIRST_FILE;
89 //Put code here
90 }
91
92 bool ListFiles::isInList(string name)
93 {
94 for(int i=0;(i<=nrOfFiles);i++)
95 {
96 if(0==strcmp(name.c_str(),filenames[i].c_str()))
97 {
98 return true;
99 }
100 }
101 return false;
102 }
103
104 void ListFiles::setDictory2(string dic)
105 {
106 #if defined(__unix__)
107 DIR *DirectoryPointer;
108 struct dirent *dp;
109 printf("Will look in: %s\n",dic.c_str());
110 DirectoryPointer = opendir(dic.c_str());
111 while((dp=readdir(DirectoryPointer))&&(nrOfFiles<MAX_NR_OF_FILES-1))
112 {
113 string name = (string)(char*)dp->d_name;
114 if(!isInList(name))
115 {
116 nrOfFiles++;
117 filenames[nrOfFiles] = name;
118 }
119 }
120 closedir(DirectoryPointer);
121 #endif
122 }
123
124 string ListFiles::getFileName(int nr)
125 {
126 if(startFileNr+nr<MAX_NR_OF_FILES)
127 return filenames[startFileNr+nr];
128 else
129 {
130 string emptyString="";
131 return "";
132 }
133 }
134
135 bool ListFiles::fileExists(int nr)
136 {
137 string emptyString="";
138 if(startFileNr+nr<MAX_NR_OF_FILES)
139 {
140 if(filenames[startFileNr+nr]==emptyString)
141 return false;
142 else
143 return true;
144 }
145 else
146 return false;
147 }
148
149 void ListFiles::back()
150 {
151 if(startFileNr>FIRST_FILE)
152 startFileNr = startFileNr-10;
153 if(startFileNr<FIRST_FILE)
154 startFileNr = FIRST_FILE;
155 }
156
157 void ListFiles::forward()
158 {
159 if(startFileNr<nrOfFiles-FIRST_FILE)
160 startFileNr = startFileNr+10;
161 }
0 /*
1 listFiles.h
2 Copyright (C) 2005 Poul Sander
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 Poul Sander
19 Rævehøjvej 36, V. 1111
20 2800 Kgs. Lyngby
21 DENMARK
22 poul.sander@tdcadsl.dk
23 */
24
25 //listFiles.h - List files in a given dictory, 10 files at a time, at most 250 files
26 #include <string.h>
27 #include <iostream>
28 #if defined(_WIN32)
29 #include <windows.h>
30 #elif defined(__unix__)
31 #include <dirent.h>
32 #endif
33 #include <string>
34 #include <vector>
35
36 #define MAX_NR_OF_FILES 253
37 #if defined (_WIN32)
38 #define FIRST_FILE 2
39 #else
40 #define FIRST_FILE 3
41 #endif
42
43 using namespace std;
44
45 class ListFiles
46 {
47 private:
48 int startFileNr; //The first fileto belisted
49 string filenames[MAX_NR_OF_FILES];
50 int nrOfFiles;
51 #if defined(_WIN32)
52 WIN32_FIND_DATA FindFileData;
53 HANDLE hFind;
54 #endif
55 bool isInList(string name); //The name is already in the list
56 public:
57 //ListFiles();
58 //~ListFiles();
59 void setDictory(string dictory); //Find file in BlockAttack folder
60 void setDictory2(string dictory); //Second dictory we also look in
61 //void setDictoryInHome(string dictory); //Find files in home folder (it should work...)
62 string getFileName(int); //Returns the filename of a file
63 bool fileExists(int);
64 void forward(); //inclease startFile by 10
65 void back(); //decrease startFile by 10
66 };
0 /*
1 Block Attack - Rise of the Blocks, SDL game, besed on Nintendo's Tetris Attack
2 Copyright (C) 2005 Poul Sander
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 Poul Sander
19 Rævehjvej 36, V. 1111
20 2800 Kgs. Lyngby
21 DENMARK
22 poul@poulsander.com
23 http://blockattack.sf.net
24 */
25
26 #define VERSION_NUMBER "version 1.3.1"
27
28 //If DEBUG is defined: AI info and FPS will be written to screen
29 //#define DEBUG
30
31 //If NETWORK id defined: enet will be used
32 #define NETWORK
33
34 //Macros to convert surfaces (for faster drawing)
35 #define CONVERT(n) tmp = SDL_DisplayFormat(n); SDL_FreeSurface(n); n = tmp
36 #define CONVERTA(n) tmp = SDL_DisplayFormatAlpha(n); SDL_FreeSurface(n); n = tmp
37
38 #include <iostream>
39 #include <stdlib.h>
40 #include <time.h> //Used for srand()
41 #include <sstream>
42 #include <string>
43 #include "SDL.h" //The SDL libary, used for most things
44 #include <SDL_mixer.h> //Used for sound & music
45 #include <SDL_image.h> //To load PNG images!
46 //#include "config.h"
47
48 //if SHAREDIR is not used we look in current directory
49 #ifndef SHAREDIR
50 #define SHAREDIR "./"
51 #endif
52
53 //enet things
54 #ifdef NETWORK
55 #include "enet/enet.h"
56 //#include "enet/list.h"
57 //#include "enet/protocol.h"
58 #endif
59 //enet things end
60
61 #include "SFont.h" //Used to write on screen
62 #include "highscore.h" //Stores highscores
63 #include "ReadKeyboard.h" //Reads text from keyboard
64 #include "joypad.h" //Used for joypads
65 #include "listFiles.h" //Used to show files on screen
66 #include "replay.h" //Used for replays
67 #include <vector>
68
69 //Some definitions
70 //The game is divided in frames. FALLTIME means the blocks will fall one block every FRAMELENGTH*FALLTIME millisecond
71 #define FRAMELENGTH 50
72 #define HANGTIME 40
73 #define FALLTIME 20
74 //Don't change the following, they are fundamental and later some functions are hardcoded
75 #define BLOCKFALL 10000
76 #define BLOCKWAIT 100000
77 #define BLOCKHANG 1000
78 #define GARBAGE 1000000
79 #define CHAINPLACE 10000000
80 #define NUMBEROFCHAINS 100
81
82 //Animation lengths:
83 #define READYTIME 500
84 #define BOMBTIME 200
85 #define CURSORTIME 200
86
87
88 using namespace std; //remove it if you dare...
89 #ifdef SHAREDIR
90 char sharedir[] = SHAREDIR;
91 #endif
92
93 //All graphic in the game (as pointers):
94 SDL_Surface *background; //Stores background
95 SDL_Surface *backgroundImage; //Stores the background image
96 int backgroundImageW, backgroundImageH; //size of background image
97 SDL_Surface *backBoard; //Stores the background to the board
98 SDL_Surface *b1player;
99 SDL_Surface *b2players;
100 SDL_Surface *bVsMode;
101 SDL_Surface *bStageClear;
102 SDL_Surface *bPuzzle;
103 SDL_Surface *bNewGame; //The New Game botton
104 SDL_Surface *bEndless; //Endless button (sub to new)
105 SDL_Surface *bTimeTrial; //Time trial button (sub to new)
106 SDL_Surface *bOptions; //The Options botton
107 //new in 1.1.1
108 SDL_Surface *bConfigure; //The configure button
109 SDL_Surface *bSelectPuzzle; //The Select Puzzle Button
110 SDL_Surface *bBack; //The "Back" button
111 SDL_Surface *bForward; //The "forward" button
112 //new in 1.1.1 end
113 //new in 1.1.2
114 SDL_Surface *iChainBack;
115 //new in 1.1.2 end (nota that iSmallFont has also been added)
116 //new in 1.2.0
117 SDL_Surface *bReplay;
118 SDL_Surface *bSave;
119 SDL_Surface *bLoad;
120 #ifdef NETWORK
121 SDL_Surface *bNetwork;
122 SDL_Surface *bConnect;
123 SDL_Surface *bHost;
124 #endif
125 //new in 1.2.0 end
126 SDL_Surface *bHighScore; //The High Score botton
127 SDL_Surface *bExit; //The Exit botton
128 SDL_Surface *blackLine; //The seperator in stage clear
129 SDL_Surface *stageBobble; //The bobble instage clear
130 SDL_Surface *screen; //The whole screen;
131 SDL_Surface *iGameOver; //The gameOver image
132 SDL_Surface *iWinner; //the "winner" image
133 SDL_Surface *iDraw; //the "draw" image
134 SDL_Surface *iLoser; //the "loser" image
135 //Animations:
136 SDL_Surface *cursor[2]; //The animated cursor
137 SDL_Surface *bomb[2]; //Bomb then the bricks should blow
138 SDL_Surface *ready[2]; //Before the blocks fall
139 SDL_Surface *explosion[4]; //Then a block explodes
140 //Animations end
141 SDL_Surface *counter[3]; //Counts down from 3
142 SDL_Surface *bricks[7]; //The bricks, saved in an array of pointers
143 SDL_Surface *crossover; //Cross the bricks that will be cleared soon
144 SDL_Surface *balls[7]; //The balls (the small ones that jump around)
145 SDL_Surface *iBlueFont; //Contains the blue font used
146 SDL_Surface *iSmallFont; //Small font used for the chain text
147 SDL_Surface *topscoresBack; //The backgound to the highscore list
148 SDL_Surface *optionsBack;
149 SDL_Surface *changeButtonsBack;
150 SDL_Surface *dialogBox;
151 //SDL_Surface *fileDialogBox; //Manual entering of filename, new in 1.1.1, obsolute in 1.1.2
152 SDL_Surface *bOn;
153 SDL_Surface *bOff;
154 SDL_Surface *bChange;
155 SDL_Surface *b1024;
156 //SDL_Surface *b1280;
157 //SDL_Surface *b1400;
158 //SDL_Surface *b1600;
159 SDL_Surface *iLevelCheck; //To the level select screen
160 SDL_Surface *iLevelCheckBox;
161 SDL_Surface *iCheckBoxArea;
162 SDL_Surface *boardBackBack;
163 SDL_Surface *garbageTL; //the Garbage Blocks
164 SDL_Surface *garbageT;
165 SDL_Surface *garbageTR;
166 SDL_Surface *garbageR;
167 SDL_Surface *garbageBR;
168 SDL_Surface *garbageB;
169 SDL_Surface *garbageBL;
170 SDL_Surface *garbageL;
171 SDL_Surface *garbageFill;
172 SDL_Surface *garbageM;
173 SDL_Surface *garbageML;
174 SDL_Surface *garbageMR;
175 //new in 1.2.3 start
176 SDL_Surface *smiley[4];
177 SDL_Surface *garbageGM;
178 SDL_Surface *garbageGML;
179 SDL_Surface *garbageGMR;
180 //new in 1.2.3 end
181 SDL_Surface *mouse; //The mouse cursor
182
183
184 SDL_Surface *tmp; //a temporary surface to use DisplayFormat
185
186
187 SFont_Font *fBlueFont; //Stores the blue font (SFont)
188 SFont_Font *fSmallFont; //Stores the small font (SFont)
189
190 Mix_Music *bgMusic; //backgroundMusic
191 Mix_Chunk *boing; //boing sound when clearing
192 Mix_Chunk *timesUp; //whistle when times up
193 Mix_Chunk *applause; //Applause, then the player is good
194 Mix_Chunk *photoClick; //clickSound
195 Mix_Chunk *heartBeat; //heart beat
196 Mix_Chunk *typingChunk; //When writing
197 Mix_Chunk *counterChunk; //When counting down
198
199 Highscore theTopScoresEndless; //Stores highscores for endless
200 Highscore theTopScoresTimeTrial; //Stores highscores for timetrial
201
202 bool bMouseUp; //true if the mouse(1) is unpressed
203 bool bMouseUp2; //true if the mouse(2) is unpressed
204 bool bNewGameOpen; //show sub menues
205 bool bOptionsOpen; //Show OptionsMenu (Configure and Select Puzzle)
206 bool b1playerOpen; //show submenu
207 bool b2playersOpen; //show submenu
208 bool bReplayOpen; //Show replay menu
209 #ifdef NETWORK
210 bool bNetworkOpen; //Show the network menu
211 #endif
212 bool showHighscores; //true if highscores is displayed
213 bool showEndless; //if true show endless highscores else timetrial
214 bool showGame; //the game is active don't show highscores/options
215 bool showOptions; //true if options is open
216 bool bScreenLocked; //Don't take input or allow any mouse interaction! Used for dialogbox and warningbox
217 bool showDialog;
218 //new in 1.3.1
219 bool NoSound; //if true, absolutely no sound will be played, can be set from the commandline
220 //prevents crash on systems without a soundcard
221 //end new 1.3.1
222 bool MusicEnabled; //true if background music is enabled
223 bool SoundEnabled; //true if sound effects is enabled
224 bool bFullscreen; //true if game is running fullscreen
225 bool puzzleLoaded; //true if the puzzle levels have been loaded
226 bool drawBalls; //if true balls are drawed to the screen, this might lower framerate too much
227 bool standardBackground;
228
229 //Things for network play:
230 bool networkPlay;
231 bool networkActive;
232 Uint8 nrOfNetworkPlayers; //Up to 4 players (inkl. self)
233 bool playerAlive[4];
234 //sockets here
235 #define SERVERPORT 41780
236 #define CLIENTPORT 41781
237
238 #ifdef NETWORK
239 char serverAddress[30];
240 #endif
241
242 //should be automatically disabled if framerate to low (isn't implemented and wont be soon/ever):
243 const int ballsFpsEnable = 30; //If framerate higher -> enable balls
244 const int ballsFpsDisable = 10; //If framerate lower -> disable balls
245
246 //other ball constants:
247 const double gravity = 200.8; //acceleration
248 const double startVelocityY = 50.0;
249 const double VelocityX = 50.0;
250 const int ballSize = 16;
251 const double minVelocity = 200.0;
252
253 //global settings (reset everytime the game starts)
254 Uint8 player1Speed=0;
255 Uint8 player2Speed=0;
256 bool player1AI=false; //Is AI enabled?
257 bool player2AI=false; //Is AI enabled for player 2 (opponent in single player)
258 Uint8 player1AIlevel=3; //What level is AI? 0 min, 6 max
259 Uint8 player2AIlevel=3;
260 const Uint8 AIlevels=7; //7 possible levels: 0..6
261 Uint8 player1handicap=0;
262 Uint8 player2handicap=0;
263
264 unsigned long int currentTime; //contains the current time, so we don't call SDL_GetTickets() too often...
265
266 int xsize;
267
268 //Stores the players names (way to long, but at least no buffer overflows (max length is 16 for display reasons))
269 char player1name[30];
270 char player2name[30];
271
272 //paths
273 string stageClearSavePath;
274 string puzzleSavePath;
275 string puzzleName; //The filename of
276
277 const int nrOfStageLevels = 50; //number of stages in stage Clear
278 const int maxNrOfPuzzleStages = 50; //Maximum number of puzzle stages
279 vector<bool> stageCleared(nrOfStageLevels); //vector that tells if a stage is cleared
280 vector<bool> puzzleCleared(maxNrOfPuzzleStages); //vector that tells if puzzle cleared
281 vector<int> nrOfMovesAllowed(maxNrOfPuzzleStages); //Moves to clear
282 int puzzleLevels[maxNrOfPuzzleStages][6][12]; //Contains board layout;
283 int nrOfPuzzles; //How many are there actually?
284
285 //Old mouse position:
286 int oldMousex, oldMousey;
287 //Old Stage Clear Buble
288 int oldBubleX, oldBubleY;
289
290 //bool doublebuf = false; //if true, screen is double buffered
291 char forceredraw; //If 1: always redraw, if 2: rarely redraw
292
293 bool singlePuzzle = false; //if true we are just in a little 300x600 window
294 int singlePuzzleNr = 0;
295 string singlePuzzleFile;
296
297 #if defined(DEBUG)
298 //frame counter (fps)
299 unsigned long int Frames, Ticks;
300 char FPS[10];
301 #endif
302
303 int lastNrOfPlayers; //1 if 1 player and 2 if vs. mode
304
305 //keySetup
306 int player1keys, player2keys;
307 bool mouseplay1=false; //The mouse works on the play field
308 bool mouseplay2=false; //Same for player2
309 bool joyplay1=false; //Player one uses the joypad
310 bool joyplay2=false; //Player two uses the joypad
311
312 //Stores the controls
313 struct control
314 {
315 SDLKey up;
316 SDLKey down;
317 SDLKey left;
318 SDLKey right;
319 SDLKey change;
320 SDLKey push;
321 };
322
323 control keySettings[3]; //array to hold the controls
324
325 void MakeBackground(int,int);
326
327 void closeAllMenus()
328 {
329 bNewGameOpen=false; //show sub menues
330 bOptionsOpen=false; //Show OptionsMenu (Configure and Select Puzzle)
331 b1playerOpen=false; //show submenu
332 b2playersOpen=false;
333 bReplayOpen = false;
334 #ifdef NETWORK
335 bNetworkOpen = false;
336 #endif
337 showOptions = false;
338 showHighscores = false;
339
340 }
341
342 #ifdef WIN32
343 //Returns path to "my Documents" in windows:
344 string getMyDocumentsPath()
345 {
346 TCHAR pszPath[MAX_PATH];
347 if (SUCCEEDED(SHGetSpecialFolderPath(NULL, pszPath, CSIDL_PERSONAL, FALSE))) {
348 // pszPath is now the path that you want
349 #ifdef DEBUG
350 cout << "MyDocuments Located: " << pszPath << endl;
351 #endif
352 string theResult= pszPath;
353 return theResult;
354 }
355 else
356 {
357 cout << "Warning: My Documents not found!" << endl;
358 string theResult ="";
359 return theResult;
360 }
361 }
362
363 #endif
364
365 //If we use the SHAREDIR we need:
366 #ifdef SHAREDIR
367 SDL_Surface * IMG_Load2(char* path) {
368
369 char * tmp;
370 SDL_Surface * ret=NULL;
371 tmp = (char*)malloc (sizeof(char)*(strlen(path)+strlen(sharedir)+2));
372 strcpy(tmp, sharedir);
373 strcat(tmp, "/");
374 strcat(tmp, path);
375 #ifdef DEBUG
376 printf("loading %s\n",tmp);
377 #endif
378 if(!(ret = IMG_Load(tmp)))
379 ret = IMG_Load(path);
380
381 free(tmp);
382 return ret;
383 }
384
385 Mix_Music * Mix_LoadMUS2(char* path)
386 {
387 char * tmp;
388 Mix_Music * ret=NULL;
389 tmp = (char*)malloc (sizeof(char)*(strlen(path)+strlen(sharedir)+2));
390 strcpy(tmp, sharedir);
391 strcat(tmp, "/");
392 strcat(tmp, path);
393 #ifdef DEBUG
394 printf("loading %s\n",tmp);
395 #endif
396 if(!(ret = Mix_LoadMUS(tmp)))
397 ret = Mix_LoadMUS(path);
398
399 free(tmp);
400 return ret;
401 }
402
403 Mix_Chunk * Mix_LoadWAV2(char* path)
404 {
405 char * tmp;
406 Mix_Chunk * ret=NULL;
407 tmp = (char*)malloc (sizeof(char)*(strlen(path)+strlen(sharedir)+2));
408 strcpy(tmp, sharedir);
409 strcat(tmp, "/");
410 strcat(tmp, path);
411 #ifdef DEBUG
412 printf("loading %s\n",tmp);
413 #endif
414 if(!(ret = Mix_LoadWAV(tmp)))
415 ret = Mix_LoadWAV(path);
416
417 free(tmp);
418 return ret;
419 }
420 #else
421 SDL_Surface * IMG_Load2(char* path)
422 {
423 return IMG_Load(path);
424 }
425
426 Mix_Music * Mix_LoadMUS2(char* path)
427 {
428 return Mix_LoadMUS(path);
429 }
430
431 Mix_Chunk * Mix_LoadWAV2(char* path)
432 {
433 return Mix_LoadWAV(path);
434 }
435 #endif
436
437
438 //Load all image files to memory
439 int InitImages()
440 {
441 if (!((backgroundImage = IMG_Load2("gfx/background.png"))
442 && (background = IMG_Load2("gfx/blackBackGround.png"))
443 && (bNewGame = IMG_Load2("gfx/bNewGame.png"))
444 && (b1player = IMG_Load2("gfx/bOnePlayer.png"))
445 && (b2players = IMG_Load2("gfx/bTwoPlayers.png"))
446 && (bVsMode = IMG_Load2("gfx/bVsGame.png"))
447 && (bPuzzle = IMG_Load2("gfx/bPuzzle.png"))
448 && (bStageClear = IMG_Load2("gfx/bStageClear.png"))
449 && (bTimeTrial = IMG_Load2("gfx/bTimeTrial.png"))
450 && (bEndless = IMG_Load2("gfx/bEndless.png"))
451 && (bOptions = IMG_Load2("gfx/bOptions.png"))
452 && (bConfigure = IMG_Load2("gfx/bConfigure.png"))
453 && (bSelectPuzzle = IMG_Load2("gfx/bSelectPuzzle.png"))
454 && (bHighScore = IMG_Load2("gfx/bHighScore.png"))
455 && (bExit = IMG_Load2("gfx/bExit.png"))
456 && (bBack = IMG_Load2("gfx/bBack.png"))
457 && (bForward = IMG_Load2("gfx/bForward.png"))
458 && (bReplay = IMG_Load2("gfx/bReplays.png"))
459 && (bSave = IMG_Load2("gfx/bSave.png"))
460 && (bLoad = IMG_Load2("gfx/bLoad.png"))
461 #ifdef NETWORK
462 && (bNetwork = IMG_Load2("gfx/bNetwork.png"))
463 && (bHost = IMG_Load2("gfx/bHost.png"))
464 && (bConnect = IMG_Load2("gfx/bConnect.png"))
465 #endif
466 && (blackLine = IMG_Load2("gfx/blackLine.png"))
467 && (stageBobble = IMG_Load2("gfx/iStageClearLimit.png"))
468 && (bricks[0] = IMG_Load2("gfx/blue.png"))
469 && (bricks[1] = IMG_Load2("gfx/green.png"))
470 && (bricks[2] = IMG_Load2("gfx/purple.png"))
471 && (bricks[3] = IMG_Load2("gfx/red.png"))
472 && (bricks[4] = IMG_Load2("gfx/turkish.png"))
473 && (bricks[5] = IMG_Load2("gfx/yellow.png"))
474 && (bricks[6] = IMG_Load2("gfx/grey.png"))
475 && (crossover = IMG_Load2("gfx/crossover.png"))
476 && (balls[0] = IMG_Load2("gfx/balls/ballBlue.png"))
477 && (balls[1] = IMG_Load2("gfx/balls/ballGreen.png"))
478 && (balls[2] = IMG_Load2("gfx/balls/ballPurple.png"))
479 && (balls[3] = IMG_Load2("gfx/balls/ballRed.png"))
480 && (balls[4] = IMG_Load2("gfx/balls/ballTurkish.png"))
481 && (balls[5] = IMG_Load2("gfx/balls/ballYellow.png"))
482 && (balls[6] = IMG_Load2("gfx/balls/ballGray.png"))
483 && (cursor[0] = IMG_Load2("gfx/animations/cursor/1.png"))
484 && (cursor[1] = IMG_Load2("gfx/animations/cursor/2.png"))
485 && (bomb[0] = IMG_Load2("gfx/animations/bomb/bomb_1.png"))
486 && (bomb[1] = IMG_Load2("gfx/animations/bomb/bomb_2.png"))
487 && (ready[0] = IMG_Load2("gfx/animations/ready/ready_1.png"))
488 && (ready[1] = IMG_Load2("gfx/animations/ready/ready_2.png"))
489 && (explosion[0] = IMG_Load2("gfx/animations/explosion/0.png"))
490 && (explosion[1] = IMG_Load2("gfx/animations/explosion/1.png"))
491 && (explosion[2] = IMG_Load2("gfx/animations/explosion/2.png"))
492 && (explosion[3] = IMG_Load2("gfx/animations/explosion/3.png"))
493 && (counter[0] = IMG_Load2("gfx/counter/1.png"))
494 && (counter[1] = IMG_Load2("gfx/counter/2.png"))
495 && (counter[2] = IMG_Load2("gfx/counter/3.png"))
496 && (backBoard = IMG_Load2("gfx/BackBoard.png")) //not used, we just test if it exists :)
497 && (iGameOver = IMG_Load2("gfx/iGameOver.png"))
498 && (iWinner = IMG_Load2("gfx/iWinner.png"))
499 && (iDraw = IMG_Load2("gfx/iDraw.png"))
500 && (iLoser = IMG_Load2("gfx/iLoser.png"))
501 && (iChainBack = IMG_Load2("gfx/chainFrame.png"))
502 //&& (iBlueFont = IMG_Load2("gfx/24P_Copperplate_Blue.png"))
503 && (iBlueFont = IMG_Load2("gfx/24P_Arial_Blue.png"))
504 && (iSmallFont = IMG_Load2("gfx/14P_Arial_Angle_Red.png"))
505 && (topscoresBack = IMG_Load2("gfx/topscores.png"))
506 && (optionsBack = IMG_Load2("gfx/options.png"))
507 && (bOn = IMG_Load2("gfx/bOn.png"))
508 && (bOff = IMG_Load2("gfx/bOff.png"))
509 && (bChange = IMG_Load2("gfx/bChange.png"))
510 && (b1024 = IMG_Load2("gfx/b1024.png"))
511 //&& (b1280 = IMG_Load2("gfx/b1280.png"))
512 //&& (b1400 = IMG_Load2("gfx/b1400.png"))
513 //&& (b1600 = IMG_Load2("gfx/b1600.png"))
514 && (dialogBox = IMG_Load2("gfx/dialogbox.png"))
515 // && (fileDialogBox = IMG_Load2("gfx/fileDialogbox.png"))
516 && (iLevelCheck = IMG_Load2("gfx/iLevelCheck.png"))
517 && (iLevelCheckBox = IMG_Load2("gfx/iLevelCheckBox.png"))
518 && (iCheckBoxArea = IMG_Load2("gfx/iCheckBoxArea.png"))
519 && (boardBackBack = IMG_Load2("gfx/boardBackBack.png"))
520 && (changeButtonsBack = IMG_Load2("gfx/changeButtonsBack.png"))
521 && (garbageTL = IMG_Load2("gfx/garbage/garbageTL.png"))
522 && (garbageT = IMG_Load2("gfx/garbage/garbageT.png"))
523 && (garbageTR = IMG_Load2("gfx/garbage/garbageTR.png"))
524 && (garbageR = IMG_Load2("gfx/garbage/garbageR.png"))
525 && (garbageBR = IMG_Load2("gfx/garbage/garbageBR.png"))
526 && (garbageB = IMG_Load2("gfx/garbage/garbageB.png"))
527 && (garbageBL = IMG_Load2("gfx/garbage/garbageBL.png"))
528 && (garbageL = IMG_Load2("gfx/garbage/garbageL.png"))
529 && (garbageFill = IMG_Load2("gfx/garbage/garbageFill.png"))
530 && (garbageML = IMG_Load2("gfx/garbage/garbageML.png"))
531 && (garbageM = IMG_Load2("gfx/garbage/garbageM.png"))
532 && (garbageMR = IMG_Load2("gfx/garbage/garbageMR.png"))
533 && (garbageGM = IMG_Load2("gfx/garbage/garbageGM.png"))
534 && (garbageGML = IMG_Load2("gfx/garbage/garbageGML.png"))
535 && (garbageGMR = IMG_Load2("gfx/garbage/garbageGMR.png"))
536 && (smiley[0] = IMG_Load2("gfx/smileys/0.png"))
537 && (smiley[1] = IMG_Load2("gfx/smileys/1.png"))
538 && (smiley[2] = IMG_Load2("gfx/smileys/2.png"))
539 && (smiley[3] = IMG_Load2("gfx/smileys/3.png"))
540 && (mouse = IMG_Load2("gfx/mouse.png"))
541 ))
542 //if there was a problem ie. "File not found"
543 {
544 cout << "Error loading image file: " << SDL_GetError() << endl;
545 exit(1);
546 }
547
548
549 //Prepare for fast blittering!
550 CONVERT(background);
551 CONVERT(bNewGame);
552 CONVERT(backgroundImage);
553 CONVERT(b1player);
554 CONVERT(b2players);
555 CONVERT(bVsMode);
556 CONVERT(bPuzzle);
557 CONVERT(bStageClear);
558 CONVERT(bTimeTrial);
559 CONVERT(bEndless);
560 CONVERT(bOptions);
561 CONVERTA(bConfigure);
562 CONVERTA(bSelectPuzzle);
563 CONVERTA(bReplay);
564 CONVERTA(bSave);
565 CONVERTA(bLoad);
566 #ifdef NETWORK
567 CONVERTA(bNetwork);
568 CONVERTA(bHost);
569 CONVERTA(bConnect);
570 #endif
571 CONVERT(bHighScore);
572 CONVERTA(boardBackBack);
573 CONVERT(backBoard);
574 CONVERT(blackLine);
575 CONVERTA(changeButtonsBack);
576 CONVERTA(cursor[0]);
577 CONVERTA(cursor[1]);
578 CONVERTA(counter[0]);
579 CONVERTA(counter[1]);
580 CONVERTA(counter[2]);
581 CONVERTA(topscoresBack);
582 CONVERTA(optionsBack);
583 CONVERT(bExit);
584 CONVERT(bOn);
585 CONVERT(bOff);
586 CONVERT(bChange);
587 CONVERT(b1024);
588 CONVERTA(dialogBox);
589 // CONVERTA(fileDialogBox);
590 CONVERTA(iLevelCheck);
591 CONVERT(iLevelCheckBox);
592 CONVERTA(iCheckBoxArea);
593 for(int i = 0;i<4;i++)
594 {
595 CONVERTA(explosion[i]);
596 }
597 for(int i = 0; i<7; i++)
598 {
599 CONVERTA(bricks[i]);
600 CONVERTA(balls[i]);
601 }
602 CONVERTA(crossover);
603 CONVERTA(garbageTL);
604 CONVERTA(garbageT);
605 CONVERTA(garbageTR);
606 CONVERTA(garbageR);
607 CONVERTA(garbageBR);
608 CONVERTA(garbageB);
609 CONVERTA(garbageBL);
610 CONVERTA(garbageL);
611 CONVERTA(garbageFill);
612 CONVERTA(garbageML);
613 CONVERTA(garbageMR);
614 CONVERTA(garbageM);
615 CONVERTA(garbageGML);
616 CONVERTA(garbageGMR);
617 CONVERTA(garbageGM);
618 CONVERTA(smiley[0]);
619 CONVERTA(smiley[1]);
620 CONVERTA(smiley[2]);
621 CONVERTA(smiley[3]);
622 CONVERTA(iWinner);
623 CONVERTA(iDraw);
624 CONVERTA(iLoser);
625 CONVERTA(iChainBack);
626 CONVERTA(iBlueFont);
627 CONVERTA(iSmallFont);
628 CONVERTA(iGameOver);
629 CONVERTA(mouse);
630 CONVERTA(stageBobble);
631
632 /*
633 SDL_SetColorKey(topscoresBack, SDL_SRCCOLORKEY,
634 SDL_MapRGB(topscoresBack->format, 0, 255, 0));
635 SDL_SetColorKey(optionsBack, SDL_SRCCOLORKEY,
636 SDL_MapRGB(optionsBack->format, 0, 255, 0));
637 */
638
639 //Here comes the fonts:
640 fBlueFont = SFont_InitFont(iBlueFont);
641 fSmallFont = SFont_InitFont(iSmallFont);
642
643 //Loads the sound if sound present
644 if(!NoSound)
645 {
646 //And here the music:
647 bgMusic = Mix_LoadMUS2("music/bgMusic.ogg");
648 //the music... we just hope it exists, else the user won't hear anything
649 //Same goes for the sounds
650 boing = Mix_LoadWAV2("sound/pop.ogg");
651 timesUp = Mix_LoadWAV2("sound/whistleblow.ogg");
652 applause = Mix_LoadWAV2("sound/applause.ogg");
653 photoClick = Mix_LoadWAV2("sound/cameraclick.ogg");
654 heartBeat = Mix_LoadWAV2("sound/heartbeat3.ogg");
655 typingChunk = Mix_LoadWAV2("sound/typing.ogg");
656 counterChunk = Mix_LoadWAV2("sound/counter.ogg");
657 } //All sound has been loaded or not
658 return 0;
659 } //InitImages()
660
661
662 //Unload images and fonts and sounds
663 void UnloadImages()
664 {
665 //Fonts and Sounds needs to be freed
666 SFont_FreeFont(fBlueFont);
667 SFont_FreeFont(fSmallFont);
668 if(!NoSound) //Only unload then it has been loaded!
669 {
670 Mix_FreeMusic(bgMusic);
671 Mix_FreeChunk(boing);
672 Mix_FreeChunk(timesUp);
673 Mix_FreeChunk(applause);
674 Mix_FreeChunk(photoClick);
675 Mix_FreeChunk(heartBeat);
676 Mix_FreeChunk(counterChunk);
677 Mix_FreeChunk(typingChunk);
678 }
679 //Free surfaces:
680 //I think this will crash, at least it happend to me...
681 /*SDL_FreeSurface(backgroundImage);
682 SDL_FreeSurface(background);
683 SDL_FreeSurface(bNewGame);
684 SDL_FreeSurface(b1player);
685 SDL_FreeSurface(b2players);
686 SDL_FreeSurface(bVsMode);
687 SDL_FreeSurface(bPuzzle);
688 SDL_FreeSurface(bStageClear);
689 SDL_FreeSurface(bTimeTrial);
690 SDL_FreeSurface(bEndless);
691 SDL_FreeSurface(bOptions);
692 SDL_FreeSurface(bConfigure);
693 SDL_FreeSurface(bSelectPuzzle);
694 SDL_FreeSurface(bHighScore);
695 SDL_FreeSurface(bReplay);
696 SDL_FreeSurface(bSave);
697 SDL_FreeSurface(bLoad);
698 #ifdef NETWORK
699 SDL_FreeSurface(bNetwork);
700 SDL_FreeSurface(bHost);
701 SDL_FreeSurface(bConnect);
702 #endif
703 SDL_FreeSurface(bExit);
704 SDL_FreeSurface(blackLine);
705 SDL_FreeSurface(stageBobble);
706 SDL_FreeSurface(bricks[0]);
707 SDL_FreeSurface(bricks[1]);
708 SDL_FreeSurface(bricks[2]);
709 SDL_FreeSurface(bricks[3]);
710 SDL_FreeSurface(bricks[4]);
711 SDL_FreeSurface(bricks[5]);
712 SDL_FreeSurface(bricks[6]);
713 SDL_FreeSurface(crossover);
714 SDL_FreeSurface(balls[0]);
715 SDL_FreeSurface(balls[1]);
716 SDL_FreeSurface(balls[2]);
717 SDL_FreeSurface(balls[3]);
718 SDL_FreeSurface(balls[4]);
719 SDL_FreeSurface(balls[5]);
720 SDL_FreeSurface(balls[6]);
721 SDL_FreeSurface(cursor[0]);
722 SDL_FreeSurface(cursor[1]);
723 SDL_FreeSurface(backBoard); //not used, we just test if it exists :)
724 SDL_FreeSurface(iGameOver);
725 SDL_FreeSurface(iWinner);
726 SDL_FreeSurface(iDraw);
727 SDL_FreeSurface(iLoser);
728 SDL_FreeSurface(iChainBack);
729 SDL_FreeSurface(iBlueFont);
730 SDL_FreeSurface(iSmallFont);
731 SDL_FreeSurface(topscoresBack);
732 SDL_FreeSurface(optionsBack);
733 SDL_FreeSurface(bOn);
734 SDL_FreeSurface(bOff);
735 SDL_FreeSurface(bChange);
736 SDL_FreeSurface(b1024);
737 SDL_FreeSurface(b1280);
738 SDL_FreeSurface(b1400);
739 SDL_FreeSurface(b1600);
740 SDL_FreeSurface(dialogBox);
741 SDL_FreeSurface(fileDialogBox);
742 SDL_FreeSurface(iLevelCheck);
743 SDL_FreeSurface(iLevelCheckBox);
744 SDL_FreeSurface(iCheckBoxArea);
745 SDL_FreeSurface(boardBackBack);
746 SDL_FreeSurface(changeButtonsBack);
747 SDL_FreeSurface(garbageTL);
748 SDL_FreeSurface(garbageT);
749 SDL_FreeSurface(garbageTR);
750 SDL_FreeSurface(garbageR);
751 SDL_FreeSurface(garbageBR);
752 SDL_FreeSurface(garbageB);
753 SDL_FreeSurface(garbageBL);
754 SDL_FreeSurface(garbageL);
755 SDL_FreeSurface(garbageFill);
756 SDL_FreeSurface(garbageML);
757 SDL_FreeSurface(garbageM);
758 SDL_FreeSurface(garbageMR);
759 SDL_FreeSurface(garbageGML);
760 SDL_FreeSurface(garbageGM);
761 SDL_FreeSurface(garbageGMR);
762 SDL_FreeSurface(smiley[0]);
763 SDL_FreeSurface(smiley[1]);
764 SDL_FreeSurface(smiley[2]);
765 SDL_FreeSurface(smiley[3]);
766 SDL_FreeSurface(mouse);
767 */
768 }
769
770 //Function to convert numbers to string
771 string itoa(int num)
772 {
773 stringstream converter;
774 converter << num;
775 return converter.str();
776 }
777
778 /*Loads all the puzzle levels*/
779 int LoadPuzzleStages()
780 {
781 //if(puzzleLoaded)
782 // return 1;
783 #ifdef __unix__
784 string filename0 = (string)getenv("HOME")+(string)"/.gamesaves/blockattack/puzzles/";
785 filename0 = filename0+puzzleName;
786 if(singlePuzzle)
787 filename0 = singlePuzzleFile;
788 #endif //__unix__
789 #ifdef SHAREDIR
790 string filename = (string)SHAREDIR+(string)"/res/";
791 filename = filename+puzzleName;
792 #else
793 string filename = "res/"+puzzleName;
794 #endif
795 #ifdef __unix__
796 ifstream inFile(filename0.c_str());
797 if(!inFile)
798 inFile.open(filename.c_str());
799 #else
800 ifstream inFile(filename.c_str());
801 #endif
802 inFile >> nrOfPuzzles;
803 if(nrOfPuzzles>maxNrOfPuzzleStages)
804 nrOfPuzzles=maxNrOfPuzzleStages;
805 for(int k=0; (k<nrOfPuzzles)&&(!inFile.eof()); k++)
806 {
807 inFile >> nrOfMovesAllowed[k];
808 for(int i=11;i>=0;i--)
809 for(int j=0;j<6;j++)
810 {
811 inFile >> puzzleLevels[k][j][i];
812 }
813 }
814 puzzleLoaded = true;
815 return 0;
816 }
817
818 /*Draws a image from on a given Surface. Takes source image, destination surface and coordinates*/
819 inline void DrawIMG(SDL_Surface *img, SDL_Surface *target, int x, int y)
820 {
821 SDL_Rect dest;
822 dest.x = x;
823 dest.y = y;
824 SDL_BlitSurface(img, NULL, target, &dest);
825 }
826
827 /*Draws a part of an image on a surface of choice*/
828 void DrawIMG(SDL_Surface *img, SDL_Surface * target, int x, int y, int w, int h, int x2, int y2)
829 {
830 SDL_Rect dest;
831 dest.x = x;
832 dest.y = y;
833 SDL_Rect dest2;
834 dest2.x = x2;
835 dest2.y = y2;
836 dest2.w = w;
837 dest2.h = h;
838 SDL_BlitSurface(img, &dest2, target, &dest);
839 }
840
841 //The small things that are faaling when you clear something
842 class aBall
843 {
844 private:
845 double x;
846 double y;
847 double velocityY;
848 double velocityX;
849 int color;
850 unsigned long int lastTime;
851 public:
852
853 aBall()
854 {}
855
856 //constructor:
857 aBall(int X, int Y, bool right, int coulor)
858 {
859 double tal = 1.0;
860 velocityY = -tal*startVelocityY;
861 lastTime = currentTime;
862 x = (double)X;
863 y = (double)Y;
864 color = coulor;
865 if(right)
866 velocityX = tal*VelocityX;
867 else
868 velocityX = -tal*VelocityX;
869 } //constructor
870
871 //Deconstructor
872 ~aBall()
873 {
874 } //Deconstructor
875
876 void update()
877 {
878 double timePassed = (((double)(currentTime-lastTime))/1000.0); //time passed in seconds
879 x = x+timePassed*velocityX;
880 y = y+timePassed*velocityY;
881 velocityY = velocityY + gravity*timePassed;
882 if(y<1.0)
883 velocityY=10.0;
884 if((velocityY>minVelocity) && (y>(double)(768-ballSize)) && (y<768.0))
885 {
886 velocityY = -0.70*velocityY;
887 y = 768.0-ballSize;
888 }
889 lastTime = currentTime;
890 }
891
892 int getX()
893 {
894 return (int)x;
895 }
896
897 int getY()
898 {
899 return (int)y;
900 }
901
902 int getColor()
903 {
904 return color;
905 }
906 }; //aBall
907
908 const int maxNumberOfBalls = 100;
909
910 class ballManeger
911 {
912 public:
913 aBall ballArray[maxNumberOfBalls];
914 bool ballUsed[maxNumberOfBalls];
915 //The old ball information is also saved so balls can be deleted!
916 aBall oldBallArray[maxNumberOfBalls];
917 bool oldBallUsed[maxNumberOfBalls];
918
919 ballManeger()
920 {
921 for(int i=0; i<maxNumberOfBalls; i++)
922 {
923 ballUsed[i] = false;
924 oldBallUsed[i] = false;
925 }
926 }
927
928 int addBall(int x, int y,bool right,int color)
929 {
930 //cout << "Tries to add a ball" << endl;
931 int ballNumber = 0;
932 while((ballUsed[ballNumber])&&(ballNumber<maxNumberOfBalls))
933 ballNumber++;
934 if(ballNumber==maxNumberOfBalls)
935 return -1;
936 currentTime = SDL_GetTicks();
937 ballArray[ballNumber] = aBall(x,y,right,color);
938 ballUsed[ballNumber] = true;
939 //cout << "Ball added" << endl;
940 return 1;
941 } //addBall
942
943 void update()
944 {
945 currentTime = SDL_GetTicks();
946 for(int i = 0; i<maxNumberOfBalls; i++)
947 {
948
949 if(ballUsed[i])
950 {
951 oldBallUsed[i] = true;
952 oldBallArray[i] = ballArray[i];
953 ballArray[i].update();
954 if(ballArray[i].getY()>800)
955 {
956 ballArray[i].~aBall();
957 ballUsed[i] = false;
958 //cout << "Ball removed" << endl;
959 }
960 }
961 else
962 {
963 oldBallUsed[i] = false;
964 }
965 }
966 } //update
967
968
969 }; //theBallManeger
970
971 ballManeger theBallManeger;
972
973 //a explosions, non moving
974 class anExplosion
975 {
976 private:
977 int x;
978 int y;
979 Uint8 frameNumber;
980 #define frameLength 80
981 //How long an image in an animation should be showed
982 #define maxFrame 4
983 //How many images there are in the animation
984 unsigned long int placeTime; //Then the explosion occored
985 public:
986
987 anExplosion()
988 {}
989
990 //constructor:
991 anExplosion(int X, int Y)
992 {
993 placeTime = currentTime;
994 x = X;
995 y = Y;
996 frameNumber=0;
997 } //constructor
998
999 //Deconstructor
1000 ~anExplosion()
1001 {
1002 } //Deconstructor
1003
1004 //true if animation has played and object should be removed from the screen
1005 bool removeMe()
1006 {
1007 frameNumber = (currentTime-placeTime)/frameLength;
1008 return (!(frameNumber<maxFrame));
1009 }
1010
1011 int getX()
1012 {
1013 return (int)x;
1014 }
1015
1016 int getY()
1017 {
1018 return (int)y;
1019 }
1020
1021 int getFrame()
1022 {
1023 return frameNumber;
1024 }
1025 }; //nExplosion
1026
1027 class explosionManeger
1028 {
1029 public:
1030 anExplosion explosionArray[maxNumberOfBalls];
1031 bool explosionUsed[maxNumberOfBalls];
1032 //The old explosion information is also saved so explosions can be deleted!
1033 anExplosion oldExplosionArray[maxNumberOfBalls];
1034 bool oldExplosionUsed[maxNumberOfBalls];
1035
1036 explosionManeger()
1037 {
1038 for(int i=0; i<maxNumberOfBalls; i++)
1039 {
1040 explosionUsed[i] = false;
1041 oldExplosionUsed[i] = false;
1042 }
1043 }
1044
1045 int addExplosion(int x, int y)
1046 {
1047 //cout << "Tries to add an explosion" << endl;
1048 int explosionNumber = 0;
1049 while((explosionUsed[explosionNumber])&&(explosionNumber<maxNumberOfBalls))
1050 explosionNumber++;
1051 if(explosionNumber==maxNumberOfBalls)
1052 return -1;
1053 currentTime = SDL_GetTicks();
1054 explosionArray[explosionNumber] = anExplosion(x,y);
1055 explosionUsed[explosionNumber] = true;
1056 //cout << "Explosion added" << endl;
1057 return 1;
1058 } //addBall
1059
1060 void update()
1061 {
1062 currentTime = SDL_GetTicks();
1063 for(int i = 0; i<maxNumberOfBalls; i++)
1064 {
1065
1066 if(explosionUsed[i])
1067 {
1068 oldExplosionUsed[i] = true;
1069 oldExplosionArray[i] = explosionArray[i];
1070 if(explosionArray[i].removeMe())
1071 {
1072 explosionArray[i].~anExplosion();
1073 explosionUsed[i] = false;
1074 //cout << "Explosion removed" << endl;
1075 }
1076 }
1077 else
1078 {
1079 oldExplosionUsed[i] = false;
1080 }
1081 }
1082 } //update
1083
1084
1085 }; //explosionManeger
1086
1087 explosionManeger theExplosionManeger;
1088
1089 //text pop-up
1090 class textMessage
1091 {
1092 private:
1093 int x;
1094 int y;
1095 char textt[10];
1096 unsigned long int time;
1097 unsigned long int placeTime; //Then the text was placed
1098 public:
1099
1100 textMessage()
1101 {}
1102
1103 //constructor:
1104 textMessage(int X, int Y,const char* Text,unsigned int Time)
1105 {
1106 //cout << "Running constructor" << endl;
1107 placeTime = currentTime;
1108 x = X;
1109 y = Y;
1110 strncpy(textt,Text,10);
1111 textt[9]=0;
1112 time = Time;
1113 //cout << "Constructor runned" << endl;
1114 } //constructor
1115
1116 //true if the text has expired
1117 bool removeMe()
1118 {
1119 return currentTime-placeTime>time;
1120 }
1121
1122 int getX()
1123 {
1124 //cout << "Gets X" << endl;
1125 return x;
1126 }
1127
1128 int getY()
1129 {
1130 //cout << "Gets Y" << endl;
1131 return y;
1132 }
1133
1134 char* getText()
1135 {
1136 //cout << "Gets text" << endl;
1137 return textt;
1138 }
1139 }; //text popup
1140
1141 class textManeger
1142 {
1143 public:
1144 textMessage textArray[maxNumberOfBalls];
1145 bool textUsed[maxNumberOfBalls];
1146 //The old text information is also saved so text can be deleted!
1147 textMessage oldTextArray[maxNumberOfBalls];
1148 bool oldTextUsed[maxNumberOfBalls];
1149
1150 textManeger()
1151 {
1152 for(int i=0; i<maxNumberOfBalls; i++)
1153 {
1154 textUsed[i] = false;
1155 oldTextUsed[i] = false;
1156 }
1157 }
1158
1159 int addText(int x, int y,string Text,unsigned int Time)
1160 {
1161 //cout << "Tries to add text" << endl;
1162 int textNumber = 0;
1163 while((textNumber<maxNumberOfBalls)&&((textUsed[textNumber])||(oldTextUsed[textNumber])))
1164 textNumber++;
1165 if(textNumber==maxNumberOfBalls)
1166 return -1;
1167 //cout << "adding to: " << textNumber << ":" << textUsed[textNumber] << ":" << &textArray[textNumber] << endl;
1168 currentTime = SDL_GetTicks();
1169 //if(&textArray[textNumber]!=NULL)
1170 //*textArray[textNumber]=0;
1171 textArray[textNumber] = textMessage(x,y,Text.c_str(),Time);
1172 textUsed[textNumber] = true;
1173 //cout << "Text added" << endl;
1174 return 1;
1175 } //addText
1176
1177 void update()
1178 {
1179 //cout << "Running update" << endl;
1180 currentTime = SDL_GetTicks();
1181 for(int i = 0; i<maxNumberOfBalls; i++)
1182 {
1183
1184 if(textUsed[i])
1185 {
1186 if(!oldTextUsed[i])
1187 {
1188 oldTextUsed[i] = true;
1189 oldTextArray[i] = textMessage(textArray[i]);
1190 }
1191 if(textArray[i].removeMe())
1192 {
1193 textArray[i].~textMessage();
1194 textUsed[i] = false;
1195 }
1196 }
1197 else
1198 if(oldTextUsed[i])
1199 {
1200 oldTextUsed[i] = false;
1201 oldTextArray[i].~textMessage();
1202 }
1203 }
1204 } //update
1205
1206
1207 }; //textManeger
1208
1209 textManeger theTextManeger;
1210
1211 //Here comes the Block Game object
1212 #include "BlockGame.hpp"
1213
1214 //writeScreenShot saves the screen as a bmp file, it uses the time to get a unique filename
1215 void writeScreenShot()
1216 {
1217 cout << "Saving screenshot" << endl;
1218 int rightNow = (int)time(NULL);
1219 #if defined(__unix__)
1220 char buf[514];
1221 sprintf( buf, "%s/.gamesaves/blockattack/screenshots/screenshot%i.bmp", getenv("HOME"), rightNow );
1222 #else
1223 char buf[MAX_PATH];
1224 sprintf( buf, "%s\\My Games\\blockattack\\screenshots\\screenshot%i.bmp", (getMyDocumentsPath()).c_str(), rightNow );
1225 #endif
1226 SDL_SaveBMP( screen, buf );
1227 if(!NoSound)
1228 if(SoundEnabled)Mix_PlayChannel(1,photoClick,0);
1229 }
1230
1231 //Draws the highscores
1232 inline void DrawHighscores(int x, int y)
1233 {
1234 DrawIMG(topscoresBack,screen,x,y);
1235 if(showEndless) SFont_Write(screen,fBlueFont,x+100,y+100,"Endless:");
1236 else SFont_Write(screen,fBlueFont,x+100,y+100,"Time Trial:");
1237 for(int i =0;i<10;i++)
1238 {
1239 char playerScore[32];
1240 char playerName[32];
1241 if(showEndless) sprintf(playerScore, "%i", theTopScoresEndless.getScoreNumber(i));
1242 else sprintf(playerScore, "%i", theTopScoresTimeTrial.getScoreNumber(i));
1243 if(showEndless) strcpy(playerName,theTopScoresEndless.getScoreName(i));
1244 else strcpy(playerName,theTopScoresTimeTrial.getScoreName(i));
1245 SFont_Write(screen,fBlueFont,x+420,y+150+i*35,playerScore);
1246 SFont_Write(screen,fBlueFont,x+60,y+150+i*35,playerName);
1247 }
1248 }
1249
1250 char keyname[11];
1251
1252 //Function to return the name of a key, to be displayed...
1253 char* getKeyName(SDLKey key)
1254 {
1255
1256 char charToPut = '\0';
1257 switch(key)
1258 {
1259 case SDLK_a: charToPut = 'A'; break;
1260 case SDLK_b: charToPut = 'B'; break;
1261 case SDLK_c: charToPut = 'C'; break;
1262 case SDLK_d: charToPut = 'D'; break;
1263 case SDLK_e: charToPut = 'E'; break;
1264 case SDLK_f: charToPut = 'F'; break;
1265 case SDLK_g: charToPut = 'G'; break;
1266 case SDLK_h: charToPut = 'H'; break;
1267 case SDLK_i: charToPut = 'I'; break;
1268 case SDLK_j: charToPut = 'J'; break;
1269 case SDLK_k: charToPut = 'K'; break;
1270 case SDLK_l: charToPut = 'L'; break;
1271 case SDLK_m: charToPut = 'M'; break;
1272 case SDLK_n: charToPut = 'N'; break;
1273 case SDLK_o: charToPut = 'O'; break;
1274 case SDLK_p: charToPut = 'P'; break;
1275 case SDLK_q: charToPut = 'Q'; break;
1276 case SDLK_r: charToPut = 'R'; break;
1277 case SDLK_s: charToPut = 'S'; break;
1278 case SDLK_t: charToPut = 'T'; break;
1279 case SDLK_u: charToPut = 'U'; break;
1280 case SDLK_v: charToPut = 'V'; break;
1281 case SDLK_w: charToPut = 'W'; break;
1282 case SDLK_x: charToPut = 'X'; break;
1283 case SDLK_y: charToPut = 'Y'; break;
1284 case SDLK_z: charToPut = 'Z'; break;
1285 case SDLK_0: charToPut = '0'; break;
1286 case SDLK_1: charToPut = '1'; break;
1287 case SDLK_2: charToPut = '2'; break;
1288 case SDLK_3: charToPut = '3'; break;
1289 case SDLK_4: charToPut = '4'; break;
1290 case SDLK_5: charToPut = '5'; break;
1291 case SDLK_6: charToPut = '6'; break;
1292 case SDLK_7: charToPut = '7'; break;
1293 case SDLK_8: charToPut = '8'; break;
1294 case SDLK_9: charToPut = '9'; break;
1295 case SDLK_KP0: sprintf(keyname,"NP_0"); break;
1296 case SDLK_KP1: sprintf(keyname,"NP_1"); break;
1297 case SDLK_KP2: sprintf(keyname,"NP_2"); break;
1298 case SDLK_KP3: sprintf(keyname,"NP_3"); break;
1299 case SDLK_KP4: sprintf(keyname,"NP_4"); break;
1300 case SDLK_KP5: sprintf(keyname,"NP_5"); break;
1301 case SDLK_KP6: sprintf(keyname,"NP_6"); break;
1302 case SDLK_KP7: sprintf(keyname,"NP_7"); break;
1303 case SDLK_KP8: sprintf(keyname,"NP_8"); break;
1304 case SDLK_KP9: sprintf(keyname,"NP_9"); break;
1305 case SDLK_BACKSPACE: sprintf(keyname,"Backspace"); break;
1306 case SDLK_TAB: sprintf(keyname,"Tab"); break;
1307 case SDLK_CLEAR: sprintf(keyname,"Clear"); break;
1308 case SDLK_RETURN: sprintf(keyname,"Return"); break;
1309 case SDLK_PAUSE: sprintf(keyname,"Pause"); break;
1310 case SDLK_SPACE: sprintf(keyname,"Space"); break;
1311 case SDLK_EXCLAIM: charToPut = '!'; break;
1312 case SDLK_QUOTEDBL: sprintf(keyname,"QuoteDBL"); break;
1313 case SDLK_HASH: charToPut = '#'; break;
1314 case SDLK_DOLLAR: sprintf(keyname,"$"); break;
1315 case SDLK_ASTERISK: sprintf(keyname,"Asterisk"); break;
1316 case SDLK_PLUS: sprintf(keyname,"Plus"); break;
1317 case SDLK_COMMA: sprintf(keyname,"Comma"); break;
1318 case SDLK_MINUS: sprintf(keyname,"Minus"); break;
1319 case SDLK_PERIOD: sprintf(keyname,"Period"); break;
1320 case SDLK_SLASH: charToPut ='/'; break;
1321 case SDLK_COLON: sprintf(keyname,"Colon"); break;
1322 case SDLK_SEMICOLON: sprintf(keyname,"SemiColon"); break;
1323 case SDLK_LESS: charToPut = '<'; break;
1324 case SDLK_EQUALS: sprintf(keyname,"Equals"); break;
1325 case SDLK_DELETE: sprintf(keyname,"Delete"); break;
1326 case SDLK_KP_PERIOD: sprintf(keyname,"NPperiod"); break;
1327 case SDLK_KP_DIVIDE: sprintf(keyname,"NPdivide"); break;
1328 case SDLK_KP_MULTIPLY: sprintf(keyname,"NPmultiply"); break;
1329 case SDLK_KP_MINUS: sprintf(keyname,"NPminus"); break;
1330 case SDLK_KP_PLUS: sprintf(keyname,"NPplus"); break;
1331 case SDLK_KP_ENTER: sprintf(keyname,"NP_Enter"); break;
1332 case SDLK_KP_EQUALS: sprintf(keyname,"NP="); break;
1333 case SDLK_UP: sprintf(keyname,"UP"); break;
1334 case SDLK_DOWN: sprintf(keyname,"DOWN"); break;
1335 case SDLK_RIGHT: sprintf(keyname,"RIGHT"); break;
1336 case SDLK_LEFT: sprintf(keyname,"LEFT"); break;
1337 case SDLK_INSERT: sprintf(keyname,"Insert"); break;
1338 case SDLK_HOME: sprintf(keyname,"Home"); break;
1339 case SDLK_END: sprintf(keyname,"End"); break;
1340 case SDLK_PAGEUP: sprintf(keyname,"PageUp"); break;
1341 case SDLK_PAGEDOWN: sprintf(keyname,"PageDown"); break;
1342 case SDLK_NUMLOCK: sprintf(keyname,"NumLock"); break;
1343 case SDLK_CAPSLOCK: sprintf(keyname,"CapsLock"); break;
1344 case SDLK_SCROLLOCK: sprintf(keyname,"ScrolLock"); break;
1345 case SDLK_RSHIFT: sprintf(keyname,"Rshift"); break;
1346 case SDLK_LSHIFT: sprintf(keyname,"Lshift"); break;
1347 case SDLK_RCTRL: sprintf(keyname,"Rctrl"); break;
1348 case SDLK_LCTRL: sprintf(keyname,"Lctrl"); break;
1349 case SDLK_RALT: sprintf(keyname,"Ralt"); break;
1350 case SDLK_LALT: sprintf(keyname,"Lalt"); break;
1351 case SDLK_RMETA: sprintf(keyname,"Rmeta"); break;
1352 case SDLK_LMETA: sprintf(keyname,"Lmeta"); break;
1353 case SDLK_LSUPER: sprintf(keyname,"Lwin"); break;
1354 case SDLK_RSUPER: sprintf(keyname,"Rwin"); break;
1355 case SDLK_MODE: sprintf(keyname,"Mode"); break;
1356 case SDLK_HELP: sprintf(keyname,"Help"); break;
1357 default:
1358 sprintf(keyname,"Unknown"); break;
1359 }
1360 if(charToPut != '\0')
1361 sprintf(keyname,"%c",charToPut);
1362 return &keyname[0];
1363 }
1364
1365 void MakeBackground(int xsize,int ysize,BlockGame &theGame, BlockGame &theGame2);
1366
1367 int OpenControlsBox(int x, int y, int player)
1368 {
1369 int mousex, mousey;
1370 Uint8 *keys;
1371 bool done =false;
1372 char *keyname;
1373 MakeBackground(1024,768);
1374 while(!done)
1375 {
1376 SDL_Delay(10);
1377 DrawIMG(background, screen, 0, 0);
1378 DrawIMG(changeButtonsBack,screen,x,y);
1379 if(player == 0)
1380 SFont_Write(screen,fBlueFont,x+40,y+2,"Player 1 keys");
1381 else
1382 SFont_Write(screen,fBlueFont,x+40,y+2,"Player 2 keys");
1383 SFont_Write(screen,fBlueFont,x+6,y+50,"Up");
1384 keyname = getKeyName(keySettings[player].up);
1385 SFont_Write(screen,fBlueFont,x+200,y+50,keyname);
1386 SFont_Write(screen,fBlueFont,x+6,y+100,"Down");
1387 keyname = getKeyName(keySettings[player].down);
1388 SFont_Write(screen,fBlueFont,x+200,y+100,keyname);
1389 SFont_Write(screen,fBlueFont,x+6,y+150,"Left");
1390 keyname = getKeyName(keySettings[player].left);
1391 SFont_Write(screen,fBlueFont,x+200,y+150,keyname);
1392 SFont_Write(screen,fBlueFont,x+6,y+200,"Right");
1393 keyname = getKeyName(keySettings[player].right);
1394 SFont_Write(screen,fBlueFont,x+200,y+200,keyname);
1395 SFont_Write(screen,fBlueFont,x+6,y+250,"Push");
1396 keyname = getKeyName(keySettings[player].push);
1397 SFont_Write(screen,fBlueFont,x+200,y+250,keyname);
1398 SFont_Write(screen,fBlueFont,x+6,y+300,"Change");
1399 keyname = getKeyName(keySettings[player].change);
1400 SFont_Write(screen,fBlueFont,x+200,y+300,keyname);
1401 //Ask for mouse play
1402 SFont_Write(screen,fBlueFont,x+6,y+350,"Mouse play?");
1403 DrawIMG(iLevelCheckBox,screen,x+220,y+350);
1404 if(((player==0)&&(mouseplay1))||((player==2)&&(mouseplay2)))
1405 DrawIMG(iLevelCheck,screen,x+220,y+350); //iLevelCheck witdh is 42
1406 //Ask for joypad play
1407 SFont_Write(screen,fBlueFont,x+300,y+350,"Joypad?");
1408 DrawIMG(iLevelCheckBox,screen,x+460,y+350);
1409 if(((player==0)&&(joyplay1))||((player==2)&&(joyplay2)))
1410 DrawIMG(iLevelCheck,screen,x+460,y+350); //iLevelCheck witdh is 42
1411 for(int i=1; i<7; i++)
1412 DrawIMG(bChange,screen,x+420,y+50*i);
1413 SDL_Event event;
1414
1415 while(SDL_PollEvent(&event))
1416 {
1417 if ( event.type == SDL_QUIT ) {done = true;}
1418
1419 if(event.type == SDL_KEYDOWN)
1420 {
1421 if (event.key.keysym.sym == SDLK_ESCAPE)
1422 done = true;
1423 }
1424 } //PollEvent
1425
1426 keys = SDL_GetKeyState(NULL);
1427
1428 SDL_GetMouseState(&mousex,&mousey);
1429
1430 // If the mouse button is released, make bMouseUp equal true
1431 if(!SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(1))
1432 {
1433 bMouseUp=true;
1434 }
1435
1436 if(SDL_GetMouseState(NULL,NULL)&SDL_BUTTON(1) && bMouseUp)
1437 {
1438 bMouseUp = false;
1439
1440 if((mousex>(420+x)) && (mousex<(540+x)) && (mousey>(50+y)) && (mousey<(90+y)))
1441 {
1442 //up
1443 bool finnish = false;
1444 while(!finnish)
1445 while ( SDL_PollEvent(&event) )
1446 {
1447 if(event.type == SDL_KEYDOWN)
1448 {
1449 if(event.key.keysym.sym != SDLK_ESCAPE)
1450 keySettings[player].up = event.key.keysym.sym;
1451 finnish = true;
1452 }
1453 }
1454 } //up
1455 if((mousex>(420+x)) && (mousex<(540+x)) && (mousey>(100+y)) && (mousey<(140+y)))
1456 {
1457 //down
1458 bool finnish = false;
1459 while(!finnish)
1460 while ( SDL_PollEvent(&event) )
1461 {
1462 if(event.type == SDL_KEYDOWN)
1463 {
1464 if(event.key.keysym.sym != SDLK_ESCAPE)
1465 keySettings[player].down = event.key.keysym.sym;
1466 finnish = true;
1467 }
1468 }
1469 } //down
1470 if((mousex>(420+x)) && (mousex<(540+x)) && (mousey>(150+y)) && (mousey<(190+y)))
1471 {
1472 //left
1473 bool finnish = false;
1474 while(!finnish)
1475 while ( SDL_PollEvent(&event) )
1476 {
1477 if(event.type == SDL_KEYDOWN)
1478 {
1479 if(event.key.keysym.sym != SDLK_ESCAPE)
1480 keySettings[player].left = event.key.keysym.sym;
1481 finnish = true;
1482 }
1483 }
1484 } //left
1485 if((mousex>(420+x)) && (mousex<(540+x)) && (mousey>(200+y)) && (mousey<(240+y)))
1486 {
1487 //right
1488 bool finnish = false;
1489 while(!finnish)
1490 while ( SDL_PollEvent(&event) )
1491 {
1492 if(event.type == SDL_KEYDOWN)
1493 {
1494 if(event.key.keysym.sym != SDLK_ESCAPE)
1495 keySettings[player].right = event.key.keysym.sym;
1496 finnish = true;
1497 }
1498 }
1499 } //right
1500 if((mousex>(420+x)) && (mousex<(540+x)) && (mousey>(250+y)) && (mousey<(290+y)))
1501 {
1502 //push
1503 bool finnish = false;
1504 while(!finnish)
1505 while ( SDL_PollEvent(&event) )
1506 {
1507 if(event.type == SDL_KEYDOWN)
1508 {
1509 if(event.key.keysym.sym != SDLK_ESCAPE)
1510 keySettings[player].push = event.key.keysym.sym;
1511 finnish = true;
1512 }
1513 }
1514 } //push
1515 if((mousex>(420+x)) && (mousex<(540+x)) && (mousey>(300+y)) && (mousey<(340+y)))
1516 {
1517 //change
1518 bool finnish = false;
1519 while(!finnish)
1520 while ( SDL_PollEvent(&event) )
1521 {
1522 if(event.type == SDL_KEYDOWN)
1523 {
1524 if(event.key.keysym.sym != SDLK_ESCAPE)
1525 keySettings[player].change = event.key.keysym.sym;
1526 finnish = true;
1527 }
1528 }
1529 } //change
1530 //mouseplay:
1531 if((mousex>(220+x)) && (mousex<(262+x)) && (mousey>(350+y)) && (mousey<(392+y)))
1532 {
1533 if (player==0)
1534 {
1535 mouseplay1 = !mouseplay1;
1536 }
1537 else
1538 {
1539 mouseplay2 = !mouseplay2;
1540 }
1541 }
1542 //Joyplay:
1543 if((mousex>(460+x)) && (mousex<(502+x)) && (mousey>(350+y)) && (mousey<(392+y)))
1544 {
1545 if (player==0)
1546 {
1547 joyplay1 = !joyplay1;
1548 }
1549 else
1550 {
1551 joyplay2 = !joyplay2;
1552 }
1553 }
1554 } //get mouse state
1555
1556 DrawIMG(mouse,screen,mousex,mousey);
1557 SDL_Flip(screen);
1558 } //while !done
1559 DrawIMG(background, screen, 0, 0);
1560 return 0;
1561 }
1562
1563
1564 //Dialogbox
1565 bool OpenDialogbox(int x, int y, char *name)
1566 {
1567 bool done = false; //We are done!
1568 bool accept = false; //New name is accepted! (not Cancelled)
1569 bool repeating = false; //The key is being held (BACKSPACE)
1570 const int repeatDelay = 200; //Repeating
1571 unsigned long time = 0;
1572 ReadKeyboard rk = ReadKeyboard(name);
1573 Uint8* keys;
1574 string strHolder;
1575 MakeBackground(1024,768);
1576 DrawIMG(background,screen,0,0);
1577 while(!done)
1578 {
1579 DrawIMG(dialogBox,screen,x,y);
1580 SFont_Write(screen,fBlueFont,x+40,y+72,rk.GetString());
1581 strHolder = rk.GetString();
1582 //cout << "hej\n" << (int)rk.CharsBeforeCursor() << endl;
1583 strHolder.erase((int)rk.CharsBeforeCursor());
1584
1585 if(((SDL_GetTicks()/600)%2)==1)
1586 SFont_Write(screen,fBlueFont,x+40+SFont_TextWidth(fBlueFont,strHolder.c_str()),y+69,"|");
1587
1588 SDL_Event event;
1589
1590 while ( SDL_PollEvent(&event) )
1591 {
1592 if ( event.type == SDL_QUIT ) { done = true; accept = false; }
1593
1594 if ( event.type == SDL_KEYDOWN )
1595 {
1596 if ( (event.key.keysym.sym == SDLK_RETURN)||(event.key.keysym.sym == SDLK_KP_ENTER) ) { done = true; accept = true;}
1597 else
1598 if ( (event.key.keysym.sym == SDLK_ESCAPE) ) { done = true; accept = false;}
1599 else if(!(event.key.keysym.sym == SDLK_BACKSPACE)){if((rk.ReadKey(event.key.keysym.sym))&&(SoundEnabled)&&(!NoSound))Mix_PlayChannel(1,typingChunk,0);}
1600 else if((event.key.keysym.sym == SDLK_BACKSPACE)&&(!repeating)){if((rk.ReadKey(event.key.keysym.sym))&&(SoundEnabled)&&(!NoSound))Mix_PlayChannel(1,typingChunk,0); repeating = true; time=SDL_GetTicks();}
1601 }
1602
1603 } //while(event)
1604
1605 if(SDL_GetTicks()>(time+repeatDelay))
1606 {
1607 time = SDL_GetTicks();
1608 keys = SDL_GetKeyState(NULL);
1609 if( (keys[SDLK_BACKSPACE])&&(repeating) )
1610 {if((rk.ReadKey(SDLK_BACKSPACE))&&(SoundEnabled)&&(!NoSound))Mix_PlayChannel(1,typingChunk,0);}
1611 else
1612 repeating = false;
1613 }
1614
1615 SDL_Flip(screen); //Update screen
1616 } //while(!done)
1617 strcpy(name,rk.GetString());
1618 bScreenLocked = false;
1619 showDialog = false;
1620 return accept;
1621 }
1622
1623
1624 //Open a puzzle file
1625 bool OpenFileDialogbox(int x, int y, char *name)
1626 {
1627 bool done = false; //We are done!
1628 int mousex, mousey;
1629 ListFiles lf = ListFiles();
1630 #ifdef SHAREDIR
1631 string folder = (string)SHAREDIR+(string)"/res";
1632 cout << "Looking in " << folder << endl;
1633 lf.setDictory(folder.c_str());
1634 #else
1635 lf.setDictory("./res");
1636 #endif
1637 #ifdef __unix__
1638 string homeFolder = (string)getenv("HOME")+(string)"/.gamesaves/blockattack/puzzles";
1639 lf.setDictory2(homeFolder.c_str());
1640 #endif
1641 Uint8* keys;
1642 string strHolder;
1643 MakeBackground(1024,768);
1644 DrawIMG(background,screen,0,0);
1645 DrawIMG(bForward,background,x+460,y+420);
1646 DrawIMG(bBack,background,x+20,y+420);
1647 while(!done)
1648 {
1649 DrawIMG(background,screen,0,0);
1650 const int nrOfFiles = 10;
1651 DrawIMG(changeButtonsBack,screen,x,y);
1652 for(int i=0;i<nrOfFiles;i++)
1653 {
1654 SFont_Write(screen,fBlueFont,x+10,y+10+36*i,lf.getFileName(i).c_str());
1655 }
1656
1657 SDL_Event event;
1658
1659 while ( SDL_PollEvent(&event) )
1660 {
1661 if ( event.type == SDL_QUIT ) { done = true; }
1662
1663 if ( event.type == SDL_KEYDOWN )
1664 {
1665 if ( (event.key.keysym.sym == SDLK_ESCAPE) ) { done = true;}
1666
1667 if ( (event.key.keysym.sym == SDLK_RIGHT) ) { lf.forward(); }
1668
1669 if ( (event.key.keysym.sym == SDLK_LEFT) ) { lf.back(); }
1670 }
1671
1672 } //while(event)
1673
1674 SDL_GetMouseState(&mousex,&mousey);
1675
1676 // If the mouse button is released, make bMouseUp equal true
1677 if(!SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(1))
1678 {
1679 bMouseUp=true;
1680 }
1681
1682 if(SDL_GetMouseState(NULL,NULL)&SDL_BUTTON(1) && bMouseUp)
1683 {
1684 bMouseUp = false;
1685
1686 //The Forward Button:
1687 if( (mousex>x+460) && (mousex<x+460+120) && (mousey>y+420) && (mousey<y+420+40) )
1688 {
1689 lf.forward();
1690 }
1691
1692 //The back button:
1693 if( (mousex>x+20) && (mousex<x+20+120) && (mousey>y+420) && (mousey<y+420+40) )
1694 {
1695 lf.back();
1696 }
1697
1698 for(int i=0;i<10;i++)
1699 {
1700 if( (mousex>x+10) && (mousex<x+480) && (mousey>y+10+i*36) && (mousey<y+10+i*36+32) )
1701 {
1702 if(lf.fileExists(i))
1703 {
1704 strncpy(name,lf.getFileName(i).c_str(),28); //Problems occurs then larger than 28 (maybe 29)
1705 done=true; //The user have, clicked the purpose of this function is now complete
1706 }
1707 }
1708 }
1709 }
1710
1711 DrawIMG(mouse,screen,mousex,mousey);
1712 SDL_Flip(screen); //Update screen
1713 }
1714 }
1715
1716 //Open a saved replay
1717 bool OpenReplayDialogbox(int x, int y, char *name)
1718 {
1719 bool done = false; //We are done!
1720 int mousex, mousey;
1721 ListFiles lf = ListFiles();
1722 cout << "Ready to set directory!" << endl;
1723 #ifdef __unix__
1724 string dictory = (string)getenv("HOME")+(string)"/.gamesaves/blockattack/replays";
1725 #elif WIN32
1726 string dictory = getMyDocumentsPath()+(string)"/My Games/blockattack/replays";
1727 #else
1728 string dictory = "./replays";
1729 #endif
1730 lf.setDictory(dictory);
1731 cout << "Directory sat" << endl;
1732 Uint8* keys;
1733 string strHolder;
1734 MakeBackground(1024,768);
1735 DrawIMG(background,screen,0,0);
1736 DrawIMG(bForward,background,x+460,y+420);
1737 DrawIMG(bBack,background,x+20,y+420);
1738 while(!done)
1739 {
1740 DrawIMG(background,screen,0,0);
1741 const int nrOfFiles = 10;
1742 DrawIMG(changeButtonsBack,screen,x,y);
1743 for(int i=0;i<nrOfFiles;i++)
1744 {
1745 SFont_Write(screen,fBlueFont,x+10,y+10+36*i,lf.getFileName(i).c_str());
1746 }
1747
1748 SDL_Event event;
1749
1750 while ( SDL_PollEvent(&event) )
1751 {
1752 if ( event.type == SDL_QUIT ) { done = true; return false;}
1753
1754 if ( event.type == SDL_KEYDOWN )
1755 {
1756 if ( (event.key.keysym.sym == SDLK_ESCAPE) ) { done = true; return false;}
1757
1758 if ( (event.key.keysym.sym == SDLK_RIGHT) ) { lf.forward(); }
1759
1760 if ( (event.key.keysym.sym == SDLK_LEFT) ) { lf.back(); }
1761 }
1762
1763 } //while(event)
1764
1765 SDL_GetMouseState(&mousex,&mousey);
1766
1767 // If the mouse button is released, make bMouseUp equal true
1768 if(!SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(1))
1769 {
1770 bMouseUp=true;
1771 }
1772
1773 if(SDL_GetMouseState(NULL,NULL)&SDL_BUTTON(1) && bMouseUp)
1774 {
1775 bMouseUp = false;
1776
1777 //The Forward Button:
1778 if( (mousex>x+460) && (mousex<x+460+120) && (mousey>y+420) && (mousey<y+420+40) )
1779 {
1780 lf.forward();
1781 }
1782
1783 //The back button:
1784 if( (mousex>x+20) && (mousex<x+20+120) && (mousey>y+420) && (mousey<y+420+40) )
1785 {
1786 lf.back();
1787 }
1788
1789 for(int i=0;i<10;i++)
1790 {
1791 if( (mousex>x+10) && (mousex<x+480) && (mousey>y+10+i*36) && (mousey<y+10+i*36+32) )
1792 {
1793 if(lf.fileExists(i))
1794 {
1795 strncpy(name,lf.getFileName(i).c_str(),28); //Problems occurs then larger than 28 (maybe 29)
1796 done=true; //The user have, clicked the purpose of this function is now complete
1797 return true;
1798 }
1799 }
1800 }
1801 }
1802
1803 DrawIMG(mouse,screen,mousex,mousey);
1804 SDL_Flip(screen); //Update screen
1805 }
1806 }
1807
1808
1809 //draws options:
1810 inline void DrawOptions(int x, int y)
1811 {
1812 if(MusicEnabled) DrawIMG(bOn,optionsBack,400,120);
1813 else DrawIMG(bOff,optionsBack,400,120);
1814 if(SoundEnabled) DrawIMG(bOn,optionsBack,400,170);
1815 else DrawIMG(bOff,optionsBack,400,170);
1816 if(bFullscreen) DrawIMG(bOn,optionsBack,400,220);
1817 else DrawIMG(bOff,optionsBack,400,220);
1818 DrawIMG(bChange,optionsBack,230,435);
1819 DrawIMG(bChange,optionsBack,410,435);
1820 DrawIMG(bChange,optionsBack,230,500);
1821 DrawIMG(bChange,optionsBack,410,500);
1822 DrawIMG(optionsBack,screen,x,y);
1823 } //drawOptions
1824
1825 //Draws the balls and explosions
1826 void DrawBalls()
1827 {
1828 for(int i = 0; i< maxNumberOfBalls; i++)
1829 {
1830 if(theBallManeger.ballUsed[i])
1831 {
1832 DrawIMG(balls[theBallManeger.ballArray[i].getColor()],screen,theBallManeger.ballArray[i].getX(),theBallManeger.ballArray[i].getY());
1833 } //if used
1834 if(theExplosionManeger.explosionUsed[i])
1835 {
1836 DrawIMG(explosion[theExplosionManeger.explosionArray[i].getFrame()],screen,theExplosionManeger.explosionArray[i].getX(),theExplosionManeger.explosionArray[i].getY());
1837 }
1838 if(theTextManeger.textUsed[i])
1839 {
1840 //cout << "Printing text: " << theTextManeger.textArray[i].getText() << endl;
1841 int x = theTextManeger.textArray[i].getX()-SFont_TextWidth(fSmallFont,theTextManeger.textArray[i].getText())/2;
1842 int y = theTextManeger.textArray[i].getY()-SFont_TextHeight(fSmallFont)/2;
1843 DrawIMG(iChainBack,screen,x,y);
1844 SFont_Write(screen,fSmallFont,x+(25-SFont_TextWidth(fSmallFont,theTextManeger.textArray[i].getText()))/2,y+(25-SFont_TextHeight(fSmallFont))/2,theTextManeger.textArray[i].getText());
1845 }
1846 } //for
1847 } //DrawBalls
1848
1849 //Removes the old balls
1850 void UndrawBalls()
1851 {
1852 for(int i = 0; i< maxNumberOfBalls; i++)
1853 {
1854 if(theBallManeger.oldBallUsed[i])
1855 {
1856 DrawIMG(background,screen,theBallManeger.oldBallArray[i].getX(),theBallManeger.oldBallArray[i].getY(),ballSize,ballSize,theBallManeger.oldBallArray[i].getX(),theBallManeger.oldBallArray[i].getY());
1857 } //if used
1858 if(theExplosionManeger.oldExplosionUsed[i])
1859 {
1860 DrawIMG(background,screen,theExplosionManeger.oldExplosionArray[i].getX(),theExplosionManeger.oldExplosionArray[i].getY(),70,120,theExplosionManeger.oldExplosionArray[i].getX(),theExplosionManeger.oldExplosionArray[i].getY());
1861 }
1862 if(theTextManeger.oldTextUsed[i])
1863 {
1864 int x = theTextManeger.oldTextArray[i].getX()-SFont_TextWidth(fSmallFont,theTextManeger.oldTextArray[i].getText())/2;
1865 int y = theTextManeger.oldTextArray[i].getY()-SFont_TextHeight(fSmallFont)/2;
1866 DrawIMG(background,screen,x,y,25,25,x,y);
1867 }
1868 } //for
1869 } //UndrawBalls
1870
1871 //draws everything
1872 void DrawEverything(int xsize, int ysize,BlockGame &theGame, BlockGame &theGame2)
1873 {
1874 SDL_ShowCursor(SDL_DISABLE);
1875 //draw background:
1876 if(forceredraw != 1)
1877 {
1878
1879 UndrawBalls();
1880 DrawIMG(background,screen,oldMousex,oldMousey,32,32,oldMousex,oldMousey);
1881 DrawIMG(background,screen,oldBubleX,oldBubleY,140,50,oldBubleX,oldBubleY);
1882
1883
1884 DrawIMG(background,screen,350,200,120,200,350,200);
1885 DrawIMG(background,screen,830,200,120,200,830,200);
1886 DrawIMG(background,screen,800,0,140,50,800,0);
1887
1888 DrawIMG(background,screen,50,60,300,50,50,60);
1889 DrawIMG(background,screen,510,60,300,50,510,60);
1890 }
1891 else
1892 DrawIMG(background,screen,0,0);
1893 //draw bottons (should be moves and drawn directly to background once)
1894 if(!networkActive) //We don't show the menu while running server or connected to a server
1895 {
1896 //Here we draw the menu
1897 DrawIMG(bNewGame, screen, 0, 0);
1898 DrawIMG(bOptions, screen, 120,0);
1899 DrawIMG(bHighScore, screen, 2*120,0);
1900 DrawIMG(bReplay,screen,3*120,0);
1901 }
1902 else
1903 { //If network is active
1904 DrawIMG(bBack, screen, 0, 0); //Display a disconnect button
1905 }
1906 DrawIMG(bExit, screen, xsize-120,ysize-120);
1907 //DrawIMG(boardBackBack,screen,theGame.topx-60,theGame.topy-68);
1908 DrawIMG(theGame.sBoard,screen,theGame.topx,theGame.topy);
1909 string strHolder;
1910 strHolder = itoa(theGame.score+theGame.handicap);
1911 SFont_Write(screen,fBlueFont,theGame.topx+310,theGame.topy+100,strHolder.c_str());
1912 if(theGame.AI_Enabled)
1913 SFont_Write(screen,fBlueFont,theGame.topx+10,theGame.topy-40,"CPU");
1914 else
1915 if(!singlePuzzle)
1916 SFont_Write(screen,fBlueFont,theGame.topx+10,theGame.topy-40,player1name);
1917 if(theGame.timetrial)
1918 {
1919 int tid = (int)SDL_GetTicks()-theGame.gameStartedAt;
1920 int minutes;
1921 int seconds;
1922 if(tid>=0)
1923 {
1924 minutes = (2*60*1000-(abs((int)SDL_GetTicks()-theGame.gameStartedAt)))/60/1000;
1925 seconds = ((2*60*1000-(abs((int)SDL_GetTicks()-theGame.gameStartedAt)))%(60*1000))/1000;
1926 }
1927 else
1928 {
1929 minutes = ((abs((int)SDL_GetTicks()-theGame.gameStartedAt)))/60/1000;
1930 seconds = (((abs((int)SDL_GetTicks()-theGame.gameStartedAt)))%(60*1000))/1000;
1931 }
1932 if(theGame.bGameOver) minutes=0;
1933 if(theGame.bGameOver) seconds=0;
1934 if(seconds>9)
1935 strHolder = itoa(minutes)+":"+itoa(seconds);
1936 else strHolder = itoa(minutes)+":0"+itoa(seconds);
1937 if((SoundEnabled)&&(!NoSound)&&(tid>0)&&(seconds<5)&&(minutes == 0)&&(seconds>1)&&(!(Mix_Playing(6)))) Mix_PlayChannel(6,heartBeat,0);
1938 SFont_Write(screen,fBlueFont,theGame.topx+310,theGame.topy+150,strHolder.c_str());
1939 }
1940 else
1941 {
1942 int minutes = ((abs((int)SDL_GetTicks()-theGame.gameStartedAt)))/60/1000;
1943 int seconds = (((abs((int)SDL_GetTicks()-theGame.gameStartedAt)))%(60*1000))/1000;
1944 if(theGame.bGameOver) minutes=(theGame.gameEndedAfter/1000/60)%100;
1945 if(theGame.bGameOver) seconds=(theGame.gameEndedAfter/1000)%60;
1946 if(seconds>9)
1947 strHolder = itoa(minutes)+":"+itoa(seconds);
1948 else
1949 strHolder = itoa(minutes)+":0"+itoa(seconds);
1950 SFont_Write(screen,fBlueFont,theGame.topx+310,theGame.topy+150,strHolder.c_str());
1951 }
1952 strHolder = itoa(theGame.chain);
1953 SFont_Write(screen,fBlueFont,theGame.topx+310,theGame.topy+200,strHolder.c_str());
1954 //drawspeedLevel:
1955 strHolder = itoa(theGame.speedLevel);
1956 SFont_Write(screen,fBlueFont,theGame.topx+310,theGame.topy+250,strHolder.c_str());
1957 if((theGame.stageClear) &&(theGame.topy+700+50*(theGame.stageClearLimit-theGame.linesCleared)-theGame.pixels-1<600+theGame.topy))
1958 {
1959 oldBubleX = theGame.topx+280;
1960 oldBubleY = theGame.topy+650+50*(theGame.stageClearLimit-theGame.linesCleared)-theGame.pixels-1;
1961 DrawIMG(stageBobble,screen,theGame.topx+280,theGame.topy+650+50*(theGame.stageClearLimit-theGame.linesCleared)-theGame.pixels-1);
1962 }
1963 //player1 finnish, player2 start
1964 //DrawIMG(boardBackBack,screen,theGame2.topx-60,theGame2.topy-68);
1965 DrawIMG(theGame2.sBoard,screen,theGame2.topx,theGame2.topy);
1966 strHolder = itoa(theGame2.score+theGame2.handicap);
1967 SFont_Write(screen,fBlueFont,theGame2.topx+310,theGame2.topy+100,strHolder.c_str());
1968 if(theGame2.AI_Enabled)
1969 SFont_Write(screen,fBlueFont,theGame2.topx+10,theGame2.topy-40,"CPU");
1970 else
1971 SFont_Write(screen,fBlueFont,theGame2.topx+10,theGame2.topy-40,theGame2.name);
1972 if(theGame2.timetrial)
1973 {
1974 int tid = (int)SDL_GetTicks()-theGame2.gameStartedAt;
1975 int minutes;
1976 int seconds;
1977 if(tid>=0)
1978 {
1979 minutes = (2*60*1000-(abs((int)SDL_GetTicks()-theGame2.gameStartedAt)))/60/1000;
1980 seconds = ((2*60*1000-(abs((int)SDL_GetTicks()-theGame2.gameStartedAt)))%(60*1000))/1000;
1981 }
1982 else
1983 {
1984 minutes = ((abs((int)SDL_GetTicks()-theGame2.gameStartedAt)))/60/1000;
1985 seconds = (((abs((int)SDL_GetTicks()-theGame2.gameStartedAt)))%(60*1000))/1000;
1986 }
1987 if(theGame2.bGameOver) minutes=0;
1988 if(theGame2.bGameOver) seconds=0;
1989 if(seconds>9)
1990 strHolder = itoa(minutes)+":"+itoa(seconds);
1991 else
1992 strHolder = itoa(minutes)+":0"+itoa(seconds);
1993 if((SoundEnabled)&&(!NoSound)&&(tid>0)&&(seconds<5)&&(minutes == 0)&&(seconds>1)&&(!(Mix_Playing(6)))) Mix_PlayChannel(6,heartBeat,0);
1994 SFont_Write(screen,fBlueFont,theGame2.topx+310,theGame2.topy+150,strHolder.c_str());
1995 }
1996 else
1997 {
1998 int minutes = (abs((int)SDL_GetTicks()-theGame2.gameStartedAt))/60/1000;
1999 int seconds = (abs((int)SDL_GetTicks()-theGame2.gameStartedAt)%(60*1000))/1000;
2000 if(theGame2.bGameOver) minutes=(theGame2.gameEndedAfter/1000/60)%100;
2001 if(theGame2.bGameOver) seconds=(theGame2.gameEndedAfter/1000)%60;
2002 if(seconds>9)
2003 strHolder = itoa(minutes)+":"+itoa(seconds);
2004 else
2005 strHolder = itoa(minutes)+":0"+itoa(seconds);
2006 SFont_Write(screen,fBlueFont,theGame2.topx+310,theGame2.topy+150,strHolder.c_str());
2007 }
2008 strHolder = itoa(theGame2.chain);
2009 SFont_Write(screen,fBlueFont,theGame2.topx+310,theGame2.topy+200,strHolder.c_str());
2010 strHolder = itoa(theGame2.speedLevel);
2011 SFont_Write(screen,fBlueFont,theGame2.topx+310,theGame2.topy+250,strHolder.c_str());
2012
2013 //player2 finnish
2014
2015 if(bNewGameOpen)
2016 {
2017 DrawIMG(b1player,screen,0,40);
2018 DrawIMG(b2players,screen,0,80);
2019 #ifdef NETWORK
2020 DrawIMG(bNetwork,screen,0,120);
2021 #endif
2022 if(b1playerOpen)
2023 {
2024 DrawIMG(bEndless,screen,120,40);
2025 DrawIMG(bTimeTrial,screen,120,80);
2026 DrawIMG(bStageClear,screen,120,120);
2027 DrawIMG(bPuzzle,screen,120,160);
2028 DrawIMG(bVsMode,screen,120,200);
2029 }
2030 else
2031 if(b2playersOpen)
2032 {
2033 DrawIMG(bTimeTrial,screen,120,80);
2034 DrawIMG(bVsMode,screen,120,120);
2035 }
2036 #ifdef NETWORK
2037 else
2038 if(bNetworkOpen)
2039 {
2040 DrawIMG(bHost,screen,120,120);
2041 DrawIMG(bConnect,screen,120,160);
2042 }
2043 #endif
2044 }
2045 if(bOptionsOpen)
2046 {
2047 DrawIMG(bConfigure,screen,120,40);
2048 DrawIMG(bSelectPuzzle,screen,120,80);
2049 DrawIMG(bVsMode,screen,120,120);
2050 }
2051 if(bReplayOpen)
2052 {
2053 DrawIMG(bSave,screen,360,40);
2054 DrawIMG(bLoad,screen,360,80);
2055 }
2056 if(showHighscores) DrawHighscores(100,100);
2057 if(showOptions) DrawOptions(100,100);
2058
2059 DrawBalls();
2060
2061 #if defined(DEBUG)
2062 Frames++;
2063 if(SDL_GetTicks() >= Ticks + 1000)
2064 {
2065 if(Frames > 999) Frames=999;
2066 sprintf(FPS, "%i fps", Frames);
2067 Frames = 0;
2068 Ticks = SDL_GetTicks();
2069 }
2070
2071 SFont_Write(screen,fBlueFont,800,4,FPS);
2072 #endif
2073
2074 //SDL_Flip(screen); //Update screen, now called outside DrawEvrything, bacause the mouse needs to be painted
2075
2076 }
2077
2078 //Generates the standard background
2079 void MakeBackground(int xsize,int ysize)
2080 {
2081 DrawIMG(backgroundImage,background,0,0);
2082 standardBackground = true;
2083 }
2084
2085 //Generates the background with red board backs
2086 void MakeBackground(int xsize,int ysize,BlockGame &theGame, BlockGame &theGame2)
2087 {
2088 DrawIMG(backgroundImage,background,0,0);
2089 DrawIMG(boardBackBack,background,theGame.topx-60,theGame.topy-68);
2090 DrawIMG(boardBackBack,background,theGame2.topx-60,theGame2.topy-68);
2091 standardBackground = false;
2092 }
2093
2094
2095 //The function that allows the player to choose PuzzleLevel
2096 int PuzzleLevelSelect()
2097 {
2098 const int xplace = 200;
2099 const int yplace = 300;
2100 Uint8 *keys;
2101 int levelNr, mousex, mousey;
2102 bool levelSelected = false;
2103 bool tempBool;
2104
2105 //Loads the levels, if they havn't been loaded:
2106 LoadPuzzleStages();
2107
2108 //Keeps track of background;
2109 int nowTime=SDL_GetTicks();
2110
2111 ifstream puzzleFile(puzzleSavePath.c_str(),ios::binary);
2112 MakeBackground(1024,768);
2113 if(puzzleFile)
2114 {
2115 for(int i=0;(i<nrOfPuzzles)&&(!puzzleFile.eof()); i++)
2116 {
2117 puzzleFile.read(reinterpret_cast<char*>(&tempBool),sizeof(bool));
2118 puzzleCleared[i] = tempBool;
2119 }
2120 puzzleFile.close();
2121 }
2122 else
2123 {
2124 tempBool = false;
2125 for(int i=0; i<nrOfPuzzles; i++)
2126 puzzleCleared[i] = tempBool;
2127 }
2128
2129 do
2130 {
2131 nowTime=SDL_GetTicks();
2132
2133
2134 DrawIMG(background, screen, 0, 0);
2135 DrawIMG(iCheckBoxArea,screen,xplace,yplace);
2136 SFont_Write(screen,fBlueFont,xplace+12,yplace+2,"Select Puzzle");
2137 //Now drow the fields you click in (and a V if clicked):
2138 for(int i = 0; i < nrOfPuzzles;i++)
2139 {
2140 DrawIMG(iLevelCheckBox,screen,xplace+10+(i%10)*50, yplace+60+(i/10)*50);
2141 if(puzzleCleared[i]==true) DrawIMG(iLevelCheck,screen,xplace+10+(i%10)*50, yplace+60+(i/10)*50);
2142 }
2143
2144 SDL_Event event;
2145 while ( SDL_PollEvent(&event) )
2146 if ( event.type == SDL_KEYDOWN )
2147 {
2148 if ( event.key.keysym.sym == SDLK_ESCAPE ) {levelNr = -1; levelSelected = true;}
2149 }
2150
2151 keys = SDL_GetKeyState(NULL);
2152
2153 SDL_GetMouseState(&mousex,&mousey);
2154
2155 // If the mouse button is released, make bMouseUp equal true
2156 if(!SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(1))
2157 {
2158 bMouseUp=true;
2159 }
2160
2161 if(SDL_GetMouseState(NULL,NULL)&SDL_BUTTON(1) && bMouseUp)
2162 {
2163 bMouseUp = false;
2164
2165 int levelClicked = -1;
2166 int i;
2167 for(i = 0; (i<nrOfPuzzles/10)||((i<nrOfPuzzles/10+1)&&(nrOfPuzzles%10 != 0)); i++)
2168 if((60+i*50<mousey-yplace)&&(mousey-yplace<i*50+92))
2169 levelClicked = i*10;
2170 i++;
2171 if(levelClicked != -1)
2172 for(int j = 0; ((j<nrOfStageLevels%(i*10))&&(j<10)); j++)
2173 if((10+j*50<mousex-xplace)&&(mousex-xplace<j*50+42))
2174 {
2175 levelClicked +=j;
2176 levelSelected = true;
2177 levelNr = levelClicked;
2178 }
2179 }
2180
2181 DrawIMG(mouse,screen,mousex,mousey);
2182 SDL_Flip(screen); //draws it all to the screen
2183
2184 } while(!levelSelected);
2185 DrawIMG(background, screen, 0, 0);
2186 return levelNr;
2187 }
2188
2189 //The function that allows the player to choose Level number
2190 int StageLevelSelect()
2191 {
2192 const int xplace = 200;
2193 const int yplace = 300;
2194 Uint8 *keys;
2195 int levelNr, mousex, mousey;
2196 bool levelSelected = false;
2197 bool tempBool;
2198
2199 //Keeps track of background;
2200 //int nowTime=SDL_GetTicks();
2201
2202 MakeBackground(1024,768);
2203 ifstream stageFile(stageClearSavePath.c_str(),ios::binary);
2204 if(stageFile)
2205 {
2206 for(int i = 0; i<nrOfStageLevels; i++)
2207 {
2208 stageFile.read(reinterpret_cast<char*>(&tempBool),sizeof(bool));
2209 stageCleared[i]=tempBool;
2210 }
2211 stageFile.close();
2212 }
2213 else
2214 {
2215 for(int i=0; i<nrOfStageLevels; i++)
2216 stageCleared[i]= false;
2217 }
2218
2219
2220 do
2221 {
2222 //nowTime=SDL_GetTicks();
2223 DrawIMG(background, screen, 0, 0);
2224 DrawIMG(iCheckBoxArea,screen,xplace,yplace);
2225 SFont_Write(screen,fBlueFont,xplace+12,yplace+2,"Stage Clear Level Select");
2226 for(int i = 0; i < nrOfStageLevels;i++)
2227 {
2228 DrawIMG(iLevelCheckBox,screen,xplace+10+(i%10)*50, yplace+60+(i/10)*50);
2229 if(stageCleared[i]==true) DrawIMG(iLevelCheck,screen,xplace+10+(i%10)*50, yplace+60+(i/10)*50);
2230 }
2231
2232 SDL_Event event;
2233 while ( SDL_PollEvent(&event) )
2234 if ( event.type == SDL_KEYDOWN )
2235 {
2236 if ( event.key.keysym.sym == SDLK_ESCAPE ) {levelNr = -1; levelSelected = true;}
2237 }
2238
2239 keys = SDL_GetKeyState(NULL);
2240
2241 SDL_GetMouseState(&mousex,&mousey);
2242
2243 // If the mouse button is released, make bMouseUp equal true
2244 if(!SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(1))
2245 {
2246 bMouseUp=true;
2247 }
2248
2249 if(SDL_GetMouseState(NULL,NULL)&SDL_BUTTON(1) && bMouseUp)
2250 {
2251 bMouseUp = false;
2252
2253 int levelClicked = -1;
2254 int i;
2255 for(i = 0; (i<nrOfStageLevels/10)||((i<nrOfStageLevels/10+1)&&(nrOfStageLevels%10 != 0)); i++)
2256 if((60+i*50<mousey-yplace)&&(mousey-yplace<i*50+92))
2257 levelClicked = i*10;
2258 i++;
2259 if(levelClicked != -1)
2260 for(int j = 0; ((j<nrOfStageLevels%(i*10))&&(j<10)); j++)
2261 if((10+j*50<mousex-xplace)&&(mousex-xplace<j*50+42))
2262 {
2263 levelClicked +=j;
2264 levelSelected = true;
2265 levelNr = levelClicked;
2266 }
2267 }
2268
2269 DrawIMG(mouse,screen,mousex,mousey);
2270 SDL_Flip(screen); //draws it all to the screen
2271
2272 } while(!levelSelected);
2273 DrawIMG(background, screen, 0, 0);
2274 return levelNr;
2275 }
2276
2277 //Ask user for what AI level he will compete agains, return the number. Number must be 0..AIlevels
2278 int startSingleVs()
2279 {
2280 //Where to place the windows
2281 const int xplace = 200;
2282 const int yplace = 100;
2283 Uint8 *keys; //To take keyboard input
2284 int mousex, mousey; //To allow mouse
2285 bool done = false; //When are we done?
2286
2287 MakeBackground(1024,768);
2288 DrawIMG(changeButtonsBack,background,xplace,yplace);
2289 SFont_Write(background,fBlueFont,xplace+10,yplace+10,"1 : Very Easy");
2290 SFont_Write(background,fBlueFont,xplace+10,yplace+40,"2 : Easy");
2291 SFont_Write(background,fBlueFont,xplace+10,yplace+70,"3 : Below Normal");
2292 SFont_Write(background,fBlueFont,xplace+10,yplace+100,"4 : Normal");
2293 SFont_Write(background,fBlueFont,xplace+10,yplace+130,"5 : Above Normal");
2294 SFont_Write(background,fBlueFont,xplace+10,yplace+160,"6 : Hard");
2295 SFont_Write(background,fBlueFont,xplace+10,yplace+190,"7 : Hardest");
2296 DrawIMG(background, screen, 0, 0);
2297 SDL_Flip(screen);
2298 do
2299 {
2300
2301 SDL_Delay(10);
2302 SDL_Event event;
2303 while ( SDL_PollEvent(&event) )
2304 if ( event.type == SDL_KEYDOWN )
2305 {
2306 if ( event.key.keysym.sym == SDLK_ESCAPE ) { done = true;}
2307 if ( event.key.keysym.sym == SDLK_RETURN ) { done = true;}
2308 if ( event.key.keysym.sym == SDLK_KP_ENTER ) { done = true;}
2309 if ( event.key.keysym.sym == SDLK_1 ) { return 0;}
2310 if ( event.key.keysym.sym == SDLK_2 ) { return 1;}
2311 if ( event.key.keysym.sym == SDLK_3 ) { return 2;}
2312 if ( event.key.keysym.sym == SDLK_4 ) { return 3;}
2313 if ( event.key.keysym.sym == SDLK_5 ) { return 4;}
2314 if ( event.key.keysym.sym == SDLK_6 ) { return 5;}
2315 if ( event.key.keysym.sym == SDLK_7 ) { return 6;}
2316 if ( event.key.keysym.sym == SDLK_KP1 ) { return 0;}
2317 if ( event.key.keysym.sym == SDLK_KP2 ) { return 1;}
2318 if ( event.key.keysym.sym == SDLK_KP3 ) { return 2;}
2319 if ( event.key.keysym.sym == SDLK_KP4 ) { return 3;}
2320 if ( event.key.keysym.sym == SDLK_KP5 ) { return 4;}
2321 if ( event.key.keysym.sym == SDLK_KP6 ) { return 5;}
2322 if ( event.key.keysym.sym == SDLK_KP7 ) { return 6;}
2323
2324 }
2325
2326 // If the mouse button is released, make bMouseUp equal true
2327 if(!SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(1))
2328 {
2329 bMouseUp=true;
2330 }
2331
2332 if(SDL_GetMouseState(NULL,NULL)&SDL_BUTTON(1) && bMouseUp)
2333 {
2334 bMouseUp = false;
2335
2336 for(int i=0; i<7;i++)
2337 {
2338 if((mousex>xplace+10)&&(mousex<xplace+410)&&(mousey>yplace+10+i*30)&&(mousey<yplace+38+i*30))
2339 return i;
2340 }
2341 }
2342
2343 SDL_GetMouseState(&mousex,&mousey);
2344 DrawIMG(background, screen, 0, 0);
2345 DrawIMG(mouse,screen,mousex,mousey);
2346 SDL_Flip(screen); //draws it all to the screen
2347 }while(!done);
2348
2349
2350 return 3; //Returns normal
2351 }
2352
2353 //The function that allows the player to choose Level number
2354 void startVsMenu()
2355 {
2356 const int xplace = 200;
2357 const int yplace = 100;
2358 Uint8 *keys;
2359 int mousex, mousey;
2360 bool done = false;
2361
2362 //Keeps track of background;
2363 //int nowTime=SDL_GetTicks();
2364
2365 MakeBackground(1024,768);
2366 SFont_Write(background,fBlueFont,360,650,"Press ESC to accept");
2367 DrawIMG(bBack,background,1024/2-120/2,600);
2368 do
2369 {
2370 //nowTime=SDL_GetTicks();
2371 DrawIMG(background, screen, 0, 0);
2372 DrawIMG(changeButtonsBack,screen,xplace,yplace);
2373 SFont_Write(screen,fBlueFont,xplace+50,yplace+20,"Player 1");
2374 SFont_Write(screen,fBlueFont,xplace+300+50,yplace+20,"Player 2");
2375 SFont_Write(screen,fBlueFont,xplace+50,yplace+70,"Speed:");
2376 SFont_Write(screen,fBlueFont,xplace+50+300,yplace+70,"Speed:");
2377 for(int i=0; i<5;i++)
2378 {
2379 char levelS[2]; //level string;
2380 levelS[0]='1'+i;
2381 levelS[1]=0;
2382 SFont_Write(screen,fBlueFont,xplace+50+i*40,yplace+110,levelS);
2383 DrawIMG(iLevelCheckBox,screen,xplace+50+i*40,yplace+150);
2384 if(player1Speed==i)
2385 DrawIMG(iLevelCheck,screen,xplace+50+i*40,yplace+150);
2386 }
2387 for(int i=0; i<5;i++)
2388 {
2389 char levelS[2]; //level string;
2390 levelS[0]='1'+i;
2391 levelS[1]=0;
2392 SFont_Write(screen,fBlueFont,xplace+300+50+i*40,yplace+110,levelS);
2393 DrawIMG(iLevelCheckBox,screen,xplace+300+50+i*40,yplace+150);
2394 if(player2Speed==i)
2395 DrawIMG(iLevelCheck,screen,xplace+300+50+i*40,yplace+150);
2396 }
2397 SFont_Write(screen,fBlueFont,xplace+50,yplace+200,"AI: ");
2398 DrawIMG(iLevelCheckBox,screen,xplace+50+70,yplace+200);
2399 if(player1AI)
2400 DrawIMG(iLevelCheck,screen,xplace+50+70,yplace+200);
2401 SFont_Write(screen,fBlueFont,xplace+50,yplace+250,"TT Handicap: ");
2402 SFont_Write(screen,fBlueFont,xplace+50+300,yplace+200,"AI: ");
2403 DrawIMG(iLevelCheckBox,screen,xplace+50+70+300,yplace+200);
2404 if(player2AI)
2405 DrawIMG(iLevelCheck,screen,xplace+50+70+300,yplace+200);
2406 SFont_Write(screen,fBlueFont,xplace+50+300,yplace+250,"TT Handicap: ");
2407 for(int i=0; i<5;i++)
2408 {
2409 char levelS[2]; //level string;
2410 levelS[0]='1'+i;
2411 levelS[1]=0;
2412 SFont_Write(screen,fBlueFont,xplace+50+i*40,yplace+290,levelS);
2413 DrawIMG(iLevelCheckBox,screen,xplace+50+i*40,yplace+330);
2414 if(player1handicap==i)
2415 DrawIMG(iLevelCheck,screen,xplace+50+i*40,yplace+330);
2416 }
2417 for(int i=0; i<5;i++)
2418 {
2419 char levelS[2]; //level string;
2420 levelS[0]='1'+i;
2421 levelS[1]=0;
2422 SFont_Write(screen,fBlueFont,xplace+50+i*40+300,yplace+290,levelS);
2423 DrawIMG(iLevelCheckBox,screen,xplace+50+i*40+300,yplace+330);
2424 if(player2handicap==i)
2425 DrawIMG(iLevelCheck,screen,xplace+50+i*40+300,yplace+330);
2426 }
2427
2428 SDL_Event event;
2429 while ( SDL_PollEvent(&event) )
2430 if ( event.type == SDL_KEYDOWN )
2431 {
2432 if ( event.key.keysym.sym == SDLK_ESCAPE ) { done = true;}
2433 if ( event.key.keysym.sym == SDLK_RETURN ) { done = true;}
2434 if ( event.key.keysym.sym == SDLK_KP_ENTER ) { done = true;}
2435 }
2436
2437 keys = SDL_GetKeyState(NULL);
2438
2439 SDL_GetMouseState(&mousex,&mousey);
2440
2441 // If the mouse button is released, make bMouseUp equal true
2442 if(!SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(1))
2443 {
2444 bMouseUp=true;
2445 }
2446
2447 if(SDL_GetMouseState(NULL,NULL)&SDL_BUTTON(1) && bMouseUp)
2448 {
2449 bMouseUp = false;
2450
2451 if((mousex>xplace+50+70)&&(mousey>yplace+200)&&(mousex<xplace+50+70+30)&&(mousey<yplace+200+30))
2452 player1AI=!player1AI;
2453 if((mousex>xplace+50+70+300)&&(mousey>yplace+200)&&(mousex<xplace+50+70+30+300)&&(mousey<yplace+200+30))
2454 player2AI=!player2AI;
2455 for(int i=0; i<5;i++)
2456 {
2457 if((mousex>xplace+50+i*40)&&(mousex<xplace+50+i*40+30)&&(mousey>yplace+150)&&(mousey<yplace+150+30))
2458 player1Speed=i;
2459 }
2460 for(int i=0; i<5;i++)
2461 {
2462 if((mousex>xplace+50+i*40+300)&&(mousex<xplace+50+i*40+30+300)&&(mousey>yplace+150)&&(mousey<yplace+150+30))
2463 player2Speed=i;
2464 }
2465 for(int i=0; i<5;i++)
2466 {
2467 if((mousex>xplace+50+i*40)&&(mousex<xplace+50+i*40+30)&&(mousey>yplace+330)&&(mousey<yplace+330+30))
2468 player1handicap=i;
2469 }
2470 for(int i=0; i<5;i++)
2471 {
2472 if((mousex>xplace+50+i*40+300)&&(mousex<xplace+50+i*40+30+300)&&(mousey>yplace+330)&&(mousey<yplace+330+30))
2473 player2handicap=i;
2474 }
2475 if((mousex>1024/2-120/2)&&(mousex<1024/2+120/2)&&(mousey>600)&&(mousey<640))
2476 done = true;
2477 }
2478
2479 DrawIMG(mouse,screen,mousex,mousey);
2480 SDL_Flip(screen); //draws it all to the screen
2481 SDL_Delay(10);
2482
2483 } while(!done);
2484 DrawIMG(background, screen, 0, 0);
2485 }
2486
2487 //This function will promt for the user to select another file for puzzle mode
2488 void changePuzzleLevels()
2489 {
2490 char theFileName[30];
2491 strcpy(theFileName,puzzleName.c_str());
2492 for(int i=puzzleName.length();i<30;i++)
2493 theFileName[i]=' ';
2494 theFileName[29]=0;
2495 if(OpenFileDialogbox(200,100,theFileName))
2496 {
2497 for(int i=28;((theFileName[i]==' ')&&(i>0));i--)
2498 theFileName[i]=0;
2499 puzzleName = theFileName;
2500 #if defined(__unix__)
2501 string home = getenv("HOME");
2502 puzzleSavePath = home+"/.gamesaves/blockattack/"+puzzleName+".save";
2503 #elif defined(_WIN32)
2504 string home = getenv("APPDATA");
2505 if(&home!=NULL)
2506 {
2507 puzzleSavePath = home+"/gamesaves/blockattack/"+puzzleName+".save";
2508 }
2509 else
2510 {
2511 puzzleSavePath = puzzleName+".save";
2512 }
2513 #else
2514 puzzleSavePath = puzzleName+".save";
2515 #endif
2516 }
2517
2518 }
2519
2520 #ifdef NETWORK
2521 //The network interface
2522 class NetworkThing
2523 {
2524 private:
2525 ENetAddress address;
2526 ENetHost * server;
2527 ENetHost * client;
2528 ENetPeer *peer;
2529
2530 BlockGame *bgHome, *bgAway; //Pointers to the two games, so we can call the procedures
2531 bool weAreAServer, weAreAClient;
2532 bool weAreConnected;
2533 bool enemyIsReady;
2534 bool enemyHasStarted; //If we should have a ready button
2535 bool gameHasStarted; //If the player is GameOver it might just be because the game hasn't started yet... not if this is true!
2536
2537 public:
2538
2539 Uint32 theSeed;
2540
2541 NetworkThing()
2542 {
2543 weAreAServer = false;
2544 weAreAClient = false;
2545 weAreConnected = false;
2546 enemyIsReady = false;
2547 enemyHasStarted = false;
2548 gameHasStarted = false;
2549 if (enet_initialize () != 0)
2550 {
2551 fprintf (stderr, "An error occurred while initializing ENet.\n");
2552 }
2553 else
2554 {
2555 cout << "Network is working!" << endl;
2556 }
2557 atexit (enet_deinitialize);
2558 }
2559
2560 //This function couses us to remove the connection to the other peer, plus destroying servers
2561 void ntDisconnect()
2562 {
2563 strcpy(bgAway->name,player2name);
2564 if(weAreConnected || weAreAClient || weAreAServer)
2565 {
2566 if(weAreAClient)
2567 {
2568 enet_peer_disconnect (peer,0);
2569 SDL_Delay(20);
2570 enet_host_destroy(client);
2571 weAreAClient = false;
2572 weAreConnected = false;
2573 enemyHasStarted = false;
2574 }
2575 else
2576 if(weAreAServer)
2577 {
2578 enet_host_destroy(server);
2579 weAreAServer = false;
2580 weAreConnected = false;
2581 enemyHasStarted = false;
2582 }
2583 //If the game is running then we disconnect, we are considered the looser!
2584 if((!bgHome->bGameOver)&&(!bgAway->bGameOver))
2585 {
2586 bgAway->setPlayerWon();
2587 bgHome->SetGameOver();
2588 }
2589 gameHasStarted = false;
2590 }
2591 };
2592
2593 //Lets disconnect before we close...
2594 ~NetworkThing()
2595 {
2596 cout << "Network system is going down" << endl;
2597 ntDisconnect();
2598 }
2599
2600 void theGameHasStarted()
2601 {
2602 gameHasStarted = true;
2603 }
2604
2605 //The NetworkThing needs to be able to call the models... here the pointers are set
2606 void setBGpointers(BlockGame *bg1, BlockGame *bg2)
2607 {
2608 bgHome = bg1;
2609 bgAway = bg2;
2610 }
2611
2612 //Starts a server instance
2613 void startServer()
2614 {
2615 if(!weAreAServer)
2616 {
2617 ntDisconnect();
2618
2619 /* Bind the server to the default localhost. */
2620 /* A specific host address can be specified by */
2621 /* enet_address_set_host (& address, "x.x.x.x"); */
2622
2623 address.host = ENET_HOST_ANY;
2624 /* Bind the server to port SERVERPORT. */
2625 address.port = SERVERPORT;
2626
2627 server = enet_host_create (& address /* the address to bind the server host to */,
2628 1 /* allow up to 1 clients and/or outgoing connections */,
2629 0 /* assume any amount of incoming bandwidth */,
2630 0 /* assume any amount of outgoing bandwidth */);
2631 if (server == NULL)
2632 {
2633 fprintf (stderr,
2634 "An error occurred while trying to create an ENet server host.\n");
2635
2636 }
2637 else
2638 {
2639 weAreAServer = true;
2640 enemyIsReady = false;
2641 gameHasStarted = false;
2642 cout << "Server is listening on port " << SERVERPORT << endl;
2643 }
2644 }
2645 }
2646
2647 void connectToServer(string server)
2648 {
2649 ENetAddress address;
2650 ENetEvent event;
2651
2652 enet_address_set_host (& address, server.c_str());
2653 address.port = SERVERPORT;
2654
2655 ntDisconnect();
2656 client = enet_host_create (NULL /* create a client host */,
2657 1 /* only allow 1 outgoing connection */,
2658 0 /* Unlimited downstream bandwidth */,
2659 0 /* Unlimted upstream bandwidth */);
2660
2661 if (client == NULL)
2662 {
2663 cout << "An error occurred while trying to create an ENet client host." << endl;
2664 }
2665 else
2666 {
2667 /* Initiate the connection, allocating the four channels 0 and 1 and 2 and 3. */
2668 peer = enet_host_connect (client, & address, 4);
2669
2670 if (peer == NULL)
2671 {
2672 cout << "No available peers for initiating an ENet connection." << endl;
2673 }
2674 else
2675 if (enet_host_service (client, & event, 2000) > 0 &&
2676 event.type == ENET_EVENT_TYPE_CONNECT)
2677 {
2678 cout << "We are connected!" << endl;
2679 enemyIsReady = false;
2680 weAreAClient = true;
2681 weAreConnected = true;
2682 gameHasStarted = false;
2683 }
2684 else
2685 {
2686 cout << "Server didn't answer in time" << endl;
2687 }
2688 }
2689 }
2690
2691 bool isConnected()
2692 {
2693 return (weAreConnected||weAreAServer);
2694 }
2695
2696 bool isConnectedToPeer()
2697 {
2698 return weAreConnected;
2699 }
2700
2701 //This function must be called in the game loop:
2702 void updateNetwork()
2703 {
2704 //Now we must send our own board:
2705 if(weAreConnected)
2706 {
2707 //cout << "Creating package" << endl;
2708 boardPackage boardpack = bgHome->getPackage();
2709 ENetPacket * packet = enet_packet_create (&boardpack,
2710 sizeof(boardPackage),
2711 0);
2712 //Now lets send the package
2713 if(weAreAServer)
2714 enet_host_broadcast (server, 0, packet);
2715 else
2716 if(weAreAClient)
2717 enet_peer_send (peer, 0, packet);
2718 //cout << "Package sent" << endl;
2719
2720 //See if we are game over and in that case notify the other player
2721 if((gameHasStarted)&&(bgHome->bGameOver))
2722 {
2723 ENetPacket * packet = enet_packet_create("G",2,ENET_PACKET_FLAG_RELIABLE);
2724 if(weAreAServer)
2725 enet_host_broadcast (server, 1, packet);
2726 else
2727 if(weAreAClient)
2728 enet_peer_send (peer, 1, packet);
2729 gameHasStarted=false;
2730 }
2731
2732 //Now lets see if we have something to throw at the opponent.
2733 Uint8 x,y,type;
2734
2735 if(gameHasStarted)
2736 while(bgAway->popGarbage(&x,&y,&type))
2737 { //if there are garbage to drop
2738 if(type==1)
2739 {
2740 x=255;
2741 y=255;
2742 }
2743 Uint16 g = ((Uint16)x)*256+(Uint16)y; //A 16-bit int containing everything
2744 ENetPacket * packet = enet_packet_create(&g,2,ENET_PACKET_FLAG_RELIABLE);
2745 if(weAreAServer)
2746 enet_host_broadcast (server, 2, packet);
2747 else
2748 if(weAreAClient)
2749 enet_peer_send (peer, 2, packet);
2750 cout << "We send a garbage block: " << (int)x << "," << (int)y << "==" << g << endl;
2751 }
2752 }
2753 ENetEvent event;
2754
2755 /* Wait up to 0 milliseconds for an event. */
2756 while (((weAreAClient)&&(enet_host_service (client, & event, 0) > 0))||((weAreAServer)&&(enet_host_service (server, & event, 0) > 0)))
2757 {
2758 switch (event.type)
2759 {
2760 case ENET_EVENT_TYPE_CONNECT:
2761 printf ("A new client connected from %x:%u.\n",
2762 event.peer -> address.host,
2763 event.peer -> address.port);
2764 weAreConnected = true;
2765 /* Store any relevant client information here. */
2766 //event.peer -> data = "Client";
2767 {
2768
2769 ENetPacket * namePacket = enet_packet_create(bgHome->name,sizeof(char[30]),ENET_PACKET_FLAG_RELIABLE);
2770 //if(weAreAServer)
2771 enet_host_broadcast (server, 3, namePacket);
2772 ENetPacket * answerPacket = enet_packet_create("version2",sizeof("version2"),ENET_PACKET_FLAG_RELIABLE);
2773 enet_host_broadcast (server, 3, answerPacket);
2774 theSeed = time(0)/4;
2775 bgHome->putStartBlocks(theSeed);
2776 ENetPacket * timePacket = enet_packet_create(&theSeed,sizeof(theSeed),ENET_PACKET_FLAG_RELIABLE);
2777 enet_host_broadcast (server, 3, timePacket);
2778 cout << "We send the seed: " << theSeed << endl;
2779 }
2780 break;
2781
2782 case ENET_EVENT_TYPE_RECEIVE:
2783 /*printf ("A packet of length %u containing %s was received from %s on channel %u.\n",
2784 event.packet -> dataLength,
2785 event.packet -> data,
2786 event.peer -> data,
2787 event.channelID);*/
2788 //cout << "Package recieved" << endl;
2789 if(event.channelID==0) //Unreliable (only boardPacks)
2790 {
2791 boardPackage bpack;
2792 //cout << "Package size: "<< event.packet->dataLength << " should be: " << sizeof(boardPackage) << endl;
2793 memcpy(&bpack,(const char*)event.packet->data,sizeof(boardPackage));
2794 bgAway->setBoard(bpack);
2795 }
2796 if(event.channelID==1) //reliable (used for GameOver notifications only!)
2797 {
2798 if((bgHome->bGameOver)&&(!bgHome->hasWonTheGame)&&(gameHasStarted))
2799 {
2800 bgHome->setDraw();
2801 bgAway->setDraw();
2802 }
2803 else
2804 {
2805 bgHome->setPlayerWon();
2806 bgAway->SetGameOver();
2807 }
2808 gameHasStarted=false;
2809 }
2810
2811 if(event.channelID==2) //reliable (used for Garbage only!)
2812 {
2813 Uint16 g;
2814 memcpy(&g,event.packet->data,sizeof(Uint16));
2815 Uint8 x = (g/256);
2816 Uint8 y = (g%256);
2817 cout << "Recieved Garbage: " << (int)x << "," << (int)y << endl;
2818 if((x==255)&&(y==255))
2819 bgHome->CreateGreyGarbage();
2820 else
2821 bgHome->CreateGarbage(x,y);
2822 }
2823
2824 if(event.channelID==3) //We have reacieved a name or a version number
2825 {
2826 if(event.packet->dataLength==sizeof(char[30])) //We have reveived a name
2827 {
2828 strcpy(bgAway->name,(const char*)event.packet->data);
2829 cout << "The enemy name is: " << bgAway->name << " Length: " << sizeof(char[30])<< endl;
2830 if(weAreAClient) //We have just recieved the servers name and must send our own
2831 {
2832 ENetPacket * answerPacket = enet_packet_create(bgHome->name,sizeof(char[30]),ENET_PACKET_FLAG_RELIABLE);
2833 enet_peer_send (peer, 3, answerPacket);
2834 }
2835 }
2836 else
2837 if(event.packet->dataLength==sizeof("2")) //We have recieved aversion number
2838 {
2839 if(0!=strcmp((const char*)event.packet->data,"version2"))
2840 {
2841 cout << "Incompatible version: " << event.packet->data << "!=" << "version2" << endl;
2842 ntDisconnect();
2843 }
2844 if(weAreAClient) //We will send our version number
2845 {
2846 ENetPacket * answerPacket = enet_packet_create("version2",sizeof("version2"),ENET_PACKET_FLAG_RELIABLE);
2847 enet_peer_send (peer, 3, answerPacket);
2848 }
2849 }
2850 else
2851 if(event.packet->dataLength==sizeof(Uint32)) //We have recieved a seed
2852 {
2853 memcpy(&theSeed,event.packet->data,sizeof(Uint32));
2854 bgHome->putStartBlocks(theSeed);
2855 cout << "We recieved a seed: " << theSeed << endl;
2856 }
2857 }
2858
2859 /* Clean up the packet now that we're done using it. */
2860 enet_packet_destroy (event.packet);
2861
2862 break;
2863
2864 case ENET_EVENT_TYPE_DISCONNECT:
2865 printf ("%s disconected.\n", event.peer -> data);
2866
2867 /* Reset the peer's client information. */
2868
2869 event.peer -> data = NULL;
2870 //weAreConnected = false;
2871 if((!bgHome->bGameOver)&&(!bgAway->bGameOver))
2872 {
2873 bgHome->setPlayerWon();
2874 bgAway->SetGameOver();
2875 }
2876
2877 ntDisconnect(); //When we will disconnect!
2878
2879 }
2880 }
2881
2882
2883 }
2884 }; //NetworkThing
2885 #endif
2886
2887 //The main function, quite big... too big
2888 int main(int argc, char *argv[])
2889 {
2890 //We first create the folder there we will save (only on UNIX systems)
2891 //we call the external command "mkdir"... the user might have renamed this, but we hope he hasn't
2892 #if defined(__unix__)
2893 //system("mkdir -p ~/.gamesaves");
2894 //system("mkdir -p ~/.gamesaves/blockattack");
2895 system("mkdir -p ~/.gamesaves/blockattack/screenshots");
2896 system("mkdir -p ~/.gamesaves/blockattack/replays");
2897 system("mkdir -p ~/.gamesaves/blockattack/puzzles");
2898 #elif defined(_WIN32)
2899 //Now for Windows NT/2k/xp/2k3 etc.
2900 string tempA = getMyDocumentsPath()+"\\My Games";
2901 CreateDirectory(tempA.c_str(),NULL);//system(tempA.c_str());
2902 tempA = getMyDocumentsPath()+"\\My Games\\blockattack";
2903 CreateDirectory(tempA.c_str(),NULL);//system(tempA.c_str());
2904 tempA = getMyDocumentsPath()+"\\My Games\\blockattack\\replays";
2905 CreateDirectory(tempA.c_str(),NULL);//system(tempA.c_str());
2906 tempA = getMyDocumentsPath()+"\\My Games\\blockattack\\screenshots";
2907 CreateDirectory(tempA.c_str(),NULL);//system(tempA.c_str());
2908 #endif
2909 bool highPriority = false; //if true the game will take most resources, but increase framerate.
2910 bFullscreen = false;
2911 if(argc > 1)
2912 {
2913 int argumentNr = 1;
2914 forceredraw = 2;
2915 while(argc>argumentNr)
2916 {
2917 char helpString[] = "--help";
2918 char priorityString[] = "-priority";
2919 char forceRedrawString[] = "-forceredraw";
2920 char forcepartdrawString[] = "-forcepartdraw";
2921 char singlePuzzleString[] = "-SP";
2922 char noSoundAtAll[] = "-nosound";
2923 if(!(strncmp(argv[argumentNr],helpString,6)))
2924 {
2925 cout << "Block Attack Help" << endl << "--help Display this message" <<
2926 endl << "-priority Starts game in high priority" << endl <<
2927 "-forceredraw Redraw the whole screen every frame, prevents garbage" << endl <<
2928 "-forcepartdraw Only draw what is changed, sometimes cause garbage" << endl <<
2929 "-nosound No sound will be played at all, and sound hardware want be loaded (use this if game crashes because of sound)" << endl;
2930 #ifdef WIN32
2931 system("Pause");
2932 #endif
2933 return 0;
2934 }
2935 if(!(strncmp(argv[argumentNr],priorityString,9)))
2936 {
2937 cout << "Priority mode" << endl;
2938 highPriority = true;
2939 }
2940 if(!(strncmp(argv[argumentNr],forceRedrawString,12)))
2941 {
2942 forceredraw = 1;
2943 }
2944 if(!(strncmp(argv[argumentNr],forcepartdrawString,14)))
2945 {
2946 forceredraw = 2;
2947 }
2948 if(!(strncmp(argv[argumentNr],singlePuzzleString,3)))
2949 {
2950 singlePuzzle = true; //We will just have one puzzle
2951 if(argv[argumentNr+1][1]!=0)
2952 singlePuzzleNr = (argv[argumentNr+1][1]-'0')+(argv[argumentNr+1][0]-'0')*10;
2953 else
2954 singlePuzzleNr = (argv[argumentNr+1][0]-'0');
2955 singlePuzzleFile = argv[argumentNr+2];
2956 argumentNr+=2;
2957 cout << "SinglePuzzleMode, File: " << singlePuzzleFile << " and Level: " << singlePuzzleNr << endl;
2958 }
2959 if(!(strncmp(argv[argumentNr],noSoundAtAll,8)))
2960 {
2961 NoSound = true;
2962 }
2963 argumentNr++;
2964 } //while
2965 } //if
2966
2967 SoundEnabled = true;
2968 MusicEnabled = true;
2969 xsize = 1024; //screen size x
2970 int ysize = 768; //screen size y
2971 int mousex, mousey; //Mouse coordinates
2972 showHighscores = false;
2973 showEndless = true;
2974 showOptions = false;
2975 b1playerOpen = false;
2976 b2playersOpen = false;
2977 bReplayOpen = false;
2978 bScreenLocked = false;
2979 bool twoPlayers = false; //true if two players splitscreen
2980 bool vsMode = false;
2981 theTopScoresEndless = Highscore(1);
2982 theTopScoresTimeTrial = Highscore(2);
2983 drawBalls = true;
2984 puzzleLoaded = false;
2985 bool weWhereConnected = false;
2986
2987 //Things used for repeating keystrokes:
2988 bool repeatingP1N = false; //The key is being held
2989 bool repeatingP1S = false; //The key is being held
2990 bool repeatingP1W = false; //The key is being held
2991 bool repeatingP1E = false; //The key is being held
2992 bool repeatingP2N = false; //The key is being held
2993 bool repeatingP2S = false; //The key is being held
2994 bool repeatingP2W = false; //The key is being held
2995 bool repeatingP2E = false; //The key is being held
2996 const int startRepeat = 200;
2997 const int repeatDelay = 100; //Repeating
2998 unsigned long timeHeldP1N = 0;
2999 unsigned long timeHeldP1S = 0;
3000 unsigned long timeHeldP1E = 0;
3001 unsigned long timeHeldP1W = 0;
3002 unsigned long timeHeldP2N = 0;
3003 unsigned long timeHeldP2S = 0;
3004 unsigned long timeHeldP2E = 0;
3005 unsigned long timeHeldP2W = 0;
3006 unsigned long timesRepeatedP1N = 0;
3007 unsigned long timesRepeatedP1S = 0;
3008 unsigned long timesRepeatedP1E = 0;
3009 unsigned long timesRepeatedP1W = 0;
3010 unsigned long timesRepeatedP2N = 0;
3011 unsigned long timesRepeatedP2S = 0;
3012 unsigned long timesRepeatedP2E = 0;
3013 unsigned long timesRepeatedP2W = 0;
3014
3015 theBallManeger = ballManeger();
3016 theExplosionManeger = explosionManeger();
3017
3018 //We now set the paths were we are saving, we are using the keyword __unix__ . I hope that all UNIX systems has a home folder
3019 #if defined(__unix__)
3020 string home = getenv("HOME");
3021 string optionsPath = home+"/.gamesaves/blockattack/options.dat";
3022 #elif defined(_WIN32)
3023 string home = getMyDocumentsPath();
3024 string optionsPath;
3025 if(&home!=NULL) //Null if no APPDATA dir exists (win 9x)
3026 optionsPath = home+"/My Games/blockattack/options.dat";
3027 else
3028 optionsPath = "options.dat";
3029 #else
3030 string optionsPath = "options.dat";
3031 #endif
3032
3033 #if defined(__unix__)
3034 stageClearSavePath = home+"/.gamesaves/blockattack/stageClear.SCsave";
3035 puzzleSavePath = home+"/.gamesaves/blockattack/puzzle.levels.save";
3036 #elif defined(_WIN32)
3037 if(&home!=NULL)
3038 {
3039 stageClearSavePath = home+"/My Games/blockattack/stageClear.SCsave";
3040 puzzleSavePath = home+"/My Games/blockattack/puzzle.levels.save";
3041 }
3042 else
3043 {
3044 stageClearSavePath = "stageClear.SCsave";
3045 puzzleSavePath = "puzzle.levels.save";
3046 }
3047 #else
3048 stageClearSavePath = "stageClear.SCsave";
3049 puzzleSavePath = "puzzle.levels.save";
3050 #endif
3051 puzzleName="puzzle.levels";
3052
3053 Uint8 *keys;
3054
3055 //Init SDL
3056 if ( SDL_Init(SDL_INIT_VIDEO) < 0 )
3057 {
3058 cout << "Unable to init SDL: " << SDL_GetError() << endl;
3059 exit(1);
3060 }
3061 atexit(SDL_Quit); //quits SDL when the game stops for some reason (like you hit exit or Esc)
3062
3063 Joypad_init(); //Prepare the joysticks
3064
3065 Joypad joypad1 = Joypad(); //Creates a joypad
3066 Joypad joypad2 = Joypad(); //Creates a joypad
3067
3068 theTextManeger = textManeger();
3069
3070 //Open Audio
3071 if(!NoSound) //If sound has not been disabled, then load the sound system
3072 if(Mix_OpenAudio(44100, AUDIO_S16SYS, 2, 2048) < 0)
3073 {
3074 cout << "Warning: Couldn't set 44100 Hz 16-bit audio - Reason: " << SDL_GetError() << endl
3075 << "Sound will be disabled!" << endl;
3076 NoSound = true; //Tries to stop all sound from playing/loading
3077 }
3078
3079 SDL_WM_SetCaption("Block Attack - Rise of the Blocks", NULL); //Sets title line
3080 //Now sets the icon:
3081 SDL_Surface *icon = IMG_Load2("gfx/icon.png");
3082 SDL_WM_SetIcon(icon,NULL);
3083 SDL_FreeSurface(icon);
3084
3085 //Copyright notice:
3086 cout << "Block Attack - Rise of the Blocks (" << VERSION_NUMBER << ")" << endl << "http://blockattack.sf.net" << endl << "Copyright 2004-2006 Poul Sander" << endl <<
3087 "A SDL based game (see www.libsdl.org)" << endl;
3088 #if defined(_WIN32)
3089 cout << "Windows build" << endl;
3090 #elif defined(__linux__)
3091 cout << "Linux build" << endl;
3092 #elif defined(__unix__)
3093 cout << "Unix build" << endl;
3094 #else
3095 cout << "Alternative build" << endl;
3096 #endif
3097 cout << "-------------------------------------------" << endl;
3098
3099 keySettings[0].up= SDLK_UP;
3100 keySettings[0].down = SDLK_DOWN;
3101 keySettings[0].left = SDLK_LEFT;
3102 keySettings[0].right = SDLK_RIGHT;
3103 keySettings[0].change = SDLK_KP_ENTER;
3104 keySettings[0].push = SDLK_KP0;
3105
3106 keySettings[2].up= SDLK_w;
3107 keySettings[2].down = SDLK_s;
3108 keySettings[2].left = SDLK_a;
3109 keySettings[2].right = SDLK_d;
3110 keySettings[2].change = SDLK_LCTRL;
3111 keySettings[2].push = SDLK_LSHIFT;
3112
3113 player1keys=0;
3114 player2keys=2;
3115
3116 strcpy(player1name, "Player 1 \0");
3117 strcpy(player2name, "Player 2 \0");
3118
3119 #ifdef NETWORK
3120 strcpy(serverAddress, "192.168.0.2 \0");
3121 #endif
3122
3123 //Reads options from file:
3124 ifstream optionsFile(optionsPath.c_str(), ios::binary);
3125 if(optionsFile)
3126 {
3127 //reads data: xsize,ysize,fullescreen, player1keys, player2keys, MusicEnabled, SoundEnabled,player1name,player2name
3128 optionsFile.read(reinterpret_cast<char*>(&xsize), sizeof(int));
3129 optionsFile.read(reinterpret_cast<char*>(&ysize), sizeof(int));
3130 optionsFile.read(reinterpret_cast<char*>(&bFullscreen), sizeof(bool));
3131 optionsFile.read(reinterpret_cast<char*>(&keySettings[0].up), sizeof(SDLKey));
3132 optionsFile.read(reinterpret_cast<char*>(&keySettings[0].down), sizeof(SDLKey));
3133 optionsFile.read(reinterpret_cast<char*>(&keySettings[0].left), sizeof(SDLKey));
3134 optionsFile.read(reinterpret_cast<char*>(&keySettings[0].right), sizeof(SDLKey));
3135 optionsFile.read(reinterpret_cast<char*>(&keySettings[0].change), sizeof(SDLKey));
3136 optionsFile.read(reinterpret_cast<char*>(&keySettings[0].push), sizeof(SDLKey));
3137 optionsFile.read(reinterpret_cast<char*>(&keySettings[2].up), sizeof(SDLKey));
3138 optionsFile.read(reinterpret_cast<char*>(&keySettings[2].down), sizeof(SDLKey));
3139 optionsFile.read(reinterpret_cast<char*>(&keySettings[2].left), sizeof(SDLKey));
3140 optionsFile.read(reinterpret_cast<char*>(&keySettings[2].right), sizeof(SDLKey));
3141 optionsFile.read(reinterpret_cast<char*>(&keySettings[2].change), sizeof(SDLKey));
3142 optionsFile.read(reinterpret_cast<char*>(&keySettings[2].push), sizeof(SDLKey));
3143 optionsFile.read(reinterpret_cast<char*>(&MusicEnabled), sizeof(bool));
3144 optionsFile.read(reinterpret_cast<char*>(&SoundEnabled), sizeof(bool));
3145 optionsFile.read(player1name, 30*sizeof(char));
3146 optionsFile.read(player2name, 30*sizeof(char));
3147 //mouseplay?
3148 if(!optionsFile.eof())
3149 {
3150 optionsFile.read(reinterpret_cast<char*>(&mouseplay1), sizeof(bool));
3151 optionsFile.read(reinterpret_cast<char*>(&mouseplay2), sizeof(bool));
3152 optionsFile.read(reinterpret_cast<char*>(&joyplay1),sizeof(bool));
3153 optionsFile.read(reinterpret_cast<char*>(&joyplay2),sizeof(bool));
3154 }
3155 optionsFile.close();
3156 cout << "Data loaded from options file" << endl;
3157 }
3158 else
3159 {
3160 cout << "Unable to load options file, using default values" << endl;
3161 }
3162
3163 xsize = 1024;
3164 ysize = 768;
3165 if(singlePuzzle)
3166 {
3167 xsize=300;
3168 ysize=600;
3169 }
3170 //Open video
3171 if((bFullscreen)&&(!singlePuzzle)) screen=SDL_SetVideoMode(xsize,ysize,32,SDL_SWSURFACE|SDL_FULLSCREEN|SDL_ANYFORMAT);
3172 else screen=SDL_SetVideoMode(xsize,ysize,32,SDL_SWSURFACE|SDL_ANYFORMAT);
3173
3174 if ( screen == NULL )
3175 {
3176 cout << "Unable to set " << xsize << "x" << ysize << " video: " << SDL_GetError() << endl;
3177 exit(1);
3178 }
3179
3180 //Loading all images into memory
3181 InitImages();
3182
3183 cout << "Images loaded" << endl;
3184
3185
3186 BlockGame theGame = BlockGame(50,100); //creates game objects
3187 BlockGame theGame2 = BlockGame(xsize-500,100);
3188 if(singlePuzzle)
3189 {
3190 theGame.topy=0;
3191 theGame.topx=0;
3192 theGame2.topy=10000;
3193 theGame2.topx=10000;
3194 }
3195 theGame.DoPaintJob(); //Makes sure what there is something to paint
3196 theGame2.DoPaintJob();
3197 theGame.SetGameOver(); //sets the game over in the beginning
3198 theGame2.SetGameOver();
3199
3200
3201 //Takes names from file instead
3202 strcpy(theGame.name, player1name);
3203 strcpy(theGame2.name, player2name);
3204
3205 //Keeps track of background;
3206 int nowTime=SDL_GetTicks();
3207
3208
3209 #ifdef NETWORK
3210 NetworkThing nt = NetworkThing();
3211 nt.setBGpointers(&theGame,&theGame2);
3212 #endif
3213
3214 if(singlePuzzle)
3215 {
3216 LoadPuzzleStages();
3217 theGame.NewPuzzleGame(singlePuzzleNr,0,0);
3218 showGame = true;
3219 vsMode = true;
3220 }
3221 //Draws everything to screen
3222 MakeBackground(xsize,ysize,theGame,theGame2);
3223 DrawIMG(background, screen, 0, 0);
3224 DrawEverything(xsize,ysize,theGame,theGame2);
3225 SDL_Flip(screen);
3226
3227 //game loop
3228 int done = 0;
3229 cout << "Starting game loop" << endl;
3230 while(done == 0)
3231 {
3232 if(!(highPriority)) SDL_Delay(10);
3233
3234 if(standardBackground)
3235 {
3236 MakeBackground(xsize,ysize,theGame,theGame2);
3237 DrawIMG(background, screen, 0, 0);
3238 }
3239
3240 //updates the balls and explosions:
3241 theBallManeger.update();
3242 theExplosionManeger.update();
3243 theTextManeger.update();
3244
3245 #ifdef NETWORK
3246 if(nt.isConnected())
3247 {
3248 nt.updateNetwork();
3249 networkActive = true;
3250 if(!nt.isConnectedToPeer())
3251 DrawIMG(background, screen, 0, 0);
3252 }
3253 else
3254 networkActive = false;
3255 if(nt.isConnectedToPeer())
3256 {
3257 networkPlay=true;
3258 if(!weWhereConnected) //We have just connected
3259 {
3260 theGame.NewVsGame(50,100,&theGame2);
3261 theGame.putStartBlocks(nt.theSeed);
3262 theGame2.playNetwork(xsize-500,100);
3263 nt.theGameHasStarted();
3264 DrawIMG(background, screen, 0, 0);
3265 }
3266 weWhereConnected = true;
3267 }
3268 else
3269 {
3270 networkPlay=false;
3271 weWhereConnected = false;
3272 }
3273 #endif
3274
3275 if(!bScreenLocked)
3276 {
3277 SDL_Event event;
3278
3279 while ( SDL_PollEvent(&event) )
3280 {
3281 if ( event.type == SDL_QUIT ) { done = 1; }
3282
3283 if ( event.type == SDL_KEYDOWN )
3284 {
3285 if ( event.key.keysym.sym == SDLK_ESCAPE )
3286 {
3287 if(showHighscores)
3288 {
3289 showHighscores = false;
3290 }
3291 else
3292 if(showOptions)
3293 {
3294 showOptions = false;
3295 }
3296 else
3297 done=1;
3298 DrawIMG(background, screen, 0, 0);
3299
3300 }
3301 //player1:
3302 if ( event.key.keysym.sym == keySettings[player1keys].up ) { theGame.MoveCursor('N'); repeatingP1N=true; timeHeldP1N=SDL_GetTicks(); timesRepeatedP1N=0;}
3303 if ( event.key.keysym.sym == keySettings[player1keys].down ) { theGame.MoveCursor('S'); repeatingP1S=true; timeHeldP1S=SDL_GetTicks(); timesRepeatedP1S=0;}
3304 if ( (event.key.keysym.sym == keySettings[player1keys].left) && (showGame) ) { theGame.MoveCursor('W'); repeatingP1W=true; timeHeldP1W=SDL_GetTicks(); timesRepeatedP1W=0;}
3305 if ( (event.key.keysym.sym == keySettings[player1keys].right) && (showGame) ) { theGame.MoveCursor('E'); repeatingP1E=true; timeHeldP1E=SDL_GetTicks(); timesRepeatedP1E=0;}
3306 if ( event.key.keysym.sym == keySettings[player1keys].push ) { theGame.PushLine(); }
3307 if ( event.key.keysym.sym == keySettings[player1keys].change ) { theGame.SwitchAtCursor();}
3308 //player2:
3309 if ( event.key.keysym.sym == keySettings[player2keys].up ) { theGame2.MoveCursor('N'); repeatingP2N=true; timeHeldP2N=SDL_GetTicks(); timesRepeatedP2N=0;}
3310 if ( event.key.keysym.sym == keySettings[player2keys].down ) { theGame2.MoveCursor('S'); repeatingP2S=true; timeHeldP2S=SDL_GetTicks(); timesRepeatedP2S=0;}
3311 if ( (event.key.keysym.sym == keySettings[player2keys].left) && (showGame) ) { theGame2.MoveCursor('W'); repeatingP2W=true; timeHeldP2W=SDL_GetTicks(); timesRepeatedP2W=0;}
3312 if ( (event.key.keysym.sym == keySettings[player2keys].right) && (showGame) ) { theGame2.MoveCursor('E'); repeatingP2E=true; timeHeldP2E=SDL_GetTicks(); timesRepeatedP2E=0;}
3313 if ( event.key.keysym.sym == keySettings[player2keys].push ) { theGame2.PushLine(); }
3314 if ( event.key.keysym.sym == keySettings[player2keys].change ) { theGame2.SwitchAtCursor();}
3315 //common:
3316 if(!singlePuzzle)
3317 {
3318 if ( ((event.key.keysym.sym == SDLK_LEFT)||(event.key.keysym.sym == SDLK_RIGHT)) && (showHighscores) ) {showEndless = !showEndless;}
3319
3320 if ( event.key.keysym.sym == SDLK_F2 ) {if((!showHighscores)&&(!showOptions)&&(!networkActive)){theGame.NewGame(50,100); theGame.timetrial = false; theGame.putStartBlocks(); closeAllMenus(); twoPlayers =false; theGame2.SetGameOver(); showGame = true; vsMode = false;}}
3321 if ( event.key.keysym.sym == SDLK_F3 ) {if((!showHighscores)&&(!showOptions)&&(!networkActive)){theGame.NewGame(50,100); theGame.timetrial = true; theGame.putStartBlocks(); closeAllMenus(); twoPlayers =false; theGame2.SetGameOver(); showGame = true; vsMode = false;}}
3322 if ( event.key.keysym.sym == SDLK_F5 )
3323 {
3324 if((!showHighscores)&&(!showOptions)&&(!networkActive))
3325 {
3326 int myLevel = StageLevelSelect();
3327 theGame.NewStageGame(myLevel,50,100);
3328 MakeBackground(xsize,ysize,theGame,theGame2);
3329 DrawIMG(background, screen, 0, 0);
3330 closeAllMenus();
3331 twoPlayers =false;
3332 theGame2.SetGameOver();
3333 showGame = true;
3334 vsMode = false;
3335 }
3336 }
3337 if ( event.key.keysym.sym == SDLK_F6 )
3338 {
3339 if((!showHighscores)&&(!showOptions)&&(!networkActive))
3340 {
3341 theGame.NewVsGame(50,100,&theGame2);
3342 theGame2.NewVsGame(xsize-500,100,&theGame);
3343 closeAllMenus();
3344 vsMode = true;
3345 theGame.setGameSpeed(player1Speed);
3346 theGame2.setGameSpeed(player2Speed);
3347 theGame.setHandicap(player1handicap);
3348 theGame2.setHandicap(player2handicap);
3349 theGame.AI_Enabled = player1AI;
3350 theGame2.AI_Enabled = player2AI;
3351 theGame.setAIlevel(player1AIlevel);
3352 theGame2.setAIlevel(player2AIlevel);
3353 int theTime = time(0);
3354 theGame.putStartBlocks(theTime);
3355 theGame2.putStartBlocks(theTime);
3356 twoPlayers = true;
3357 }
3358 }
3359 if ( event.key.keysym.sym == SDLK_F4 )
3360 {
3361 if((!showHighscores)&&(!showOptions)&&(!networkActive))
3362 {
3363 theGame.NewGame(50,100);
3364 theGame2.NewGame(xsize-500,100);
3365 theGame.timetrial = true;
3366 theGame2.timetrial = true;
3367 int theTime = time(0);
3368 theGame.putStartBlocks(theTime);
3369 theGame2.putStartBlocks(theTime);
3370 closeAllMenus();
3371 twoPlayers = true;
3372 theGame.setGameSpeed(player1Speed);
3373 theGame2.setGameSpeed(player2Speed);
3374 theGame.setHandicap(player1handicap);
3375 theGame2.setHandicap(player2handicap);
3376 theGame.AI_Enabled = player1AI;
3377 theGame2.AI_Enabled = player2AI;
3378 theGame.setAIlevel(player1AIlevel);
3379 theGame2.setAIlevel(player2AIlevel);
3380 }
3381 }
3382 if ( event.key.keysym.sym == SDLK_F7 )
3383 {
3384 if((!showHighscores)&&(!showOptions)&&(!networkActive))
3385 {
3386 int myLevel = PuzzleLevelSelect();
3387 theGame.NewPuzzleGame(myLevel,50,100);
3388 MakeBackground(xsize,ysize,theGame,theGame2);
3389 DrawIMG(background, screen, 0, 0);
3390 closeAllMenus();
3391 twoPlayers = false;
3392 theGame2.SetGameOver();
3393 showGame = true;
3394 vsMode = true;
3395 }
3396 }
3397 if ( event.key.keysym.sym == SDLK_F8 )
3398 {
3399 if((!showGame)&&(!showOptions)&&(!networkActive))
3400 if(!showHighscores)
3401 {
3402 closeAllMenus();
3403 showHighscores = true;
3404 MakeBackground(xsize,ysize,theGame,theGame2);
3405 DrawIMG(background, screen, 0, 0);
3406 closeAllMenus();
3407 theGame2.SetGameOver();
3408 }
3409 else
3410 {
3411 showEndless = !showEndless;
3412 }
3413 }
3414 if ( event.key.keysym.sym == SDLK_F9 ) {writeScreenShot();}
3415 if ( event.key.keysym.sym == SDLK_F11 ) {
3416 /*This is the test place, place function to test here*/
3417
3418 theGame.CreateGreyGarbage();
3419
3420 } //F11
3421 }
3422 if ( event.key.keysym.sym == SDLK_F12 ) {done=1;}
3423 }
3424 } //while event PollEvent - read keys
3425
3426 /**********************************************************************
3427 **************************** Repeating start **************************
3428 repeatingP2E=true; timeHeldP2E=SDL_GetTicks(); timesRepeatedP2E=0;
3429 keySettings[player2keys].right
3430 keys = SDL_GetKeyState(NULL);
3431 (this is just info so we don't need to look too long back)
3432 **********************************************************************/
3433
3434 keys = SDL_GetKeyState(NULL);
3435 //Also the joysticks:
3436 //Repeating not implemented
3437
3438 //Player 1 start
3439 if(!(keys[keySettings[player1keys].up]))
3440 repeatingP1N=false;
3441 while((repeatingP1N)&&(keys[keySettings[player1keys].up])&&(SDL_GetTicks()>timeHeldP1N+timesRepeatedP1N*repeatDelay+startRepeat))
3442 {
3443 theGame.MoveCursor('N');
3444 timesRepeatedP1N++;
3445 }
3446
3447 if(!(keys[keySettings[player1keys].down]))
3448 repeatingP1S=false;
3449 while((repeatingP1S)&&(keys[keySettings[player1keys].down])&&(SDL_GetTicks()>timeHeldP1S+timesRepeatedP1S*repeatDelay+startRepeat))
3450 {
3451 theGame.MoveCursor('S');
3452 timesRepeatedP1S++;
3453 }
3454
3455 if(!(keys[keySettings[player1keys].left]))
3456 repeatingP1W=false;
3457 while((repeatingP1W)&&(keys[keySettings[player1keys].left])&&(SDL_GetTicks()>timeHeldP1W+timesRepeatedP1W*repeatDelay+startRepeat))
3458 {
3459 timesRepeatedP1W++;
3460 theGame.MoveCursor('W');
3461 }
3462
3463 if(!(keys[keySettings[player1keys].right]))
3464 repeatingP1E=false;
3465 while((repeatingP1E)&&(keys[keySettings[player1keys].right])&&(SDL_GetTicks()>timeHeldP1E+timesRepeatedP1E*repeatDelay+startRepeat))
3466 {
3467 timesRepeatedP1E++;
3468 theGame.MoveCursor('E');
3469 }
3470
3471 //Player 1 end
3472
3473 //Player 2 start
3474 if(!(keys[keySettings[player2keys].up]))
3475 repeatingP2N=false;
3476 while((repeatingP2N)&&(keys[keySettings[player2keys].up])&&(SDL_GetTicks()>timeHeldP2N+timesRepeatedP2N*repeatDelay+startRepeat))
3477 {
3478 theGame2.MoveCursor('N');
3479 timesRepeatedP2N++;
3480 }
3481
3482 if(!(keys[keySettings[player2keys].down]))
3483 repeatingP2S=false;
3484 while((repeatingP2S)&&(keys[keySettings[player2keys].down])&&(SDL_GetTicks()>timeHeldP2S+timesRepeatedP2S*repeatDelay+startRepeat))
3485 {
3486 theGame2.MoveCursor('S');
3487 timesRepeatedP2S++;
3488 }
3489
3490 if(!(keys[keySettings[player2keys].left]))
3491 repeatingP2W=false;
3492 while((repeatingP2W)&&(keys[keySettings[player2keys].left])&&(SDL_GetTicks()>timeHeldP2W+timesRepeatedP2W*repeatDelay+startRepeat))
3493 {
3494 theGame2.MoveCursor('W');
3495 timesRepeatedP2W++;
3496 }
3497
3498 if(!(keys[keySettings[player2keys].right]))
3499 repeatingP2E=false;
3500 while((repeatingP2E)&&(keys[keySettings[player2keys].right])&&(SDL_GetTicks()>timeHeldP2E+timesRepeatedP2E*repeatDelay+startRepeat))
3501 {
3502 theGame2.MoveCursor('E');
3503 timesRepeatedP2E++;
3504 }
3505
3506 //Player 2 end
3507
3508 /**********************************************************************
3509 **************************** Repeating end ****************************
3510 **********************************************************************/
3511
3512 /**********************************************************************
3513 ***************************** Joypad start ****************************
3514 **********************************************************************/
3515
3516 if(joyplay1||joyplay2)
3517 {
3518 if(joypad1.working)
3519 if(joyplay1)
3520 {
3521 joypad1.update();
3522 if(joypad1.up)
3523 {theGame.MoveCursor('N'); repeatingP1N=true; timeHeldP1N=SDL_GetTicks(); timesRepeatedP1N=0;}
3524 if(joypad1.down)
3525 {theGame.MoveCursor('S'); repeatingP1S=true; timeHeldP1S=SDL_GetTicks(); timesRepeatedP1S=0;}
3526 if(joypad1.left)
3527 {theGame.MoveCursor('W'); repeatingP1W=true; timeHeldP1W=SDL_GetTicks(); timesRepeatedP1W=0;}
3528 if(joypad1.right)
3529 {theGame.MoveCursor('E'); repeatingP1E=true; timeHeldP1E=SDL_GetTicks(); timesRepeatedP1E=0;}
3530 if(joypad1.but1)
3531 theGame.SwitchAtCursor();
3532 if(joypad1.but2)
3533 theGame.PushLine();
3534 }
3535 else
3536 {
3537 joypad1.update();
3538 if(joypad1.up)
3539 {theGame2.MoveCursor('N'); repeatingP2N=true; timeHeldP2N=SDL_GetTicks(); timesRepeatedP2N=0;}
3540 if(joypad1.down)
3541 {theGame2.MoveCursor('S'); repeatingP2S=true; timeHeldP2S=SDL_GetTicks(); timesRepeatedP2S=0;}
3542 if(joypad1.left)
3543 {theGame2.MoveCursor('W'); repeatingP2W=true; timeHeldP2W=SDL_GetTicks(); timesRepeatedP2W=0;}
3544 if(joypad1.right)
3545 {theGame2.MoveCursor('E'); repeatingP2E=true; timeHeldP2E=SDL_GetTicks(); timesRepeatedP2E=0;}
3546 if(joypad1.but1)
3547 theGame2.SwitchAtCursor();
3548 if(joypad1.but2)
3549 theGame2.PushLine();
3550 }
3551 if(joypad2.working)
3552 if(!joyplay2)
3553 {
3554 joypad2.update();
3555 if(joypad2.up)
3556 {theGame.MoveCursor('N'); repeatingP1N=true; timeHeldP1N=SDL_GetTicks(); timesRepeatedP1N=0;}
3557 if(joypad2.down)
3558 {theGame.MoveCursor('S'); repeatingP1S=true; timeHeldP1S=SDL_GetTicks(); timesRepeatedP1S=0;}
3559 if(joypad2.left)
3560 {theGame.MoveCursor('W'); repeatingP1W=true; timeHeldP1W=SDL_GetTicks(); timesRepeatedP1W=0;}
3561 if(joypad2.right)
3562 {theGame.MoveCursor('E'); repeatingP1E=true; timeHeldP1E=SDL_GetTicks(); timesRepeatedP1E=0;}
3563 if(joypad2.but1)
3564 theGame.SwitchAtCursor();
3565 if(joypad2.but2)
3566 theGame.PushLine();
3567 }
3568 else
3569 {
3570 joypad2.update();
3571 if(joypad2.up)
3572 {theGame2.MoveCursor('N'); repeatingP2N=true; timeHeldP2N=SDL_GetTicks(); timesRepeatedP2N=0;}
3573 if(joypad2.down)
3574 {theGame2.MoveCursor('S'); repeatingP2S=true; timeHeldP2S=SDL_GetTicks(); timesRepeatedP2S=0;}
3575 if(joypad2.left)
3576 {theGame2.MoveCursor('W'); repeatingP2W=true; timeHeldP2W=SDL_GetTicks(); timesRepeatedP2W=0;}
3577 if(joypad2.right)
3578 {theGame2.MoveCursor('E'); repeatingP2E=true; timeHeldP2E=SDL_GetTicks(); timesRepeatedP2E=0;}
3579 if(joypad2.but1)
3580 theGame2.SwitchAtCursor();
3581 if(joypad2.but2)
3582 theGame2.PushLine();
3583 }
3584 }
3585
3586 /**********************************************************************
3587 ***************************** Joypad end ******************************
3588 **********************************************************************/
3589
3590
3591 keys = SDL_GetKeyState(NULL);
3592
3593 SDL_GetMouseState(&mousex,&mousey);
3594
3595 /********************************************************************
3596 **************** Here comes mouse play ******************************
3597 ********************************************************************/
3598
3599 if(mouseplay1) //player 1
3600 if((mousex > 50)&&(mousey>100)&&(mousex<50+300)&&(mousey<100+600))
3601 {
3602 int yLine, xLine;
3603 yLine = ((100+600)-(mousey-100+theGame.pixels))/50;
3604 xLine = (mousex-50+25)/50;
3605 yLine-=2;
3606 xLine-=1;
3607 if((yLine>10)&&(theGame.TowerHeight<12))
3608 yLine=10;
3609 if(((theGame.pixels==50)||(theGame.pixels==0)) && (yLine>11))
3610 yLine=11;
3611 if(yLine<0)
3612 yLine=0;
3613 if(xLine<0)
3614 xLine=0;
3615 if(xLine>4)
3616 xLine=4;
3617 theGame.cursorx=xLine;
3618 theGame.cursory=yLine;
3619 }
3620
3621 if(mouseplay2) //player 2
3622 if((mousex > xsize-500)&&(mousey>100)&&(mousex<xsize-500+300)&&(mousey<100+600))
3623 {
3624 int yLine, xLine;
3625 yLine = ((100+600)-(mousey-100+theGame2.pixels))/50;
3626 xLine = (mousex-(xsize-500)+25)/50;
3627 yLine-=2;
3628 xLine-=1;
3629 if((yLine>10)&&(theGame2.TowerHeight<12))
3630 yLine=10;
3631 if(((theGame2.pixels==50)||(theGame2.pixels==0)) && (yLine>11))
3632 yLine=11;
3633 if(yLine<0)
3634 yLine=0;
3635 if(xLine<0)
3636 xLine=0;
3637 if(xLine>4)
3638 xLine=4;
3639 theGame2.cursorx=xLine;
3640 theGame2.cursory=yLine;
3641 }
3642
3643 /********************************************************************
3644 **************** Here ends mouse play *******************************
3645 ********************************************************************/
3646
3647 // If the mouse button is released, make bMouseUp equal true
3648 if(!SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(1))
3649 {
3650 bMouseUp=true;
3651 }
3652
3653 // If the mouse button 2 is released, make bMouseUp2 equal true
3654 if((SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(3))!=SDL_BUTTON(3))
3655 {
3656 bMouseUp2=true;
3657 }
3658
3659 if(!singlePuzzle)
3660 {
3661 //read mouse events
3662 if(SDL_GetMouseState(NULL,NULL)&SDL_BUTTON(1) && bMouseUp)
3663 {
3664 bMouseUp = false;
3665 DrawIMG(background, screen, 0, 0);
3666 if((0<mousex) && (mousex<120) && (0<mousey) && (mousey<40) &&(!networkActive) )
3667 {
3668 //New game clicked
3669 bool state = (!bNewGameOpen);
3670 closeAllMenus();
3671 bNewGameOpen = state; //theGame.NewGame(50,100);
3672 showOptions = false;
3673 showHighscores = false;
3674 }
3675 else
3676 #ifdef NETWORK
3677 if((0<mousex) && (mousex<120) && (0<mousey) && (mousey<40) &&(networkActive))
3678 {
3679 //Disconnect clicked!
3680 cout << "Disconnect clicked!" << endl;
3681 nt.ntDisconnect();
3682 }
3683 else
3684 #endif
3685 if((0<mousex) && (mousex<120) && (40<mousey) && (mousey<80) && (bNewGameOpen) &&(!networkActive))
3686 {
3687 //1player
3688 b1playerOpen = (!b1playerOpen);
3689 b2playersOpen = false;
3690 #ifdef NETWORK
3691 bNetworkOpen = false;
3692 #endif
3693 }
3694 else
3695 if((0<mousex) && (mousex<120) && (80<mousey) && (mousey<120) && (bNewGameOpen) &&(!networkActive))
3696 {
3697 //2player
3698 b2playersOpen = (!b2playersOpen);
3699 b1playerOpen = false;
3700 #ifdef NETWORK
3701 bNetworkOpen = false;
3702 #endif
3703 }
3704 #ifdef NETWORK
3705 else
3706 if((0<mousex) && (mousex<120) && (120<mousey) && (mousey<160) && (bNewGameOpen) &&(!networkActive))
3707 {
3708 //Network
3709 b1playerOpen = false;
3710 b2playersOpen = false;
3711 bNetworkOpen = (!bNetworkOpen);
3712 }
3713 #endif
3714 else
3715 if((120<mousex) && (mousex<240) && (40<mousey) && (mousey<80) && (b1playerOpen) &&(!networkActive))
3716 {
3717 //1 player - endless
3718 theGame.NewGame(50,100);
3719 theGame.putStartBlocks();
3720 bNewGameOpen = false;
3721 b1playerOpen = false;
3722 twoPlayers =false; theGame2.SetGameOver(); showGame = true;
3723 }
3724 else
3725 if((120<mousex) && (mousex<240) && (80<mousey) && (mousey<120) && (b1playerOpen) &&(!networkActive) )
3726 {
3727 //1 player - time trial
3728 theGame.NewGame(50,100); theGame.timetrial=true;
3729 theGame.putStartBlocks();
3730 bNewGameOpen = false;
3731 b1playerOpen = false;
3732 twoPlayers =false; theGame2.SetGameOver(); showGame = true;
3733 }
3734 else
3735 if((120<mousex) && (mousex<240) && (120<mousey) && (mousey<160) && (b1playerOpen)&&(!networkActive) )
3736 {
3737 //1 player - stage clear
3738 bNewGameOpen = false;
3739 b1playerOpen = false;
3740 int myLevel = StageLevelSelect();
3741 theGame.NewStageGame(myLevel,50,100);
3742 MakeBackground(xsize,ysize,theGame,theGame2);
3743 DrawIMG(background, screen, 0, 0);
3744 twoPlayers =false; theGame2.SetGameOver(); showGame = true;
3745 vsMode = false;
3746 }
3747 else
3748 if((120<mousex) && (mousex<240) && (160<mousey) && (mousey<200) && (b1playerOpen))
3749 {
3750 //1 player - puzzle
3751 bNewGameOpen = false;
3752 b1playerOpen = false;
3753 int myLevel = PuzzleLevelSelect();
3754 theGame.NewPuzzleGame(myLevel,50,100);
3755 MakeBackground(xsize,ysize,theGame,theGame2);
3756 DrawIMG(background, screen, 0, 0);
3757 twoPlayers =false; theGame2.SetGameOver(); showGame = true;
3758 vsMode = false;
3759 }
3760 else
3761 if((120<mousex) && (mousex<240) && (200<mousey) && (mousey<240) && (b1playerOpen))
3762 {
3763 //1 player - Vs mode
3764 bNewGameOpen = false;
3765 b1playerOpen = false;
3766 int theAIlevel = startSingleVs();
3767 theGame.NewVsGame(50,100,&theGame2);
3768 theGame2.NewVsGame(xsize-500,100,&theGame);
3769 MakeBackground(xsize,ysize,theGame,theGame2);
3770 DrawIMG(background, screen, 0, 0);
3771 twoPlayers = true; //Single player, but AI plays
3772 showGame = true;
3773 vsMode = true;
3774 theGame2.AI_Enabled=true; //Of course we need an AI
3775 theGame2.setAIlevel((Uint8)theAIlevel);
3776 int theTime = time(0);
3777 theGame.putStartBlocks(theTime);
3778 theGame2.putStartBlocks(theTime);
3779 }
3780 else
3781 if((120<mousex) && (mousex<240) && (80<mousey) && (mousey<120) && (b2playersOpen))
3782 {
3783 //2 player - time trial
3784 theGame.NewGame(50,100); theGame.timetrial=true;
3785 bNewGameOpen = false;
3786 b2playersOpen = false;
3787 theGame.NewGame(50,100);
3788 theGame2.NewGame(xsize-500,100);
3789 theGame.timetrial = true;
3790 theGame2.timetrial = true;
3791 int theTime = time(0);
3792 theGame.putStartBlocks(theTime);
3793 theGame2.putStartBlocks(theTime);
3794 theGame.setGameSpeed(player1Speed);
3795 theGame2.setGameSpeed(player2Speed);
3796 theGame.setHandicap(player1handicap);
3797 theGame2.setHandicap(player2handicap);
3798 theGame.AI_Enabled = player1AI;
3799 theGame2.AI_Enabled = player2AI;
3800 theGame.setAIlevel(player1AIlevel);
3801 theGame2.setAIlevel(player2AIlevel);
3802 twoPlayers = true;
3803 }
3804 else
3805 if((120<mousex) && (mousex<240) && (120<mousey) && (mousey<160) && (b2playersOpen))
3806 {
3807 //2 player - VsMode
3808 theGame.NewVsGame(50,100,&theGame2);
3809 theGame2.NewVsGame(xsize-500,100,&theGame);
3810 bNewGameOpen = false;
3811 vsMode = true;
3812 twoPlayers = true;
3813 b2playersOpen = false;
3814 theGame.setGameSpeed(player1Speed);
3815 theGame2.setGameSpeed(player2Speed);
3816 theGame.setHandicap(player1handicap);
3817 theGame2.setHandicap(player2handicap);
3818 theGame.AI_Enabled = player1AI;
3819 theGame2.AI_Enabled = player2AI;
3820 theGame.setAIlevel(player1AIlevel);
3821 theGame2.setAIlevel(player2AIlevel);
3822 int theTime = time(0);
3823 theGame.putStartBlocks(theTime);
3824 theGame2.putStartBlocks(theTime);
3825 }
3826 #ifdef NETWORK
3827 else
3828 if((120<mousex) && (mousex<240) && (120<mousey) && (mousey<160) && (bNetworkOpen))
3829 {
3830 //Host
3831 cout << "Host" << endl;
3832 closeAllMenus();
3833 theGame.SetGameOver();
3834 theGame2.SetGameOver();
3835 nt.startServer();
3836 }
3837 else
3838 if((120<mousex) && (mousex<240) && (160<mousey) && (mousey<200) && (bNetworkOpen))
3839 {
3840 //Connect
3841 cout << "Connect" << endl;
3842 closeAllMenus();
3843 theGame.SetGameOver();
3844 theGame2.SetGameOver();
3845 if(OpenDialogbox(200,100,serverAddress))
3846 {
3847 char buf[30];
3848 memcpy(buf,serverAddress,30);
3849 nt.connectToServer(strtok(buf," "));
3850 }
3851 while ( SDL_PollEvent(&event) ); //If the user have pressed ESC or the like
3852 }
3853 #endif
3854 else
3855 if((120<mousex) && (mousex<2*120) && (0<mousey) && (mousey<40) &&(!networkActive))
3856 {
3857 //options button clicked
3858 if(bOptionsOpen)
3859 {
3860 closeAllMenus();
3861 }
3862 else
3863 {
3864 closeAllMenus();
3865 bOptionsOpen = true;
3866 DrawIMG(background, screen, 0, 0);
3867 }
3868 }
3869 else
3870 if((120<mousex) && (mousex<2*120) && (40<mousey) && (mousey<80) && (bOptionsOpen) )
3871 {
3872 //Configure button clicked
3873 closeAllMenus();
3874 if(!showOptions) { showOptions = true; showHighscores = false; }
3875 else showOptions = false;
3876 DrawIMG(background, screen, 0, 0);
3877 }
3878 else
3879 if((120<mousex) && (mousex<2*120) && (80<mousey) && (mousey<120) && (bOptionsOpen) )
3880 {
3881 //Configure button clicked
3882 closeAllMenus();
3883 changePuzzleLevels();
3884 }
3885 else
3886 if((120<mousex) && (mousex<2*120) && (120<mousey) && (mousey<160) && (bOptionsOpen) )
3887 {
3888 //vsMode button clicked
3889 closeAllMenus();
3890 startVsMenu();
3891 }
3892 else
3893 if((120*2<mousex) && (mousex<3*120) && (0<mousey) && (mousey<40) &&(!networkActive))
3894 {
3895 //highscore button clicked
3896 bool state = showHighscores;
3897 closeAllMenus();
3898 if(!state) {showHighscores = true; showOptions = false;}
3899 DrawIMG(background, screen, 0, 0);
3900 }
3901 else
3902 if((360<mousex) && (mousex<4*120) && (0<mousey) && (mousey<40) &&(!networkActive))
3903 {
3904 //Replay clicked!
3905 bool state = (!bReplayOpen);
3906 closeAllMenus();
3907 bReplayOpen = state; //theGame.NewGame(50,100);
3908 showOptions = false;
3909 showHighscores = false;
3910 }
3911 else
3912 if((360<mousex) && (mousex<4*120) && (40<mousey) && (mousey<80) &&(bReplayOpen))
3913 {
3914 //Replay->Save clicked!
3915 //cout << "Replay->Save clicked" << endl;
3916 char buf[30];
3917 for(int i=0;i<29;i++)buf[i]=' ';
3918 buf[30]=0;
3919 OpenDialogbox(200,100,buf);
3920 for(int i=28;buf[i]==' ';i--)
3921 buf[i]=0;
3922 #ifdef __unix__
3923 string saveHere = (string)getenv("HOME")+(string)"/.gamesaves/blockattack/replays/"+(string)buf;
3924 #elif WIN32
3925 string saveHere = home+(string)"/My Games/blockattack/replays/"+(string)buf;
3926 #else
3927 string saveHere = (string)"./replays"+(string)buf;
3928 #endif
3929 ofstream replayFileOut;
3930 replayFileOut.open(saveHere.c_str(),ios::binary|ios::trunc);
3931 if(replayFileOut)
3932 {
3933 //writes data: xsize,ysize,fullescreen, player1keys, player2keys, MusicEnabled, SoundEnabled,player1name,player2name
3934 // optionsFileOut.write(reinterpret_cast<char*>(&xsize),sizeof(int));
3935 Uint8 version = 1;
3936 replayFileOut.write(reinterpret_cast<char*>(&version),sizeof(Uint8));
3937 if(lastNrOfPlayers>0)
3938 replayFileOut.write(reinterpret_cast<char*>(&theGame.theReplay),sizeof(Replay));
3939 if(lastNrOfPlayers>1)
3940 replayFileOut.write(reinterpret_cast<char*>(&theGame2.theReplay),sizeof(Replay));
3941 replayFileOut.close();
3942 }
3943 closeAllMenus();
3944 }
3945 else
3946 if((360<mousex) && (mousex<4*120) && (80<mousey) && (mousey<120)&&(bReplayOpen))
3947 {
3948 //Replay->Load clicked!
3949 //cout << "Replay->Load clicked" << endl;
3950
3951 char buf[30];
3952 for(int i=0;i<29;i++)buf[i]=' ';
3953 buf[30]=0;
3954 if(OpenReplayDialogbox(50,100,buf))
3955 {
3956 //cout << "Good way" << endl;
3957 for(int i=28;buf[i]==' ';i--)
3958 buf[i]=0;
3959 #ifdef __unix__
3960 string loadThis = (string)getenv("HOME")+(string)"/.gamesaves/blockattack/replays/"+(string)buf;
3961 #elif WIN32
3962 string loadThis = home+(string)"/My Games/blockattack/replays/"+(string)buf;
3963 #else
3964 string loadThis = (string)"./replays/"+(string)buf;
3965 #endif
3966 ifstream replayFileIn;
3967 replayFileIn.open(loadThis.c_str(),ios::binary);
3968 bool play2 = false;
3969 if(replayFileIn)
3970 {
3971 Uint8 version = 0;
3972 replayFileIn.read(reinterpret_cast<char*>(&version),sizeof(Uint8));
3973 if(version==1)
3974 {
3975 replayFileIn.read(reinterpret_cast<char*>(&theGame.theReplay), sizeof(Replay));
3976 if(!replayFileIn.eof())
3977 {
3978 cout << "2 players" << endl;
3979 if(replayFileIn.read(reinterpret_cast<char*>(&theGame2.theReplay), sizeof(Replay)))
3980 play2 = true; //If we can actually read a player 2
3981 }
3982 }
3983 replayFileIn.close();
3984 theGame.playReplay(50,100);
3985 if(play2)
3986 theGame2.playReplay(xsize-500,100);
3987 else
3988 theGame2.SetGameOver();
3989 }
3990 }
3991 closeAllMenus();
3992 }
3993 else
3994 if((xsize-120<mousex) && (xsize-20>mousex) && (ysize-120<mousey) && (ysize-20>mousey))
3995 {
3996 //Exit clicked
3997 done=1;
3998 }
3999 else
4000 if((showOptions) && (mousex>500) && (mousex<560) && (mousey>220) && (mousey<260))
4001 {
4002 MusicEnabled = !MusicEnabled;
4003 if(!MusicEnabled) Mix_FadeOutMusic(500);
4004 }
4005 if((showOptions) && (mousex>500) && (mousex<560) && (mousey>270) && (mousey<310))
4006 {
4007 SoundEnabled = !SoundEnabled;
4008 }
4009 if((showOptions) && (mousex>500) && (mousex<560) && (mousey>320) && (mousey<360))
4010 {
4011 //Fullscreen
4012 bFullscreen = !bFullscreen;
4013 #if defined(WIN32)
4014 if(bFullscreen) screen=SDL_SetVideoMode(xsize,ysize,32,SDL_SWSURFACE|SDL_FULLSCREEN|SDL_ANYFORMAT);
4015 else screen=SDL_SetVideoMode(xsize,ysize,32,SDL_SWSURFACE|SDL_ANYFORMAT);
4016 DrawIMG(background, screen, 0, 0);
4017 #else
4018 SDL_WM_ToggleFullScreen(screen); //Will only work in Linux
4019 #endif
4020 SDL_ShowCursor(SDL_DISABLE);
4021 }
4022
4023 if((showOptions) && (mousex>330) && (mousex<470) && (mousey>535) && (mousey<585))
4024 {
4025 //change name
4026 bScreenLocked = true;
4027 showDialog = true;
4028 if(OpenDialogbox(200,100,player1name))
4029 strcpy(theGame.name, player1name);
4030 else
4031 strcpy(player1name,theGame.name);
4032 bScreenLocked = false;
4033 showDialog = false;
4034 MakeBackground(xsize,ysize,theGame,theGame2);
4035 DrawIMG(background, screen, 0, 0);
4036 }
4037 if((showOptions) && (mousex>330) && (mousex<470) && (mousey>600) && (mousey<640))
4038 {
4039 //change name
4040 bScreenLocked = true;
4041 showDialog = true;
4042 if(OpenDialogbox(200,100,player2name))
4043 strcpy(theGame2.name, player2name);
4044 else
4045 strcpy(player2name,theGame2.name);
4046 bScreenLocked = false;
4047 showDialog = false;
4048 MakeBackground(xsize,ysize,theGame,theGame2);
4049 DrawIMG(background, screen, 0, 0);
4050 }
4051 if((showOptions) && (mousex>510) && (mousex<630) && (mousey>535) && (mousey<585))
4052 {
4053 //changeControls
4054 OpenControlsBox(200,100,0);
4055 MakeBackground(xsize,ysize,theGame,theGame2);
4056 DrawIMG(background, screen, 0, 0);
4057 }
4058 if((showOptions) && (mousex>510) && (mousex<630) && (mousey>600) && (mousey<640))
4059 {
4060 //changeControls
4061 OpenControlsBox(200,100,2);
4062 MakeBackground(xsize,ysize,theGame,theGame2);
4063 DrawIMG(background, screen, 0, 0);
4064 }
4065 if((showHighscores)&&(((mousex>150)&&(mousex<173))||((mousex>628)&&(mousex<650)))&&(mousey<652)&&(mousey>630))
4066 {
4067 //small arrors on Highscore board clicked!
4068 showEndless = !showEndless;
4069 DrawIMG(background, screen, 0, 0);
4070 }
4071
4072 /********************************************************************
4073 **************** Here comes mouse play ******************************
4074 ********************************************************************/
4075 if((!showOptions)&&(!showHighscores))
4076 {
4077 if(mouseplay1) //player 1
4078 if((mousex > 50)&&(mousey>100)&&(mousex<50+300)&&(mousey<100+600))
4079 {
4080 theGame.SwitchAtCursor();
4081 }
4082 if(mouseplay2) //player 2
4083 if((mousex > xsize-500)&&(mousey>100)&&(mousex<xsize-500+300)&&(mousey<100+600))
4084 {
4085 theGame2.SwitchAtCursor();
4086 }
4087 }
4088 /********************************************************************
4089 **************** Here ends mouse play *******************************
4090 ********************************************************************/
4091
4092 //cout << "Mouse x: " << mousex << ", mouse y: " << mousey << endl;
4093 }
4094
4095 //Mouse button 2:
4096 if((SDL_GetMouseState(NULL,NULL)&SDL_BUTTON(3))==SDL_BUTTON(3) && bMouseUp2)
4097 {
4098 bMouseUp2=false; //The button is pressed
4099 /********************************************************************
4100 **************** Here comes mouse play ******************************
4101 ********************************************************************/
4102 if((!showOptions)&&(!showHighscores))
4103 {
4104 if(mouseplay1) //player 1
4105 if((mousex > 50)&&(mousey>100)&&(mousex<50+300)&&(mousey<100+600))
4106 {
4107 theGame.PushLine();
4108 }
4109 if(mouseplay2) //player 2
4110 if((mousex > xsize-500)&&(mousey>100)&&(mousex<xsize-500+300)&&(mousey<100+600))
4111 {
4112 theGame2.PushLine();
4113 }
4114 }
4115 /********************************************************************
4116 **************** Here ends mouse play *******************************
4117 ********************************************************************/
4118 }
4119 } //if !singlePuzzle
4120 else
4121 {
4122
4123 }
4124 } //if !bScreenBocked;
4125
4126
4127 //Sees if music is stopped and if music is enabled
4128 if((!NoSound)&&(!Mix_PlayingMusic())&&(MusicEnabled))
4129 {
4130 // then starts playing it.
4131 Mix_PlayMusic(bgMusic, 0); //music loop
4132 }
4133
4134 //Updates the objects
4135 theGame.Update();
4136 theGame2.Update();
4137
4138 //see if anyone has won (two players only)
4139 if(!networkPlay)
4140 if(twoPlayers)
4141 {
4142 lastNrOfPlayers = 2;
4143 if((theGame.bGameOver) && (theGame2.bGameOver))
4144 {
4145 if(theGame.score+theGame.handicap>theGame2.score+theGame2.handicap)
4146 theGame.setPlayerWon();
4147 else
4148 if(theGame.score+theGame.handicap<theGame2.score+theGame2.handicap)
4149 theGame2.setPlayerWon();
4150 else {theGame.setDraw(); theGame2.setDraw();}
4151 twoPlayers = false;
4152 }
4153 if((theGame.bGameOver) && (!theGame2.bGameOver))
4154 {
4155 theGame2.setPlayerWon();
4156 twoPlayers = false;
4157 }
4158 if((!theGame.bGameOver) && (theGame2.bGameOver))
4159 {
4160 theGame.setPlayerWon();
4161 twoPlayers = false;
4162 }
4163 }
4164
4165 //Once evrything has been checked, update graphics
4166 DrawEverything(xsize,ysize,theGame, theGame2);
4167 SDL_GetMouseState(&mousex,&mousey);
4168 //Remember mouse placement
4169 oldMousex = mousex;
4170 oldMousey = mousey;
4171 //Draw the mouse:
4172 DrawIMG(mouse,screen,mousex,mousey);
4173 SDL_Flip(screen);
4174 } //game loop
4175
4176
4177
4178 //Saves options
4179 ofstream optionsFileOut;
4180 optionsFileOut.open(optionsPath.c_str(),ios::binary|ios::trunc);
4181 if(optionsFileOut)
4182 {
4183 //writes data: xsize,ysize,fullescreen, player1keys, player2keys, MusicEnabled, SoundEnabled,player1name,player2name
4184 optionsFileOut.write(reinterpret_cast<char*>(&xsize),sizeof(int));
4185 optionsFileOut.write(reinterpret_cast<char*>(&ysize),sizeof(int));
4186 optionsFileOut.write(reinterpret_cast<char*>(&bFullscreen),sizeof(bool));
4187 optionsFileOut.write(reinterpret_cast<char*>(&keySettings[0].up), sizeof(SDLKey));
4188 optionsFileOut.write(reinterpret_cast<char*>(&keySettings[0].down), sizeof(SDLKey));
4189 optionsFileOut.write(reinterpret_cast<char*>(&keySettings[0].left), sizeof(SDLKey));
4190 optionsFileOut.write(reinterpret_cast<char*>(&keySettings[0].right), sizeof(SDLKey));
4191 optionsFileOut.write(reinterpret_cast<char*>(&keySettings[0].change), sizeof(SDLKey));
4192 optionsFileOut.write(reinterpret_cast<char*>(&keySettings[0].push), sizeof(SDLKey));
4193 optionsFileOut.write(reinterpret_cast<char*>(&keySettings[2].up), sizeof(SDLKey));
4194 optionsFileOut.write(reinterpret_cast<char*>(&keySettings[2].down), sizeof(SDLKey));
4195 optionsFileOut.write(reinterpret_cast<char*>(&keySettings[2].left), sizeof(SDLKey));
4196 optionsFileOut.write(reinterpret_cast<char*>(&keySettings[2].right), sizeof(SDLKey));
4197 optionsFileOut.write(reinterpret_cast<char*>(&keySettings[2].change), sizeof(SDLKey));
4198 optionsFileOut.write(reinterpret_cast<char*>(&keySettings[2].push), sizeof(SDLKey));
4199 optionsFileOut.write(reinterpret_cast<char*>(&MusicEnabled),sizeof(bool));
4200 optionsFileOut.write(reinterpret_cast<char*>(&SoundEnabled),sizeof(bool));
4201 optionsFileOut.write(player1name,30*sizeof(char));
4202 optionsFileOut.write(player2name,30*sizeof(char));
4203 optionsFileOut.write(reinterpret_cast<char*>(&mouseplay1),sizeof(bool));
4204 optionsFileOut.write(reinterpret_cast<char*>(&mouseplay2),sizeof(bool));
4205 optionsFileOut.write(reinterpret_cast<char*>(&joyplay1),sizeof(bool));
4206 optionsFileOut.write(reinterpret_cast<char*>(&joyplay2),sizeof(bool));
4207 optionsFileOut.close();
4208 cout << "options written to file" << endl;
4209 }
4210 else
4211 {
4212 cout << "Failed to write options" << endl;
4213 }
4214
4215
4216 //Frees memory from music and fonts
4217 //This is done after writing of options since it's often crashes the program :(
4218 UnloadImages();
4219
4220 //calculate uptime:
4221 int hours, mins, secs, time;
4222 time = SDL_GetTicks();
4223 hours = time/(1000*60*60);
4224 time = time % (1000*60*60);
4225 mins = time/(1000*60);
4226 time = time % (1000*60);
4227 secs = time/1000;
4228
4229 cout << "Block Attack - Rise of the Blocks ran for: " << hours << " hours " << mins << " mins and " << secs << " secs" << endl;
4230
4231 return 0;
4232 }
0 /*
1 Block Attack - Rise of the Blocks, SDL game, besed on Nintendo's Tetris Attack
2 Copyright (C) 2005 Poul Sander
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 Poul Sander
19 Rævehjvej 36, V. 1111
20 2800 Kgs. Lyngby
21 DENMARK
22 poul@poulsander.com
23 http://blockattack.sf.net
24 */
25
26 #define VERSION_NUMBER "version 1.3.1"
27
28 //If DEBUG is defined: AI info and FPS will be written to screen
29 //#define DEBUG
30
31 //If NETWORK id defined: enet will be used
32 #define NETWORK
33
34 //Macros to convert surfaces (for faster drawing)
35 #define CONVERT(n) tmp = SDL_DisplayFormat(n); SDL_FreeSurface(n); n = tmp
36 #define CONVERTA(n) tmp = SDL_DisplayFormatAlpha(n); SDL_FreeSurface(n); n = tmp
37
38 #include <iostream>
39 #include <stdlib.h>
40 #include <time.h> //Used for srand()
41 #include <sstream>
42 #include <string>
43 #include "SDL.h" //The SDL libary, used for most things
44 #include <SDL_mixer.h> //Used for sound & music
45 #include <SDL_image.h> //To load PNG images!
46 //#include "config.h"
47
48 //if SHAREDIR is not used we look in current directory
49 #ifndef SHAREDIR
50 #define SHAREDIR "./"
51 #endif
52
53 //enet things
54 #ifdef NETWORK
55 #include "enet/enet.h"
56 //#include "enet/list.h"
57 //#include "enet/protocol.h"
58 #endif
59 //enet things end
60
61 #include "SFont.h" //Used to write on screen
62 #include "highscore.h" //Stores highscores
63 #include "ReadKeyboard.h" //Reads text from keyboard
64 #include "joypad.h" //Used for joypads
65 #include "listFiles.h" //Used to show files on screen
66 #include "replay.h" //Used for replays
67 #include <vector>
68
69 //Some definitions
70 //The game is divided in frames. FALLTIME means the blocks will fall one block every FRAMELENGTH*FALLTIME millisecond
71 #define FRAMELENGTH 50
72 #define HANGTIME 40
73 #define FALLTIME 20
74 //Don't change the following, they are fundamental and later some functions are hardcoded
75 #define BLOCKFALL 10000
76 #define BLOCKWAIT 100000
77 #define BLOCKHANG 1000
78 #define GARBAGE 1000000
79 #define CHAINPLACE 10000000
80 #define NUMBEROFCHAINS 100
81
82 //Animation lengths:
83 #define READYTIME 500
84 #define BOMBTIME 200
85 #define CURSORTIME 200
86
87
88 using namespace std; //remove it if you dare...
89 #ifdef SHAREDIR
90 char sharedir[] = SHAREDIR;
91 #endif
92
93 //All graphic in the game (as pointers):
94 SDL_Surface *background; //Stores background
95 SDL_Surface *backgroundImage; //Stores the background image
96 int backgroundImageW, backgroundImageH; //size of background image
97 SDL_Surface *backBoard; //Stores the background to the board
98 SDL_Surface *b1player;
99 SDL_Surface *b2players;
100 SDL_Surface *bVsMode;
101 SDL_Surface *bStageClear;
102 SDL_Surface *bPuzzle;
103 SDL_Surface *bNewGame; //The New Game botton
104 SDL_Surface *bEndless; //Endless button (sub to new)
105 SDL_Surface *bTimeTrial; //Time trial button (sub to new)
106 SDL_Surface *bOptions; //The Options botton
107 //new in 1.1.1
108 SDL_Surface *bConfigure; //The configure button
109 SDL_Surface *bSelectPuzzle; //The Select Puzzle Button
110 SDL_Surface *bBack; //The "Back" button
111 SDL_Surface *bForward; //The "forward" button
112 //new in 1.1.1 end
113 //new in 1.1.2
114 SDL_Surface *iChainBack;
115 //new in 1.1.2 end (nota that iSmallFont has also been added)
116 //new in 1.2.0
117 SDL_Surface *bReplay;
118 SDL_Surface *bSave;
119 SDL_Surface *bLoad;
120 #ifdef NETWORK
121 SDL_Surface *bNetwork;
122 SDL_Surface *bConnect;
123 SDL_Surface *bHost;
124 #endif
125 //new in 1.2.0 end
126 SDL_Surface *bHighScore; //The High Score botton
127 SDL_Surface *bExit; //The Exit botton
128 SDL_Surface *blackLine; //The seperator in stage clear
129 SDL_Surface *stageBobble; //The bobble instage clear
130 SDL_Surface *screen; //The whole screen;
131 SDL_Surface *iGameOver; //The gameOver image
132 SDL_Surface *iWinner; //the "winner" image
133 SDL_Surface *iDraw; //the "draw" image
134 SDL_Surface *iLoser; //the "loser" image
135 //Animations:
136 SDL_Surface *cursor[2]; //The animated cursor
137 SDL_Surface *bomb[2]; //Bomb then the bricks should blow
138 SDL_Surface *ready[2]; //Before the blocks fall
139 SDL_Surface *explosion[4]; //Then a block explodes
140 //Animations end
141 SDL_Surface *counter[3]; //Counts down from 3
142 SDL_Surface *bricks[7]; //The bricks, saved in an array of pointers
143 SDL_Surface *crossover; //Cross the bricks that will be cleared soon
144 SDL_Surface *balls[7]; //The balls (the small ones that jump around)
145 SDL_Surface *iBlueFont; //Contains the blue font used
146 SDL_Surface *iSmallFont; //Small font used for the chain text
147 SDL_Surface *topscoresBack; //The backgound to the highscore list
148 SDL_Surface *optionsBack;
149 SDL_Surface *changeButtonsBack;
150 SDL_Surface *dialogBox;
151 //SDL_Surface *fileDialogBox; //Manual entering of filename, new in 1.1.1, obsolute in 1.1.2
152 SDL_Surface *bOn;
153 SDL_Surface *bOff;
154 SDL_Surface *bChange;
155 SDL_Surface *b1024;
156 //SDL_Surface *b1280;
157 //SDL_Surface *b1400;
158 //SDL_Surface *b1600;
159 SDL_Surface *iLevelCheck; //To the level select screen
160 SDL_Surface *iLevelCheckBox;
161 SDL_Surface *iCheckBoxArea;
162 SDL_Surface *boardBackBack;
163 SDL_Surface *garbageTL; //the Garbage Blocks
164 SDL_Surface *garbageT;
165 SDL_Surface *garbageTR;
166 SDL_Surface *garbageR;
167 SDL_Surface *garbageBR;
168 SDL_Surface *garbageB;
169 SDL_Surface *garbageBL;
170 SDL_Surface *garbageL;
171 SDL_Surface *garbageFill;
172 SDL_Surface *garbageM;
173 SDL_Surface *garbageML;
174 SDL_Surface *garbageMR;
175 //new in 1.2.3 start
176 SDL_Surface *smiley[4];
177 SDL_Surface *garbageGM;
178 SDL_Surface *garbageGML;
179 SDL_Surface *garbageGMR;
180 //new in 1.2.3 end
181 SDL_Surface *mouse; //The mouse cursor
182
183
184 SDL_Surface *tmp; //a temporary surface to use DisplayFormat
185
186
187 SFont_Font *fBlueFont; //Stores the blue font (SFont)
188 SFont_Font *fSmallFont; //Stores the small font (SFont)
189
190 Mix_Music *bgMusic; //backgroundMusic
191 Mix_Chunk *boing; //boing sound when clearing
192 Mix_Chunk *timesUp; //whistle when times up
193 Mix_Chunk *applause; //Applause, then the player is good
194 Mix_Chunk *photoClick; //clickSound
195 Mix_Chunk *heartBeat; //heart beat
196 Mix_Chunk *typingChunk; //When writing
197 Mix_Chunk *counterChunk; //When counting down
198
199 Highscore theTopScoresEndless; //Stores highscores for endless
200 Highscore theTopScoresTimeTrial; //Stores highscores for timetrial
201
202 bool bMouseUp; //true if the mouse(1) is unpressed
203 bool bMouseUp2; //true if the mouse(2) is unpressed
204 bool bNewGameOpen; //show sub menues
205 bool bOptionsOpen; //Show OptionsMenu (Configure and Select Puzzle)
206 bool b1playerOpen; //show submenu
207 bool b2playersOpen; //show submenu
208 bool bReplayOpen; //Show replay menu
209 #ifdef NETWORK
210 bool bNetworkOpen; //Show the network menu
211 #endif
212 bool showHighscores; //true if highscores is displayed
213 bool showEndless; //if true show endless highscores else timetrial
214 bool showGame; //the game is active don't show highscores/options
215 bool showOptions; //true if options is open
216 bool bScreenLocked; //Don't take input or allow any mouse interaction! Used for dialogbox and warningbox
217 bool showDialog;
218 //new in 1.3.1
219 bool NoSound; //if true, absolutely no sound will be played, can be set from the commandline
220 //prevents crash on systems without a soundcard
221 //end new 1.3.1
222 bool MusicEnabled; //true if background music is enabled
223 bool SoundEnabled; //true if sound effects is enabled
224 bool bFullscreen; //true if game is running fullscreen
225 bool puzzleLoaded; //true if the puzzle levels have been loaded
226 bool drawBalls; //if true balls are drawed to the screen, this might lower framerate too much
227 bool standardBackground;
228
229 //Things for network play:
230 bool networkPlay;
231 bool networkActive;
232 Uint8 nrOfNetworkPlayers; //Up to 4 players (inkl. self)
233 bool playerAlive[4];
234 //sockets here
235 #define SERVERPORT 41780
236 #define CLIENTPORT 41781
237
238 #ifdef NETWORK
239 char serverAddress[30];
240 #endif
241
242 //should be automatically disabled if framerate to low (isn't implemented and wont be soon/ever):
243 const int ballsFpsEnable = 30; //If framerate higher -> enable balls
244 const int ballsFpsDisable = 10; //If framerate lower -> disable balls
245
246 //other ball constants:
247 const double gravity = 200.8; //acceleration
248 const double startVelocityY = 50.0;
249 const double VelocityX = 50.0;
250 const int ballSize = 16;
251 const double minVelocity = 200.0;
252
253 //global settings (reset everytime the game starts)
254 Uint8 player1Speed=0;
255 Uint8 player2Speed=0;
256 bool player1AI=false; //Is AI enabled?
257 bool player2AI=false; //Is AI enabled for player 2 (opponent in single player)
258 Uint8 player1AIlevel=3; //What level is AI? 0 min, 6 max
259 Uint8 player2AIlevel=3;
260 const Uint8 AIlevels=7; //7 possible levels: 0..6
261 Uint8 player1handicap=0;
262 Uint8 player2handicap=0;
263
264 unsigned long int currentTime; //contains the current time, so we don't call SDL_GetTickets() too often...
265
266 int xsize;
267
268 //Stores the players names (way to long, but at least no buffer overflows (max length is 16 for display reasons))
269 char player1name[30];
270 char player2name[30];
271
272 //paths
273 string stageClearSavePath;
274 string puzzleSavePath;
275 string puzzleName; //The filename of
276
277 const int nrOfStageLevels = 50; //number of stages in stage Clear
278 const int maxNrOfPuzzleStages = 50; //Maximum number of puzzle stages
279 vector<bool> stageCleared(nrOfStageLevels); //vector that tells if a stage is cleared
280 vector<bool> puzzleCleared(maxNrOfPuzzleStages); //vector that tells if puzzle cleared
281 vector<int> nrOfMovesAllowed(maxNrOfPuzzleStages); //Moves to clear
282 int puzzleLevels[maxNrOfPuzzleStages][6][12]; //Contains board layout;
283 int nrOfPuzzles; //How many are there actually?
284
285 //Old mouse position:
286 int oldMousex, oldMousey;
287 //Old Stage Clear Buble
288 int oldBubleX, oldBubleY;
289
290 //bool doublebuf = false; //if true, screen is double buffered
291 char forceredraw; //If 1: always redraw, if 2: rarely redraw
292
293 bool singlePuzzle = false; //if true we are just in a little 300x600 window
294 int singlePuzzleNr = 0;
295 string singlePuzzleFile;
296
297 #if defined(DEBUG)
298 //frame counter (fps)
299 unsigned long int Frames, Ticks;
300 char FPS[10];
301 #endif
302
303 int lastNrOfPlayers; //1 if 1 player and 2 if vs. mode
304
305 //keySetup
306 int player1keys, player2keys;
307 bool mouseplay1=false; //The mouse works on the play field
308 bool mouseplay2=false; //Same for player2
309 bool joyplay1=false; //Player one uses the joypad
310 bool joyplay2=false; //Player two uses the joypad
311
312 //Stores the controls
313 struct control
314 {
315 SDLKey up;
316 SDLKey down;
317 SDLKey left;
318 SDLKey right;
319 SDLKey change;
320 SDLKey push;
321 };
322
323 control keySettings[3]; //array to hold the controls
324
325 void MakeBackground(int,int);
326
327 void closeAllMenus()
328 {
329 bNewGameOpen=false; //show sub menues
330 bOptionsOpen=false; //Show OptionsMenu (Configure and Select Puzzle)
331 b1playerOpen=false; //show submenu
332 b2playersOpen=false;
333 bReplayOpen = false;
334 #ifdef NETWORK
335 bNetworkOpen = false;
336 #endif
337 showOptions = false;
338 showHighscores = false;
339
340 }
341
342 #ifdef WIN32
343 //Returns path to "my Documents" in windows:
344 string getMyDocumentsPath()
345 {
346 TCHAR pszPath[MAX_PATH];
347 if (SUCCEEDED(SHGetSpecialFolderPath(NULL, pszPath, CSIDL_PERSONAL, FALSE))) {
348 // pszPath is now the path that you want
349 #ifdef DEBUG
350 cout << "MyDocuments Located: " << pszPath << endl;
351 #endif
352 string theResult= pszPath;
353 return theResult;
354 }
355 else
356 {
357 cout << "Warning: My Documents not found!" << endl;
358 string theResult ="";
359 return theResult;
360 }
361 }
362
363 #endif
364
365 //If we use the SHAREDIR we need:
366 #ifdef SHAREDIR
367 SDL_Surface * IMG_Load2(char* path) {
368
369 char * tmp;
370 SDL_Surface * ret=NULL;
371 tmp = (char*)malloc (sizeof(char)*(strlen(path)+strlen(sharedir)+2));
372 strcpy(tmp, sharedir);
373 strcat(tmp, "/");
374 strcat(tmp, path);
375 #ifdef DEBUG
376 printf("loading %s\n",tmp);
377 #endif
378 if(!(ret = IMG_Load(tmp)))
379 ret = IMG_Load(path);
380
381 free(tmp);
382 return ret;
383 }
384
385 Mix_Music * Mix_LoadMUS2(char* path)
386 {
387 char * tmp;
388 Mix_Music * ret=NULL;
389 tmp = (char*)malloc (sizeof(char)*(strlen(path)+strlen(sharedir)+2));
390 strcpy(tmp, sharedir);
391 strcat(tmp, "/");
392 strcat(tmp, path);
393 #ifdef DEBUG
394 printf("loading %s\n",tmp);
395 #endif
396 if(!(ret = Mix_LoadMUS(tmp)))
397 ret = Mix_LoadMUS(path);
398
399 free(tmp);
400 return ret;
401 }
402
403 Mix_Chunk * Mix_LoadWAV2(char* path)
404 {
405 char * tmp;
406 Mix_Chunk * ret=NULL;
407 tmp = (char*)malloc (sizeof(char)*(strlen(path)+strlen(sharedir)+2));
408 strcpy(tmp, sharedir);
409 strcat(tmp, "/");
410 strcat(tmp, path);
411 #ifdef DEBUG
412 printf("loading %s\n",tmp);
413 #endif
414 if(!(ret = Mix_LoadWAV(tmp)))
415 ret = Mix_LoadWAV(path);
416
417 free(tmp);
418 return ret;
419 }
420 #else
421 SDL_Surface * IMG_Load2(char* path)
422 {
423 return IMG_Load(path);
424 }
425
426 Mix_Music * Mix_LoadMUS2(char* path)
427 {
428 return Mix_LoadMUS(path);
429 }
430
431 Mix_Chunk * Mix_LoadWAV2(char* path)
432 {
433 return Mix_LoadWAV(path);
434 }
435 #endif
436
437
438 //Load all image files to memory
439 int InitImages()
440 {
441 if (!((backgroundImage = IMG_Load2("gfx/background.png"))
442 && (background = IMG_Load2("gfx/blackBackGround.png"))
443 && (bNewGame = IMG_Load2("gfx/bNewGame.png"))
444 && (b1player = IMG_Load2("gfx/bOnePlayer.png"))
445 && (b2players = IMG_Load2("gfx/bTwoPlayers.png"))
446 && (bVsMode = IMG_Load2("gfx/bVsGame.png"))
447 && (bPuzzle = IMG_Load2("gfx/bPuzzle.png"))
448 && (bStageClear = IMG_Load2("gfx/bStageClear.png"))
449 && (bTimeTrial = IMG_Load2("gfx/bTimeTrial.png"))
450 && (bEndless = IMG_Load2("gfx/bEndless.png"))
451 && (bOptions = IMG_Load2("gfx/bOptions.png"))
452 && (bConfigure = IMG_Load2("gfx/bConfigure.png"))
453 && (bSelectPuzzle = IMG_Load2("gfx/bSelectPuzzle.png"))
454 && (bHighScore = IMG_Load2("gfx/bHighScore.png"))
455 && (bExit = IMG_Load2("gfx/bExit.png"))
456 && (bBack = IMG_Load2("gfx/bBack.png"))
457 && (bForward = IMG_Load2("gfx/bForward.png"))
458 && (bReplay = IMG_Load2("gfx/bReplays.png"))
459 && (bSave = IMG_Load2("gfx/bSave.png"))
460 && (bLoad = IMG_Load2("gfx/bLoad.png"))
461 #ifdef NETWORK
462 && (bNetwork = IMG_Load2("gfx/bNetwork.png"))
463 && (bHost = IMG_Load2("gfx/bHost.png"))
464 && (bConnect = IMG_Load2("gfx/bConnect.png"))
465 #endif
466 && (blackLine = IMG_Load2("gfx/blackLine.png"))
467 && (stageBobble = IMG_Load2("gfx/iStageClearLimit.png"))
468 && (bricks[0] = IMG_Load2("gfx/blue.png"))
469 && (bricks[1] = IMG_Load2("gfx/green.png"))
470 && (bricks[2] = IMG_Load2("gfx/purple.png"))
471 && (bricks[3] = IMG_Load2("gfx/red.png"))
472 && (bricks[4] = IMG_Load2("gfx/turkish.png"))
473 && (bricks[5] = IMG_Load2("gfx/yellow.png"))
474 && (bricks[6] = IMG_Load2("gfx/grey.png"))
475 && (crossover = IMG_Load2("gfx/crossover.png"))
476 && (balls[0] = IMG_Load2("gfx/balls/ballBlue.png"))
477 && (balls[1] = IMG_Load2("gfx/balls/ballGreen.png"))
478 && (balls[2] = IMG_Load2("gfx/balls/ballPurple.png"))
479 && (balls[3] = IMG_Load2("gfx/balls/ballRed.png"))
480 && (balls[4] = IMG_Load2("gfx/balls/ballTurkish.png"))
481 && (balls[5] = IMG_Load2("gfx/balls/ballYellow.png"))
482 && (balls[6] = IMG_Load2("gfx/balls/ballGray.png"))
483 && (cursor[0] = IMG_Load2("gfx/animations/cursor/1.png"))
484 && (cursor[1] = IMG_Load2("gfx/animations/cursor/2.png"))
485 && (bomb[0] = IMG_Load2("gfx/animations/bomb/bomb_1.png"))
486 && (bomb[1] = IMG_Load2("gfx/animations/bomb/bomb_2.png"))
487 && (ready[0] = IMG_Load2("gfx/animations/ready/ready_1.png"))
488 && (ready[1] = IMG_Load2("gfx/animations/ready/ready_2.png"))
489 && (explosion[0] = IMG_Load2("gfx/animations/explosion/0.png"))
490 && (explosion[1] = IMG_Load2("gfx/animations/explosion/1.png"))
491 && (explosion[2] = IMG_Load2("gfx/animations/explosion/2.png"))
492 && (explosion[3] = IMG_Load2("gfx/animations/explosion/3.png"))
493 && (counter[0] = IMG_Load2("gfx/counter/1.png"))
494 && (counter[1] = IMG_Load2("gfx/counter/2.png"))
495 && (counter[2] = IMG_Load2("gfx/counter/3.png"))
496 && (backBoard = IMG_Load2("gfx/BackBoard.png")) //not used, we just test if it exists :)
497 && (iGameOver = IMG_Load2("gfx/iGameOver.png"))
498 && (iWinner = IMG_Load2("gfx/iWinner.png"))
499 && (iDraw = IMG_Load2("gfx/iDraw.png"))
500 && (iLoser = IMG_Load2("gfx/iLoser.png"))
501 && (iChainBack = IMG_Load2("gfx/chainFrame.png"))
502 //&& (iBlueFont = IMG_Load2("gfx/24P_Copperplate_Blue.png"))
503 && (iBlueFont = IMG_Load2("gfx/24P_Arial_Blue.png"))
504 && (iSmallFont = IMG_Load2("gfx/14P_Arial_Angle_Red.png"))
505 && (topscoresBack = IMG_Load2("gfx/topscores.png"))
506 && (optionsBack = IMG_Load2("gfx/options.png"))
507 && (bOn = IMG_Load2("gfx/bOn.png"))
508 && (bOff = IMG_Load2("gfx/bOff.png"))
509 && (bChange = IMG_Load2("gfx/bChange.png"))
510 && (b1024 = IMG_Load2("gfx/b1024.png"))
511 //&& (b1280 = IMG_Load2("gfx/b1280.png"))
512 //&& (b1400 = IMG_Load2("gfx/b1400.png"))
513 //&& (b1600 = IMG_Load2("gfx/b1600.png"))
514 && (dialogBox = IMG_Load2("gfx/dialogbox.png"))
515 // && (fileDialogBox = IMG_Load2("gfx/fileDialogbox.png"))
516 && (iLevelCheck = IMG_Load2("gfx/iLevelCheck.png"))
517 && (iLevelCheckBox = IMG_Load2("gfx/iLevelCheckBox.png"))
518 && (iCheckBoxArea = IMG_Load2("gfx/iCheckBoxArea.png"))
519 && (boardBackBack = IMG_Load2("gfx/boardBackBack.png"))
520 && (changeButtonsBack = IMG_Load2("gfx/changeButtonsBack.png"))
521 && (garbageTL = IMG_Load2("gfx/garbage/garbageTL.png"))
522 && (garbageT = IMG_Load2("gfx/garbage/garbageT.png"))
523 && (garbageTR = IMG_Load2("gfx/garbage/garbageTR.png"))
524 && (garbageR = IMG_Load2("gfx/garbage/garbageR.png"))
525 && (garbageBR = IMG_Load2("gfx/garbage/garbageBR.png"))
526 && (garbageB = IMG_Load2("gfx/garbage/garbageB.png"))
527 && (garbageBL = IMG_Load2("gfx/garbage/garbageBL.png"))
528 && (garbageL = IMG_Load2("gfx/garbage/garbageL.png"))
529 && (garbageFill = IMG_Load2("gfx/garbage/garbageFill.png"))
530 && (garbageML = IMG_Load2("gfx/garbage/garbageML.png"))
531 && (garbageM = IMG_Load2("gfx/garbage/garbageM.png"))
532 && (garbageMR = IMG_Load2("gfx/garbage/garbageMR.png"))
533 && (garbageGM = IMG_Load2("gfx/garbage/garbageGM.png"))
534 && (garbageGML = IMG_Load2("gfx/garbage/garbageGML.png"))
535 && (garbageGMR = IMG_Load2("gfx/garbage/garbageGMR.png"))
536 && (smiley[0] = IMG_Load2("gfx/smileys/0.png"))
537 && (smiley[1] = IMG_Load2("gfx/smileys/1.png"))
538 && (smiley[2] = IMG_Load2("gfx/smileys/2.png"))
539 && (smiley[3] = IMG_Load2("gfx/smileys/3.png"))
540 && (mouse = IMG_Load2("gfx/mouse.png"))
541 ))
542 //if there was a problem ie. "File not found"
543 {
544 cout << "Error loading image file: " << SDL_GetError() << endl;
545 exit(1);
546 }
547
548
549 //Prepare for fast blittering!
550 CONVERT(background);
551 CONVERT(bNewGame);
552 CONVERT(backgroundImage);
553 CONVERT(b1player);
554 CONVERT(b2players);
555 CONVERT(bVsMode);
556 CONVERT(bPuzzle);
557 CONVERT(bStageClear);
558 CONVERT(bTimeTrial);
559 CONVERT(bEndless);
560 CONVERT(bOptions);
561 CONVERTA(bConfigure);
562 CONVERTA(bSelectPuzzle);
563 CONVERTA(bReplay);
564 CONVERTA(bSave);
565 CONVERTA(bLoad);
566 #ifdef NETWORK
567 CONVERTA(bNetwork);
568 CONVERTA(bHost);
569 CONVERTA(bConnect);
570 #endif
571 CONVERT(bHighScore);
572 CONVERTA(boardBackBack);
573 CONVERT(backBoard);
574 CONVERT(blackLine);
575 CONVERTA(changeButtonsBack);
576 CONVERTA(cursor[0]);
577 CONVERTA(cursor[1]);
578 CONVERTA(counter[0]);
579 CONVERTA(counter[1]);
580 CONVERTA(counter[2]);
581 CONVERTA(topscoresBack);
582 CONVERTA(optionsBack);
583 CONVERT(bExit);
584 CONVERT(bOn);
585 CONVERT(bOff);
586 CONVERT(bChange);
587 CONVERT(b1024);
588 CONVERTA(dialogBox);
589 // CONVERTA(fileDialogBox);
590 CONVERTA(iLevelCheck);
591 CONVERT(iLevelCheckBox);
592 CONVERTA(iCheckBoxArea);
593 for(int i = 0;i<4;i++)
594 {
595 CONVERTA(explosion[i]);
596 }
597 for(int i = 0; i<7; i++)
598 {
599 CONVERTA(bricks[i]);
600 CONVERTA(balls[i]);
601 }
602 CONVERTA(crossover);
603 CONVERTA(garbageTL);
604 CONVERTA(garbageT);
605 CONVERTA(garbageTR);
606 CONVERTA(garbageR);
607 CONVERTA(garbageBR);
608 CONVERTA(garbageB);
609 CONVERTA(garbageBL);
610 CONVERTA(garbageL);
611 CONVERTA(garbageFill);
612 CONVERTA(garbageML);
613 CONVERTA(garbageMR);
614 CONVERTA(garbageM);
615 CONVERTA(garbageGML);
616 CONVERTA(garbageGMR);
617 CONVERTA(garbageGM);
618 CONVERTA(smiley[0]);
619 CONVERTA(smiley[1]);
620 CONVERTA(smiley[2]);
621 CONVERTA(smiley[3]);
622 CONVERTA(iWinner);
623 CONVERTA(iDraw);
624 CONVERTA(iLoser);
625 CONVERTA(iChainBack);
626 CONVERTA(iBlueFont);
627 CONVERTA(iSmallFont);
628 CONVERTA(iGameOver);
629 CONVERTA(mouse);
630 CONVERTA(stageBobble);
631
632 /*
633 SDL_SetColorKey(topscoresBack, SDL_SRCCOLORKEY,
634 SDL_MapRGB(topscoresBack->format, 0, 255, 0));
635 SDL_SetColorKey(optionsBack, SDL_SRCCOLORKEY,
636 SDL_MapRGB(optionsBack->format, 0, 255, 0));
637 */
638
639 //Here comes the fonts:
640 fBlueFont = SFont_InitFont(iBlueFont);
641 fSmallFont = SFont_InitFont(iSmallFont);
642
643 //Loads the sound if sound present
644 if(!NoSound)
645 {
646 //And here the music:
647 bgMusic = Mix_LoadMUS2("music/bgMusic.ogg");
648 //the music... we just hope it exists, else the user won't hear anything
649 //Same goes for the sounds
650 boing = Mix_LoadWAV2("sound/pop.ogg");
651 timesUp = Mix_LoadWAV2("sound/whistleblow.ogg");
652 applause = Mix_LoadWAV2("sound/applause.ogg");
653 photoClick = Mix_LoadWAV2("sound/cameraclick.ogg");
654 heartBeat = Mix_LoadWAV2("sound/heartbeat3.ogg");
655 typingChunk = Mix_LoadWAV2("sound/typing.ogg");
656 counterChunk = Mix_LoadWAV2("sound/counter.ogg");
657 } //All sound has been loaded or not
658 return 0;
659 } //InitImages()
660
661
662 //Unload images and fonts and sounds
663 void UnloadImages()
664 {
665 //Fonts and Sounds needs to be freed
666 SFont_FreeFont(fBlueFont);
667 SFont_FreeFont(fSmallFont);
668 if(!NoSound) //Only unload then it has been loaded!
669 {
670 Mix_FreeMusic(bgMusic);
671 Mix_FreeChunk(boing);
672 Mix_FreeChunk(timesUp);
673 Mix_FreeChunk(applause);
674 Mix_FreeChunk(photoClick);
675 Mix_FreeChunk(heartBeat);
676 Mix_FreeChunk(counterChunk);
677 Mix_FreeChunk(typingChunk);
678 }
679 //Free surfaces:
680 //I think this will crash, at least it happend to me...
681 /*SDL_FreeSurface(backgroundImage);
682 SDL_FreeSurface(background);
683 SDL_FreeSurface(bNewGame);
684 SDL_FreeSurface(b1player);
685 SDL_FreeSurface(b2players);
686 SDL_FreeSurface(bVsMode);
687 SDL_FreeSurface(bPuzzle);
688 SDL_FreeSurface(bStageClear);
689 SDL_FreeSurface(bTimeTrial);
690 SDL_FreeSurface(bEndless);
691 SDL_FreeSurface(bOptions);
692 SDL_FreeSurface(bConfigure);
693 SDL_FreeSurface(bSelectPuzzle);
694 SDL_FreeSurface(bHighScore);
695 SDL_FreeSurface(bReplay);
696 SDL_FreeSurface(bSave);
697 SDL_FreeSurface(bLoad);
698 #ifdef NETWORK
699 SDL_FreeSurface(bNetwork);
700 SDL_FreeSurface(bHost);
701 SDL_FreeSurface(bConnect);
702 #endif
703 SDL_FreeSurface(bExit);
704 SDL_FreeSurface(blackLine);
705 SDL_FreeSurface(stageBobble);
706 SDL_FreeSurface(bricks[0]);
707 SDL_FreeSurface(bricks[1]);
708 SDL_FreeSurface(bricks[2]);
709 SDL_FreeSurface(bricks[3]);
710 SDL_FreeSurface(bricks[4]);
711 SDL_FreeSurface(bricks[5]);
712 SDL_FreeSurface(bricks[6]);
713 SDL_FreeSurface(crossover);
714 SDL_FreeSurface(balls[0]);
715 SDL_FreeSurface(balls[1]);
716 SDL_FreeSurface(balls[2]);
717 SDL_FreeSurface(balls[3]);
718 SDL_FreeSurface(balls[4]);
719 SDL_FreeSurface(balls[5]);
720 SDL_FreeSurface(balls[6]);
721 SDL_FreeSurface(cursor[0]);
722 SDL_FreeSurface(cursor[1]);
723 SDL_FreeSurface(backBoard); //not used, we just test if it exists :)
724 SDL_FreeSurface(iGameOver);
725 SDL_FreeSurface(iWinner);
726 SDL_FreeSurface(iDraw);
727 SDL_FreeSurface(iLoser);
728 SDL_FreeSurface(iChainBack);
729 SDL_FreeSurface(iBlueFont);
730 SDL_FreeSurface(iSmallFont);
731 SDL_FreeSurface(topscoresBack);
732 SDL_FreeSurface(optionsBack);
733 SDL_FreeSurface(bOn);
734 SDL_FreeSurface(bOff);
735 SDL_FreeSurface(bChange);
736 SDL_FreeSurface(b1024);
737 SDL_FreeSurface(b1280);
738 SDL_FreeSurface(b1400);
739 SDL_FreeSurface(b1600);
740 SDL_FreeSurface(dialogBox);
741 SDL_FreeSurface(fileDialogBox);
742 SDL_FreeSurface(iLevelCheck);
743 SDL_FreeSurface(iLevelCheckBox);
744 SDL_FreeSurface(iCheckBoxArea);
745 SDL_FreeSurface(boardBackBack);
746 SDL_FreeSurface(changeButtonsBack);
747 SDL_FreeSurface(garbageTL);
748 SDL_FreeSurface(garbageT);
749 SDL_FreeSurface(garbageTR);
750 SDL_FreeSurface(garbageR);
751 SDL_FreeSurface(garbageBR);
752 SDL_FreeSurface(garbageB);
753 SDL_FreeSurface(garbageBL);
754 SDL_FreeSurface(garbageL);
755 SDL_FreeSurface(garbageFill);
756 SDL_FreeSurface(garbageML);
757 SDL_FreeSurface(garbageM);
758 SDL_FreeSurface(garbageMR);
759 SDL_FreeSurface(garbageGML);
760 SDL_FreeSurface(garbageGM);
761 SDL_FreeSurface(garbageGMR);
762 SDL_FreeSurface(smiley[0]);
763 SDL_FreeSurface(smiley[1]);
764 SDL_FreeSurface(smiley[2]);
765 SDL_FreeSurface(smiley[3]);
766 SDL_FreeSurface(mouse);
767 */
768 }
769
770 //Function to convert numbers to string
771 string itoa(int num)
772 {
773 stringstream converter;
774 converter << num;
775 return converter.str();
776 }
777
778 /*Loads all the puzzle levels*/
779 int LoadPuzzleStages()
780 {
781 //if(puzzleLoaded)
782 // return 1;
783 #ifdef __unix__
784 string filename0 = (string)getenv("HOME")+(string)"/.gamesaves/blockattack/puzzles/";
785 filename0 = filename0+puzzleName;
786 if(singlePuzzle)
787 filename0 = singlePuzzleFile;
788 #endif //__unix__
789 #ifdef SHAREDIR
790 string filename = (string)SHAREDIR+(string)"/res/";
791 filename = filename+puzzleName;
792 #else
793 string filename = "res/"+puzzleName;
794 #endif
795 #ifdef __unix__
796 ifstream inFile(filename0.c_str());
797 if(!inFile)
798 inFile.open(filename.c_str());
799 #else
800 ifstream inFile(filename.c_str());
801 #endif
802 inFile >> nrOfPuzzles;
803 if(nrOfPuzzles>maxNrOfPuzzleStages)
804 nrOfPuzzles=maxNrOfPuzzleStages;
805 for(int k=0; (k<nrOfPuzzles)&&(!inFile.eof()); k++)
806 {
807 inFile >> nrOfMovesAllowed[k];
808 for(int i=11;i>=0;i--)
809 for(int j=0;j<6;j++)
810 {
811 inFile >> puzzleLevels[k][j][i];
812 }
813 }
814 puzzleLoaded = true;
815 return 0;
816 }
817
818 /*Draws a image from on a given Surface. Takes source image, destination surface and coordinates*/
819 inline void DrawIMG(SDL_Surface *img, SDL_Surface *target, int x, int y)
820 {
821 SDL_Rect dest;
822 dest.x = x;
823 dest.y = y;
824 SDL_BlitSurface(img, NULL, target, &dest);
825 }
826
827 /*Draws a part of an image on a surface of choice*/
828 void DrawIMG(SDL_Surface *img, SDL_Surface * target, int x, int y, int w, int h, int x2, int y2)
829 {
830 SDL_Rect dest;
831 dest.x = x;
832 dest.y = y;
833 SDL_Rect dest2;
834 dest2.x = x2;
835 dest2.y = y2;
836 dest2.w = w;
837 dest2.h = h;
838 SDL_BlitSurface(img, &dest2, target, &dest);
839 }
840
841 //The small things that are faaling when you clear something
842 class aBall
843 {
844 private:
845 double x;
846 double y;
847 double velocityY;
848 double velocityX;
849 int color;
850 unsigned long int lastTime;
851 public:
852
853 aBall()
854 {}
855
856 //constructor:
857 aBall(int X, int Y, bool right, int coulor)
858 {
859 double tal = 1.0;
860 velocityY = -tal*startVelocityY;
861 lastTime = currentTime;
862 x = (double)X;
863 y = (double)Y;
864 color = coulor;
865 if(right)
866 velocityX = tal*VelocityX;
867 else
868 velocityX = -tal*VelocityX;
869 } //constructor
870
871 //Deconstructor
872 ~aBall()
873 {
874 } //Deconstructor
875
876 void update()
877 {
878 double timePassed = (((double)(currentTime-lastTime))/1000.0); //time passed in seconds
879 x = x+timePassed*velocityX;
880 y = y+timePassed*velocityY;
881 velocityY = velocityY + gravity*timePassed;
882 if(y<1.0)
883 velocityY=10.0;
884 if((velocityY>minVelocity) && (y>(double)(768-ballSize)) && (y<768.0))
885 {
886 velocityY = -0.70*velocityY;
887 y = 768.0-ballSize;
888 }
889 lastTime = currentTime;
890 }
891
892 int getX()
893 {
894 return (int)x;
895 }
896
897 int getY()
898 {
899 return (int)y;
900 }
901
902 int getColor()
903 {
904 return color;
905 }
906 }; //aBall
907
908 const int maxNumberOfBalls = 100;
909
910 class ballManeger
911 {
912 public:
913 aBall ballArray[maxNumberOfBalls];
914 bool ballUsed[maxNumberOfBalls];
915 //The old ball information is also saved so balls can be deleted!
916 aBall oldBallArray[maxNumberOfBalls];
917 bool oldBallUsed[maxNumberOfBalls];
918
919 ballManeger()
920 {
921 for(int i=0; i<maxNumberOfBalls; i++)
922 {
923 ballUsed[i] = false;
924 oldBallUsed[i] = false;
925 }
926 }
927
928 int addBall(int x, int y,bool right,int color)
929 {
930 //cout << "Tries to add a ball" << endl;
931 int ballNumber = 0;
932 while((ballUsed[ballNumber])&&(ballNumber<maxNumberOfBalls))
933 ballNumber++;
934 if(ballNumber==maxNumberOfBalls)
935 return -1;
936 currentTime = SDL_GetTicks();
937 ballArray[ballNumber] = aBall(x,y,right,color);
938 ballUsed[ballNumber] = true;
939 //cout << "Ball added" << endl;
940 return 1;
941 } //addBall
942
943 void update()
944 {
945 currentTime = SDL_GetTicks();
946 for(int i = 0; i<maxNumberOfBalls; i++)
947 {
948
949 if(ballUsed[i])
950 {
951 oldBallUsed[i] = true;
952 oldBallArray[i] = ballArray[i];
953 ballArray[i].update();
954 if(ballArray[i].getY()>800)
955 {
956 ballArray[i].~aBall();
957 ballUsed[i] = false;
958 //cout << "Ball removed" << endl;
959 }
960 }
961 else
962 {
963 oldBallUsed[i] = false;
964 }
965 }
966 } //update
967
968
969 }; //theBallManeger
970
971 ballManeger theBallManeger;
972
973 //a explosions, non moving
974 class anExplosion
975 {
976 private:
977 int x;
978 int y;
979 Uint8 frameNumber;
980 #define frameLength 80
981 //How long an image in an animation should be showed
982 #define maxFrame 4
983 //How many images there are in the animation
984 unsigned long int placeTime; //Then the explosion occored
985 public:
986
987 anExplosion()
988 {}
989
990 //constructor:
991 anExplosion(int X, int Y)
992 {
993 placeTime = currentTime;
994 x = X;
995 y = Y;
996 frameNumber=0;
997 } //constructor
998
999 //Deconstructor
1000 ~anExplosion()
1001 {
1002 } //Deconstructor
1003
1004 //true if animation has played and object should be removed from the screen
1005 bool removeMe()
1006 {
1007 frameNumber = (currentTime-placeTime)/frameLength;
1008 return (!(frameNumber<maxFrame));
1009 }
1010
1011 int getX()
1012 {
1013 return (int)x;
1014 }
1015
1016 int getY()
1017 {
1018 return (int)y;
1019 }
1020
1021 int getFrame()
1022 {
1023 return frameNumber;
1024 }
1025 }; //nExplosion
1026
1027 class explosionManeger
1028 {
1029 public:
1030 anExplosion explosionArray[maxNumberOfBalls];
1031 bool explosionUsed[maxNumberOfBalls];
1032 //The old explosion information is also saved so explosions can be deleted!
1033 anExplosion oldExplosionArray[maxNumberOfBalls];
1034 bool oldExplosionUsed[maxNumberOfBalls];
1035
1036 explosionManeger()
1037 {
1038 for(int i=0; i<maxNumberOfBalls; i++)
1039 {
1040 explosionUsed[i] = false;
1041 oldExplosionUsed[i] = false;
1042 }
1043 }
1044
1045 int addExplosion(int x, int y)
1046 {
1047 //cout << "Tries to add an explosion" << endl;
1048 int explosionNumber = 0;
1049 while((explosionUsed[explosionNumber])&&(explosionNumber<maxNumberOfBalls))
1050 explosionNumber++;
1051 if(explosionNumber==maxNumberOfBalls)
1052 return -1;
1053 currentTime = SDL_GetTicks();
1054 explosionArray[explosionNumber] = anExplosion(x,y);
1055 explosionUsed[explosionNumber] = true;
1056 //cout << "Explosion added" << endl;
1057 return 1;
1058 } //addBall
1059
1060 void update()
1061 {
1062 currentTime = SDL_GetTicks();
1063 for(int i = 0; i<maxNumberOfBalls; i++)
1064 {
1065
1066 if(explosionUsed[i])
1067 {
1068 oldExplosionUsed[i] = true;
1069 oldExplosionArray[i] = explosionArray[i];
1070 if(explosionArray[i].removeMe())
1071 {
1072 explosionArray[i].~anExplosion();
1073 explosionUsed[i] = false;
1074 //cout << "Explosion removed" << endl;
1075 }
1076 }
1077 else
1078 {
1079 oldExplosionUsed[i] = false;
1080 }
1081 }
1082 } //update
1083
1084
1085 }; //explosionManeger
1086
1087 explosionManeger theExplosionManeger;
1088
1089 //text pop-up
1090 class textMessage
1091 {
1092 private:
1093 int x;
1094 int y;
1095 char textt[10];
1096 unsigned long int time;
1097 unsigned long int placeTime; //Then the text was placed
1098 public:
1099
1100 textMessage()
1101 {}
1102
1103 //constructor:
1104 textMessage(int X, int Y,const char* Text,unsigned int Time)
1105 {
1106 //cout << "Running constructor" << endl;
1107 placeTime = currentTime;
1108 x = X;
1109 y = Y;
1110 strncpy(textt,Text,10);
1111 textt[9]=0;
1112 time = Time;
1113 //cout << "Constructor runned" << endl;
1114 } //constructor
1115
1116 //true if the text has expired
1117 bool removeMe()
1118 {
1119 return currentTime-placeTime>time;
1120 }
1121
1122 int getX()
1123 {
1124 //cout << "Gets X" << endl;
1125 return x;
1126 }
1127
1128 int getY()
1129 {
1130 //cout << "Gets Y" << endl;
1131 return y;
1132 }
1133
1134 char* getText()
1135 {
1136 //cout << "Gets text" << endl;
1137 return textt;
1138 }
1139 }; //text popup
1140
1141 class textManeger
1142 {
1143 public:
1144 textMessage textArray[maxNumberOfBalls];
1145 bool textUsed[maxNumberOfBalls];
1146 //The old text information is also saved so text can be deleted!
1147 textMessage oldTextArray[maxNumberOfBalls];
1148 bool oldTextUsed[maxNumberOfBalls];
1149
1150 textManeger()
1151 {
1152 for(int i=0; i<maxNumberOfBalls; i++)
1153 {
1154 textUsed[i] = false;
1155 oldTextUsed[i] = false;
1156 }
1157 }
1158
1159 int addText(int x, int y,string Text,unsigned int Time)
1160 {
1161 //cout << "Tries to add text" << endl;
1162 int textNumber = 0;
1163 while((textNumber<maxNumberOfBalls)&&((textUsed[textNumber])||(oldTextUsed[textNumber])))
1164 textNumber++;
1165 if(textNumber==maxNumberOfBalls)
1166 return -1;
1167 //cout << "adding to: " << textNumber << ":" << textUsed[textNumber] << ":" << &textArray[textNumber] << endl;
1168 currentTime = SDL_GetTicks();
1169 //if(&textArray[textNumber]!=NULL)
1170 //*textArray[textNumber]=0;
1171 textArray[textNumber] = textMessage(x,y,Text.c_str(),Time);
1172 textUsed[textNumber] = true;
1173 //cout << "Text added" << endl;
1174 return 1;
1175 } //addText
1176
1177 void update()
1178 {
1179 //cout << "Running update" << endl;
1180 currentTime = SDL_GetTicks();
1181 for(int i = 0; i<maxNumberOfBalls; i++)
1182 {
1183
1184 if(textUsed[i])
1185 {
1186 if(!oldTextUsed[i])
1187 {
1188 oldTextUsed[i] = true;
1189 oldTextArray[i] = textMessage(textArray[i]);
1190 }
1191 if(textArray[i].removeMe())
1192 {
1193 textArray[i].~textMessage();
1194 textUsed[i] = false;
1195 }
1196 }
1197 else
1198 if(oldTextUsed[i])
1199 {
1200 oldTextUsed[i] = false;
1201 oldTextArray[i].~textMessage();
1202 }
1203 }
1204 } //update
1205
1206
1207 }; //textManeger
1208
1209 textManeger theTextManeger;
1210
1211 //Here comes the Block Game object
1212 #include "BlockGame.hpp"
1213
1214 //writeScreenShot saves the screen as a bmp file, it uses the time to get a unique filename
1215 void writeScreenShot()
1216 {
1217 cout << "Saving screenshot" << endl;
1218 int rightNow = (int)time(NULL);
1219 #if defined(__unix__)
1220 char buf[514];
1221 sprintf( buf, "%s/.gamesaves/blockattack/screenshots/screenshot%i.bmp", getenv("HOME"), rightNow );
1222 #else
1223 char buf[MAX_PATH];
1224 sprintf( buf, "%s\\My Games\\blockattack\\screenshots\\screenshot%i.bmp", (getMyDocumentsPath()).c_str(), rightNow );
1225 #endif
1226 SDL_SaveBMP( screen, buf );
1227 if(!NoSound)
1228 if(SoundEnabled)Mix_PlayChannel(1,photoClick,0);
1229 }
1230
1231 //Draws the highscores
1232 inline void DrawHighscores(int x, int y)
1233 {
1234 DrawIMG(topscoresBack,screen,x,y);
1235 if(showEndless) SFont_Write(screen,fBlueFont,x+100,y+100,"Endless:");
1236 else SFont_Write(screen,fBlueFont,x+100,y+100,"Time Trial:");
1237 for(int i =0;i<10;i++)
1238 {
1239 char playerScore[32];
1240 char playerName[32];
1241 if(showEndless) sprintf(playerScore, "%i", theTopScoresEndless.getScoreNumber(i));
1242 else sprintf(playerScore, "%i", theTopScoresTimeTrial.getScoreNumber(i));
1243 if(showEndless) strcpy(playerName,theTopScoresEndless.getScoreName(i));
1244 else strcpy(playerName,theTopScoresTimeTrial.getScoreName(i));
1245 SFont_Write(screen,fBlueFont,x+420,y+150+i*35,playerScore);
1246 SFont_Write(screen,fBlueFont,x+60,y+150+i*35,playerName);
1247 }
1248 }
1249
1250 char keyname[11];
1251
1252 //Function to return the name of a key, to be displayed...
1253 char* getKeyName(SDLKey key)
1254 {
1255
1256 char charToPut = '\0';
1257 switch(key)
1258 {
1259 case SDLK_a: charToPut = 'A'; break;
1260 case SDLK_b: charToPut = 'B'; break;
1261 case SDLK_c: charToPut = 'C'; break;
1262 case SDLK_d: charToPut = 'D'; break;
1263 case SDLK_e: charToPut = 'E'; break;
1264 case SDLK_f: charToPut = 'F'; break;
1265 case SDLK_g: charToPut = 'G'; break;
1266 case SDLK_h: charToPut = 'H'; break;
1267 case SDLK_i: charToPut = 'I'; break;
1268 case SDLK_j: charToPut = 'J'; break;
1269 case SDLK_k: charToPut = 'K'; break;
1270 case SDLK_l: charToPut = 'L'; break;
1271 case SDLK_m: charToPut = 'M'; break;
1272 case SDLK_n: charToPut = 'N'; break;
1273 case SDLK_o: charToPut = 'O'; break;
1274 case SDLK_p: charToPut = 'P'; break;
1275 case SDLK_q: charToPut = 'Q'; break;
1276 case SDLK_r: charToPut = 'R'; break;
1277 case SDLK_s: charToPut = 'S'; break;
1278 case SDLK_t: charToPut = 'T'; break;
1279 case SDLK_u: charToPut = 'U'; break;
1280 case SDLK_v: charToPut = 'V'; break;
1281 case SDLK_w: charToPut = 'W'; break;
1282 case SDLK_x: charToPut = 'X'; break;
1283 case SDLK_y: charToPut = 'Y'; break;
1284 case SDLK_z: charToPut = 'Z'; break;
1285 case SDLK_0: charToPut = '0'; break;
1286 case SDLK_1: charToPut = '1'; break;
1287 case SDLK_2: charToPut = '2'; break;
1288 case SDLK_3: charToPut = '3'; break;
1289 case SDLK_4: charToPut = '4'; break;
1290 case SDLK_5: charToPut = '5'; break;
1291 case SDLK_6: charToPut = '6'; break;
1292 case SDLK_7: charToPut = '7'; break;
1293 case SDLK_8: charToPut = '8'; break;
1294 case SDLK_9: charToPut = '9'; break;
1295 case SDLK_KP0: sprintf(keyname,"NP_0"); break;
1296 case SDLK_KP1: sprintf(keyname,"NP_1"); break;
1297 case SDLK_KP2: sprintf(keyname,"NP_2"); break;
1298 case SDLK_KP3: sprintf(keyname,"NP_3"); break;
1299 case SDLK_KP4: sprintf(keyname,"NP_4"); break;
1300 case SDLK_KP5: sprintf(keyname,"NP_5"); break;
1301 case SDLK_KP6: sprintf(keyname,"NP_6"); break;
1302 case SDLK_KP7: sprintf(keyname,"NP_7"); break;
1303 case SDLK_KP8: sprintf(keyname,"NP_8"); break;
1304 case SDLK_KP9: sprintf(keyname,"NP_9"); break;
1305 case SDLK_BACKSPACE: sprintf(keyname,"Backspace"); break;
1306 case SDLK_TAB: sprintf(keyname,"Tab"); break;
1307 case SDLK_CLEAR: sprintf(keyname,"Clear"); break;
1308 case SDLK_RETURN: sprintf(keyname,"Return"); break;
1309 case SDLK_PAUSE: sprintf(keyname,"Pause"); break;
1310 case SDLK_SPACE: sprintf(keyname,"Space"); break;
1311 case SDLK_EXCLAIM: charToPut = '!'; break;
1312 case SDLK_QUOTEDBL: sprintf(keyname,"QuoteDBL"); break;
1313 case SDLK_HASH: charToPut = '#'; break;
1314 case SDLK_DOLLAR: sprintf(keyname,"$"); break;
1315 case SDLK_ASTERISK: sprintf(keyname,"Asterisk"); break;
1316 case SDLK_PLUS: sprintf(keyname,"Plus"); break;
1317 case SDLK_COMMA: sprintf(keyname,"Comma"); break;
1318 case SDLK_MINUS: sprintf(keyname,"Minus"); break;
1319 case SDLK_PERIOD: sprintf(keyname,"Period"); break;
1320 case SDLK_SLASH: charToPut ='/'; break;
1321 case SDLK_COLON: sprintf(keyname,"Colon"); break;
1322 case SDLK_SEMICOLON: sprintf(keyname,"SemiColon"); break;
1323 case SDLK_LESS: charToPut = '<'; break;
1324 case SDLK_EQUALS: sprintf(keyname,"Equals"); break;
1325 case SDLK_DELETE: sprintf(keyname,"Delete"); break;
1326 case SDLK_KP_PERIOD: sprintf(keyname,"NPperiod"); break;
1327 case SDLK_KP_DIVIDE: sprintf(keyname,"NPdivide"); break;
1328 case SDLK_KP_MULTIPLY: sprintf(keyname,"NPmultiply"); break;
1329 case SDLK_KP_MINUS: sprintf(keyname,"NPminus"); break;
1330 case SDLK_KP_PLUS: sprintf(keyname,"NPplus"); break;
1331 case SDLK_KP_ENTER: sprintf(keyname,"NP_Enter"); break;
1332 case SDLK_KP_EQUALS: sprintf(keyname,"NP="); break;
1333 case SDLK_UP: sprintf(keyname,"UP"); break;
1334 case SDLK_DOWN: sprintf(keyname,"DOWN"); break;
1335 case SDLK_RIGHT: sprintf(keyname,"RIGHT"); break;
1336 case SDLK_LEFT: sprintf(keyname,"LEFT"); break;
1337 case SDLK_INSERT: sprintf(keyname,"Insert"); break;
1338 case SDLK_HOME: sprintf(keyname,"Home"); break;
1339 case SDLK_END: sprintf(keyname,"End"); break;
1340 case SDLK_PAGEUP: sprintf(keyname,"PageUp"); break;
1341 case SDLK_PAGEDOWN: sprintf(keyname,"PageDown"); break;
1342 case SDLK_NUMLOCK: sprintf(keyname,"NumLock"); break;
1343 case SDLK_CAPSLOCK: sprintf(keyname,"CapsLock"); break;
1344 case SDLK_SCROLLOCK: sprintf(keyname,"ScrolLock"); break;
1345 case SDLK_RSHIFT: sprintf(keyname,"Rshift"); break;
1346 case SDLK_LSHIFT: sprintf(keyname,"Lshift"); break;
1347 case SDLK_RCTRL: sprintf(keyname,"Rctrl"); break;
1348 case SDLK_LCTRL: sprintf(keyname,"Lctrl"); break;
1349 case SDLK_RALT: sprintf(keyname,"Ralt"); break;
1350 case SDLK_LALT: sprintf(keyname,"Lalt"); break;
1351 case SDLK_RMETA: sprintf(keyname,"Rmeta"); break;
1352 case SDLK_LMETA: sprintf(keyname,"Lmeta"); break;
1353 case SDLK_LSUPER: sprintf(keyname,"Lwin"); break;
1354 case SDLK_RSUPER: sprintf(keyname,"Rwin"); break;
1355 case SDLK_MODE: sprintf(keyname,"Mode"); break;
1356 case SDLK_HELP: sprintf(keyname,"Help"); break;
1357 default:
1358 sprintf(keyname,"Unknown"); break;
1359 }
1360 if(charToPut != '\0')
1361 sprintf(keyname,"%c",charToPut);
1362 return &keyname[0];
1363 }
1364
1365 void MakeBackground(int xsize,int ysize,BlockGame &theGame, BlockGame &theGame2);
1366
1367 int OpenControlsBox(int x, int y, int player)
1368 {
1369 int mousex, mousey;
1370 Uint8 *keys;
1371 bool done =false;
1372 char *keyname;
1373 MakeBackground(1024,768);
1374 while(!done)
1375 {
1376 SDL_Delay(10);
1377 DrawIMG(background, screen, 0, 0);
1378 DrawIMG(changeButtonsBack,screen,x,y);
1379 if(player == 0)
1380 SFont_Write(screen,fBlueFont,x+40,y+2,"Player 1 keys");
1381 else
1382 SFont_Write(screen,fBlueFont,x+40,y+2,"Player 2 keys");
1383 SFont_Write(screen,fBlueFont,x+6,y+50,"Up");
1384 keyname = getKeyName(keySettings[player].up);
1385 SFont_Write(screen,fBlueFont,x+200,y+50,keyname);
1386 SFont_Write(screen,fBlueFont,x+6,y+100,"Down");
1387 keyname = getKeyName(keySettings[player].down);
1388 SFont_Write(screen,fBlueFont,x+200,y+100,keyname);
1389 SFont_Write(screen,fBlueFont,x+6,y+150,"Left");
1390 keyname = getKeyName(keySettings[player].left);
1391 SFont_Write(screen,fBlueFont,x+200,y+150,keyname);
1392 SFont_Write(screen,fBlueFont,x+6,y+200,"Right");
1393 keyname = getKeyName(keySettings[player].right);
1394 SFont_Write(screen,fBlueFont,x+200,y+200,keyname);
1395 SFont_Write(screen,fBlueFont,x+6,y+250,"Push");
1396 keyname = getKeyName(keySettings[player].push);
1397 SFont_Write(screen,fBlueFont,x+200,y+250,keyname);
1398 SFont_Write(screen,fBlueFont,x+6,y+300,"Change");
1399 keyname = getKeyName(keySettings[player].change);
1400 SFont_Write(screen,fBlueFont,x+200,y+300,keyname);
1401 //Ask for mouse play
1402 SFont_Write(screen,fBlueFont,x+6,y+350,"Mouse play?");
1403 DrawIMG(iLevelCheckBox,screen,x+220,y+350);
1404 if(((player==0)&&(mouseplay1))||((player==2)&&(mouseplay2)))
1405 DrawIMG(iLevelCheck,screen,x+220,y+350); //iLevelCheck witdh is 42
1406 //Ask for joypad play
1407 SFont_Write(screen,fBlueFont,x+300,y+350,"Joypad?");
1408 DrawIMG(iLevelCheckBox,screen,x+460,y+350);
1409 if(((player==0)&&(joyplay1))||((player==2)&&(joyplay2)))
1410 DrawIMG(iLevelCheck,screen,x+460,y+350); //iLevelCheck witdh is 42
1411 for(int i=1; i<7; i++)
1412 DrawIMG(bChange,screen,x+420,y+50*i);
1413 SDL_Event event;
1414
1415 while(SDL_PollEvent(&event))
1416 {
1417 if ( event.type == SDL_QUIT ) {done = true;}
1418
1419 if(event.type == SDL_KEYDOWN)
1420 {
1421 if (event.key.keysym.sym == SDLK_ESCAPE)
1422 done = true;
1423 }
1424 } //PollEvent
1425
1426 keys = SDL_GetKeyState(NULL);
1427
1428 SDL_GetMouseState(&mousex,&mousey);
1429
1430 // If the mouse button is released, make bMouseUp equal true
1431 if(!SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(1))
1432 {
1433 bMouseUp=true;
1434 }
1435
1436 if(SDL_GetMouseState(NULL,NULL)&SDL_BUTTON(1) && bMouseUp)
1437 {
1438 bMouseUp = false;
1439
1440 if((mousex>(420+x)) && (mousex<(540+x)) && (mousey>(50+y)) && (mousey<(90+y)))
1441 {
1442 //up
1443 bool finnish = false;
1444 while(!finnish)
1445 while ( SDL_PollEvent(&event) )
1446 {
1447 if(event.type == SDL_KEYDOWN)
1448 {
1449 if(event.key.keysym.sym != SDLK_ESCAPE)
1450 keySettings[player].up = event.key.keysym.sym;
1451 finnish = true;
1452 }
1453 }
1454 } //up
1455 if((mousex>(420+x)) && (mousex<(540+x)) && (mousey>(100+y)) && (mousey<(140+y)))
1456 {
1457 //down
1458 bool finnish = false;
1459 while(!finnish)
1460 while ( SDL_PollEvent(&event) )
1461 {
1462 if(event.type == SDL_KEYDOWN)
1463 {
1464 if(event.key.keysym.sym != SDLK_ESCAPE)
1465 keySettings[player].down = event.key.keysym.sym;
1466 finnish = true;
1467 }
1468 }
1469 } //down
1470 if((mousex>(420+x)) && (mousex<(540+x)) && (mousey>(150+y)) && (mousey<(190+y)))
1471 {
1472 //left
1473 bool finnish = false;
1474 while(!finnish)
1475 while ( SDL_PollEvent(&event) )
1476 {
1477 if(event.type == SDL_KEYDOWN)
1478 {
1479 if(event.key.keysym.sym != SDLK_ESCAPE)
1480 keySettings[player].left = event.key.keysym.sym;
1481 finnish = true;
1482 }
1483 }
1484 } //left
1485 if((mousex>(420+x)) && (mousex<(540+x)) && (mousey>(200+y)) && (mousey<(240+y)))
1486 {
1487 //right
1488 bool finnish = false;
1489 while(!finnish)
1490 while ( SDL_PollEvent(&event) )
1491 {
1492 if(event.type == SDL_KEYDOWN)
1493 {
1494 if(event.key.keysym.sym != SDLK_ESCAPE)
1495 keySettings[player].right = event.key.keysym.sym;
1496 finnish = true;
1497 }
1498 }
1499 } //right
1500 if((mousex>(420+x)) && (mousex<(540+x)) && (mousey>(250+y)) && (mousey<(290+y)))
1501 {
1502 //push
1503 bool finnish = false;
1504 while(!finnish)
1505 while ( SDL_PollEvent(&event) )
1506 {
1507 if(event.type == SDL_KEYDOWN)
1508 {
1509 if(event.key.keysym.sym != SDLK_ESCAPE)
1510 keySettings[player].push = event.key.keysym.sym;
1511 finnish = true;
1512 }
1513 }
1514 } //push
1515 if((mousex>(420+x)) && (mousex<(540+x)) && (mousey>(300+y)) && (mousey<(340+y)))
1516 {
1517 //change
1518 bool finnish = false;
1519 while(!finnish)
1520 while ( SDL_PollEvent(&event) )
1521 {
1522 if(event.type == SDL_KEYDOWN)
1523 {
1524 if(event.key.keysym.sym != SDLK_ESCAPE)
1525 keySettings[player].change = event.key.keysym.sym;
1526 finnish = true;
1527 }
1528 }
1529 } //change
1530 //mouseplay:
1531 if((mousex>(220+x)) && (mousex<(262+x)) && (mousey>(350+y)) && (mousey<(392+y)))
1532 {
1533 if (player==0)
1534 {
1535 mouseplay1 = !mouseplay1;
1536 }
1537 else
1538 {
1539 mouseplay2 = !mouseplay2;
1540 }
1541 }
1542 //Joyplay:
1543 if((mousex>(460+x)) && (mousex<(502+x)) && (mousey>(350+y)) && (mousey<(392+y)))
1544 {
1545 if (player==0)
1546 {
1547 joyplay1 = !joyplay1;
1548 }
1549 else
1550 {
1551 joyplay2 = !joyplay2;
1552 }
1553 }
1554 } //get mouse state
1555
1556 DrawIMG(mouse,screen,mousex,mousey);
1557 SDL_Flip(screen);
1558 } //while !done
1559 DrawIMG(background, screen, 0, 0);
1560 return 0;
1561 }
1562
1563
1564 //Dialogbox
1565 bool OpenDialogbox(int x, int y, char *name)
1566 {
1567 bool done = false; //We are done!
1568 bool accept = false; //New name is accepted! (not Cancelled)
1569 bool repeating = false; //The key is being held (BACKSPACE)
1570 const int repeatDelay = 200; //Repeating
1571 unsigned long time = 0;
1572 ReadKeyboard rk = ReadKeyboard(name);
1573 Uint8* keys;
1574 string strHolder;
1575 MakeBackground(1024,768);
1576 DrawIMG(background,screen,0,0);
1577 while(!done)
1578 {
1579 DrawIMG(dialogBox,screen,x,y);
1580 SFont_Write(screen,fBlueFont,x+40,y+72,rk.GetString());
1581 strHolder = rk.GetString();
1582 //cout << "hej\n" << (int)rk.CharsBeforeCursor() << endl;
1583 strHolder.erase((int)rk.CharsBeforeCursor());
1584
1585 if(((SDL_GetTicks()/600)%2)==1)
1586 SFont_Write(screen,fBlueFont,x+40+SFont_TextWidth(fBlueFont,strHolder.c_str()),y+69,"|");
1587
1588 SDL_Event event;
1589
1590 while ( SDL_PollEvent(&event) )
1591 {
1592 if ( event.type == SDL_QUIT ) { done = true; accept = false; }
1593
1594 if ( event.type == SDL_KEYDOWN )
1595 {
1596 if ( (event.key.keysym.sym == SDLK_RETURN)||(event.key.keysym.sym == SDLK_KP_ENTER) ) { done = true; accept = true;}
1597 else
1598 if ( (event.key.keysym.sym == SDLK_ESCAPE) ) { done = true; accept = false;}
1599 else if(!(event.key.keysym.sym == SDLK_BACKSPACE)){if((rk.ReadKey(event.key.keysym.sym))&&(SoundEnabled)&&(!NoSound))Mix_PlayChannel(1,typingChunk,0);}
1600 else if((event.key.keysym.sym == SDLK_BACKSPACE)&&(!repeating)){if((rk.ReadKey(event.key.keysym.sym))&&(SoundEnabled)&&(!NoSound))Mix_PlayChannel(1,typingChunk,0); repeating = true; time=SDL_GetTicks();}
1601 }
1602
1603 } //while(event)
1604
1605 if(SDL_GetTicks()>(time+repeatDelay))
1606 {
1607 time = SDL_GetTicks();
1608 keys = SDL_GetKeyState(NULL);
1609 if( (keys[SDLK_BACKSPACE])&&(repeating) )
1610 {if((rk.ReadKey(SDLK_BACKSPACE))&&(SoundEnabled)&&(!NoSound))Mix_PlayChannel(1,typingChunk,0);}
1611 else
1612 repeating = false;
1613 }
1614
1615 SDL_Flip(screen); //Update screen
1616 } //while(!done)
1617 strcpy(name,rk.GetString());
1618 bScreenLocked = false;
1619 showDialog = false;
1620 return accept;
1621 }
1622
1623
1624 //Open a puzzle file
1625 bool OpenFileDialogbox(int x, int y, char *name)
1626 {
1627 bool done = false; //We are done!
1628 int mousex, mousey;
1629 ListFiles lf = ListFiles();
1630 #ifdef SHAREDIR
1631 string folder = (string)SHAREDIR+(string)"/res";
1632 cout << "Looking in " << folder << endl;
1633 lf.setDictory(folder.c_str());
1634 #else
1635 lf.setDictory("./res");
1636 #endif
1637 #ifdef __unix__
1638 string homeFolder = (string)getenv("HOME")+(string)"/.gamesaves/blockattack/puzzles";
1639 lf.setDictory2(homeFolder.c_str());
1640 #endif
1641 Uint8* keys;
1642 string strHolder;
1643 MakeBackground(1024,768);
1644 DrawIMG(background,screen,0,0);
1645 DrawIMG(bForward,background,x+460,y+420);
1646 DrawIMG(bBack,background,x+20,y+420);
1647 while(!done)
1648 {
1649 DrawIMG(background,screen,0,0);
1650 const int nrOfFiles = 10;
1651 DrawIMG(changeButtonsBack,screen,x,y);
1652 for(int i=0;i<nrOfFiles;i++)
1653 {
1654 SFont_Write(screen,fBlueFont,x+10,y+10+36*i,lf.getFileName(i).c_str());
1655 }
1656
1657 SDL_Event event;
1658
1659 while ( SDL_PollEvent(&event) )
1660 {
1661 if ( event.type == SDL_QUIT ) { done = true; }
1662
1663 if ( event.type == SDL_KEYDOWN )
1664 {
1665 if ( (event.key.keysym.sym == SDLK_ESCAPE) ) { done = true;}
1666
1667 if ( (event.key.keysym.sym == SDLK_RIGHT) ) { lf.forward(); }
1668
1669 if ( (event.key.keysym.sym == SDLK_LEFT) ) { lf.back(); }
1670 }
1671
1672 } //while(event)
1673
1674 SDL_GetMouseState(&mousex,&mousey);
1675
1676 // If the mouse button is released, make bMouseUp equal true
1677 if(!SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(1))
1678 {
1679 bMouseUp=true;
1680 }
1681
1682 if(SDL_GetMouseState(NULL,NULL)&SDL_BUTTON(1) && bMouseUp)
1683 {
1684 bMouseUp = false;
1685
1686 //The Forward Button:
1687 if( (mousex>x+460) && (mousex<x+460+120) && (mousey>y+420) && (mousey<y+420+40) )
1688 {
1689 lf.forward();
1690 }
1691
1692 //The back button:
1693 if( (mousex>x+20) && (mousex<x+20+120) && (mousey>y+420) && (mousey<y+420+40) )
1694 {
1695 lf.back();
1696 }
1697
1698 for(int i=0;i<10;i++)
1699 {
1700 if( (mousex>x+10) && (mousex<x+480) && (mousey>y+10+i*36) && (mousey<y+10+i*36+32) )
1701 {
1702 if(lf.fileExists(i))
1703 {
1704 strncpy(name,lf.getFileName(i).c_str(),28); //Problems occurs then larger than 28 (maybe 29)
1705 done=true; //The user have, clicked the purpose of this function is now complete
1706 }
1707 }
1708 }
1709 }
1710
1711 DrawIMG(mouse,screen,mousex,mousey);
1712 SDL_Flip(screen); //Update screen
1713 }
1714 }
1715
1716 //Open a saved replay
1717 bool OpenReplayDialogbox(int x, int y, char *name)
1718 {
1719 bool done = false; //We are done!
1720 int mousex, mousey;
1721 ListFiles lf = ListFiles();
1722 cout << "Ready to set directory!" << endl;
1723 #ifdef __unix__
1724 string dictory = (string)getenv("HOME")+(string)"/.gamesaves/blockattack/replays";
1725 #elif WIN32
1726 string dictory = getMyDocumentsPath()+(string)"/My Games/blockattack/replays";
1727 #else
1728 string dictory = "./replays";
1729 #endif
1730 lf.setDictory(dictory);
1731 cout << "Directory sat" << endl;
1732 Uint8* keys;
1733 string strHolder;
1734 MakeBackground(1024,768);
1735 DrawIMG(background,screen,0,0);
1736 DrawIMG(bForward,background,x+460,y+420);
1737 DrawIMG(bBack,background,x+20,y+420);
1738 while(!done)
1739 {
1740 DrawIMG(background,screen,0,0);
1741 const int nrOfFiles = 10;
1742 DrawIMG(changeButtonsBack,screen,x,y);
1743 for(int i=0;i<nrOfFiles;i++)
1744 {
1745 SFont_Write(screen,fBlueFont,x+10,y+10+36*i,lf.getFileName(i).c_str());
1746 }
1747
1748 SDL_Event event;
1749
1750 while ( SDL_PollEvent(&event) )
1751 {
1752 if ( event.type == SDL_QUIT ) { done = true; return false;}
1753
1754 if ( event.type == SDL_KEYDOWN )
1755 {
1756 if ( (event.key.keysym.sym == SDLK_ESCAPE) ) { done = true; return false;}
1757
1758 if ( (event.key.keysym.sym == SDLK_RIGHT) ) { lf.forward(); }
1759
1760 if ( (event.key.keysym.sym == SDLK_LEFT) ) { lf.back(); }
1761 }
1762
1763 } //while(event)
1764
1765 SDL_GetMouseState(&mousex,&mousey);
1766
1767 // If the mouse button is released, make bMouseUp equal true
1768 if(!SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(1))
1769 {
1770 bMouseUp=true;
1771 }
1772
1773 if(SDL_GetMouseState(NULL,NULL)&SDL_BUTTON(1) && bMouseUp)
1774 {
1775 bMouseUp = false;
1776
1777 //The Forward Button:
1778 if( (mousex>x+460) && (mousex<x+460+120) && (mousey>y+420) && (mousey<y+420+40) )
1779 {
1780 lf.forward();
1781 }
1782
1783 //The back button:
1784 if( (mousex>x+20) && (mousex<x+20+120) && (mousey>y+420) && (mousey<y+420+40) )
1785 {
1786 lf.back();
1787 }
1788
1789 for(int i=0;i<10;i++)
1790 {
1791 if( (mousex>x+10) && (mousex<x+480) && (mousey>y+10+i*36) && (mousey<y+10+i*36+32) )
1792 {
1793 if(lf.fileExists(i))
1794 {
1795 strncpy(name,lf.getFileName(i).c_str(),28); //Problems occurs then larger than 28 (maybe 29)
1796 done=true; //The user have, clicked the purpose of this function is now complete
1797 return true;
1798 }
1799 }
1800 }
1801 }
1802
1803 DrawIMG(mouse,screen,mousex,mousey);
1804 SDL_Flip(screen); //Update screen
1805 }
1806 }
1807
1808
1809 //draws options:
1810 inline void DrawOptions(int x, int y)
1811 {
1812 if(MusicEnabled) DrawIMG(bOn,optionsBack,400,120);
1813 else DrawIMG(bOff,optionsBack,400,120);
1814 if(SoundEnabled) DrawIMG(bOn,optionsBack,400,170);
1815 else DrawIMG(bOff,optionsBack,400,170);
1816 if(bFullscreen) DrawIMG(bOn,optionsBack,400,220);
1817 else DrawIMG(bOff,optionsBack,400,220);
1818 DrawIMG(bChange,optionsBack,230,435);
1819 DrawIMG(bChange,optionsBack,410,435);
1820 DrawIMG(bChange,optionsBack,230,500);
1821 DrawIMG(bChange,optionsBack,410,500);
1822 DrawIMG(optionsBack,screen,x,y);
1823 } //drawOptions
1824
1825 //Draws the balls and explosions
1826 void DrawBalls()
1827 {
1828 for(int i = 0; i< maxNumberOfBalls; i++)
1829 {
1830 if(theBallManeger.ballUsed[i])
1831 {
1832 DrawIMG(balls[theBallManeger.ballArray[i].getColor()],screen,theBallManeger.ballArray[i].getX(),theBallManeger.ballArray[i].getY());
1833 } //if used
1834 if(theExplosionManeger.explosionUsed[i])
1835 {
1836 DrawIMG(explosion[theExplosionManeger.explosionArray[i].getFrame()],screen,theExplosionManeger.explosionArray[i].getX(),theExplosionManeger.explosionArray[i].getY());
1837 }
1838 if(theTextManeger.textUsed[i])
1839 {
1840 //cout << "Printing text: " << theTextManeger.textArray[i].getText() << endl;
1841 int x = theTextManeger.textArray[i].getX()-SFont_TextWidth(fSmallFont,theTextManeger.textArray[i].getText())/2;
1842 int y = theTextManeger.textArray[i].getY()-SFont_TextHeight(fSmallFont)/2;
1843 DrawIMG(iChainBack,screen,x,y);
1844 SFont_Write(screen,fSmallFont,x+(25-SFont_TextWidth(fSmallFont,theTextManeger.textArray[i].getText()))/2,y+(25-SFont_TextHeight(fSmallFont))/2,theTextManeger.textArray[i].getText());
1845 }
1846 } //for
1847 } //DrawBalls
1848
1849 //Removes the old balls
1850 void UndrawBalls()
1851 {
1852 for(int i = 0; i< maxNumberOfBalls; i++)
1853 {
1854 if(theBallManeger.oldBallUsed[i])
1855 {
1856 DrawIMG(background,screen,theBallManeger.oldBallArray[i].getX(),theBallManeger.oldBallArray[i].getY(),ballSize,ballSize,theBallManeger.oldBallArray[i].getX(),theBallManeger.oldBallArray[i].getY());
1857 } //if used
1858 if(theExplosionManeger.oldExplosionUsed[i])
1859 {
1860 DrawIMG(background,screen,theExplosionManeger.oldExplosionArray[i].getX(),theExplosionManeger.oldExplosionArray[i].getY(),70,120,theExplosionManeger.oldExplosionArray[i].getX(),theExplosionManeger.oldExplosionArray[i].getY());
1861 }
1862 if(theTextManeger.oldTextUsed[i])
1863 {
1864 int x = theTextManeger.oldTextArray[i].getX()-SFont_TextWidth(fSmallFont,theTextManeger.oldTextArray[i].getText())/2;
1865 int y = theTextManeger.oldTextArray[i].getY()-SFont_TextHeight(fSmallFont)/2;
1866 DrawIMG(background,screen,x,y,25,25,x,y);
1867 }
1868 } //for
1869 } //UndrawBalls
1870
1871 //draws everything
1872 void DrawEverything(int xsize, int ysize,BlockGame &theGame, BlockGame &theGame2)
1873 {
1874 SDL_ShowCursor(SDL_DISABLE);
1875 //draw background:
1876 if(forceredraw != 1)
1877 {
1878
1879 UndrawBalls();
1880 DrawIMG(background,screen,oldMousex,oldMousey,32,32,oldMousex,oldMousey);
1881 DrawIMG(background,screen,oldBubleX,oldBubleY,140,50,oldBubleX,oldBubleY);
1882
1883
1884 DrawIMG(background,screen,350,200,120,200,350,200);
1885 DrawIMG(background,screen,830,200,120,200,830,200);
1886 DrawIMG(background,screen,800,0,140,50,800,0);
1887
1888 DrawIMG(background,screen,50,60,300,50,50,60);
1889 DrawIMG(background,screen,510,60,300,50,510,60);
1890 }
1891 else
1892 DrawIMG(background,screen,0,0);
1893 //draw bottons (should be moves and drawn directly to background once)
1894 if(!networkActive) //We don't show the menu while running server or connected to a server
1895 {
1896 //Here we draw the menu
1897 DrawIMG(bNewGame, screen, 0, 0);
1898 DrawIMG(bOptions, screen, 120,0);
1899 DrawIMG(bHighScore, screen, 2*120,0);
1900 DrawIMG(bReplay,screen,3*120,0);
1901 }
1902 else
1903 { //If network is active
1904 DrawIMG(bBack, screen, 0, 0); //Display a disconnect button
1905 }
1906 DrawIMG(bExit, screen, xsize-120,ysize-120);
1907 //DrawIMG(boardBackBack,screen,theGame.topx-60,theGame.topy-68);
1908 DrawIMG(theGame.sBoard,screen,theGame.topx,theGame.topy);
1909 string strHolder;
1910 strHolder = itoa(theGame.score+theGame.handicap);
1911 SFont_Write(screen,fBlueFont,theGame.topx+310,theGame.topy+100,strHolder.c_str());
1912 if(theGame.AI_Enabled)
1913 SFont_Write(screen,fBlueFont,theGame.topx+10,theGame.topy-40,"CPU");
1914 else
1915 if(!singlePuzzle)
1916 SFont_Write(screen,fBlueFont,theGame.topx+10,theGame.topy-40,player1name);
1917 if(theGame.timetrial)
1918 {
1919 int tid = (int)SDL_GetTicks()-theGame.gameStartedAt;
1920 int minutes;
1921 int seconds;
1922 if(tid>=0)
1923 {
1924 minutes = (2*60*1000-(abs((int)SDL_GetTicks()-theGame.gameStartedAt)))/60/1000;
1925 seconds = ((2*60*1000-(abs((int)SDL_GetTicks()-theGame.gameStartedAt)))%(60*1000))/1000;
1926 }
1927 else
1928 {
1929 minutes = ((abs((int)SDL_GetTicks()-theGame.gameStartedAt)))/60/1000;
1930 seconds = (((abs((int)SDL_GetTicks()-theGame.gameStartedAt)))%(60*1000))/1000;
1931 }
1932 if(theGame.bGameOver) minutes=0;
1933 if(theGame.bGameOver) seconds=0;
1934 if(seconds>9)
1935 strHolder = itoa(minutes)+":"+itoa(seconds);
1936 else strHolder = itoa(minutes)+":0"+itoa(seconds);
1937 if((SoundEnabled)&&(!NoSound)&&(tid>0)&&(seconds<5)&&(minutes == 0)&&(seconds>1)&&(!(Mix_Playing(6)))) Mix_PlayChannel(6,heartBeat,0);
1938 SFont_Write(screen,fBlueFont,theGame.topx+310,theGame.topy+150,strHolder.c_str());
1939 }
1940 else
1941 {
1942 int minutes = ((abs((int)SDL_GetTicks()-theGame.gameStartedAt)))/60/1000;
1943 int seconds = (((abs((int)SDL_GetTicks()-theGame.gameStartedAt)))%(60*1000))/1000;
1944 if(theGame.bGameOver) minutes=(theGame.gameEndedAfter/1000/60)%100;
1945 if(theGame.bGameOver) seconds=(theGame.gameEndedAfter/1000)%60;
1946 if(seconds>9)
1947 strHolder = itoa(minutes)+":"+itoa(seconds);
1948 else
1949 strHolder = itoa(minutes)+":0"+itoa(seconds);
1950 SFont_Write(screen,fBlueFont,theGame.topx+310,theGame.topy+150,strHolder.c_str());
1951 }
1952 strHolder = itoa(theGame.chain);
1953 SFont_Write(screen,fBlueFont,theGame.topx+310,theGame.topy+200,strHolder.c_str());
1954 //drawspeedLevel:
1955 strHolder = itoa(theGame.speedLevel);
1956 SFont_Write(screen,fBlueFont,theGame.topx+310,theGame.topy+250,strHolder.c_str());
1957 if((theGame.stageClear) &&(theGame.topy+700+50*(theGame.stageClearLimit-theGame.linesCleared)-theGame.pixels-1<600+theGame.topy))
1958 {
1959 oldBubleX = theGame.topx+280;
1960 oldBubleY = theGame.topy+650+50*(theGame.stageClearLimit-theGame.linesCleared)-theGame.pixels-1;
1961 DrawIMG(stageBobble,screen,theGame.topx+280,theGame.topy+650+50*(theGame.stageClearLimit-theGame.linesCleared)-theGame.pixels-1);
1962 }
1963 //player1 finnish, player2 start
1964 //DrawIMG(boardBackBack,screen,theGame2.topx-60,theGame2.topy-68);
1965 DrawIMG(theGame2.sBoard,screen,theGame2.topx,theGame2.topy);
1966 strHolder = itoa(theGame2.score+theGame2.handicap);
1967 SFont_Write(screen,fBlueFont,theGame2.topx+310,theGame2.topy+100,strHolder.c_str());
1968 if(theGame2.AI_Enabled)
1969 SFont_Write(screen,fBlueFont,theGame2.topx+10,theGame2.topy-40,"CPU");
1970 else
1971 SFont_Write(screen,fBlueFont,theGame2.topx+10,theGame2.topy-40,theGame2.name);
1972 if(theGame2.timetrial)
1973 {
1974 int tid = (int)SDL_GetTicks()-theGame2.gameStartedAt;
1975 int minutes;
1976 int seconds;
1977 if(tid>=0)
1978 {
1979 minutes = (2*60*1000-(abs((int)SDL_GetTicks()-theGame2.gameStartedAt)))/60/1000;
1980 seconds = ((2*60*1000-(abs((int)SDL_GetTicks()-theGame2.gameStartedAt)))%(60*1000))/1000;
1981 }
1982 else
1983 {
1984 minutes = ((abs((int)SDL_GetTicks()-theGame2.gameStartedAt)))/60/1000;
1985 seconds = (((abs((int)SDL_GetTicks()-theGame2.gameStartedAt)))%(60*1000))/1000;
1986 }
1987 if(theGame2.bGameOver) minutes=0;
1988 if(theGame2.bGameOver) seconds=0;
1989 if(seconds>9)
1990 strHolder = itoa(minutes)+":"+itoa(seconds);
1991 else
1992 strHolder = itoa(minutes)+":0"+itoa(seconds);
1993 if((SoundEnabled)&&(!NoSound)&&(tid>0)&&(seconds<5)&&(minutes == 0)&&(seconds>1)&&(!(Mix_Playing(6)))) Mix_PlayChannel(6,heartBeat,0);
1994 SFont_Write(screen,fBlueFont,theGame2.topx+310,theGame2.topy+150,strHolder.c_str());
1995 }
1996 else
1997 {
1998 int minutes = (abs((int)SDL_GetTicks()-theGame2.gameStartedAt))/60/1000;
1999 int seconds = (abs((int)SDL_GetTicks()-theGame2.gameStartedAt)%(60*1000))/1000;
2000 if(theGame2.bGameOver) minutes=(theGame2.gameEndedAfter/1000/60)%100;
2001 if(theGame2.bGameOver) seconds=(theGame2.gameEndedAfter/1000)%60;
2002 if(seconds>9)
2003 strHolder = itoa(minutes)+":"+itoa(seconds);
2004 else
2005 strHolder = itoa(minutes)+":0"+itoa(seconds);
2006 SFont_Write(screen,fBlueFont,theGame2.topx+310,theGame2.topy+150,strHolder.c_str());
2007 }
2008 strHolder = itoa(theGame2.chain);
2009 SFont_Write(screen,fBlueFont,theGame2.topx+310,theGame2.topy+200,strHolder.c_str());
2010 strHolder = itoa(theGame2.speedLevel);
2011 SFont_Write(screen,fBlueFont,theGame2.topx+310,theGame2.topy+250,strHolder.c_str());
2012
2013 //player2 finnish
2014
2015 if(bNewGameOpen)
2016 {
2017 DrawIMG(b1player,screen,0,40);
2018 DrawIMG(b2players,screen,0,80);
2019 #ifdef NETWORK
2020 DrawIMG(bNetwork,screen,0,120);
2021 #endif
2022 if(b1playerOpen)
2023 {
2024 DrawIMG(bEndless,screen,120,40);
2025 DrawIMG(bTimeTrial,screen,120,80);
2026 DrawIMG(bStageClear,screen,120,120);
2027 DrawIMG(bPuzzle,screen,120,160);
2028 DrawIMG(bVsMode,screen,120,200);
2029 }
2030 else
2031 if(b2playersOpen)
2032 {
2033 DrawIMG(bTimeTrial,screen,120,80);
2034 DrawIMG(bVsMode,screen,120,120);
2035 }
2036 #ifdef NETWORK
2037 else
2038 if(bNetworkOpen)
2039 {
2040 DrawIMG(bHost,screen,120,120);
2041 DrawIMG(bConnect,screen,120,160);
2042 }
2043 #endif
2044 }
2045 if(bOptionsOpen)
2046 {
2047 DrawIMG(bConfigure,screen,120,40);
2048 DrawIMG(bSelectPuzzle,screen,120,80);
2049 DrawIMG(bVsMode,screen,120,120);
2050 }
2051 if(bReplayOpen)
2052 {
2053 DrawIMG(bSave,screen,360,40);
2054 DrawIMG(bLoad,screen,360,80);
2055 }
2056 if(showHighscores) DrawHighscores(100,100);
2057 if(showOptions) DrawOptions(100,100);
2058
2059 DrawBalls();
2060
2061 #if defined(DEBUG)
2062 Frames++;
2063 if(SDL_GetTicks() >= Ticks + 1000)
2064 {
2065 if(Frames > 999) Frames=999;
2066 sprintf(FPS, "%i fps", Frames);
2067 Frames = 0;
2068 Ticks = SDL_GetTicks();
2069 }
2070
2071 SFont_Write(screen,fBlueFont,800,4,FPS);
2072 #endif
2073
2074 //SDL_Flip(screen); //Update screen, now called outside DrawEvrything, bacause the mouse needs to be painted
2075
2076 }
2077
2078 //Generates the standard background
2079 void MakeBackground(int xsize,int ysize)
2080 {
2081 DrawIMG(backgroundImage,background,0,0);
2082 standardBackground = true;
2083 }
2084
2085 //Generates the background with red board backs
2086 void MakeBackground(int xsize,int ysize,BlockGame &theGame, BlockGame &theGame2)
2087 {
2088 DrawIMG(backgroundImage,background,0,0);
2089 DrawIMG(boardBackBack,background,theGame.topx-60,theGame.topy-68);
2090 DrawIMG(boardBackBack,background,theGame2.topx-60,theGame2.topy-68);
2091 standardBackground = false;
2092 }
2093
2094
2095 //The function that allows the player to choose PuzzleLevel
2096 int PuzzleLevelSelect()
2097 {
2098 const int xplace = 200;
2099 const int yplace = 300;
2100 Uint8 *keys;
2101 int levelNr, mousex, mousey;
2102 bool levelSelected = false;
2103 bool tempBool;
2104
2105 //Loads the levels, if they havn't been loaded:
2106 LoadPuzzleStages();
2107
2108 //Keeps track of background;
2109 int nowTime=SDL_GetTicks();
2110
2111 ifstream puzzleFile(puzzleSavePath.c_str(),ios::binary);
2112 MakeBackground(1024,768);
2113 if(puzzleFile)
2114 {
2115 for(int i=0;(i<nrOfPuzzles)&&(!puzzleFile.eof()); i++)
2116 {
2117 puzzleFile.read(reinterpret_cast<char*>(&tempBool),sizeof(bool));
2118 puzzleCleared[i] = tempBool;
2119 }
2120 puzzleFile.close();
2121 }
2122 else
2123 {
2124 tempBool = false;
2125 for(int i=0; i<nrOfPuzzles; i++)
2126 puzzleCleared[i] = tempBool;
2127 }
2128
2129 do
2130 {
2131 nowTime=SDL_GetTicks();
2132
2133
2134 DrawIMG(background, screen, 0, 0);
2135 DrawIMG(iCheckBoxArea,screen,xplace,yplace);
2136 SFont_Write(screen,fBlueFont,xplace+12,yplace+2,"Select Puzzle");
2137 //Now drow the fields you click in (and a V if clicked):
2138 for(int i = 0; i < nrOfPuzzles;i++)
2139 {
2140 DrawIMG(iLevelCheckBox,screen,xplace+10+(i%10)*50, yplace+60+(i/10)*50);
2141 if(puzzleCleared[i]==true) DrawIMG(iLevelCheck,screen,xplace+10+(i%10)*50, yplace+60+(i/10)*50);
2142 }
2143
2144 SDL_Event event;
2145 while ( SDL_PollEvent(&event) )
2146 if ( event.type == SDL_KEYDOWN )
2147 {
2148 if ( event.key.keysym.sym == SDLK_ESCAPE ) {levelNr = -1; levelSelected = true;}
2149 }
2150
2151 keys = SDL_GetKeyState(NULL);
2152
2153 SDL_GetMouseState(&mousex,&mousey);
2154
2155 // If the mouse button is released, make bMouseUp equal true
2156 if(!SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(1))
2157 {
2158 bMouseUp=true;
2159 }
2160
2161 if(SDL_GetMouseState(NULL,NULL)&SDL_BUTTON(1) && bMouseUp)
2162 {
2163 bMouseUp = false;
2164
2165 int levelClicked = -1;
2166 int i;
2167 for(i = 0; (i<nrOfPuzzles/10)||((i<nrOfPuzzles/10+1)&&(nrOfPuzzles%10 != 0)); i++)
2168 if((60+i*50<mousey-yplace)&&(mousey-yplace<i*50+92))
2169 levelClicked = i*10;
2170 i++;
2171 if(levelClicked != -1)
2172 for(int j = 0; ((j<nrOfStageLevels%(i*10))&&(j<10)); j++)
2173 if((10+j*50<mousex-xplace)&&(mousex-xplace<j*50+42))
2174 {
2175 levelClicked +=j;
2176 levelSelected = true;
2177 levelNr = levelClicked;
2178 }
2179 }
2180
2181 DrawIMG(mouse,screen,mousex,mousey);
2182 SDL_Flip(screen); //draws it all to the screen
2183
2184 } while(!levelSelected);
2185 DrawIMG(background, screen, 0, 0);
2186 return levelNr;
2187 }
2188
2189 //The function that allows the player to choose Level number
2190 int StageLevelSelect()
2191 {
2192 const int xplace = 200;
2193 const int yplace = 300;
2194 Uint8 *keys;
2195 int levelNr, mousex, mousey;
2196 bool levelSelected = false;
2197 bool tempBool;
2198
2199 //Keeps track of background;
2200 //int nowTime=SDL_GetTicks();
2201
2202 MakeBackground(1024,768);
2203 ifstream stageFile(stageClearSavePath.c_str(),ios::binary);
2204 if(stageFile)
2205 {
2206 for(int i = 0; i<nrOfStageLevels; i++)
2207 {
2208 stageFile.read(reinterpret_cast<char*>(&tempBool),sizeof(bool));
2209 stageCleared[i]=tempBool;
2210 }
2211 stageFile.close();
2212 }
2213 else
2214 {
2215 for(int i=0; i<nrOfStageLevels; i++)
2216 stageCleared[i]= false;
2217 }
2218
2219
2220 do
2221 {
2222 //nowTime=SDL_GetTicks();
2223 DrawIMG(background, screen, 0, 0);
2224 DrawIMG(iCheckBoxArea,screen,xplace,yplace);
2225 SFont_Write(screen,fBlueFont,xplace+12,yplace+2,"Stage Clear Level Select");
2226 for(int i = 0; i < nrOfStageLevels;i++)
2227 {
2228 DrawIMG(iLevelCheckBox,screen,xplace+10+(i%10)*50, yplace+60+(i/10)*50);
2229 if(stageCleared[i]==true) DrawIMG(iLevelCheck,screen,xplace+10+(i%10)*50, yplace+60+(i/10)*50);
2230 }
2231
2232 SDL_Event event;
2233 while ( SDL_PollEvent(&event) )
2234 if ( event.type == SDL_KEYDOWN )
2235 {
2236 if ( event.key.keysym.sym == SDLK_ESCAPE ) {levelNr = -1; levelSelected = true;}
2237 }
2238
2239 keys = SDL_GetKeyState(NULL);
2240
2241 SDL_GetMouseState(&mousex,&mousey);
2242
2243 // If the mouse button is released, make bMouseUp equal true
2244 if(!SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(1))
2245 {
2246 bMouseUp=true;
2247 }
2248
2249 if(SDL_GetMouseState(NULL,NULL)&SDL_BUTTON(1) && bMouseUp)
2250 {
2251 bMouseUp = false;
2252
2253 int levelClicked = -1;
2254 int i;
2255 for(i = 0; (i<nrOfStageLevels/10)||((i<nrOfStageLevels/10+1)&&(nrOfStageLevels%10 != 0)); i++)
2256 if((60+i*50<mousey-yplace)&&(mousey-yplace<i*50+92))
2257 levelClicked = i*10;
2258 i++;
2259 if(levelClicked != -1)
2260 for(int j = 0; ((j<nrOfStageLevels%(i*10))&&(j<10)); j++)
2261 if((10+j*50<mousex-xplace)&&(mousex-xplace<j*50+42))
2262 {
2263 levelClicked +=j;
2264 levelSelected = true;
2265 levelNr = levelClicked;
2266 }
2267 }
2268
2269 DrawIMG(mouse,screen,mousex,mousey);
2270 SDL_Flip(screen); //draws it all to the screen
2271
2272 } while(!levelSelected);
2273 DrawIMG(background, screen, 0, 0);
2274 return levelNr;
2275 }
2276
2277 //Ask user for what AI level he will compete agains, return the number. Number must be 0..AIlevels
2278 int startSingleVs()
2279 {
2280 //Where to place the windows
2281 const int xplace = 200;
2282 const int yplace = 100;
2283 Uint8 *keys; //To take keyboard input
2284 int mousex, mousey; //To allow mouse
2285 bool done = false; //When are we done?
2286
2287 MakeBackground(1024,768);
2288 DrawIMG(changeButtonsBack,background,xplace,yplace);
2289 SFont_Write(background,fBlueFont,xplace+10,yplace+10,"1 : Very Easy");
2290 SFont_Write(background,fBlueFont,xplace+10,yplace+40,"2 : Easy");
2291 SFont_Write(background,fBlueFont,xplace+10,yplace+70,"3 : Below Normal");
2292 SFont_Write(background,fBlueFont,xplace+10,yplace+100,"4 : Normal");
2293 SFont_Write(background,fBlueFont,xplace+10,yplace+130,"5 : Above Normal");
2294 SFont_Write(background,fBlueFont,xplace+10,yplace+160,"6 : Hard");
2295 SFont_Write(background,fBlueFont,xplace+10,yplace+190,"7 : Hardest");
2296 DrawIMG(background, screen, 0, 0);
2297 SDL_Flip(screen);
2298 do
2299 {
2300
2301 SDL_Delay(10);
2302 SDL_Event event;
2303 while ( SDL_PollEvent(&event) )
2304 if ( event.type == SDL_KEYDOWN )
2305 {
2306 if ( event.key.keysym.sym == SDLK_ESCAPE ) { done = true;}
2307 if ( event.key.keysym.sym == SDLK_RETURN ) { done = true;}
2308 if ( event.key.keysym.sym == SDLK_KP_ENTER ) { done = true;}
2309 if ( event.key.keysym.sym == SDLK_1 ) { return 0;}
2310 if ( event.key.keysym.sym == SDLK_2 ) { return 1;}
2311 if ( event.key.keysym.sym == SDLK_3 ) { return 2;}
2312 if ( event.key.keysym.sym == SDLK_4 ) { return 3;}
2313 if ( event.key.keysym.sym == SDLK_5 ) { return 4;}
2314 if ( event.key.keysym.sym == SDLK_6 ) { return 5;}
2315 if ( event.key.keysym.sym == SDLK_7 ) { return 6;}
2316 if ( event.key.keysym.sym == SDLK_KP1 ) { return 0;}
2317 if ( event.key.keysym.sym == SDLK_KP2 ) { return 1;}
2318 if ( event.key.keysym.sym == SDLK_KP3 ) { return 2;}
2319 if ( event.key.keysym.sym == SDLK_KP4 ) { return 3;}
2320 if ( event.key.keysym.sym == SDLK_KP5 ) { return 4;}
2321 if ( event.key.keysym.sym == SDLK_KP6 ) { return 5;}
2322 if ( event.key.keysym.sym == SDLK_KP7 ) { return 6;}
2323
2324 }
2325
2326 // If the mouse button is released, make bMouseUp equal true
2327 if(!SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(1))
2328 {
2329 bMouseUp=true;
2330 }
2331
2332 if(SDL_GetMouseState(NULL,NULL)&SDL_BUTTON(1) && bMouseUp)
2333 {
2334 bMouseUp = false;
2335
2336 for(int i=0; i<7;i++)
2337 {
2338 if((mousex>xplace+10)&&(mousex<xplace+410)&&(mousey>yplace+10+i*30)&&(mousey<yplace+38+i*30))
2339 return i;
2340 }
2341 }
2342
2343 SDL_GetMouseState(&mousex,&mousey);
2344 DrawIMG(background, screen, 0, 0);
2345 DrawIMG(mouse,screen,mousex,mousey);
2346 SDL_Flip(screen); //draws it all to the screen
2347 }while(!done);
2348
2349
2350 return 3; //Returns normal
2351 }
2352
2353 //The function that allows the player to choose Level number
2354 void startVsMenu()
2355 {
2356 const int xplace = 200;
2357 const int yplace = 100;
2358 Uint8 *keys;
2359 int mousex, mousey;
2360 bool done = false;
2361
2362 //Keeps track of background;
2363 //int nowTime=SDL_GetTicks();
2364
2365 MakeBackground(1024,768);
2366 SFont_Write(background,fBlueFont,360,650,"Press ESC to accept");
2367 DrawIMG(bBack,background,1024/2-120/2,600);
2368 do
2369 {
2370 //nowTime=SDL_GetTicks();
2371 DrawIMG(background, screen, 0, 0);
2372 DrawIMG(changeButtonsBack,screen,xplace,yplace);
2373 SFont_Write(screen,fBlueFont,xplace+50,yplace+20,"Player 1");
2374 SFont_Write(screen,fBlueFont,xplace+300+50,yplace+20,"Player 2");
2375 SFont_Write(screen,fBlueFont,xplace+50,yplace+70,"Speed:");
2376 SFont_Write(screen,fBlueFont,xplace+50+300,yplace+70,"Speed:");
2377 for(int i=0; i<5;i++)
2378 {
2379 char levelS[2]; //level string;
2380 levelS[0]='1'+i;
2381 levelS[1]=0;
2382 SFont_Write(screen,fBlueFont,xplace+50+i*40,yplace+110,levelS);
2383 DrawIMG(iLevelCheckBox,screen,xplace+50+i*40,yplace+150);
2384 if(player1Speed==i)
2385 DrawIMG(iLevelCheck,screen,xplace+50+i*40,yplace+150);
2386 }
2387 for(int i=0; i<5;i++)
2388 {
2389 char levelS[2]; //level string;
2390 levelS[0]='1'+i;
2391 levelS[1]=0;
2392 SFont_Write(screen,fBlueFont,xplace+300+50+i*40,yplace+110,levelS);
2393 DrawIMG(iLevelCheckBox,screen,xplace+300+50+i*40,yplace+150);
2394 if(player2Speed==i)
2395 DrawIMG(iLevelCheck,screen,xplace+300+50+i*40,yplace+150);
2396 }
2397 SFont_Write(screen,fBlueFont,xplace+50,yplace+200,"AI: ");
2398 DrawIMG(iLevelCheckBox,screen,xplace+50+70,yplace+200);
2399 if(player1AI)
2400 DrawIMG(iLevelCheck,screen,xplace+50+70,yplace+200);
2401 SFont_Write(screen,fBlueFont,xplace+50,yplace+250,"TT Handicap: ");
2402 SFont_Write(screen,fBlueFont,xplace+50+300,yplace+200,"AI: ");
2403 DrawIMG(iLevelCheckBox,screen,xplace+50+70+300,yplace+200);
2404 if(player2AI)
2405 DrawIMG(iLevelCheck,screen,xplace+50+70+300,yplace+200);
2406 SFont_Write(screen,fBlueFont,xplace+50+300,yplace+250,"TT Handicap: ");
2407 for(int i=0; i<5;i++)
2408 {
2409 char levelS[2]; //level string;
2410 levelS[0]='1'+i;
2411 levelS[1]=0;
2412 SFont_Write(screen,fBlueFont,xplace+50+i*40,yplace+290,levelS);
2413 DrawIMG(iLevelCheckBox,screen,xplace+50+i*40,yplace+330);
2414 if(player1handicap==i)
2415 DrawIMG(iLevelCheck,screen,xplace+50+i*40,yplace+330);
2416 }
2417 for(int i=0; i<5;i++)
2418 {
2419 char levelS[2]; //level string;
2420 levelS[0]='1'+i;
2421 levelS[1]=0;
2422 SFont_Write(screen,fBlueFont,xplace+50+i*40+300,yplace+290,levelS);
2423 DrawIMG(iLevelCheckBox,screen,xplace+50+i*40+300,yplace+330);
2424 if(player2handicap==i)
2425 DrawIMG(iLevelCheck,screen,xplace+50+i*40+300,yplace+330);
2426 }
2427
2428 SDL_Event event;
2429 while ( SDL_PollEvent(&event) )
2430 if ( event.type == SDL_KEYDOWN )
2431 {
2432 if ( event.key.keysym.sym == SDLK_ESCAPE ) { done = true;}
2433 if ( event.key.keysym.sym == SDLK_RETURN ) { done = true;}
2434 if ( event.key.keysym.sym == SDLK_KP_ENTER ) { done = true;}
2435 }
2436
2437 keys = SDL_GetKeyState(NULL);
2438
2439 SDL_GetMouseState(&mousex,&mousey);
2440
2441 // If the mouse button is released, make bMouseUp equal true
2442 if(!SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(1))
2443 {
2444 bMouseUp=true;
2445 }
2446
2447 if(SDL_GetMouseState(NULL,NULL)&SDL_BUTTON(1) && bMouseUp)
2448 {
2449 bMouseUp = false;
2450
2451 if((mousex>xplace+50+70)&&(mousey>yplace+200)&&(mousex<xplace+50+70+30)&&(mousey<yplace+200+30))
2452 player1AI=!player1AI;
2453 if((mousex>xplace+50+70+300)&&(mousey>yplace+200)&&(mousex<xplace+50+70+30+300)&&(mousey<yplace+200+30))
2454 player2AI=!player2AI;
2455 for(int i=0; i<5;i++)
2456 {
2457 if((mousex>xplace+50+i*40)&&(mousex<xplace+50+i*40+30)&&(mousey>yplace+150)&&(mousey<yplace+150+30))
2458 player1Speed=i;
2459 }
2460 for(int i=0; i<5;i++)
2461 {
2462 if((mousex>xplace+50+i*40+300)&&(mousex<xplace+50+i*40+30+300)&&(mousey>yplace+150)&&(mousey<yplace+150+30))
2463 player2Speed=i;
2464 }
2465 for(int i=0; i<5;i++)
2466 {
2467 if((mousex>xplace+50+i*40)&&(mousex<xplace+50+i*40+30)&&(mousey>yplace+330)&&(mousey<yplace+330+30))
2468 player1handicap=i;
2469 }
2470 for(int i=0; i<5;i++)
2471 {
2472 if((mousex>xplace+50+i*40+300)&&(mousex<xplace+50+i*40+30+300)&&(mousey>yplace+330)&&(mousey<yplace+330+30))
2473 player2handicap=i;
2474 }
2475 if((mousex>1024/2-120/2)&&(mousex<1024/2+120/2)&&(mousey>600)&&(mousey<640))
2476 done = true;
2477 }
2478
2479 DrawIMG(mouse,screen,mousex,mousey);
2480 SDL_Flip(screen); //draws it all to the screen
2481 SDL_Delay(10);
2482
2483 } while(!done);
2484 DrawIMG(background, screen, 0, 0);
2485 }
2486
2487 //This function will promt for the user to select another file for puzzle mode
2488 void changePuzzleLevels()
2489 {
2490 char theFileName[30];
2491 strcpy(theFileName,puzzleName.c_str());
2492 for(int i=puzzleName.length();i<30;i++)
2493 theFileName[i]=' ';
2494 theFileName[29]=0;
2495 if(OpenFileDialogbox(200,100,theFileName))
2496 {
2497 for(int i=28;((theFileName[i]==' ')&&(i>0));i--)
2498 theFileName[i]=0;
2499 puzzleName = theFileName;
2500 #if defined(__unix__)
2501 string home = getenv("HOME");
2502 puzzleSavePath = home+"/.gamesaves/blockattack/"+puzzleName+".save";
2503 #elif defined(_WIN32)
2504 string home = getenv("APPDATA");
2505 if(&home!=NULL)
2506 {
2507 puzzleSavePath = home+"/gamesaves/blockattack/"+puzzleName+".save";
2508 }
2509 else
2510 {
2511 puzzleSavePath = puzzleName+".save";
2512 }
2513 #else
2514 puzzleSavePath = puzzleName+".save";
2515 #endif
2516 }
2517
2518 }
2519
2520 #ifdef NETWORK
2521 //The network interface
2522 class NetworkThing
2523 {
2524 private:
2525 ENetAddress address;
2526 ENetHost * server;
2527 ENetHost * client;
2528 ENetPeer *peer;
2529
2530 BlockGame *bgHome, *bgAway; //Pointers to the two games, so we can call the procedures
2531 bool weAreAServer, weAreAClient;
2532 bool weAreConnected;
2533 bool enemyIsReady;
2534 bool enemyHasStarted; //If we should have a ready button
2535 bool gameHasStarted; //If the player is GameOver it might just be because the game hasn't started yet... not if this is true!
2536
2537 public:
2538
2539 Uint32 theSeed;
2540
2541 NetworkThing()
2542 {
2543 weAreAServer = false;
2544 weAreAClient = false;
2545 weAreConnected = false;
2546 enemyIsReady = false;
2547 enemyHasStarted = false;
2548 gameHasStarted = false;
2549 if (enet_initialize () != 0)
2550 {
2551 fprintf (stderr, "An error occurred while initializing ENet.\n");
2552 }
2553 else
2554 {
2555 cout << "Network is working!" << endl;
2556 }
2557 atexit (enet_deinitialize);
2558 }
2559
2560 //This function couses us to remove the connection to the other peer, plus destroying servers
2561 void ntDisconnect()
2562 {
2563 strcpy(bgAway->name,player2name);
2564 if(weAreConnected || weAreAClient || weAreAServer)
2565 {
2566 if(weAreAClient)
2567 {
2568 enet_peer_disconnect (peer);
2569 SDL_Delay(20);
2570 enet_host_destroy(client);
2571 weAreAClient = false;
2572 weAreConnected = false;
2573 enemyHasStarted = false;
2574 }
2575 else
2576 if(weAreAServer)
2577 {
2578 enet_host_destroy(server);
2579 weAreAServer = false;
2580 weAreConnected = false;
2581 enemyHasStarted = false;
2582 }
2583 //If the game is running then we disconnect, we are considered the looser!
2584 if((!bgHome->bGameOver)&&(!bgAway->bGameOver))
2585 {
2586 bgAway->setPlayerWon();
2587 bgHome->SetGameOver();
2588 }
2589 gameHasStarted = false;
2590 }
2591 };
2592
2593 //Lets disconnect before we close...
2594 ~NetworkThing()
2595 {
2596 cout << "Network system is going down" << endl;
2597 ntDisconnect();
2598 }
2599
2600 void theGameHasStarted()
2601 {
2602 gameHasStarted = true;
2603 }
2604
2605 //The NetworkThing needs to be able to call the models... here the pointers are set
2606 void setBGpointers(BlockGame *bg1, BlockGame *bg2)
2607 {
2608 bgHome = bg1;
2609 bgAway = bg2;
2610 }
2611
2612 //Starts a server instance
2613 void startServer()
2614 {
2615 if(!weAreAServer)
2616 {
2617 ntDisconnect();
2618
2619 /* Bind the server to the default localhost. */
2620 /* A specific host address can be specified by */
2621 /* enet_address_set_host (& address, "x.x.x.x"); */
2622
2623 address.host = ENET_HOST_ANY;
2624 /* Bind the server to port SERVERPORT. */
2625 address.port = SERVERPORT;
2626
2627 server = enet_host_create (& address /* the address to bind the server host to */,
2628 1 /* allow up to 1 clients and/or outgoing connections */,
2629 0 /* assume any amount of incoming bandwidth */,
2630 0 /* assume any amount of outgoing bandwidth */);
2631 if (server == NULL)
2632 {
2633 fprintf (stderr,
2634 "An error occurred while trying to create an ENet server host.\n");
2635
2636 }
2637 else
2638 {
2639 weAreAServer = true;
2640 enemyIsReady = false;
2641 gameHasStarted = false;
2642 cout << "Server is listening on port " << SERVERPORT << endl;
2643 }
2644 }
2645 }
2646
2647 void connectToServer(string server)
2648 {
2649 ENetAddress address;
2650 ENetEvent event;
2651
2652 enet_address_set_host (& address, server.c_str());
2653 address.port = SERVERPORT;
2654
2655 ntDisconnect();
2656 client = enet_host_create (NULL /* create a client host */,
2657 1 /* only allow 1 outgoing connection */,
2658 0 /* Unlimited downstream bandwidth */,
2659 0 /* Unlimted upstream bandwidth */);
2660
2661 if (client == NULL)
2662 {
2663 cout << "An error occurred while trying to create an ENet client host." << endl;
2664 }
2665 else
2666 {
2667 /* Initiate the connection, allocating the four channels 0 and 1 and 2 and 3. */
2668 peer = enet_host_connect (client, & address, 4);
2669
2670 if (peer == NULL)
2671 {
2672 cout << "No available peers for initiating an ENet connection." << endl;
2673 }
2674 else
2675 if (enet_host_service (client, & event, 2000) > 0 &&
2676 event.type == ENET_EVENT_TYPE_CONNECT)
2677 {
2678 cout << "We are connected!" << endl;
2679 enemyIsReady = false;
2680 weAreAClient = true;
2681 weAreConnected = true;
2682 gameHasStarted = false;
2683 }
2684 else
2685 {
2686 cout << "Server didn't answer in time" << endl;
2687 }
2688 }
2689 }
2690
2691 bool isConnected()
2692 {
2693 return (weAreConnected||weAreAServer);
2694 }
2695
2696 bool isConnectedToPeer()
2697 {
2698 return weAreConnected;
2699 }
2700
2701 //This function must be called in the game loop:
2702 void updateNetwork()
2703 {
2704 //Now we must send our own board:
2705 if(weAreConnected)
2706 {
2707 //cout << "Creating package" << endl;
2708 boardPackage boardpack = bgHome->getPackage();
2709 ENetPacket * packet = enet_packet_create (&boardpack,
2710 sizeof(boardPackage),
2711 0);
2712 //Now lets send the package
2713 if(weAreAServer)
2714 enet_host_broadcast (server, 0, packet);
2715 else
2716 if(weAreAClient)
2717 enet_peer_send (peer, 0, packet);
2718 //cout << "Package sent" << endl;
2719
2720 //See if we are game over and in that case notify the other player
2721 if((gameHasStarted)&&(bgHome->bGameOver))
2722 {
2723 ENetPacket * packet = enet_packet_create("G",2,ENET_PACKET_FLAG_RELIABLE);
2724 if(weAreAServer)
2725 enet_host_broadcast (server, 1, packet);
2726 else
2727 if(weAreAClient)
2728 enet_peer_send (peer, 1, packet);
2729 gameHasStarted=false;
2730 }
2731
2732 //Now lets see if we have something to throw at the opponent.
2733 Uint8 x,y,type;
2734
2735 if(gameHasStarted)
2736 while(bgAway->popGarbage(&x,&y,&type))
2737 { //if there are garbage to drop
2738 if(type==1)
2739 {
2740 x=255;
2741 y=255;
2742 }
2743 Uint16 g = ((Uint16)x)*256+(Uint16)y; //A 16-bit int containing everything
2744 ENetPacket * packet = enet_packet_create(&g,2,ENET_PACKET_FLAG_RELIABLE);
2745 if(weAreAServer)
2746 enet_host_broadcast (server, 2, packet);
2747 else
2748 if(weAreAClient)
2749 enet_peer_send (peer, 2, packet);
2750 cout << "We send a garbage block: " << (int)x << "," << (int)y << "==" << g << endl;
2751 }
2752 }
2753 ENetEvent event;
2754
2755 /* Wait up to 0 milliseconds for an event. */
2756 while (((weAreAClient)&&(enet_host_service (client, & event, 0) > 0))||((weAreAServer)&&(enet_host_service (server, & event, 0) > 0)))
2757 {
2758 switch (event.type)
2759 {
2760 case ENET_EVENT_TYPE_CONNECT:
2761 printf ("A new client connected from %x:%u.\n",
2762 event.peer -> address.host,
2763 event.peer -> address.port);
2764 weAreConnected = true;
2765 /* Store any relevant client information here. */
2766 //event.peer -> data = "Client";
2767 {
2768
2769 ENetPacket * namePacket = enet_packet_create(bgHome->name,sizeof(char[30]),ENET_PACKET_FLAG_RELIABLE);
2770 //if(weAreAServer)
2771 enet_host_broadcast (server, 3, namePacket);
2772 ENetPacket * answerPacket = enet_packet_create("version2",sizeof("version2"),ENET_PACKET_FLAG_RELIABLE);
2773 enet_host_broadcast (server, 3, answerPacket);
2774 theSeed = time(0)/4;
2775 bgHome->putStartBlocks(theSeed);
2776 ENetPacket * timePacket = enet_packet_create(&theSeed,sizeof(theSeed),ENET_PACKET_FLAG_RELIABLE);
2777 enet_host_broadcast (server, 3, timePacket);
2778 cout << "We send the seed: " << theSeed << endl;
2779 }
2780 break;
2781
2782 case ENET_EVENT_TYPE_RECEIVE:
2783 /*printf ("A packet of length %u containing %s was received from %s on channel %u.\n",
2784 event.packet -> dataLength,
2785 event.packet -> data,
2786 event.peer -> data,
2787 event.channelID);*/
2788 //cout << "Package recieved" << endl;
2789 if(event.channelID==0) //Unreliable (only boardPacks)
2790 {
2791 boardPackage bpack;
2792 //cout << "Package size: "<< event.packet->dataLength << " should be: " << sizeof(boardPackage) << endl;
2793 memcpy(&bpack,(const char*)event.packet->data,sizeof(boardPackage));
2794 bgAway->setBoard(bpack);
2795 }
2796 if(event.channelID==1) //reliable (used for GameOver notifications only!)
2797 {
2798 if((bgHome->bGameOver)&&(!bgHome->hasWonTheGame)&&(gameHasStarted))
2799 {
2800 bgHome->setDraw();
2801 bgAway->setDraw();
2802 }
2803 else
2804 {
2805 bgHome->setPlayerWon();
2806 bgAway->SetGameOver();
2807 }
2808 gameHasStarted=false;
2809 }
2810
2811 if(event.channelID==2) //reliable (used for Garbage only!)
2812 {
2813 Uint16 g;
2814 memcpy(&g,event.packet->data,sizeof(Uint16));
2815 Uint8 x = (g/256);
2816 Uint8 y = (g%256);
2817 cout << "Recieved Garbage: " << (int)x << "," << (int)y << endl;
2818 if((x==255)&&(y==255))
2819 bgHome->CreateGreyGarbage();
2820 else
2821 bgHome->CreateGarbage(x,y);
2822 }
2823
2824 if(event.channelID==3) //We have reacieved a name or a version number
2825 {
2826 if(event.packet->dataLength==sizeof(char[30])) //We have reveived a name
2827 {
2828 strcpy(bgAway->name,(const char*)event.packet->data);
2829 cout << "The enemy name is: " << bgAway->name << " Length: " << sizeof(char[30])<< endl;
2830 if(weAreAClient) //We have just recieved the servers name and must send our own
2831 {
2832 ENetPacket * answerPacket = enet_packet_create(bgHome->name,sizeof(char[30]),ENET_PACKET_FLAG_RELIABLE);
2833 enet_peer_send (peer, 3, answerPacket);
2834 }
2835 }
2836 else
2837 if(event.packet->dataLength==sizeof("2")) //We have recieved aversion number
2838 {
2839 if(0!=strcmp((const char*)event.packet->data,"version2"))
2840 {
2841 cout << "Incompatible version: " << event.packet->data << "!=" << "version2" << endl;
2842 ntDisconnect();
2843 }
2844 if(weAreAClient) //We will send our version number
2845 {
2846 ENetPacket * answerPacket = enet_packet_create("version2",sizeof("version2"),ENET_PACKET_FLAG_RELIABLE);
2847 enet_peer_send (peer, 3, answerPacket);
2848 }
2849 }
2850 else
2851 if(event.packet->dataLength==sizeof(Uint32)) //We have recieved a seed
2852 {
2853 memcpy(&theSeed,event.packet->data,sizeof(Uint32));
2854 bgHome->putStartBlocks(theSeed);
2855 cout << "We recieved a seed: " << theSeed << endl;
2856 }
2857 }
2858
2859 /* Clean up the packet now that we're done using it. */
2860 enet_packet_destroy (event.packet);
2861
2862 break;
2863
2864 case ENET_EVENT_TYPE_DISCONNECT:
2865 printf ("%s disconected.\n", event.peer -> data);
2866
2867 /* Reset the peer's client information. */
2868
2869 event.peer -> data = NULL;
2870 //weAreConnected = false;
2871 if((!bgHome->bGameOver)&&(!bgAway->bGameOver))
2872 {
2873 bgHome->setPlayerWon();
2874 bgAway->SetGameOver();
2875 }
2876
2877 ntDisconnect(); //When we will disconnect!
2878
2879 }
2880 }
2881
2882
2883 }
2884 }; //NetworkThing
2885 #endif
2886
2887 //The main function, quite big... too big
2888 int main(int argc, char *argv[])
2889 {
2890 //We first create the folder there we will save (only on UNIX systems)
2891 //we call the external command "mkdir"... the user might have renamed this, but we hope he hasn't
2892 #if defined(__unix__)
2893 //system("mkdir -p ~/.gamesaves");
2894 //system("mkdir -p ~/.gamesaves/blockattack");
2895 system("mkdir -p ~/.gamesaves/blockattack/screenshots");
2896 system("mkdir -p ~/.gamesaves/blockattack/replays");
2897 system("mkdir -p ~/.gamesaves/blockattack/puzzles");
2898 #elif defined(_WIN32)
2899 //Now for Windows NT/2k/xp/2k3 etc.
2900 string tempA = getMyDocumentsPath()+"\\My Games";
2901 CreateDirectory(tempA.c_str(),NULL);//system(tempA.c_str());
2902 tempA = getMyDocumentsPath()+"\\My Games\\blockattack";
2903 CreateDirectory(tempA.c_str(),NULL);//system(tempA.c_str());
2904 tempA = getMyDocumentsPath()+"\\My Games\\blockattack\\replays";
2905 CreateDirectory(tempA.c_str(),NULL);//system(tempA.c_str());
2906 tempA = getMyDocumentsPath()+"\\My Games\\blockattack\\screenshots";
2907 CreateDirectory(tempA.c_str(),NULL);//system(tempA.c_str());
2908 #endif
2909 bool highPriority = false; //if true the game will take most resources, but increase framerate.
2910 bFullscreen = false;
2911 if(argc > 1)
2912 {
2913 int argumentNr = 1;
2914 forceredraw = 2;
2915 while(argc>argumentNr)
2916 {
2917 char helpString[] = "--help";
2918 char priorityString[] = "-priority";
2919 char forceRedrawString[] = "-forceredraw";
2920 char forcepartdrawString[] = "-forcepartdraw";
2921 char singlePuzzleString[] = "-SP";
2922 char noSoundAtAll[] = "-nosound";
2923 if(!(strncmp(argv[argumentNr],helpString,6)))
2924 {
2925 cout << "Block Attack Help" << endl << "--help Display this message" <<
2926 endl << "-priority Starts game in high priority" << endl <<
2927 "-forceredraw Redraw the whole screen every frame, prevents garbage" << endl <<
2928 "-forcepartdraw Only draw what is changed, sometimes cause garbage" << endl <<
2929 "-nosound No sound will be played at all, and sound hardware want be loaded (use this if game crashes because of sound)" << endl;
2930 #ifdef WIN32
2931 system("Pause");
2932 #endif
2933 return 0;
2934 }
2935 if(!(strncmp(argv[argumentNr],priorityString,9)))
2936 {
2937 cout << "Priority mode" << endl;
2938 highPriority = true;
2939 }
2940 if(!(strncmp(argv[argumentNr],forceRedrawString,12)))
2941 {
2942 forceredraw = 1;
2943 }
2944 if(!(strncmp(argv[argumentNr],forcepartdrawString,14)))
2945 {
2946 forceredraw = 2;
2947 }
2948 if(!(strncmp(argv[argumentNr],singlePuzzleString,3)))
2949 {
2950 singlePuzzle = true; //We will just have one puzzle
2951 if(argv[argumentNr+1][1]!=0)
2952 singlePuzzleNr = (argv[argumentNr+1][1]-'0')+(argv[argumentNr+1][0]-'0')*10;
2953 else
2954 singlePuzzleNr = (argv[argumentNr+1][0]-'0');
2955 singlePuzzleFile = argv[argumentNr+2];
2956 argumentNr+=2;
2957 cout << "SinglePuzzleMode, File: " << singlePuzzleFile << " and Level: " << singlePuzzleNr << endl;
2958 }
2959 if(!(strncmp(argv[argumentNr],noSoundAtAll,8)))
2960 {
2961 NoSound = true;
2962 }
2963 argumentNr++;
2964 } //while
2965 } //if
2966
2967 SoundEnabled = true;
2968 MusicEnabled = true;
2969 xsize = 1024; //screen size x
2970 int ysize = 768; //screen size y
2971 int mousex, mousey; //Mouse coordinates
2972 showHighscores = false;
2973 showEndless = true;
2974 showOptions = false;
2975 b1playerOpen = false;
2976 b2playersOpen = false;
2977 bReplayOpen = false;
2978 bScreenLocked = false;
2979 bool twoPlayers = false; //true if two players splitscreen
2980 bool vsMode = false;
2981 theTopScoresEndless = Highscore(1);
2982 theTopScoresTimeTrial = Highscore(2);
2983 drawBalls = true;
2984 puzzleLoaded = false;
2985 bool weWhereConnected = false;
2986
2987 //Things used for repeating keystrokes:
2988 bool repeatingP1N = false; //The key is being held
2989 bool repeatingP1S = false; //The key is being held
2990 bool repeatingP1W = false; //The key is being held
2991 bool repeatingP1E = false; //The key is being held
2992 bool repeatingP2N = false; //The key is being held
2993 bool repeatingP2S = false; //The key is being held
2994 bool repeatingP2W = false; //The key is being held
2995 bool repeatingP2E = false; //The key is being held
2996 const int startRepeat = 200;
2997 const int repeatDelay = 100; //Repeating
2998 unsigned long timeHeldP1N = 0;
2999 unsigned long timeHeldP1S = 0;
3000 unsigned long timeHeldP1E = 0;
3001 unsigned long timeHeldP1W = 0;
3002 unsigned long timeHeldP2N = 0;
3003 unsigned long timeHeldP2S = 0;
3004 unsigned long timeHeldP2E = 0;
3005 unsigned long timeHeldP2W = 0;
3006 unsigned long timesRepeatedP1N = 0;
3007 unsigned long timesRepeatedP1S = 0;
3008 unsigned long timesRepeatedP1E = 0;
3009 unsigned long timesRepeatedP1W = 0;
3010 unsigned long timesRepeatedP2N = 0;
3011 unsigned long timesRepeatedP2S = 0;
3012 unsigned long timesRepeatedP2E = 0;
3013 unsigned long timesRepeatedP2W = 0;
3014
3015 theBallManeger = ballManeger();
3016 theExplosionManeger = explosionManeger();
3017
3018 //We now set the paths were we are saving, we are using the keyword __unix__ . I hope that all UNIX systems has a home folder
3019 #if defined(__unix__)
3020 string home = getenv("HOME");
3021 string optionsPath = home+"/.gamesaves/blockattack/options.dat";
3022 #elif defined(_WIN32)
3023 string home = getMyDocumentsPath();
3024 string optionsPath;
3025 if(&home!=NULL) //Null if no APPDATA dir exists (win 9x)
3026 optionsPath = home+"/My Games/blockattack/options.dat";
3027 else
3028 optionsPath = "options.dat";
3029 #else
3030 string optionsPath = "options.dat";
3031 #endif
3032
3033 #if defined(__unix__)
3034 stageClearSavePath = home+"/.gamesaves/blockattack/stageClear.SCsave";
3035 puzzleSavePath = home+"/.gamesaves/blockattack/puzzle.levels.save";
3036 #elif defined(_WIN32)
3037 if(&home!=NULL)
3038 {
3039 stageClearSavePath = home+"/My Games/blockattack/stageClear.SCsave";
3040 puzzleSavePath = home+"/My Games/blockattack/puzzle.levels.save";
3041 }
3042 else
3043 {
3044 stageClearSavePath = "stageClear.SCsave";
3045 puzzleSavePath = "puzzle.levels.save";
3046 }
3047 #else
3048 stageClearSavePath = "stageClear.SCsave";
3049 puzzleSavePath = "puzzle.levels.save";
3050 #endif
3051 puzzleName="puzzle.levels";
3052
3053 Uint8 *keys;
3054
3055 //Init SDL
3056 if ( SDL_Init(SDL_INIT_VIDEO) < 0 )
3057 {
3058 cout << "Unable to init SDL: " << SDL_GetError() << endl;
3059 exit(1);
3060 }
3061 atexit(SDL_Quit); //quits SDL when the game stops for some reason (like you hit exit or Esc)
3062
3063 Joypad_init(); //Prepare the joysticks
3064
3065 Joypad joypad1 = Joypad(); //Creates a joypad
3066 Joypad joypad2 = Joypad(); //Creates a joypad
3067
3068 theTextManeger = textManeger();
3069
3070 //Open Audio
3071 if(!NoSound) //If sound has not been disabled, then load the sound system
3072 if(Mix_OpenAudio(44100, AUDIO_S16SYS, 2, 2048) < 0)
3073 {
3074 cout << "Warning: Couldn't set 44100 Hz 16-bit audio - Reason: " << SDL_GetError() << endl
3075 << "Sound will be disabled!" << endl;
3076 NoSound = true; //Tries to stop all sound from playing/loading
3077 }
3078
3079 SDL_WM_SetCaption("Block Attack - Rise of the Blocks", NULL); //Sets title line
3080 //Now sets the icon:
3081 SDL_Surface *icon = IMG_Load2("gfx/icon.png");
3082 SDL_WM_SetIcon(icon,NULL);
3083 SDL_FreeSurface(icon);
3084
3085 //Copyright notice:
3086 cout << "Block Attack - Rise of the Blocks (" << VERSION_NUMBER << ")" << endl << "http://blockattack.sf.net" << endl << "Copyright 2004-2006 Poul Sander" << endl <<
3087 "A SDL based game (see www.libsdl.org)" << endl;
3088 #if defined(_WIN32)
3089 cout << "Windows build" << endl;
3090 #elif defined(__linux__)
3091 cout << "Linux build" << endl;
3092 #elif defined(__unix__)
3093 cout << "Unix build" << endl;
3094 #else
3095 cout << "Alternative build" << endl;
3096 #endif
3097 cout << "-------------------------------------------" << endl;
3098
3099 keySettings[0].up= SDLK_UP;
3100 keySettings[0].down = SDLK_DOWN;
3101 keySettings[0].left = SDLK_LEFT;
3102 keySettings[0].right = SDLK_RIGHT;
3103 keySettings[0].change = SDLK_KP_ENTER;
3104 keySettings[0].push = SDLK_KP0;
3105
3106 keySettings[2].up= SDLK_w;
3107 keySettings[2].down = SDLK_s;
3108 keySettings[2].left = SDLK_a;
3109 keySettings[2].right = SDLK_d;
3110 keySettings[2].change = SDLK_LCTRL;
3111 keySettings[2].push = SDLK_LSHIFT;
3112
3113 player1keys=0;
3114 player2keys=2;
3115
3116 strcpy(player1name, "Player 1 \0");
3117 strcpy(player2name, "Player 2 \0");
3118
3119 #ifdef NETWORK
3120 strcpy(serverAddress, "192.168.0.2 \0");
3121 #endif
3122
3123 //Reads options from file:
3124 ifstream optionsFile(optionsPath.c_str(), ios::binary);
3125 if(optionsFile)
3126 {
3127 //reads data: xsize,ysize,fullescreen, player1keys, player2keys, MusicEnabled, SoundEnabled,player1name,player2name
3128 optionsFile.read(reinterpret_cast<char*>(&xsize), sizeof(int));
3129 optionsFile.read(reinterpret_cast<char*>(&ysize), sizeof(int));
3130 optionsFile.read(reinterpret_cast<char*>(&bFullscreen), sizeof(bool));
3131 optionsFile.read(reinterpret_cast<char*>(&keySettings[0].up), sizeof(SDLKey));
3132 optionsFile.read(reinterpret_cast<char*>(&keySettings[0].down), sizeof(SDLKey));
3133 optionsFile.read(reinterpret_cast<char*>(&keySettings[0].left), sizeof(SDLKey));
3134 optionsFile.read(reinterpret_cast<char*>(&keySettings[0].right), sizeof(SDLKey));
3135 optionsFile.read(reinterpret_cast<char*>(&keySettings[0].change), sizeof(SDLKey));
3136 optionsFile.read(reinterpret_cast<char*>(&keySettings[0].push), sizeof(SDLKey));
3137 optionsFile.read(reinterpret_cast<char*>(&keySettings[2].up), sizeof(SDLKey));
3138 optionsFile.read(reinterpret_cast<char*>(&keySettings[2].down), sizeof(SDLKey));
3139 optionsFile.read(reinterpret_cast<char*>(&keySettings[2].left), sizeof(SDLKey));
3140 optionsFile.read(reinterpret_cast<char*>(&keySettings[2].right), sizeof(SDLKey));
3141 optionsFile.read(reinterpret_cast<char*>(&keySettings[2].change), sizeof(SDLKey));
3142 optionsFile.read(reinterpret_cast<char*>(&keySettings[2].push), sizeof(SDLKey));
3143 optionsFile.read(reinterpret_cast<char*>(&MusicEnabled), sizeof(bool));
3144 optionsFile.read(reinterpret_cast<char*>(&SoundEnabled), sizeof(bool));
3145 optionsFile.read(player1name, 30*sizeof(char));
3146 optionsFile.read(player2name, 30*sizeof(char));
3147 //mouseplay?
3148 if(!optionsFile.eof())
3149 {
3150 optionsFile.read(reinterpret_cast<char*>(&mouseplay1), sizeof(bool));
3151 optionsFile.read(reinterpret_cast<char*>(&mouseplay2), sizeof(bool));
3152 optionsFile.read(reinterpret_cast<char*>(&joyplay1),sizeof(bool));
3153 optionsFile.read(reinterpret_cast<char*>(&joyplay2),sizeof(bool));
3154 }
3155 optionsFile.close();
3156 cout << "Data loaded from options file" << endl;
3157 }
3158 else
3159 {
3160 cout << "Unable to load options file, using default values" << endl;
3161 }
3162
3163 xsize = 1024;
3164 ysize = 768;
3165 if(singlePuzzle)
3166 {
3167 xsize=300;
3168 ysize=600;
3169 }
3170 //Open video
3171 if((bFullscreen)&&(!singlePuzzle)) screen=SDL_SetVideoMode(xsize,ysize,32,SDL_SWSURFACE|SDL_FULLSCREEN|SDL_ANYFORMAT);
3172 else screen=SDL_SetVideoMode(xsize,ysize,32,SDL_SWSURFACE|SDL_ANYFORMAT);
3173
3174 if ( screen == NULL )
3175 {
3176 cout << "Unable to set " << xsize << "x" << ysize << " video: " << SDL_GetError() << endl;
3177 exit(1);
3178 }
3179
3180 //Loading all images into memory
3181 InitImages();
3182
3183 cout << "Images loaded" << endl;
3184
3185
3186 BlockGame theGame = BlockGame(50,100); //creates game objects
3187 BlockGame theGame2 = BlockGame(xsize-500,100);
3188 if(singlePuzzle)
3189 {
3190 theGame.topy=0;
3191 theGame.topx=0;
3192 theGame2.topy=10000;
3193 theGame2.topx=10000;
3194 }
3195 theGame.DoPaintJob(); //Makes sure what there is something to paint
3196 theGame2.DoPaintJob();
3197 theGame.SetGameOver(); //sets the game over in the beginning
3198 theGame2.SetGameOver();
3199
3200
3201 //Takes names from file instead
3202 strcpy(theGame.name, player1name);
3203 strcpy(theGame2.name, player2name);
3204
3205 //Keeps track of background;
3206 int nowTime=SDL_GetTicks();
3207
3208
3209 #ifdef NETWORK
3210 NetworkThing nt = NetworkThing();
3211 nt.setBGpointers(&theGame,&theGame2);
3212 #endif
3213
3214 if(singlePuzzle)
3215 {
3216 LoadPuzzleStages();
3217 theGame.NewPuzzleGame(singlePuzzleNr,0,0);
3218 showGame = true;
3219 vsMode = true;
3220 }
3221 //Draws everything to screen
3222 MakeBackground(xsize,ysize,theGame,theGame2);
3223 DrawIMG(background, screen, 0, 0);
3224 DrawEverything(xsize,ysize,theGame,theGame2);
3225 SDL_Flip(screen);
3226
3227 //game loop
3228 int done = 0;
3229 cout << "Starting game loop" << endl;
3230 while(done == 0)
3231 {
3232 if(!(highPriority)) SDL_Delay(10);
3233
3234 if(standardBackground)
3235 {
3236 MakeBackground(xsize,ysize,theGame,theGame2);
3237 DrawIMG(background, screen, 0, 0);
3238 }
3239
3240 //updates the balls and explosions:
3241 theBallManeger.update();
3242 theExplosionManeger.update();
3243 theTextManeger.update();
3244
3245 #ifdef NETWORK
3246 if(nt.isConnected())
3247 {
3248 nt.updateNetwork();
3249 networkActive = true;
3250 if(!nt.isConnectedToPeer())
3251 DrawIMG(background, screen, 0, 0);
3252 }
3253 else
3254 networkActive = false;
3255 if(nt.isConnectedToPeer())
3256 {
3257 networkPlay=true;
3258 if(!weWhereConnected) //We have just connected
3259 {
3260 theGame.NewVsGame(50,100,&theGame2);
3261 theGame.putStartBlocks(nt.theSeed);
3262 theGame2.playNetwork(xsize-500,100);
3263 nt.theGameHasStarted();
3264 DrawIMG(background, screen, 0, 0);
3265 }
3266 weWhereConnected = true;
3267 }
3268 else
3269 {
3270 networkPlay=false;
3271 weWhereConnected = false;
3272 }
3273 #endif
3274
3275 if(!bScreenLocked)
3276 {
3277 SDL_Event event;
3278
3279 while ( SDL_PollEvent(&event) )
3280 {
3281 if ( event.type == SDL_QUIT ) { done = 1; }
3282
3283 if ( event.type == SDL_KEYDOWN )
3284 {
3285 if ( event.key.keysym.sym == SDLK_ESCAPE )
3286 {
3287 if(showHighscores)
3288 {
3289 showHighscores = false;
3290 }
3291 else
3292 if(showOptions)
3293 {
3294 showOptions = false;
3295 }
3296 else
3297 done=1;
3298 DrawIMG(background, screen, 0, 0);
3299
3300 }
3301 //player1:
3302 if ( event.key.keysym.sym == keySettings[player1keys].up ) { theGame.MoveCursor('N'); repeatingP1N=true; timeHeldP1N=SDL_GetTicks(); timesRepeatedP1N=0;}
3303 if ( event.key.keysym.sym == keySettings[player1keys].down ) { theGame.MoveCursor('S'); repeatingP1S=true; timeHeldP1S=SDL_GetTicks(); timesRepeatedP1S=0;}
3304 if ( (event.key.keysym.sym == keySettings[player1keys].left) && (showGame) ) { theGame.MoveCursor('W'); repeatingP1W=true; timeHeldP1W=SDL_GetTicks(); timesRepeatedP1W=0;}
3305 if ( (event.key.keysym.sym == keySettings[player1keys].right) && (showGame) ) { theGame.MoveCursor('E'); repeatingP1E=true; timeHeldP1E=SDL_GetTicks(); timesRepeatedP1E=0;}
3306 if ( event.key.keysym.sym == keySettings[player1keys].push ) { theGame.PushLine(); }
3307 if ( event.key.keysym.sym == keySettings[player1keys].change ) { theGame.SwitchAtCursor();}
3308 //player2:
3309 if ( event.key.keysym.sym == keySettings[player2keys].up ) { theGame2.MoveCursor('N'); repeatingP2N=true; timeHeldP2N=SDL_GetTicks(); timesRepeatedP2N=0;}
3310 if ( event.key.keysym.sym == keySettings[player2keys].down ) { theGame2.MoveCursor('S'); repeatingP2S=true; timeHeldP2S=SDL_GetTicks(); timesRepeatedP2S=0;}
3311 if ( (event.key.keysym.sym == keySettings[player2keys].left) && (showGame) ) { theGame2.MoveCursor('W'); repeatingP2W=true; timeHeldP2W=SDL_GetTicks(); timesRepeatedP2W=0;}
3312 if ( (event.key.keysym.sym == keySettings[player2keys].right) && (showGame) ) { theGame2.MoveCursor('E'); repeatingP2E=true; timeHeldP2E=SDL_GetTicks(); timesRepeatedP2E=0;}
3313 if ( event.key.keysym.sym == keySettings[player2keys].push ) { theGame2.PushLine(); }
3314 if ( event.key.keysym.sym == keySettings[player2keys].change ) { theGame2.SwitchAtCursor();}
3315 //common:
3316 if(!singlePuzzle)
3317 {
3318 if ( ((event.key.keysym.sym == SDLK_LEFT)||(event.key.keysym.sym == SDLK_RIGHT)) && (showHighscores) ) {showEndless = !showEndless;}
3319
3320 if ( event.key.keysym.sym == SDLK_F2 ) {if((!showHighscores)&&(!showOptions)&&(!networkActive)){theGame.NewGame(50,100); theGame.timetrial = false; theGame.putStartBlocks(); closeAllMenus(); twoPlayers =false; theGame2.SetGameOver(); showGame = true; vsMode = false;}}
3321 if ( event.key.keysym.sym == SDLK_F3 ) {if((!showHighscores)&&(!showOptions)&&(!networkActive)){theGame.NewGame(50,100); theGame.timetrial = true; theGame.putStartBlocks(); closeAllMenus(); twoPlayers =false; theGame2.SetGameOver(); showGame = true; vsMode = false;}}
3322 if ( event.key.keysym.sym == SDLK_F5 )
3323 {
3324 if((!showHighscores)&&(!showOptions)&&(!networkActive))
3325 {
3326 int myLevel = StageLevelSelect();
3327 theGame.NewStageGame(myLevel,50,100);
3328 MakeBackground(xsize,ysize,theGame,theGame2);
3329 DrawIMG(background, screen, 0, 0);
3330 closeAllMenus();
3331 twoPlayers =false;
3332 theGame2.SetGameOver();
3333 showGame = true;
3334 vsMode = false;
3335 }
3336 }
3337 if ( event.key.keysym.sym == SDLK_F6 )
3338 {
3339 if((!showHighscores)&&(!showOptions)&&(!networkActive))
3340 {
3341 theGame.NewVsGame(50,100,&theGame2);
3342 theGame2.NewVsGame(xsize-500,100,&theGame);
3343 closeAllMenus();
3344 vsMode = true;
3345 theGame.setGameSpeed(player1Speed);
3346 theGame2.setGameSpeed(player2Speed);
3347 theGame.setHandicap(player1handicap);
3348 theGame2.setHandicap(player2handicap);
3349 theGame.AI_Enabled = player1AI;
3350 theGame2.AI_Enabled = player2AI;
3351 theGame.setAIlevel(player1AIlevel);
3352 theGame2.setAIlevel(player2AIlevel);
3353 int theTime = time(0);
3354 theGame.putStartBlocks(theTime);
3355 theGame2.putStartBlocks(theTime);
3356 twoPlayers = true;
3357 }
3358 }
3359 if ( event.key.keysym.sym == SDLK_F4 )
3360 {
3361 if((!showHighscores)&&(!showOptions)&&(!networkActive))
3362 {
3363 theGame.NewGame(50,100);
3364 theGame2.NewGame(xsize-500,100);
3365 theGame.timetrial = true;
3366 theGame2.timetrial = true;
3367 int theTime = time(0);
3368 theGame.putStartBlocks(theTime);
3369 theGame2.putStartBlocks(theTime);
3370 closeAllMenus();
3371 twoPlayers = true;
3372 theGame.setGameSpeed(player1Speed);
3373 theGame2.setGameSpeed(player2Speed);
3374 theGame.setHandicap(player1handicap);
3375 theGame2.setHandicap(player2handicap);
3376 theGame.AI_Enabled = player1AI;
3377 theGame2.AI_Enabled = player2AI;
3378 theGame.setAIlevel(player1AIlevel);
3379 theGame2.setAIlevel(player2AIlevel);
3380 }
3381 }
3382 if ( event.key.keysym.sym == SDLK_F7 )
3383 {
3384 if((!showHighscores)&&(!showOptions)&&(!networkActive))
3385 {
3386 int myLevel = PuzzleLevelSelect();
3387 theGame.NewPuzzleGame(myLevel,50,100);
3388 MakeBackground(xsize,ysize,theGame,theGame2);
3389 DrawIMG(background, screen, 0, 0);
3390 closeAllMenus();
3391 twoPlayers = false;
3392 theGame2.SetGameOver();
3393 showGame = true;
3394 vsMode = true;
3395 }
3396 }
3397 if ( event.key.keysym.sym == SDLK_F8 )
3398 {
3399 if((!showGame)&&(!showOptions)&&(!networkActive))
3400 if(!showHighscores)
3401 {
3402 closeAllMenus();
3403 showHighscores = true;
3404 MakeBackground(xsize,ysize,theGame,theGame2);
3405 DrawIMG(background, screen, 0, 0);
3406 closeAllMenus();
3407 theGame2.SetGameOver();
3408 }
3409 else
3410 {
3411 showEndless = !showEndless;
3412 }
3413 }
3414 if ( event.key.keysym.sym == SDLK_F9 ) {writeScreenShot();}
3415 if ( event.key.keysym.sym == SDLK_F11 ) {
3416 /*This is the test place, place function to test here*/
3417
3418 theGame.CreateGreyGarbage();
3419
3420 } //F11
3421 }
3422 if ( event.key.keysym.sym == SDLK_F12 ) {done=1;}
3423 }
3424 } //while event PollEvent - read keys
3425
3426 /**********************************************************************
3427 **************************** Repeating start **************************
3428 repeatingP2E=true; timeHeldP2E=SDL_GetTicks(); timesRepeatedP2E=0;
3429 keySettings[player2keys].right
3430 keys = SDL_GetKeyState(NULL);
3431 (this is just info so we don't need to look too long back)
3432 **********************************************************************/
3433
3434 keys = SDL_GetKeyState(NULL);
3435 //Also the joysticks:
3436 //Repeating not implemented
3437
3438 //Player 1 start
3439 if(!(keys[keySettings[player1keys].up]))
3440 repeatingP1N=false;
3441 while((repeatingP1N)&&(keys[keySettings[player1keys].up])&&(SDL_GetTicks()>timeHeldP1N+timesRepeatedP1N*repeatDelay+startRepeat))
3442 {
3443 theGame.MoveCursor('N');
3444 timesRepeatedP1N++;
3445 }
3446
3447 if(!(keys[keySettings[player1keys].down]))
3448 repeatingP1S=false;
3449 while((repeatingP1S)&&(keys[keySettings[player1keys].down])&&(SDL_GetTicks()>timeHeldP1S+timesRepeatedP1S*repeatDelay+startRepeat))
3450 {
3451 theGame.MoveCursor('S');
3452 timesRepeatedP1S++;
3453 }
3454
3455 if(!(keys[keySettings[player1keys].left]))
3456 repeatingP1W=false;
3457 while((repeatingP1W)&&(keys[keySettings[player1keys].left])&&(SDL_GetTicks()>timeHeldP1W+timesRepeatedP1W*repeatDelay+startRepeat))
3458 {
3459 timesRepeatedP1W++;
3460 theGame.MoveCursor('W');
3461 }
3462
3463 if(!(keys[keySettings[player1keys].right]))
3464 repeatingP1E=false;
3465 while((repeatingP1E)&&(keys[keySettings[player1keys].right])&&(SDL_GetTicks()>timeHeldP1E+timesRepeatedP1E*repeatDelay+startRepeat))
3466 {
3467 timesRepeatedP1E++;
3468 theGame.MoveCursor('E');
3469 }
3470
3471 //Player 1 end
3472
3473 //Player 2 start
3474 if(!(keys[keySettings[player2keys].up]))
3475 repeatingP2N=false;
3476 while((repeatingP2N)&&(keys[keySettings[player2keys].up])&&(SDL_GetTicks()>timeHeldP2N+timesRepeatedP2N*repeatDelay+startRepeat))
3477 {
3478 theGame2.MoveCursor('N');
3479 timesRepeatedP2N++;
3480 }
3481
3482 if(!(keys[keySettings[player2keys].down]))
3483 repeatingP2S=false;
3484 while((repeatingP2S)&&(keys[keySettings[player2keys].down])&&(SDL_GetTicks()>timeHeldP2S+timesRepeatedP2S*repeatDelay+startRepeat))
3485 {
3486 theGame2.MoveCursor('S');
3487 timesRepeatedP2S++;
3488 }
3489
3490 if(!(keys[keySettings[player2keys].left]))
3491 repeatingP2W=false;
3492 while((repeatingP2W)&&(keys[keySettings[player2keys].left])&&(SDL_GetTicks()>timeHeldP2W+timesRepeatedP2W*repeatDelay+startRepeat))
3493 {
3494 theGame2.MoveCursor('W');
3495 timesRepeatedP2W++;
3496 }
3497
3498 if(!(keys[keySettings[player2keys].right]))
3499 repeatingP2E=false;
3500 while((repeatingP2E)&&(keys[keySettings[player2keys].right])&&(SDL_GetTicks()>timeHeldP2E+timesRepeatedP2E*repeatDelay+startRepeat))
3501 {
3502 theGame2.MoveCursor('E');
3503 timesRepeatedP2E++;
3504 }
3505
3506 //Player 2 end
3507
3508 /**********************************************************************
3509 **************************** Repeating end ****************************
3510 **********************************************************************/
3511
3512 /**********************************************************************
3513 ***************************** Joypad start ****************************
3514 **********************************************************************/
3515
3516 if(joyplay1||joyplay2)
3517 {
3518 if(joypad1.working)
3519 if(joyplay1)
3520 {
3521 joypad1.update();
3522 if(joypad1.up)
3523 {theGame.MoveCursor('N'); repeatingP1N=true; timeHeldP1N=SDL_GetTicks(); timesRepeatedP1N=0;}
3524 if(joypad1.down)
3525 {theGame.MoveCursor('S'); repeatingP1S=true; timeHeldP1S=SDL_GetTicks(); timesRepeatedP1S=0;}
3526 if(joypad1.left)
3527 {theGame.MoveCursor('W'); repeatingP1W=true; timeHeldP1W=SDL_GetTicks(); timesRepeatedP1W=0;}
3528 if(joypad1.right)
3529 {theGame.MoveCursor('E'); repeatingP1E=true; timeHeldP1E=SDL_GetTicks(); timesRepeatedP1E=0;}
3530 if(joypad1.but1)
3531 theGame.SwitchAtCursor();
3532 if(joypad1.but2)
3533 theGame.PushLine();
3534 }
3535 else
3536 {
3537 joypad1.update();
3538 if(joypad1.up)
3539 {theGame2.MoveCursor('N'); repeatingP2N=true; timeHeldP2N=SDL_GetTicks(); timesRepeatedP2N=0;}
3540 if(joypad1.down)
3541 {theGame2.MoveCursor('S'); repeatingP2S=true; timeHeldP2S=SDL_GetTicks(); timesRepeatedP2S=0;}
3542 if(joypad1.left)
3543 {theGame2.MoveCursor('W'); repeatingP2W=true; timeHeldP2W=SDL_GetTicks(); timesRepeatedP2W=0;}
3544 if(joypad1.right)
3545 {theGame2.MoveCursor('E'); repeatingP2E=true; timeHeldP2E=SDL_GetTicks(); timesRepeatedP2E=0;}
3546 if(joypad1.but1)
3547 theGame2.SwitchAtCursor();
3548 if(joypad1.but2)
3549 theGame2.PushLine();
3550 }
3551 if(joypad2.working)
3552 if(!joyplay2)
3553 {
3554 joypad2.update();
3555 if(joypad2.up)
3556 {theGame.MoveCursor('N'); repeatingP1N=true; timeHeldP1N=SDL_GetTicks(); timesRepeatedP1N=0;}
3557 if(joypad2.down)
3558 {theGame.MoveCursor('S'); repeatingP1S=true; timeHeldP1S=SDL_GetTicks(); timesRepeatedP1S=0;}
3559 if(joypad2.left)
3560 {theGame.MoveCursor('W'); repeatingP1W=true; timeHeldP1W=SDL_GetTicks(); timesRepeatedP1W=0;}
3561 if(joypad2.right)
3562 {theGame.MoveCursor('E'); repeatingP1E=true; timeHeldP1E=SDL_GetTicks(); timesRepeatedP1E=0;}
3563 if(joypad2.but1)
3564 theGame.SwitchAtCursor();
3565 if(joypad2.but2)
3566 theGame.PushLine();
3567 }
3568 else
3569 {
3570 joypad2.update();
3571 if(joypad2.up)
3572 {theGame2.MoveCursor('N'); repeatingP2N=true; timeHeldP2N=SDL_GetTicks(); timesRepeatedP2N=0;}
3573 if(joypad2.down)
3574 {theGame2.MoveCursor('S'); repeatingP2S=true; timeHeldP2S=SDL_GetTicks(); timesRepeatedP2S=0;}
3575 if(joypad2.left)
3576 {theGame2.MoveCursor('W'); repeatingP2W=true; timeHeldP2W=SDL_GetTicks(); timesRepeatedP2W=0;}
3577 if(joypad2.right)
3578 {theGame2.MoveCursor('E'); repeatingP2E=true; timeHeldP2E=SDL_GetTicks(); timesRepeatedP2E=0;}
3579 if(joypad2.but1)
3580 theGame2.SwitchAtCursor();
3581 if(joypad2.but2)
3582 theGame2.PushLine();
3583 }
3584 }
3585
3586 /**********************************************************************
3587 ***************************** Joypad end ******************************
3588 **********************************************************************/
3589
3590
3591 keys = SDL_GetKeyState(NULL);
3592
3593 SDL_GetMouseState(&mousex,&mousey);
3594
3595 /********************************************************************
3596 **************** Here comes mouse play ******************************
3597 ********************************************************************/
3598
3599 if(mouseplay1) //player 1
3600 if((mousex > 50)&&(mousey>100)&&(mousex<50+300)&&(mousey<100+600))
3601 {
3602 int yLine, xLine;
3603 yLine = ((100+600)-(mousey-100+theGame.pixels))/50;
3604 xLine = (mousex-50+25)/50;
3605 yLine-=2;
3606 xLine-=1;
3607 if((yLine>10)&&(theGame.TowerHeight<12))
3608 yLine=10;
3609 if(((theGame.pixels==50)||(theGame.pixels==0)) && (yLine>11))
3610 yLine=11;
3611 if(yLine<0)
3612 yLine=0;
3613 if(xLine<0)
3614 xLine=0;
3615 if(xLine>4)
3616 xLine=4;
3617 theGame.cursorx=xLine;
3618 theGame.cursory=yLine;
3619 }
3620
3621 if(mouseplay2) //player 2
3622 if((mousex > xsize-500)&&(mousey>100)&&(mousex<xsize-500+300)&&(mousey<100+600))
3623 {
3624 int yLine, xLine;
3625 yLine = ((100+600)-(mousey-100+theGame2.pixels))/50;
3626 xLine = (mousex-(xsize-500)+25)/50;
3627 yLine-=2;
3628 xLine-=1;
3629 if((yLine>10)&&(theGame2.TowerHeight<12))
3630 yLine=10;
3631 if(((theGame2.pixels==50)||(theGame2.pixels==0)) && (yLine>11))
3632 yLine=11;
3633 if(yLine<0)
3634 yLine=0;
3635 if(xLine<0)
3636 xLine=0;
3637 if(xLine>4)
3638 xLine=4;
3639 theGame2.cursorx=xLine;
3640 theGame2.cursory=yLine;
3641 }
3642
3643 /********************************************************************
3644 **************** Here ends mouse play *******************************
3645 ********************************************************************/
3646
3647 // If the mouse button is released, make bMouseUp equal true
3648 if(!SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(1))
3649 {
3650 bMouseUp=true;
3651 }
3652
3653 // If the mouse button 2 is released, make bMouseUp2 equal true
3654 if((SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(3))!=SDL_BUTTON(3))
3655 {
3656 bMouseUp2=true;
3657 }
3658
3659 if(!singlePuzzle)
3660 {
3661 //read mouse events
3662 if(SDL_GetMouseState(NULL,NULL)&SDL_BUTTON(1) && bMouseUp)
3663 {
3664 bMouseUp = false;
3665 DrawIMG(background, screen, 0, 0);
3666 if((0<mousex) && (mousex<120) && (0<mousey) && (mousey<40) &&(!networkActive) )
3667 {
3668 //New game clicked
3669 bool state = (!bNewGameOpen);
3670 closeAllMenus();
3671 bNewGameOpen = state; //theGame.NewGame(50,100);
3672 showOptions = false;
3673 showHighscores = false;
3674 }
3675 else
3676 #ifdef NETWORK
3677 if((0<mousex) && (mousex<120) && (0<mousey) && (mousey<40) &&(networkActive))
3678 {
3679 //Disconnect clicked!
3680 cout << "Disconnect clicked!" << endl;
3681 nt.ntDisconnect();
3682 }
3683 else
3684 #endif
3685 if((0<mousex) && (mousex<120) && (40<mousey) && (mousey<80) && (bNewGameOpen) &&(!networkActive))
3686 {
3687 //1player
3688 b1playerOpen = (!b1playerOpen);
3689 b2playersOpen = false;
3690 #ifdef NETWORK
3691 bNetworkOpen = false;
3692 #endif
3693 }
3694 else
3695 if((0<mousex) && (mousex<120) && (80<mousey) && (mousey<120) && (bNewGameOpen) &&(!networkActive))
3696 {
3697 //2player
3698 b2playersOpen = (!b2playersOpen);
3699 b1playerOpen = false;
3700 #ifdef NETWORK
3701 bNetworkOpen = false;
3702 #endif
3703 }
3704 #ifdef NETWORK
3705 else
3706 if((0<mousex) && (mousex<120) && (120<mousey) && (mousey<160) && (bNewGameOpen) &&(!networkActive))
3707 {
3708 //Network
3709 b1playerOpen = false;
3710 b2playersOpen = false;
3711 bNetworkOpen = (!bNetworkOpen);
3712 }
3713 #endif
3714 else
3715 if((120<mousex) && (mousex<240) && (40<mousey) && (mousey<80) && (b1playerOpen) &&(!networkActive))
3716 {
3717 //1 player - endless
3718 theGame.NewGame(50,100);
3719 theGame.putStartBlocks();
3720 bNewGameOpen = false;
3721 b1playerOpen = false;
3722 twoPlayers =false; theGame2.SetGameOver(); showGame = true;
3723 }
3724 else
3725 if((120<mousex) && (mousex<240) && (80<mousey) && (mousey<120) && (b1playerOpen) &&(!networkActive) )
3726 {
3727 //1 player - time trial
3728 theGame.NewGame(50,100); theGame.timetrial=true;
3729 theGame.putStartBlocks();
3730 bNewGameOpen = false;
3731 b1playerOpen = false;
3732 twoPlayers =false; theGame2.SetGameOver(); showGame = true;
3733 }
3734 else
3735 if((120<mousex) && (mousex<240) && (120<mousey) && (mousey<160) && (b1playerOpen)&&(!networkActive) )
3736 {
3737 //1 player - stage clear
3738 bNewGameOpen = false;
3739 b1playerOpen = false;
3740 int myLevel = StageLevelSelect();
3741 theGame.NewStageGame(myLevel,50,100);
3742 MakeBackground(xsize,ysize,theGame,theGame2);
3743 DrawIMG(background, screen, 0, 0);
3744 twoPlayers =false; theGame2.SetGameOver(); showGame = true;
3745 vsMode = false;
3746 }
3747 else
3748 if((120<mousex) && (mousex<240) && (160<mousey) && (mousey<200) && (b1playerOpen))
3749 {
3750 //1 player - puzzle
3751 bNewGameOpen = false;
3752 b1playerOpen = false;
3753 int myLevel = PuzzleLevelSelect();
3754 theGame.NewPuzzleGame(myLevel,50,100);
3755 MakeBackground(xsize,ysize,theGame,theGame2);
3756 DrawIMG(background, screen, 0, 0);
3757 twoPlayers =false; theGame2.SetGameOver(); showGame = true;
3758 vsMode = false;
3759 }
3760 else
3761 if((120<mousex) && (mousex<240) && (200<mousey) && (mousey<240) && (b1playerOpen))
3762 {
3763 //1 player - Vs mode
3764 bNewGameOpen = false;
3765 b1playerOpen = false;
3766 int theAIlevel = startSingleVs();
3767 theGame.NewVsGame(50,100,&theGame2);
3768 theGame2.NewVsGame(xsize-500,100,&theGame);
3769 MakeBackground(xsize,ysize,theGame,theGame2);
3770 DrawIMG(background, screen, 0, 0);
3771 twoPlayers = true; //Single player, but AI plays
3772 showGame = true;
3773 vsMode = true;
3774 theGame2.AI_Enabled=true; //Of course we need an AI
3775 theGame2.setAIlevel((Uint8)theAIlevel);
3776 int theTime = time(0);
3777 theGame.putStartBlocks(theTime);
3778 theGame2.putStartBlocks(theTime);
3779 }
3780 else
3781 if((120<mousex) && (mousex<240) && (80<mousey) && (mousey<120) && (b2playersOpen))
3782 {
3783 //2 player - time trial
3784 theGame.NewGame(50,100); theGame.timetrial=true;
3785 bNewGameOpen = false;
3786 b2playersOpen = false;
3787 theGame.NewGame(50,100);
3788 theGame2.NewGame(xsize-500,100);
3789 theGame.timetrial = true;
3790 theGame2.timetrial = true;
3791 int theTime = time(0);
3792 theGame.putStartBlocks(theTime);
3793 theGame2.putStartBlocks(theTime);
3794 theGame.setGameSpeed(player1Speed);
3795 theGame2.setGameSpeed(player2Speed);
3796 theGame.setHandicap(player1handicap);
3797 theGame2.setHandicap(player2handicap);
3798 theGame.AI_Enabled = player1AI;
3799 theGame2.AI_Enabled = player2AI;
3800 theGame.setAIlevel(player1AIlevel);
3801 theGame2.setAIlevel(player2AIlevel);
3802 twoPlayers = true;
3803 }
3804 else
3805 if((120<mousex) && (mousex<240) && (120<mousey) && (mousey<160) && (b2playersOpen))
3806 {
3807 //2 player - VsMode
3808 theGame.NewVsGame(50,100,&theGame2);
3809 theGame2.NewVsGame(xsize-500,100,&theGame);
3810 bNewGameOpen = false;
3811 vsMode = true;
3812 twoPlayers = true;
3813 b2playersOpen = false;
3814 theGame.setGameSpeed(player1Speed);
3815 theGame2.setGameSpeed(player2Speed);
3816 theGame.setHandicap(player1handicap);
3817 theGame2.setHandicap(player2handicap);
3818 theGame.AI_Enabled = player1AI;
3819 theGame2.AI_Enabled = player2AI;
3820 theGame.setAIlevel(player1AIlevel);
3821 theGame2.setAIlevel(player2AIlevel);
3822 int theTime = time(0);
3823 theGame.putStartBlocks(theTime);
3824 theGame2.putStartBlocks(theTime);
3825 }
3826 #ifdef NETWORK
3827 else
3828 if((120<mousex) && (mousex<240) && (120<mousey) && (mousey<160) && (bNetworkOpen))
3829 {
3830 //Host
3831 cout << "Host" << endl;
3832 closeAllMenus();
3833 theGame.SetGameOver();
3834 theGame2.SetGameOver();
3835 nt.startServer();
3836 }
3837 else
3838 if((120<mousex) && (mousex<240) && (160<mousey) && (mousey<200) && (bNetworkOpen))
3839 {
3840 //Connect
3841 cout << "Connect" << endl;
3842 closeAllMenus();
3843 theGame.SetGameOver();
3844 theGame2.SetGameOver();
3845 if(OpenDialogbox(200,100,serverAddress))
3846 {
3847 char buf[30];
3848 memcpy(buf,serverAddress,30);
3849 nt.connectToServer(strtok(buf," "));
3850 }
3851 while ( SDL_PollEvent(&event) ); //If the user have pressed ESC or the like
3852 }
3853 #endif
3854 else
3855 if((120<mousex) && (mousex<2*120) && (0<mousey) && (mousey<40) &&(!networkActive))
3856 {
3857 //options button clicked
3858 if(bOptionsOpen)
3859 {
3860 closeAllMenus();
3861 }
3862 else
3863 {
3864 closeAllMenus();
3865 bOptionsOpen = true;
3866 DrawIMG(background, screen, 0, 0);
3867 }
3868 }
3869 else
3870 if((120<mousex) && (mousex<2*120) && (40<mousey) && (mousey<80) && (bOptionsOpen) )
3871 {
3872 //Configure button clicked
3873 closeAllMenus();
3874 if(!showOptions) { showOptions = true; showHighscores = false; }
3875 else showOptions = false;
3876 DrawIMG(background, screen, 0, 0);
3877 }
3878 else
3879 if((120<mousex) && (mousex<2*120) && (80<mousey) && (mousey<120) && (bOptionsOpen) )
3880 {
3881 //Configure button clicked
3882 closeAllMenus();
3883 changePuzzleLevels();
3884 }
3885 else
3886 if((120<mousex) && (mousex<2*120) && (120<mousey) && (mousey<160) && (bOptionsOpen) )
3887 {
3888 //vsMode button clicked
3889 closeAllMenus();
3890 startVsMenu();
3891 }
3892 else
3893 if((120*2<mousex) && (mousex<3*120) && (0<mousey) && (mousey<40) &&(!networkActive))
3894 {
3895 //highscore button clicked
3896 bool state = showHighscores;
3897 closeAllMenus();
3898 if(!state) {showHighscores = true; showOptions = false;}
3899 DrawIMG(background, screen, 0, 0);
3900 }
3901 else
3902 if((360<mousex) && (mousex<4*120) && (0<mousey) && (mousey<40) &&(!networkActive))
3903 {
3904 //Replay clicked!
3905 bool state = (!bReplayOpen);
3906 closeAllMenus();
3907 bReplayOpen = state; //theGame.NewGame(50,100);
3908 showOptions = false;
3909 showHighscores = false;
3910 }
3911 else
3912 if((360<mousex) && (mousex<4*120) && (40<mousey) && (mousey<80) &&(bReplayOpen))
3913 {
3914 //Replay->Save clicked!
3915 //cout << "Replay->Save clicked" << endl;
3916 char buf[30];
3917 for(int i=0;i<29;i++)buf[i]=' ';
3918 buf[30]=0;
3919 OpenDialogbox(200,100,buf);
3920 for(int i=28;buf[i]==' ';i--)
3921 buf[i]=0;
3922 #ifdef __unix__
3923 string saveHere = (string)getenv("HOME")+(string)"/.gamesaves/blockattack/replays/"+(string)buf;
3924 #elif WIN32
3925 string saveHere = home+(string)"/My Games/blockattack/replays/"+(string)buf;
3926 #else
3927 string saveHere = (string)"./replays"+(string)buf;
3928 #endif
3929 ofstream replayFileOut;
3930 replayFileOut.open(saveHere.c_str(),ios::binary|ios::trunc);
3931 if(replayFileOut)
3932 {
3933 //writes data: xsize,ysize,fullescreen, player1keys, player2keys, MusicEnabled, SoundEnabled,player1name,player2name
3934 // optionsFileOut.write(reinterpret_cast<char*>(&xsize),sizeof(int));
3935 Uint8 version = 1;
3936 replayFileOut.write(reinterpret_cast<char*>(&version),sizeof(Uint8));
3937 if(lastNrOfPlayers>0)
3938 replayFileOut.write(reinterpret_cast<char*>(&theGame.theReplay),sizeof(Replay));
3939 if(lastNrOfPlayers>1)
3940 replayFileOut.write(reinterpret_cast<char*>(&theGame2.theReplay),sizeof(Replay));
3941 replayFileOut.close();
3942 }
3943 closeAllMenus();
3944 }
3945 else
3946 if((360<mousex) && (mousex<4*120) && (80<mousey) && (mousey<120)&&(bReplayOpen))
3947 {
3948 //Replay->Load clicked!
3949 //cout << "Replay->Load clicked" << endl;
3950
3951 char buf[30];
3952 for(int i=0;i<29;i++)buf[i]=' ';
3953 buf[30]=0;
3954 if(OpenReplayDialogbox(50,100,buf))
3955 {
3956 //cout << "Good way" << endl;
3957 for(int i=28;buf[i]==' ';i--)
3958 buf[i]=0;
3959 #ifdef __unix__
3960 string loadThis = (string)getenv("HOME")+(string)"/.gamesaves/blockattack/replays/"+(string)buf;
3961 #elif WIN32
3962 string loadThis = home+(string)"/My Games/blockattack/replays/"+(string)buf;
3963 #else
3964 string loadThis = (string)"./replays/"+(string)buf;
3965 #endif
3966 ifstream replayFileIn;
3967 replayFileIn.open(loadThis.c_str(),ios::binary);
3968 bool play2 = false;
3969 if(replayFileIn)
3970 {
3971 Uint8 version = 0;
3972 replayFileIn.read(reinterpret_cast<char*>(&version),sizeof(Uint8));
3973 if(version==1)
3974 {
3975 replayFileIn.read(reinterpret_cast<char*>(&theGame.theReplay), sizeof(Replay));
3976 if(!replayFileIn.eof())
3977 {
3978 cout << "2 players" << endl;
3979 if(replayFileIn.read(reinterpret_cast<char*>(&theGame2.theReplay), sizeof(Replay)))
3980 play2 = true; //If we can actually read a player 2
3981 }
3982 }
3983 replayFileIn.close();
3984 theGame.playReplay(50,100);
3985 if(play2)
3986 theGame2.playReplay(xsize-500,100);
3987 else
3988 theGame2.SetGameOver();
3989 }
3990 }
3991 closeAllMenus();
3992 }
3993 else
3994 if((xsize-120<mousex) && (xsize-20>mousex) && (ysize-120<mousey) && (ysize-20>mousey))
3995 {
3996 //Exit clicked
3997 done=1;
3998 }
3999 else
4000 if((showOptions) && (mousex>500) && (mousex<560) && (mousey>220) && (mousey<260))
4001 {
4002 MusicEnabled = !MusicEnabled;
4003 if(!MusicEnabled) Mix_FadeOutMusic(500);
4004 }
4005 if((showOptions) && (mousex>500) && (mousex<560) && (mousey>270) && (mousey<310))
4006 {
4007 SoundEnabled = !SoundEnabled;
4008 }
4009 if((showOptions) && (mousex>500) && (mousex<560) && (mousey>320) && (mousey<360))
4010 {
4011 //Fullscreen
4012 bFullscreen = !bFullscreen;
4013 #if defined(WIN32)
4014 if(bFullscreen) screen=SDL_SetVideoMode(xsize,ysize,32,SDL_SWSURFACE|SDL_FULLSCREEN|SDL_ANYFORMAT);
4015 else screen=SDL_SetVideoMode(xsize,ysize,32,SDL_SWSURFACE|SDL_ANYFORMAT);
4016 DrawIMG(background, screen, 0, 0);
4017 #else
4018 SDL_WM_ToggleFullScreen(screen); //Will only work in Linux
4019 #endif
4020 SDL_ShowCursor(SDL_DISABLE);
4021 }
4022
4023 if((showOptions) && (mousex>330) && (mousex<470) && (mousey>535) && (mousey<585))
4024 {
4025 //change name
4026 bScreenLocked = true;
4027 showDialog = true;
4028 if(OpenDialogbox(200,100,player1name))
4029 strcpy(theGame.name, player1name);
4030 else
4031 strcpy(player1name,theGame.name);
4032 bScreenLocked = false;
4033 showDialog = false;
4034 MakeBackground(xsize,ysize,theGame,theGame2);
4035 DrawIMG(background, screen, 0, 0);
4036 }
4037 if((showOptions) && (mousex>330) && (mousex<470) && (mousey>600) && (mousey<640))
4038 {
4039 //change name
4040 bScreenLocked = true;
4041 showDialog = true;
4042 if(OpenDialogbox(200,100,player2name))
4043 strcpy(theGame2.name, player2name);
4044 else
4045 strcpy(player2name,theGame2.name);
4046 bScreenLocked = false;
4047 showDialog = false;
4048 MakeBackground(xsize,ysize,theGame,theGame2);
4049 DrawIMG(background, screen, 0, 0);
4050 }
4051 if((showOptions) && (mousex>510) && (mousex<630) && (mousey>535) && (mousey<585))
4052 {
4053 //changeControls
4054 OpenControlsBox(200,100,0);
4055 MakeBackground(xsize,ysize,theGame,theGame2);
4056 DrawIMG(background, screen, 0, 0);
4057 }
4058 if((showOptions) && (mousex>510) && (mousex<630) && (mousey>600) && (mousey<640))
4059 {
4060 //changeControls
4061 OpenControlsBox(200,100,2);
4062 MakeBackground(xsize,ysize,theGame,theGame2);
4063 DrawIMG(background, screen, 0, 0);
4064 }
4065 if((showHighscores)&&(((mousex>150)&&(mousex<173))||((mousex>628)&&(mousex<650)))&&(mousey<652)&&(mousey>630))
4066 {
4067 //small arrors on Highscore board clicked!
4068 showEndless = !showEndless;
4069 DrawIMG(background, screen, 0, 0);
4070 }
4071
4072 /********************************************************************
4073 **************** Here comes mouse play ******************************
4074 ********************************************************************/
4075 if((!showOptions)&&(!showHighscores))
4076 {
4077 if(mouseplay1) //player 1
4078 if((mousex > 50)&&(mousey>100)&&(mousex<50+300)&&(mousey<100+600))
4079 {
4080 theGame.SwitchAtCursor();
4081 }
4082 if(mouseplay2) //player 2
4083 if((mousex > xsize-500)&&(mousey>100)&&(mousex<xsize-500+300)&&(mousey<100+600))
4084 {
4085 theGame2.SwitchAtCursor();
4086 }
4087 }
4088 /********************************************************************
4089 **************** Here ends mouse play *******************************
4090 ********************************************************************/
4091
4092 //cout << "Mouse x: " << mousex << ", mouse y: " << mousey << endl;
4093 }
4094
4095 //Mouse button 2:
4096 if((SDL_GetMouseState(NULL,NULL)&SDL_BUTTON(3))==SDL_BUTTON(3) && bMouseUp2)
4097 {
4098 bMouseUp2=false; //The button is pressed
4099 /********************************************************************
4100 **************** Here comes mouse play ******************************
4101 ********************************************************************/
4102 if((!showOptions)&&(!showHighscores))
4103 {
4104 if(mouseplay1) //player 1
4105 if((mousex > 50)&&(mousey>100)&&(mousex<50+300)&&(mousey<100+600))
4106 {
4107 theGame.PushLine();
4108 }
4109 if(mouseplay2) //player 2
4110 if((mousex > xsize-500)&&(mousey>100)&&(mousex<xsize-500+300)&&(mousey<100+600))
4111 {
4112 theGame2.PushLine();
4113 }
4114 }
4115 /********************************************************************
4116 **************** Here ends mouse play *******************************
4117 ********************************************************************/
4118 }
4119 } //if !singlePuzzle
4120 else
4121 {
4122
4123 }
4124 } //if !bScreenBocked;
4125
4126
4127 //Sees if music is stopped and if music is enabled
4128 if((!NoSound)&&(!Mix_PlayingMusic())&&(MusicEnabled))
4129 {
4130 // then starts playing it.
4131 Mix_PlayMusic(bgMusic, 0); //music loop
4132 }
4133
4134 //Updates the objects
4135 theGame.Update();
4136 theGame2.Update();
4137
4138 //see if anyone has won (two players only)
4139 if(!networkPlay)
4140 if(twoPlayers)
4141 {
4142 lastNrOfPlayers = 2;
4143 if((theGame.bGameOver) && (theGame2.bGameOver))
4144 {
4145 if(theGame.score+theGame.handicap>theGame2.score+theGame2.handicap)
4146 theGame.setPlayerWon();
4147 else
4148 if(theGame.score+theGame.handicap<theGame2.score+theGame2.handicap)
4149 theGame2.setPlayerWon();
4150 else {theGame.setDraw(); theGame2.setDraw();}
4151 twoPlayers = false;
4152 }
4153 if((theGame.bGameOver) && (!theGame2.bGameOver))
4154 {
4155 theGame2.setPlayerWon();
4156 twoPlayers = false;
4157 }
4158 if((!theGame.bGameOver) && (theGame2.bGameOver))
4159 {
4160 theGame.setPlayerWon();
4161 twoPlayers = false;
4162 }
4163 }
4164
4165 //Once evrything has been checked, update graphics
4166 DrawEverything(xsize,ysize,theGame, theGame2);
4167 SDL_GetMouseState(&mousex,&mousey);
4168 //Remember mouse placement
4169 oldMousex = mousex;
4170 oldMousey = mousey;
4171 //Draw the mouse:
4172 DrawIMG(mouse,screen,mousex,mousey);
4173 SDL_Flip(screen);
4174 } //game loop
4175
4176
4177
4178 //Saves options
4179 ofstream optionsFileOut;
4180 optionsFileOut.open(optionsPath.c_str(),ios::binary|ios::trunc);
4181 if(optionsFileOut)
4182 {
4183 //writes data: xsize,ysize,fullescreen, player1keys, player2keys, MusicEnabled, SoundEnabled,player1name,player2name
4184 optionsFileOut.write(reinterpret_cast<char*>(&xsize),sizeof(int));
4185 optionsFileOut.write(reinterpret_cast<char*>(&ysize),sizeof(int));
4186 optionsFileOut.write(reinterpret_cast<char*>(&bFullscreen),sizeof(bool));
4187 optionsFileOut.write(reinterpret_cast<char*>(&keySettings[0].up), sizeof(SDLKey));
4188 optionsFileOut.write(reinterpret_cast<char*>(&keySettings[0].down), sizeof(SDLKey));
4189 optionsFileOut.write(reinterpret_cast<char*>(&keySettings[0].left), sizeof(SDLKey));
4190 optionsFileOut.write(reinterpret_cast<char*>(&keySettings[0].right), sizeof(SDLKey));
4191 optionsFileOut.write(reinterpret_cast<char*>(&keySettings[0].change), sizeof(SDLKey));
4192 optionsFileOut.write(reinterpret_cast<char*>(&keySettings[0].push), sizeof(SDLKey));
4193 optionsFileOut.write(reinterpret_cast<char*>(&keySettings[2].up), sizeof(SDLKey));
4194 optionsFileOut.write(reinterpret_cast<char*>(&keySettings[2].down), sizeof(SDLKey));
4195 optionsFileOut.write(reinterpret_cast<char*>(&keySettings[2].left), sizeof(SDLKey));
4196 optionsFileOut.write(reinterpret_cast<char*>(&keySettings[2].right), sizeof(SDLKey));
4197 optionsFileOut.write(reinterpret_cast<char*>(&keySettings[2].change), sizeof(SDLKey));
4198 optionsFileOut.write(reinterpret_cast<char*>(&keySettings[2].push), sizeof(SDLKey));
4199 optionsFileOut.write(reinterpret_cast<char*>(&MusicEnabled),sizeof(bool));
4200 optionsFileOut.write(reinterpret_cast<char*>(&SoundEnabled),sizeof(bool));
4201 optionsFileOut.write(player1name,30*sizeof(char));
4202 optionsFileOut.write(player2name,30*sizeof(char));
4203 optionsFileOut.write(reinterpret_cast<char*>(&mouseplay1),sizeof(bool));
4204 optionsFileOut.write(reinterpret_cast<char*>(&mouseplay2),sizeof(bool));
4205 optionsFileOut.write(reinterpret_cast<char*>(&joyplay1),sizeof(bool));
4206 optionsFileOut.write(reinterpret_cast<char*>(&joyplay2),sizeof(bool));
4207 optionsFileOut.close();
4208 cout << "options written to file" << endl;
4209 }
4210 else
4211 {
4212 cout << "Failed to write options" << endl;
4213 }
4214
4215
4216 //Frees memory from music and fonts
4217 //This is done after writing of options since it's often crashes the program :(
4218 UnloadImages();
4219
4220 //calculate uptime:
4221 int hours, mins, secs, time;
4222 time = SDL_GetTicks();
4223 hours = time/(1000*60*60);
4224 time = time % (1000*60*60);
4225 mins = time/(1000*60);
4226 time = time % (1000*60);
4227 secs = time/1000;
4228
4229 cout << "Block Attack - Rise of the Blocks ran for: " << hours << " hours " << mins << " mins and " << secs << " secs" << endl;
4230
4231 return 0;
4232 }
0 to regenerate the manpage:
1 docbook-to-man blockattack.sgml|gzip -9 > blockattack.6.gz
0 to regenerate the manpage:
1 docbook-to-man blockattack.sgml|gzip > blockattack.6.gz
0 #-------------#
1 # Import Vars #
2 #-------------#
3 Import('*')
4
5 env.Install ('$destdir/$mandir/man6/','blockattack.6.gz')
6 env.Alias('install', '$destdir/$mandir/man6/')
7
0 #-------------#
1 # Import Vars #
2 #-------------#
3 Import('*')
4
5 env.Install ('$destdir/$mandir/man6/','blockattack.6.gz')
6 env.Alias('install', '$destdir/$mandir/man6/')
7
Binary diff not shown
0 <!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
1
2 <!-- Process this file with docbook-to-man to generate an nroff manual
3 page: `docbook-to-man manpage.sgml > manpage.1'. You may view
4 the manual page with: `docbook-to-man manpage.sgml | nroff -man |
5 less'. A typical entry in a Makefile or Makefile.am is:
6
7 manpage.1: manpage.sgml
8 docbook-to-man $< > $@
9
10
11 The docbook-to-man binary is found in the docbook-to-man package.
12 Please remember that if you create the nroff version in one of the
13 debian/rules file targets (such as build), you will need to include
14 docbook-to-man in your Build-Depends control field.
15
16 -->
17
18 <!-- Fill in your name for FIRSTNAME and SURNAME. -->
19 <!ENTITY dhfirstname "<firstname>Goneri</firstname>">
20 <!ENTITY dhsurname "<surname>Le Bouder</surname>">
21 <!-- Please adjust the date whenever revising the manpage. -->
22 <!ENTITY dhdate "<date>mai 19, 2006</date>">
23 <!-- SECTION should be 1-8, maybe w/ subsection other parameters are
24 allowed: see man(7), man(1). -->
25 <!ENTITY dhsection "<manvolnum>6</manvolnum>">
26 <!ENTITY dhemail "<email>goneri@rulezlan.org</email>">
27 <!ENTITY dhusername "Goneri Le Bouder">
28 <!ENTITY dhucpackage "<refentrytitle>BLOCKATTACK</refentrytitle>">
29 <!ENTITY dhpackage "blockattack">
30
31 <!ENTITY debian "<productname>Debian</productname>">
32 <!ENTITY gnu "<acronym>GNU</acronym>">
33 <!ENTITY gpl "&gnu; <acronym>GPL</acronym>">
34 ]>
35
36 <refentry>
37 <refentryinfo>
38 <address>
39 &dhemail;
40 </address>
41 <author>
42 &dhfirstname;
43 &dhsurname;
44 </author>
45 <copyright>
46 <year>2006</year>
47 <holder>&dhusername;</holder>
48 </copyright>
49 &dhdate;
50 </refentryinfo>
51 <refmeta>
52 &dhucpackage;
53
54 &dhsection;
55 </refmeta>
56 <refnamediv>
57 <refname>&dhpackage;</refname>
58
59 <refpurpose>Rise of the Blocks</refpurpose>
60 </refnamediv>
61 <refsect1>
62 <title>DESCRIPTION</title>
63
64 <para>This manual page documents briefly the
65 <command>&dhpackage;</command>.
66 </para>
67
68 <para>This manual page was written for the &debian; distribution
69 because the original program does not have a manual page.
70 .</para>
71
72
73 </refsect1>
74 <refsect1>
75 <title>OPTIONS</title>
76
77 <para>These programs don't have specific option.</para>
78
79 </refsect1>
80 <refsect1>
81 <title>AUTHOR</title>
82
83 <para>This manual page was written by &dhusername; &dhemail; for
84 the &debian; system (but may be used by others). Permission is
85 granted to copy, distribute and/or modify this document under
86 the terms of the &gnu; General Public License, Version 2 any
87 later version published by the Free Software Foundation.
88 </para>
89 <para>
90 On Debian systems, the complete text of the GNU General Public
91 License can be found in /usr/share/common-licenses/GPL.
92 </para>
93
94 </refsect1>
95 </refentry>
96
97 <!-- Keep this comment at the end of the file
98 Local variables:
99 mode: sgml
100 sgml-omittag:t
101 sgml-shorttag:t
102 sgml-minimize-attributes:nil
103 sgml-always-quote-attributes:t
104 sgml-indent-step:2
105 sgml-indent-data:t
106 sgml-parent-document:nil
107 sgml-default-dtd-file:nil
108 sgml-exposed-tags:nil
109 sgml-local-catalogs:nil
110 sgml-local-ecat-files:nil
111 End:
112 -->
113
114
0 /*
1 poulsCommonWindows.hpp
2 Copyright (C) 2005 Poul Sander
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 Poul Sander
19 Rævehøjvej 36, V. 1111
20 2800 Kgs. Lyngby
21 DENMARK
22 poul.sander@tdcadsl.dk
23 */
24
25 #ifdef _WIN32
26 #ifndef POULSCOMMONWINDOWS
27 #define POULSCOMMONWINDOWS
28 //#using <mscorlib.dll>
29
30
31 #endif //POULSCOMMINWINDOWS
32 #endif //_WIN32
0 /*
1 replay.cpp
2 Copyright (C) 2005 Poul Sander
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 Poul Sander
19 Rævehøjvej 36, V. 1111
20 2800 Kgs. Lyngby
21 DENMARK
22 poul.sander@tdcadsl.dk
23 */
24
25 /*
26 Handles replay
27 */
28
29 #include "replay.h"
30
31 void Replay::newReplay()
32 {
33 nrOfFrames=0;
34 }
35
36 Uint32 Replay::getNumberOfFrames()
37 {
38 return nrOfFrames;
39 }
40
41 void Replay::setFrameSecTo(Uint32 miliseconds, boardPackage bp)
42 {
43 int framesToSet = (miliseconds*FRAMESPERSEC)/1000;
44 if(!(framesToSet<TOTALFRAMES))
45 framesToSet = TOTALFRAMES;
46 for(int i=nrOfFrames;i<framesToSet;i++)
47 {
48 bps[i]=bp;
49 }
50 nrOfFrames=framesToSet;
51 }
52
53 void Replay::setFinalFrame(boardPackage bp,int theStatus)
54 {
55 finalPack = bp;
56 switch(theStatus)
57 {
58 case 1:
59 theResult = winner;
60 break;
61 case 2:
62 theResult = looser;
63 break;
64 case 3:
65 theResult = draw;
66 break;
67 default:
68 theResult = gameOver;
69 };
70
71 }
72
73 //Returns the frame to the current time, if time too high the final frame is returned
74 boardPackage Replay::getFrameSec(Uint32 miliseconds)
75 {
76 int frameToGet = (miliseconds*FRAMESPERSEC)/1000;
77 //cout << "got frame: " << frameToGet << endl;
78 if(!(frameToGet<nrOfFrames))
79 return getFinalFrame();
80 return bps[frameToGet];
81 }
82
83 bool Replay::isFinnished(Uint32 miliseconds)
84 {
85 int frameToGet = (miliseconds*FRAMESPERSEC)/1000;
86 if(!(frameToGet<nrOfFrames))
87 return true;
88 return false;
89 }
90
91 boardPackage Replay::getFinalFrame()
92 {
93 return finalPack;
94 }
95
96 int Replay::getFinalStatus()
97 {
98 return theResult;
99 }
100
101 /*
102
103 bool Replay::saveReplay(char* filename)
104 {
105 //Saving as fileversion 1
106 ofstream saveFile;
107 saveFile.open(filename,ios::binary|ios::trunc);
108 if(saveFile)
109 {
110 Uint32 version = 1;
111 saveFile.write(reinterpret_cast<char*>(&version),sizeof(Uint32)); //Fileversion
112 Uin8 nrOfReplays = 1;
113 saveFile.write(reinterpret_cast<char*>(&nrOfReplays),sizeof(Uint8)); //nrOfReplaysIn File
114 saveFile.write(reinterpret_cast<char*>(&nrOfFrames),sizeof(Uint32)); //Nr of frames in file
115 for(int i=0; (i<nrOfFrames)&&(i<TOTALFRAMES);i++)
116 { //Writing frames
117 saveFile.write(reinterpret_cast<char*>(bps[i].time),sizeof(Uint32));
118 for(int k=0;k<6;k++)
119 for(int g=0;g<13;g++)
120 saveFile.write(reinterpret_cast<char*>(bps[i].brick[k][g]),sizeof(Uint8));
121 saveFile.write(reinterpret_cast<char*>(bps[i].pixels),sizeof(Uint8));
122 saveFile.write(reinterpret_cast<char*>(bps[i].cursorX),sizeof(Uint8));
123 saveFile.write(reinterpret_cast<char*>(bps[i].cursorY),sizeof(Uint8));
124 saveFile.write(reinterpret_cast<char*>(bps[i].score),sizeof(Uint32));
125 saveFile.write(reinterpret_cast<char*>(bps[i].speed),sizeof(Uint8));
126 saveFile.write(reinterpret_cast<char*>(bps[i].chain),sizeof(Uint8));
127 }
128 saveFile.close();
129 return true;
130 }
131 else
132 {
133 return false;
134 }
135 }
136
137 bool Replay::saveReplay(char* filename,Replay p2)
138 {
139 //Saving as fileversion 1
140 ofstream saveFile;
141 saveFile.open(filename,ios::binary|ios::trunc);
142 if(saveFile)
143 {
144 Uint32 version = 1;
145 saveFile.write(reinterpret_cast<char*>(&version),sizeof(Uint32)); //Fileversion
146 Uin8 nrOfReplays = 2;
147 saveFile.write(reinterpret_cast<char*>(&nrOfReplays),sizeof(Uint8)); //nrOfReplaysIn File
148 saveFile.write(reinterpret_cast<char*>(&nrOfFrames),sizeof(Uint32)); //Nr of frames in file
149 for(int i=0; (i<nrOfFrames)&&(i<TOTALFRAMES);i++)
150 { //Writing frames
151 saveFile.write(reinterpret_cast<char*>(bps[i].time),sizeof(Uint32));
152 for(int k=0;k<6;k++)
153 for(int g=0;g<13;g++)
154 saveFile.write(reinterpret_cast<char*>(bps[i].brick[k][g]),sizeof(Uint8));
155 saveFile.write(reinterpret_cast<char*>(bps[i].pixels),sizeof(Uint8));
156 saveFile.write(reinterpret_cast<char*>(bps[i].cursorX),sizeof(Uint8));
157 saveFile.write(reinterpret_cast<char*>(bps[i].cursorY),sizeof(Uint8));
158 saveFile.write(reinterpret_cast<char*>(bps[i].score),sizeof(Uint32));
159 saveFile.write(reinterpret_cast<char*>(bps[i].speed),sizeof(Uint8));
160 saveFile.write(reinterpret_cast<char*>(bps[i].chain),sizeof(Uint8));
161 }
162 ///Player 2 starts here!!!!!!!!!!!!!!!!!!!!!!
163 saveFile.write(reinterpret_cast<char*>(&p2.nrOfFrames),sizeof(Uint32)); //Nr of frames in file
164 for(int i=0; (i<p2.nrOfFrames)&&(i<TOTALFRAMES);i++)
165 { //Writing frames
166 saveFile.write(reinterpret_cast<char*>(p2.bps[i].time),sizeof(Uint32));
167 for(int k=0;k<6;k++)
168 for(int g=0;g<13;g++)
169 saveFile.write(reinterpret_cast<char*>(p2.bps[i].brick[k][g]),sizeof(Uint8));
170 saveFile.write(reinterpret_cast<char*>(p2.bps[i].pixels),sizeof(Uint8));
171 saveFile.write(reinterpret_cast<char*>(p2.bps[i].cursorX),sizeof(Uint8));
172 saveFile.write(reinterpret_cast<char*>(p2.bps[i].cursorY),sizeof(Uint8));
173 saveFile.write(reinterpret_cast<char*>(p2.bps[i].score),sizeof(Uint32));
174 saveFile.write(reinterpret_cast<char*>(p2.bps[i].speed),sizeof(Uint8));
175 saveFile.write(reinterpret_cast<char*>(p2.bps[i].chain),sizeof(Uint8));
176 }
177 saveFile.close();
178 return true;
179 }
180 else
181 {
182 return false;
183 }
184 }
185
186 bool Replay::loadReplay(char* filename)
187 {
188 ifstream loadFile;
189 loadFile.open(filename,ios::binary);
190 if(loadFile)
191 {
192 Uint32 version;
193 loadFile.read(reinterpret_cast<char*>(&version),sizeof(Uint32));
194 switch(version)
195 {
196 case 1:
197 Uint8 nrOfPlayers;
198 loadFile.read(reinterpret_cast<char*>(&nrOfPlayers),sizeof(Uint8));
199 loadFile.read(reinterpret_cast<char*>(&nrOfFrames),sizeof(Uint32));
200 for(int i=0; (i<nrOfFrames)&&(i<TOTALFRAMES);i++)
201 {
202 loadFile.read(reinterpret_cast<char*>(bps[i].time),sizeof(Uint32)); //Writing frames
203 for(int k=0;k<6;k++)
204 for(int g=0;g<13;g++)
205 loadFile.read(reinterpret_cast<char*>(bps[i].brick[k][g]),sizeof(Uint8));
206 loadFile.read(reinterpret_cast<char*>(bps[i].pixels),sizeof(Uint8));
207 loadFile.read(reinterpret_cast<char*>(bps[i].cursorX),sizeof(Uint8));
208 loadFile.read(reinterpret_cast<char*>(bps[i].cursorY),sizeof(Uint8));
209 loadFile.read(reinterpret_cast<char*>(bps[i].score),sizeof(Uint32));
210 loadFile.read(reinterpret_cast<char*>(bps[i].speed),sizeof(Uint8));
211 loadFile.read(reinterpret_cast<char*>(bps[i].chain),sizeof(Uint8));
212 }
213 break;
214 default:
215 cout << "Unknown version" << endl;
216 return false;
217 };
218 loadFile.close();
219 }
220 else
221 {
222 cout << "File not found or couldn't open: " << filename << endl;
223 return false;
224 }
225
226 }
227 */
0 /*
1 replay.h
2 Copyright (C) 2005 Poul Sander
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 Poul Sander
19 Rævehøjvej 36, V. 1111
20 2800 Kgs. Lyngby
21 DENMARK
22 poul.sander@tdcadsl.dk
23 */
24
25 //headerfile for replay.h
26 /*
27 replay is used to save a replay, there is saved 10 moves per second, should be
28 able to give a realistic replay
29 */
30
31 //constants - 3000 is 5 minutes
32 #define FRAMESPERSEC 10
33 #define TOTALFRAMES 3000
34
35 #include "SDL.h"
36 #include <stdlib.h>
37 #include <iostream>
38 #include <fstream>
39
40 using namespace std;
41
42 //board_package, stores a board can be used for network play and replay
43 struct boardPackage //92 bytes
44 {
45 Uint32 time; //game time
46 Uint8 brick[6][13];
47 Uint8 pixels; //pixels pushed
48 Uint8 cursorX; //Cursor coordinate
49 Uint8 cursorY; // -||-
50 Uint32 score;
51 Uint8 speed;
52 Uint8 chain;
53 Uint8 result; //0=none,1=gameOver,2=winner,4=draw
54 };
55
56 class Replay{
57 private:
58 //Our replay is stored in an array of TOTALFRAMES length
59 boardPackage bps[TOTALFRAMES];
60 //The final package is not set to any specific time
61 boardPackage finalPack;
62 //We store number of frames, so we know how long to read the array
63 Uint32 nrOfFrames;
64 //An enumerator, so we know how it ends! (should be removed then boardPackage is the 92 byte version)
65 enum { gameOver=0, winner, looser, draw } theResult;
66
67 public:
68 void newReplay(); //Constructor
69 Uint32 getNumberOfFrames(); //Returns number of frames
70 void setFrameSecTo(Uint32,boardPackage); //Sets frame at a given time to the package
71 void setFinalFrame(boardPackage,int); //Sets the final package
72 boardPackage getFrameSec(Uint32); //Gets a frame to a time
73 boardPackage getFinalFrame(); //Gets the last frame, that must remain
74 int getFinalStatus(); //Return the result: winner, looser, draw or gameOver
75 bool isFinnished(Uint32); //Returns true if we are done
76 /*
77 Ok, I'll ignore this for some time, and just save to file, if however, we ever use a dynamic saving structure, we are fucked
78 bool saveReplay(char*); //Saves a replay
79 bool saveReplay(char*,Replay p2); //saves a replay, plus another replay given as a parameter
80 bool loadReaply(char*); //laods a rephttps://www.campusnet.dtu.dk/grade/index.asp?ServiceID=21&ticket=ST-61313-cfF3o6fNZafPvBaEvWiplay
81 bool loadReplay2(char*); //loads the second part of the replay file, if it exists, returns false otherwise
82 */
83 };
0 /*
1 Block Attack - Rise of the Blocks, SDL game, besed on Nintendo's Tetris Attack
2 Copyright (C) 2005 Poul Sander
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 Poul Sander
19 Rævehjvej 36, V. 1111
20 2800 Kgs. Lyngby
21 DENMARK
22 poul@poulsander.com
23 http://blockattack.sf.net
24 */
25
26 #include <iostream>
27 #include <string>
28
29 using namespace std;
30
31 int main(int argc, char *argv[])
32 {
33 #if defined(__unix__)
34 {
35 string arg = argv[0]; //Take the command used to call this
36 bool finnish = false;
37 int laengde=0; //The length of the filename (we must remove this)
38 for(int i=arg.length()-1;((i>0)&&(finnish==false)); i--)
39 {
40 if(arg[i]=='/')
41 {
42 finnish=true;
43 laengde=i;
44 }
45 }
46 if(finnish) //if we actually found something
47 {
48 arg.erase(laengde,arg.length()-laengde);
49
50 cout << "This software was called from: " << arg << endl;
51 string callME = "cd "+arg+"; ./blockattack";
52 system(callME.c_str());
53 }
54 else
55 system("pushd ./"); //If it was runned from this directory, we push that
56 }
57 #endif
58
59 #if defined(__unix__)
60 //system("popd");
61 #endif
62 return 0;
63 }
0 /*
1 Block Attack - Rise of the Blocks, SDL game, besed on Nintendo's Tetris Attack
2 Copyright (C) 2005 Poul Sander
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 Poul Sander
19 Rævehjvej 36, V. 1111
20 2800 Kgs. Lyngby
21 DENMARK
22 poul@poulsander.com
23 http://blockattack.sf.net
24 */
25
26 #include <iostream>
27 #include <string>
28
29 using namespace std;
30
31 int main(int argc, char *argv[])
32 {
33 #if defined(__unix__)
34 {
35 string arg = argv[0]; //Take the command used to call this
36 bool finnish = false;
37 int laengde=0; //The length of the filename (we must remove this)
38 for(int i=arg.length()-1;((i>0)&&(finnish==false)); i--)
39 {
40 if(arg[i]=='/')
41 {
42 finnish=true;
43 laengde=i;
44 }
45 }
46 if(finnish) //if we actually found something
47 {
48 arg.erase(laengde,arg.length()-laengde);
49
50 cout << "This software was called from: " << arg << endl;
51 string callME = "cd "+arg+"; ./blockattack";
52 system(callME.c_str());
53 }
54 else
55 system("pushd ./"); //If it was runned from this directory, we push that
56 }
57 #endif
58
59 #if defined(__unix__)
60 //system("popd");
61 #endif
62 return 0;
63 }