home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / cprog / ev_201.zip / HANOI.ZIP / TTOWER.HPP < prev   
C/C++ Source or Header  |  1993-07-03  |  3KB  |  87 lines

  1. #if !defined (TTOWER)                // Prevents multiple declarations errors
  2. #define TTOWER
  3.  
  4.  
  5. /*
  6.    Module        : TTOWER.HPP
  7.    Version       : 2.0
  8.    Revision date : July 3rd, 1993
  9.    Author(s)     : Remy Gendron
  10.  
  11.    Description   : ttower class declaration.
  12. */
  13.  
  14.  
  15. // Headers ------------------------------------------------------------------
  16.  
  17. #include "tdisk.hpp"
  18. #include "twindow.hpp"
  19.  
  20.  
  21. // Macros -------------------------------------------------------------------
  22.  
  23. #include "stdmacro.h"                           // Standard macro definitions
  24.  
  25.  
  26. // TypeDefs -----------------------------------------------------------------
  27.  
  28. #include "stdtype.h"                             // Standard type definitions
  29. #include "prjtype.h"                       // This project's type definitions
  30.  
  31.  
  32. // Prototypes ---------------------------------------------------------------
  33.  
  34. class ttower                                                  // Tower object
  35. {
  36.    int   id ;                                            // Tower's ID (1..3)
  37.    int   row ;                // Window position of tower's lower left corner
  38.    int   col ;
  39.    int   color ;                                             // Tower's color
  40.    int   nb_disks ;                  // Number of disks stacked on this tower
  41.    tdisk huge *content[10] ;            // Ptrs to disks stacked on the tower
  42.                                                 // Index 0 is the bottom disk
  43.    twindow huge *winptr ;                               // Ptr to work window
  44.  
  45.  
  46. public:
  47.  
  48. ttower                                                         // Constructor
  49. (
  50.    int           tid,                                           // Tower's ID
  51.    int           trow,               // Tower's bottom left corner's position
  52.    int           tcol,
  53.    int           tcolor,                                     // Tower's color
  54.    twindow huge *twinptr                                // Ptr to work window
  55. ) ;
  56.  
  57. ~ttower () ;                                                    // Destructor
  58.  
  59. void ttower::show () ;                                // Displays empty tower
  60.  
  61. int ttower::getrow () ;             // Returns tower's bottom left corner row
  62.  
  63. int ttower::getcol () ;             // Returns tower's bottom left corner col
  64.  
  65. int ttower::getcolor () ;                            // Returns tower's color
  66.  
  67. int ttower::getnbdisks () ;           // Returns nb of disks stacked on tower
  68.  
  69. void ttower::pushdisk                                 // Adds a disk to tower
  70. (
  71.    tdisk huge *disk                                     // Ptr to disk pushed
  72. ) ;
  73.  
  74. void ttower::popdiskto                       // Moves a disk to another tower
  75. (
  76.    ttower huge *target,                           // Ptr to destination tower
  77.    int         speed                                     // Animation's speed
  78. ) ;
  79.  
  80.  
  81. } ;                                                       // End class ttower
  82.  
  83.  
  84. // End Header File ----------------------------------------------------------
  85.  
  86. #endif
  87.