| 1 | // (_||_/ |
| 2 | // ( ) Level class |
| 3 | // ( o 0 ) |
| 4 | //-OOO°--(_)---°OOO--------------------------------------- |
| 5 | // Copyright (C) 2006 By Dominique Roux-Serret |
| 6 | // .OOOo oOOO. [email protected] |
| 7 | //-( )------( )--------------------------------------- |
| 8 | // ( ( ) / Copyright (C) 2023 By Johnny Jazeix |
| 9 | // (_) (_/ [email protected] |
| 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 or version 3 of the License. |
| 14 | |
| 15 | // This program is distributed in the hope that it will be useful, |
| 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | // GNU General Public License for more details. |
| 19 | |
| 20 | // You should have received a copy of the GNU General Public License along |
| 21 | // with this program; if not, write to the Free Software Foundation, Inc., |
| 22 | // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 23 | |
| 24 | #ifndef LEVEL_DOM_ |
| 25 | #define LEVEL_DOM_ |
| 26 | |
| 27 | #include "preference.h" |
| 28 | |
| 29 | /*** Définition de la structure d'un tableau ***/ |
| 30 | /***********************************************/ |
| 31 | struct s_Deco |
| 32 | { |
| 33 | int NumSpr; // Numéro et position du sprite décoratif |
| 34 | int x; |
| 35 | int y; |
| 36 | }; |
| 37 | |
| 38 | struct s_Level |
| 39 | { |
| 40 | unsigned char T[LT * HT]; // Définition du circuit et des options |
| 41 | int DepX; // Départ de la locomotive |
| 42 | int DepY; |
| 43 | int DepDir; // Direction du départ |
| 44 | int NDeco; // Nombre d'éléments décoratifs |
| 45 | struct s_Deco Deco[32]; |
| 46 | }; |
| 47 | |
| 48 | /*** Définition de la classe ***/ |
| 49 | /*******************************/ |
| 50 | class Level |
| 51 | { |
| 52 | public: |
| 53 | Level(); |
| 54 | ~Level() = default; |
| 55 | |
| 56 | /*** Fonctions ***/ |
| 57 | bool Load(); // charge les tableaux |
| 58 | bool Save(); // Sauve les tableaux |
| 59 | void Del(int Num); // efface un tableau |
| 60 | void Ins(int Num); // Insert un tableau vièrge |
| 61 | void Clear(int Num); // Vide un tableau |
| 62 | |
| 63 | /*** Variables ***/ |
| 64 | int N { 0 }; // Nombre de niveau |
| 65 | s_Level T[MAX_N_LEVEL_IN_MEMORY]; // Pointe sur les tableaux |
| 66 | }; |
| 67 | |
| 68 | #endif |