Crossfire Server, Trunk
TreasureLoader.h
Go to the documentation of this file.
1 /*
2  * Crossfire -- cooperative multi-player graphical RPG and adventure game
3  *
4  * Copyright (c) 2020-2021 the Crossfire Development Team
5  *
6  * Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
7  * welcome to redistribute it under certain conditions. For details, please
8  * see COPYING and LICENSE.
9  *
10  * The authors can be reached via e-mail at <crossfire@metalforge.org>.
11  */
12 
13 #ifndef TREASURELOADER_H
14 #define TREASURELOADER_H
15 
16 #include "AssetLoader.h"
17 #include "Utils.h"
18 class Treasures;
19 class Archetypes;
20 class AssetsTracker;
21 
22 extern "C" {
23 #include "global.h"
24 #include "treasure.h"
25 }
26 
27 class TreasureLoader : public AssetLoader {
28 public:
29  TreasureLoader(Treasures *treasures, Archetypes *archetypes, AssetsTracker *tracker);
30 
31  virtual bool willLoad(const std::string &filename) override {
32  return Utils::endsWith(filename, ".trs");
33  }
34 
35  virtual void load(BufferReader *reader, const std::string &filename) override;
36 
37 private:
41 
42  treasure *loadTreasure(BufferReader *reader, const std::string &filename);
43 };
44 
45 #endif /* TREASURELOADER_H */
46 
global.h
Archetypes
Definition: Archetypes.h:27
TreasureLoader
Definition: TreasureLoader.h:27
TreasureLoader::TreasureLoader
TreasureLoader(Treasures *treasures, Archetypes *archetypes, AssetsTracker *tracker)
Definition: TreasureLoader.cpp:25
AssetLoader
Definition: AssetLoader.h:24
npc_dialog.filename
filename
Definition: npc_dialog.py:99
treasurestruct
Definition: treasure.h:63
TreasureLoader::willLoad
virtual bool willLoad(const std::string &filename) override
Definition: TreasureLoader.h:31
Treasures
Definition: Treasures.h:23
AssetsTracker
Definition: AssetsTracker.h:28
TreasureLoader::m_tracker
AssetsTracker * m_tracker
Definition: TreasureLoader.h:40
TreasureLoader::m_treasures
Treasures * m_treasures
Definition: TreasureLoader.h:38
Utils.h
TreasureLoader::loadTreasure
treasure * loadTreasure(BufferReader *reader, const std::string &filename)
Definition: TreasureLoader.cpp:42
TreasureLoader::m_archetypes
Archetypes * m_archetypes
Definition: TreasureLoader.h:39
treasure.h
Utils::endsWith
static bool endsWith(const std::string &str, const std::string &with)
Definition: Utils.cpp:16
BufferReader
Definition: bufferreader.c:21
TreasureLoader::load
virtual void load(BufferReader *reader, const std::string &filename) override
Definition: TreasureLoader.cpp:101
AssetLoader.h