home *** CD-ROM | disk | FTP | other *** search
/ Freelog 17 / Freelog017.iso / BeOS / ababelone / Sources / PlateauDeJeuInterne.h < prev    next >
C/C++ Source or Header  |  2000-11-21  |  3KB  |  83 lines

  1. /*
  2.     Copyright (C) 2000 by Herv├⌐ PHILIPPE <rv@bemail.org>
  3.  
  4.     This library is free software; you can redistribute it and/or
  5.     modify it under the terms of the GNU Library General Public
  6.     License as published by the Free Software Foundation; either
  7.     version 2 of the License, or (at your option) any later version.
  8.  
  9.     This library 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 GNU
  12.     Library General Public License for more details.
  13.  
  14.     You should have received a copy of the GNU Library General Public
  15.     License along with this library; if not, write to the Free
  16.     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. */
  18.  
  19. #ifndef _PLATEAUDEJEUINTERNE_H_
  20. #define _PLATEAUDEJEUINTERNE_H_
  21.  
  22. #include <SupportDefs.h>
  23. #include "Coordonnees.h"
  24. #include "PlateauDeJeu.h"
  25.  
  26. // Constante pour la taille du tableau interne
  27. // REMARQUE : le tableau interne est de dimension carr├⌐e
  28. #define TAILLE_TABLEAU_INTERNE    11
  29.  
  30. /* REMARQUE concernant la repr├⌐sentation du tableau interne :
  31.     | 0  1  2  3  4  5  6  7  8  9 10
  32. ----+---------------------------------
  33.   0 |-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1                Directions :
  34.   1 |-1 -1 -1 -1 -1  1  2  3  4  5 -1    
  35.   2 |-1 -1 -1 -1  6  7  8  9 10 11 -1                               1  2
  36.   3 |-1 -1 -1  0  0 12 13 14  0  0 -1                             | /
  37.   4 |-1 -1  0  0  0  0  0  0  0  0 -1                        0 --   -- 3
  38.   5 |-1  0  0  0  0  0  0  0  0  0 -1                           / |
  39.   6 |-1  0  0  0  0  0  0  0  0 -1 -1                          5  4
  40.   7 |-1  0  0 15 16 17  0  0 -1 -1 -1
  41.   8 |-1 18 19 20 21 22 23 -1 -1 -1 -1
  42.   9 |-1 24 25 26 27 28 -1 -1 -1 -1 -1
  43.  10 |-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
  44. */
  45.  
  46. class PlateauDeJeuInterne : public PlateauDeJeu
  47. {
  48. // FONCTIONS
  49.     public:
  50.                         PlateauDeJeuInterne(uint8 nombre_boules = 28, uint8 nombre_joueurs = 2);
  51.         virtual            ~PlateauDeJeuInterne();
  52.         PlateauDeJeuInterne&    operator=(const PlateauDeJeuInterne& ancien_plateau_interne);
  53.         int8            ValeurCaseSuivante(int8 numero_boule, int8 direction);
  54.         int8            ValeurCasePrecedente(int8 numero_boule, int8 direction);
  55.         void            DeplacerBoule(int8 numero_boule, int8 direction);
  56.         Coordonnees        DeplacerBoule(Coordonnees coordonnees_case, int8 direction);
  57.         Coordonnees        CoordonneesBoule(int8 numero_boule);
  58.         Coordonnees        CoordonneesSuivantes(Coordonnees coordonnees_case, int8 direction);
  59.         void            SetCase(Coordonnees coordonnees_case, int8 donnee);
  60.         void            InitialiserBoulesEjectees();
  61.         uint8            BoulesEjectees(int8 couleur);
  62.         void            IncrementerBoulesEjectees(int8 couleur);
  63.         void            DecrementerBoulesEjectees(int8 couleur);
  64.         void            ChangerNombreBoules(uint8 nombre_boules);
  65.         uint8*            TableauBoulesEjectees();
  66.     private:
  67.         int8            ValeurCase(Coordonnees coordonnees_case);
  68.  
  69. // VARIABLES ET CONSTANTES
  70.     private:
  71.     // Tableau du nombre de boules ├⌐ject├⌐es hors du plateau de jeu (par joueur)
  72.         uint8*                m_TableauBoulesEjectees;
  73.     // Tableau interne qui contient les num├⌐ros des boules, les cases vides et
  74.     // les cases interdites
  75.         int8**                m_Tableau;
  76.     // Tableau qui contient les coordonn├⌐es (internes) de toutes les boules
  77.         Coordonnees*        m_TableauBoulesCoord;
  78.     // Tableau qui contient la d├⌐finition des 6 directions (internes)
  79. static const Coordonnees    m_kTableauDirectionInterne[6];
  80. };
  81.  
  82. #endif
  83.