forked from spring/spring
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMapDamage.cpp
More file actions
36 lines (28 loc) · 724 Bytes
/
MapDamage.cpp
File metadata and controls
36 lines (28 loc) · 724 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
#include "MapDamage.h"
#include "BasicMapDamage.h"
#include "NoMapDamage.h"
#include "MapInfo.h"
#include "Game/GameSetup.h"
static CDummyMapDamage dummyMapDamage;
static CBasicMapDamage basicMapDamage;
// never null
IMapDamage* mapDamage = &dummyMapDamage;
IMapDamage* IMapDamage::InitMapDamage()
{
if (mapInfo->map.notDeformable) {
dummyMapDamage.Init();
return &dummyMapDamage;
}
if (gameSetup->disableMapDamage) {
dummyMapDamage.Init();
return &dummyMapDamage;
}
basicMapDamage.Init();
return &basicMapDamage;
}
void IMapDamage::FreeMapDamage(IMapDamage* p)
{
assert(p == mapDamage);
mapDamage = &dummyMapDamage;
}