|
|
@@ -11,25 +11,11 @@
|
|
|
#include <json/json.h>
|
|
|
|
|
|
#include "danmaku/bullet_pattern.hpp"
|
|
|
+#include "danmaku/serial.hpp"
|
|
|
#include "resource_factory/prototype_factory.hpp"
|
|
|
|
|
|
using namespace danmaku;
|
|
|
|
|
|
-points_map to_points_map(Json::Value const & json) {
|
|
|
- return {json["damage"].asInt(), json["kill"].asInt()};
|
|
|
-}
|
|
|
-
|
|
|
-template <typename F, typename... Args>
|
|
|
-auto to_vector(Json::Value const & json, F && func, Args &&... args)
|
|
|
- -> std::vector<decltype(func(json, args...))> {
|
|
|
- std::vector<decltype(func(json, args...))> out;
|
|
|
- out.reserve(json.size());
|
|
|
- for (int i = 0; i < json.size(); ++i) {
|
|
|
- out.emplace_back(func(json[i], args...));
|
|
|
- }
|
|
|
- return out;
|
|
|
-}
|
|
|
-
|
|
|
enemy::enemy(Json::Value const & json, graphics::object const & obj,
|
|
|
attack_factory get_attack)
|
|
|
: actor(json, obj), points_(to_points_map(json["points"])) {
|
|
|
@@ -43,3 +29,6 @@ std::unique_ptr<enemy> make_enemy(Json::Value const & json,
|
|
|
}
|
|
|
|
|
|
BIND_ACTOR("enemy", &make_enemy);
|
|
|
+
|
|
|
+// to_vector(Json::Value, attack_factory, actor*)
|
|
|
+#include "danmaku/serial.tpp"
|