/
PortableMapFormat.cpp
89 lines (67 loc) · 1.89 KB
/
PortableMapFormat.cpp
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#include "PortableMapFormat.h"
#include "imapformat.h"
#include "PortableMapReader.h"
#include "PortableMapWriter.h"
#include "module/StaticModule.h"
namespace map
{
namespace format
{
std::size_t PortableMapFormat::Version = 1;
const char* PortableMapFormat::Name = PORTABLE_MAP_FORMAT_NAME;
// RegisterableModule implementation
const std::string& PortableMapFormat::getName() const
{
static std::string _name(typeid(PortableMapFormat).name());
return _name;
}
const StringSet& PortableMapFormat::getDependencies() const
{
static StringSet _dependencies;
if (_dependencies.empty())
{
_dependencies.insert(MODULE_MAPFORMATMANAGER);
}
return _dependencies;
}
void PortableMapFormat::initialiseModule(const IApplicationContext& ctx)
{
rMessage() << getName() << ": initialiseModule called." << std::endl;
// Register ourselves as map format for mapx and pfbx files
GlobalMapFormatManager().registerMapFormat("mapx", shared_from_this());
GlobalMapFormatManager().registerMapFormat("pfbx", shared_from_this());
}
void PortableMapFormat::shutdownModule()
{
// Unregister now that we're shutting down
GlobalMapFormatManager().unregisterMapFormat(shared_from_this());
}
const std::string& PortableMapFormat::getMapFormatName() const
{
static std::string _name = Name;
return _name;
}
const std::string& PortableMapFormat::getGameType() const
{
static std::string _gameType = "doom3";
return _gameType;
}
IMapReaderPtr PortableMapFormat::getMapReader(IMapImportFilter& filter) const
{
return std::make_shared<PortableMapReader>(filter);
}
IMapWriterPtr PortableMapFormat::getMapWriter() const
{
return std::make_shared<PortableMapWriter>();
}
bool PortableMapFormat::allowInfoFileCreation() const
{
return false;
}
bool PortableMapFormat::canLoad(std::istream& stream) const
{
return PortableMapReader::CanLoad(stream);
}
module::StaticModuleRegistration<PortableMapFormat> portableMapModule;
}
}