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
container.cpp
Go to the documentation of this file.
1 #include <stdlib.h>
2 #include "container.h"
3 #include "unit_generic.h"
5 {
6  unit = NULL;
7  VSCONSTRUCT1( 'U' )
8 }
9 UnitContainer::UnitContainer( Unit *un ) : unit( NULL )
10 {
11  SetUnit( un );
12  VSCONSTRUCT1( 'U' );
13 }
15 {
17  if (unit)
18  unit->UnRef();
19  //bad idea...arrgh!
20 }
22 {
23  //if the unit is null then go here otherwise if the unit is killed then go here
24  if (un != NULL ? un->Killed() == true : true) {
25  if (unit)
26  unit->UnRef();
27  unit = NULL;
28  return;
29  } else {
30  if (unit)
31  unit->UnRef();
32  unit = un;
33  unit->Ref();
34  }
35 }
36