ça build
This commit is contained in:
parent
50e3c41d27
commit
83b6f31dac
5 changed files with 38 additions and 17 deletions
|
|
@ -33,3 +33,21 @@ set_target_properties(zork PROPERTIES CXX_STANDARD 20
|
||||||
zork PROPERTIES CXX_STANDARD_REQUIRED ON
|
zork PROPERTIES CXX_STANDARD_REQUIRED ON
|
||||||
zork PROPERTIES CXX_EXTENSIONS OFF)
|
zork PROPERTIES CXX_EXTENSIONS OFF)
|
||||||
target_compile_options(zork PUBLIC -Wall -Wextra -Werror -pedantic -std=c++20 -Wold-style-cast)
|
target_compile_options(zork PUBLIC -Wall -Wextra -Werror -pedantic -std=c++20 -Wold-style-cast)
|
||||||
|
|
||||||
|
set(CMAKE_BINARY_DIR build/)
|
||||||
|
|
||||||
|
|
||||||
|
# Import yaml-cpp
|
||||||
|
include(FetchContent)
|
||||||
|
|
||||||
|
FetchContent_Declare(
|
||||||
|
yaml-cpp
|
||||||
|
GIT_REPOSITORY https://github.com/jbeder/yaml-cpp.git
|
||||||
|
# GIT_TAG <master>
|
||||||
|
)
|
||||||
|
FetchContent_MakeAvailable(yaml-cpp)
|
||||||
|
|
||||||
|
target_link_libraries(zork PUBLIC yaml-cpp::yaml-cpp)
|
||||||
|
|
||||||
|
target_link_options(zork PUBLIC -Wl,--no-undefined)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,12 @@ namespace libzork::store
|
||||||
|
|
||||||
const story::Node* StoreImpl::get_active_node() const
|
const story::Node* StoreImpl::get_active_node() const
|
||||||
{
|
{
|
||||||
throw NotImplemented();
|
return active_node_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StoreImpl::set_active_node(const story::Node* node)
|
void StoreImpl::set_active_node(const story::Node* node)
|
||||||
{
|
{
|
||||||
(void)node;
|
active_node_ = node;
|
||||||
throw NotImplemented();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StoreImpl::has_variable(const std::string& name) const
|
bool StoreImpl::has_variable(const std::string& name) const
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,9 @@ namespace libzork::store
|
||||||
int get_variable(const std::string& name) const override;
|
int get_variable(const std::string& name) const override;
|
||||||
void set_variable(const std::string& name, int value) override;
|
void set_variable(const std::string& name, int value) override;
|
||||||
std::map<std::string, int> get_inventory() const override;
|
std::map<std::string, int> get_inventory() const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
const story::Node* active_node_ = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace libzork::store
|
} // namespace libzork::store
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,10 @@
|
||||||
namespace libzork::story
|
namespace libzork::story
|
||||||
{
|
{
|
||||||
|
|
||||||
Choice::Choice(Node* node, std::string& text,
|
Choice::Choice(
|
||||||
std::vector<std::unique_ptr<vars::Condition>>& conditions,
|
const Node* node, const std::string& text,
|
||||||
std::vector<std::unique_ptr<vars::Action>>& actions)
|
const std::vector<std::unique_ptr<vars::Condition>>& conditions,
|
||||||
|
const std::vector<std::unique_ptr<vars::Action>>& actions)
|
||||||
: node_{ node }
|
: node_{ node }
|
||||||
, text_{ text }
|
, text_{ text }
|
||||||
{
|
{
|
||||||
|
|
@ -13,11 +14,11 @@ namespace libzork::story
|
||||||
(void)actions;
|
(void)actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string& Choice::get_text()
|
const std::string& Choice::get_text()
|
||||||
{
|
{
|
||||||
return text_;
|
return text_;
|
||||||
}
|
}
|
||||||
Node* Choice::get_node()
|
const Node* Choice::get_node()
|
||||||
{
|
{
|
||||||
return node_;
|
return node_;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,19 +13,19 @@ namespace libzork::story
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Choice() = default;
|
Choice() = default;
|
||||||
Choice(Node* node, std::string& text,
|
Choice(const Node* node, const std::string& text,
|
||||||
std::vector<std::unique_ptr<vars::Condition>>& conditions,
|
const std::vector<std::unique_ptr<vars::Condition>>& conditions,
|
||||||
std::vector<std::unique_ptr<vars::Action>>& actions);
|
const std::vector<std::unique_ptr<vars::Action>>& actions);
|
||||||
~Choice() = default;
|
~Choice() = default;
|
||||||
|
|
||||||
std::string& get_text();
|
const std::string& get_text();
|
||||||
Node* get_node();
|
const Node* get_node();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Node* node_;
|
const Node* node_;
|
||||||
std::string text_;
|
const std::string text_;
|
||||||
std::vector<std::unique_ptr<vars::Condition>> conditions_;
|
const std::vector<std::unique_ptr<vars::Condition>> conditions_;
|
||||||
std::vector<std::unique_ptr<vars::Action>> actions_;
|
const std::vector<std::unique_ptr<vars::Action>> actions_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace libzork::story
|
} // namespace libzork::story
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue