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
enhancement_generic.h
Go to the documentation of this file.
1
#ifndef _ENHANCERGENERIC_H_
2
#define _ENHANCERGENERIC_H_
3
#include "
cmd/unit_generic.h
"
4
#include "
savegame.h
"
5
6
class
Enhancement
:
public
Unit
7
{
8
friend
class
UnitFactory
;
9
protected
:
10
std::string
filename
;
11
virtual
enum
clsptr
isUnit
()
const
12
{
13
return
ENHANCEMENTPTR
;
14
}
16
Enhancement
(
const
char
*
filename
,
17
int
faction
,
18
const
string
&modifications,
19
Flightgroup
*flightgrp = NULL,
20
int
fg_subnumber = 0 ) :
21
Unit
( filename, false, faction, modifications, flightgrp, fg_subnumber )
22
, filename( filename ) {}
23
public
:
24
virtual
void
reactToCollision
(
Unit
*smaller,
25
const
QVector
&biglocation,
26
const
Vector
&bignormal,
27
const
QVector
&smalllocation,
28
const
Vector
&smallnormal,
29
float
dist )
30
{
31
if
(smaller->
isUnit
() !=
ASTEROIDPTR
) {
32
double
percent;
33
char
tempdata[
sizeof
(this->
shield
)];
34
memcpy
( tempdata, &this->
shield
,
sizeof
(this->
shield
) );
35
shield
.
number
= 0;
//don't want them getting our boosted shields!
36
shield
.
shield2fb
.front =
shield
.
shield2fb
.back =
shield
.
shield2fb
.frontmax =
shield
.
shield2fb
.backmax = 0;
37
smaller->
Upgrade
(
this
, 0, 0,
true
,
true
, percent );
38
memcpy
( &this->
shield
, tempdata,
sizeof
(this->
shield
) );
39
string
fn(
filename
);
40
string
fac(
FactionUtil::GetFaction
(
faction
) );
41
Kill
();
42
_Universe
->
AccessCockpit
()->
savegame
->
AddUnitToSave
( fn.c_str(),
ENHANCEMENTPTR
, fac.c_str(), (long)
this
);
43
}
44
}
45
protected
:
47
Enhancement
() {}
48
Enhancement
( std::vector< Mesh* >m,
bool
b
,
int
i ) :
Unit
( m, b, i ) {}
50
//Enhancement( const Enhancement& );
52
//Enhancement& operator=( const Enhancement& );
53
};
54
55
#endif
56
src
cmd
enhancement_generic.h
Generated on Fri May 29 2015 23:07:14 for Vegastrike 0.5.1 rc1 by
1.8.4