Vegastrike 0.5.1 rc1
1.0
Original sources for Vegastrike Evolved
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
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
"
4
UnitContainer::UnitContainer
()
5
{
6
unit
= NULL;
7
VSCONSTRUCT1
(
'U'
)
8
}
9
UnitContainer::UnitContainer
(
Unit
*un ) : unit( NULL )
10
{
11
SetUnit
( un );
12
VSCONSTRUCT1
(
'U'
);
13
}
14
UnitContainer::~UnitContainer
()
15
{
16
VSDESTRUCT1
17
if
(
unit
)
18
unit
->
UnRef
();
19
//bad idea...arrgh!
20
}
21
void
UnitContainer::SetUnit
(
Unit
*un )
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
src
cmd
container.cpp
Generated on Fri May 29 2015 23:07:13 for Vegastrike 0.5.1 rc1 by
1.8.4