Crossfire Server, Trunk  1.75.0
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 #include "global.h"
23 #include "treasure.h"
24 
25 class TreasureLoader : public AssetLoader {
26 public:
28 
29  virtual bool willLoad(const std::string &filename) override {
30  return Utils::endsWith(filename.c_str(), ".trs");
31  }
32 
33  virtual void load(BufferReader *reader, const std::string &filename) override;
34 
35 private:
39 
40  treasure *loadTreasure(BufferReader *reader, const std::string &filename);
41 };
42 
43 #endif /* TREASURELOADER_H */
44 
global.h
Archetypes
All archetypes in the game.
Definition: Archetypes.h:23
archetypes
in that case they will be relative to whatever the PWD of the crossfire server process is You probably shouldn though Notes on Specific and settings file datadir Usually usr share crossfire Contains data that the server does not need to modify while such as the archetypes
Definition: server-directories.txt:45
TreasureLoader
Definition: TreasureLoader.h:25
TreasureLoader::TreasureLoader
TreasureLoader(Treasures *treasures, Archetypes *archetypes, AssetsTracker *tracker)
Definition: TreasureLoader.cpp:23
AssetLoader
Abstract buffer handler, processing a BufferReader.
Definition: AssetLoader.h:24
TreasureLoader::willLoad
virtual bool willLoad(const std::string &filename) override
Whether this instance will process or not the specified file.
Definition: TreasureLoader.h:29
Treasures
Definition: Treasures.h:21
AssetsTracker
Base class to be informed of where an asset is defined.
Definition: AssetsTracker.h:24
TreasureLoader::loadTreasure
treasure * loadTreasure(BufferReader *reader, const std::string &filename)
Reads one treasure, including the 'yes', 'no' and 'more' options.
Definition: TreasureLoader.cpp:40
TreasureLoader::m_tracker
AssetsTracker * m_tracker
Definition: TreasureLoader.h:38
TreasureLoader::m_treasures
Treasures * m_treasures
Definition: TreasureLoader.h:36
Utils.h
TreasureLoader::m_archetypes
Archetypes * m_archetypes
Definition: TreasureLoader.h:37
treasure.h
treasure
treasure is one element in a linked list, which together consist of a complete treasure-list.
Definition: treasure.h:63
BufferReader
Definition: bufferreader.cpp:22
TreasureLoader::load
virtual void load(BufferReader *reader, const std::string &filename) override
Load all treasures from a buffer.
Definition: TreasureLoader.cpp:111
Utils::endsWith
static bool endsWith(const char *const str, const char *const with)
Checks if a string ends with another one.
Definition: Utils.cpp:16
AssetLoader.h