Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
unit.h
Go to the documentation of this file.
1 #ifndef __UNIT_TEST_H_
2 #define __UNIT_TEST_H_
3 #include <stdio.h>
4 
5 class Unit
6 {
7 public:
8  bool killed;
9  bool zapped;
10  int ucref;
11  Unit( bool kill ) : killed( kill )
12  {
13  ucref = 0;
14  zapped = false;
15  }
16  void Kill()
17  {
18  if (zapped == true)
19  printf( "segfault" );
20  killed = true;
21  }
22  bool Killed()
23  {
24  if (zapped == true)
25  printf( "segfault" );
26  return killed;
27  }
28 
29  void Ref()
30  {
31  if (zapped == true)
32  printf( "segfault" );
33  ucref += 1;
34  }
35  void UnRef()
36  {
37  if (zapped == true)
38  printf( "segfault" );
39  ucref -= 1;
40  if (ucref == 0 && killed)
41  zapped = true;
42  }
43 };
44 #endif
45