Crossfire Server, Trunk
Archetypes.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 ARCHETYPES_H
14 #define ARCHETYPES_H
15 
16 #include <functional>
17 #include "AssetsCollection.h"
18 #include "global.h"
19 
23 class Archetypes : public AssetsCollection<archetype> {
24 
25 public:
27  typedef std::function<void(archetype*, archetype*)> updateListener;
28 
33  empty_archetype = get("empty_archetype");
34  }
35 
41  m_updateListener = fct;
42  }
43 
49  }
50 
59  archetype *findByObjectName(const char *name);
60 
72  archetype *findByObjectTypeName(int type, const char *name);
73 
83  archetype *findBySkillNameAndType(const char *skill, int type);
84 
100  archetype *findByTypeSubtype(int type, int subtype);
101 
111  static void recursive_update(object *item, archetype *updated);
112 
113 protected:
114  virtual void replace(archetype *existing, archetype *update) override;
115 
117 };
118 
119 #endif /* ARCHETYPES_H */
120 
global.h
Archetypes::setReplaceListener
void setReplaceListener(updateListener fct)
Definition: Archetypes.h:40
AssetsCollection< archetype >::get
archetype * get(const std::string &name)
Definition: AssetsCollection.h:89
Archetypes::findByTypeSubtype
archetype * findByTypeSubtype(int type, int subtype)
Definition: Archetypes.cpp:121
Archetypes::clearReplaceListener
void clearReplaceListener()
Definition: Archetypes.h:47
name
Plugin animator file specs[Config] name
Definition: animfiles.txt:4
AssetsCollection.h
Archetypes::replace
virtual void replace(archetype *existing, archetype *update) override
Definition: Archetypes.cpp:62
Archetypes::findByObjectTypeName
archetype * findByObjectTypeName(int type, const char *name)
Definition: Archetypes.cpp:97
archetype
Definition: object.h:474
Archetypes::m_updateListener
updateListener m_updateListener
Definition: Archetypes.h:116
Archetypes::findBySkillNameAndType
archetype * findBySkillNameAndType(const char *skill, int type)
Definition: Archetypes.cpp:109
updated
it was updated by reverse engineering the client code accessing the metaserver It therefore describes the as is state rather than what was intended Communication between server and metaserver was not updated
Definition: arch-handbook.txt:126
nlohmann::detail::void
j template void())
Definition: json.hpp:4099
Archetypes::updateListener
std::function< void(archetype *, archetype *)> updateListener
Definition: Archetypes.h:27
item
Definition: item.py:1
skill
skill
Definition: arch-handbook.txt:585
empty_archetype
archetype * empty_archetype
Definition: init.cpp:119
Archetypes::Archetypes
Archetypes()
Definition: Archetypes.h:32
AssetsCollection
Definition: AssetsCollection.h:55
Archetypes
Definition: Archetypes.h:23
Archetypes::findByObjectName
archetype * findByObjectName(const char *name)
Definition: Archetypes.cpp:82
Archetypes::recursive_update
static void recursive_update(object *item, archetype *updated)
Definition: Archetypes.cpp:31
is_valid_types_gen.type
list type
Definition: is_valid_types_gen.py:25