home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / CTECHAPP.ZIP / SIMULATN.ZIP / CREATURE.CPP next >
C/C++ Source or Header  |  1990-02-09  |  768b  |  40 lines

  1. //  Program:    Creature
  2. //  Version:    2.00
  3. //
  4. //  Language:   C++ 2.0
  5. //  Environ:    MS-DOS, Zortech C++ v2.0x
  6. //
  7. //  Purpose:    SIMECO Creature class definition
  8. //
  9. //  Written by: Scott Robert Ladd
  10.  
  11. extern "C"
  12.     {
  13.     #include "stdio.h"
  14.     #include "stdlib.h"
  15.     }
  16.  
  17. #include "Creature.hpp"
  18.  
  19. // initialize static members
  20. WorkList Creature::CList;
  21.  
  22. // constructor
  23. Creature::Creature(unsigned char c, int e, int x, int y)
  24.     {
  25.     // set values of members
  26.     Color  = c;
  27.     Energy = e;
  28.     Age    = 0;
  29.     AgeRep = 0;
  30.     PosX   = x;
  31.     PosY   = y;
  32.  
  33.     // add creature to creature list
  34.     if (CList.Store(this))
  35.         {
  36.         printf("Error: Creature cannot be added to list\n");
  37.         exit(0);
  38.         }
  39.     }
  40.