| 1 | /*************************************************************************** |
| 2 | level.h - description |
| 3 | ------------------- |
| 4 | begin : Fri Dec 8 2000 |
| 5 | copyright : (C) 2000 by Waldemar Baraldi |
| 6 | email : [email protected] |
| 7 | ***************************************************************************/ |
| 8 | |
| 9 | /*************************************************************************** |
| 10 | * * |
| 11 | * This program is free software; you can redistribute it and/or modify * |
| 12 | * it under the terms of the GNU General Public License as published by * |
| 13 | * the Free Software Foundation; either version 2 of the License, or * |
| 14 | * (at your option) any later version. * |
| 15 | * * |
| 16 | ***************************************************************************/ |
| 17 | |
| 18 | #ifndef LEVEL_H |
| 19 | #define LEVEL_H |
| 20 | |
| 21 | #include "object.h" |
| 22 | #include "str.h" |
| 23 | #include "entry.h" |
| 24 | #include "exit.h" |
| 25 | #include "list.h" |
| 26 | #include "board.h" |
| 27 | |
| 28 | class Level: public Object{ |
| 29 | public: |
| 30 | |
| 31 | /** Constructor default.*/ |
| 32 | Level(); |
| 33 | |
| 34 | /** Destructor*/ |
| 35 | ~Level(); |
| 36 | |
| 37 | /** Returns the entry*/ |
| 38 | Entry * getEntry(int& row, int& column); |
| 39 | |
| 40 | /** Returns the exit*/ |
| 41 | Exit * getExit(int& row, int& column); |
| 42 | |
| 43 | /** Returns the probability coeficient of fixed pipes*/ |
| 44 | int getFixedCoef(); |
| 45 | |
| 46 | /** Returns the probability coeficient of restricted pipes*/ |
| 47 | int getRestrictionCoef(); |
| 48 | |
| 49 | /** Returns the time to wait until start*/ |
| 50 | int getStartDelay(); |
| 51 | |
| 52 | /** Returns the speed*/ |
| 53 | int getSpeed(); |
| 54 | |
| 55 | /** Returns the number of required pipes.*/ |
| 56 | int getRequired(); |
| 57 | |
| 58 | /** Returns a list with the graph directories*/ |
| 59 | List * getGraphDirs(); |
| 60 | |
| 61 | /** Returns the first pipe index*/ |
| 62 | int getPipeIndex(); |
| 63 | |
| 64 | /** Returns the background type*/ |
| 65 | BackgroundType getBackgroundType(); |
| 66 | |
| 67 | /** Returns the next pipe, NULL if it does not exist*/ |
| 68 | Pipe * getPipe(int& i, int& row, int& column); |
| 69 | |
| 70 | /** Carga el nivel en el board.*/ |
| 71 | int load(Str * filename); |
| 72 | |
| 73 | protected: |
| 74 | |
| 75 | enum PipeType {ElbowNW, ElbowNE, ElbowSW, ElbowSE, |
| 76 | BowlH, BowlV, Vert, Horiz, CrossPipe}; |
| 77 | |
| 78 | int numberAssignment(); |
| 79 | Str * stringAssignment(); |
| 80 | CardinalPoint sideAssignment(); |
| 81 | PipeType pipeTypeAssignment(); |
| 82 | Bonus bonusAssignment(); |
| 83 | bool boolAssignment(); |
| 84 | BackgroundType backgroundAssignment(); |
| 85 | |
| 86 | void ee(); |
| 87 | void pipe(); |
| 88 | void level(); |
| 89 | void printError(Str * s); |
| 90 | |
| 91 | int token; |
| 92 | int level_number; |
| 93 | |
| 94 | bool error; |
| 95 | int error_line; |
| 96 | |
| 97 | bool entry_ready; |
| 98 | bool exit_ready; |
| 99 | |
| 100 | int start_delay; |
| 101 | int restrict_coef; |
| 102 | int fixed_coef; |
| 103 | int speed; |
| 104 | int required; |
| 105 | BackgroundType background; |
| 106 | |
| 107 | List * graph_dirs; |
| 108 | |
| 109 | struct { |
| 110 | int row; |
| 111 | int column; |
| 112 | PipeType type; |
| 113 | CardinalPoint restricted_output1; |
| 114 | CardinalPoint restricted_output2; |
| 115 | Bonus bonus; |
| 116 | bool fixed; |
| 117 | }pipetable[BoardRows*BoardColumns]; //Full Board |
| 118 | int npipes; |
| 119 | }; |
| 120 | |
| 121 | #endif |
| 122 |