i6engine  1.0
SpawnpointComponent.h
Go to the documentation of this file.
1 /*
2  * i6engine
3  * Copyright (2016) Daniel Bonrath, Michael Baer, All rights reserved.
4  *
5  * This file is part of i6engine; i6engine is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
25 #ifndef __I6ENGINE_API_SPAWNPOINTCOMPONENT_H__
26 #define __I6ENGINE_API_SPAWNPOINTCOMPONENT_H__
27 
28 #include <vector>
29 
31 
32 namespace i6e {
33 namespace api {
34 
43  public:
47  SpawnpointComponent(const int64_t id, const attributeMap & params);
49 
55  inline void addSpawntype(const std::string & type) { _spawntypes.push_back(type); }
56 
62  void addSpawntypes(const std::string & types);
63 
69  void removeSpawntype(const std::string & type);
70 
76  bool containsSpawntype(const std::string & type) const;
77 
81  attributeMap synchronize() const override;
82 
86  bool available() const { return _state; }
87 
91  void setState(bool b);
92 
93  std::string getTemplateName() const override {
94  return "Spawnpoint";
95  }
96 
97  std::vector<componentOptions> getComponentOptions() override;
98 
99  private:
100  std::vector<std::string> _spawntypes;
101  bool _state;
102 
103  void Init() override;
104 
108  void News(const GameMessage::Ptr & msg) override;
109  };
110 
111 } /* namespace api */
112 } /* namespace i6e */
113 
114 #endif /* __I6ENGINE_API_SPAWNPOINTCOMPONENT_H__ */
115 
#define ISIXE_MODULES_API
void addSpawntype(const std::string &type)
Adds an object type to spawn on this component.
boost::shared_ptr< Message > Ptr
Definition: Message.h:66
std::map< std::string, std::string > attributeMap
Definition: attributeMap.h:42
std::string getTemplateName() const override
returns the name this template was registered with
Only defines this object as a spawnpoint For creating a SpawnpointComponent, these keys are possible:...
bool available() const
returns true, if this spawnpoint currently can be used
Component Base Class. All Components must derive from Component.
Definition: Component.h:97