ç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_EXTENSIONS OFF)
|
||||
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
|
||||
{
|
||||
throw NotImplemented();
|
||||
return active_node_;
|
||||
}
|
||||
|
||||
void StoreImpl::set_active_node(const story::Node* node)
|
||||
{
|
||||
(void)node;
|
||||
throw NotImplemented();
|
||||
active_node_ = node;
|
||||
}
|
||||
|
||||
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;
|
||||
void set_variable(const std::string& name, int value) override;
|
||||
std::map<std::string, int> get_inventory() const override;
|
||||
|
||||
private:
|
||||
const story::Node* active_node_ = nullptr;
|
||||
};
|
||||
|
||||
} // namespace libzork::store
|
||||
|
|
|
|||
|
|
@ -3,9 +3,10 @@
|
|||
namespace libzork::story
|
||||
{
|
||||
|
||||
Choice::Choice(Node* node, std::string& text,
|
||||
std::vector<std::unique_ptr<vars::Condition>>& conditions,
|
||||
std::vector<std::unique_ptr<vars::Action>>& actions)
|
||||
Choice::Choice(
|
||||
const Node* node, const std::string& text,
|
||||
const std::vector<std::unique_ptr<vars::Condition>>& conditions,
|
||||
const std::vector<std::unique_ptr<vars::Action>>& actions)
|
||||
: node_{ node }
|
||||
, text_{ text }
|
||||
{
|
||||
|
|
@ -13,11 +14,11 @@ namespace libzork::story
|
|||
(void)actions;
|
||||
}
|
||||
|
||||
std::string& Choice::get_text()
|
||||
const std::string& Choice::get_text()
|
||||
{
|
||||
return text_;
|
||||
}
|
||||
Node* Choice::get_node()
|
||||
const Node* Choice::get_node()
|
||||
{
|
||||
return node_;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,19 +13,19 @@ namespace libzork::story
|
|||
{
|
||||
public:
|
||||
Choice() = default;
|
||||
Choice(Node* node, std::string& text,
|
||||
std::vector<std::unique_ptr<vars::Condition>>& conditions,
|
||||
std::vector<std::unique_ptr<vars::Action>>& actions);
|
||||
Choice(const Node* node, const std::string& text,
|
||||
const std::vector<std::unique_ptr<vars::Condition>>& conditions,
|
||||
const std::vector<std::unique_ptr<vars::Action>>& actions);
|
||||
~Choice() = default;
|
||||
|
||||
std::string& get_text();
|
||||
Node* get_node();
|
||||
const std::string& get_text();
|
||||
const Node* get_node();
|
||||
|
||||
private:
|
||||
Node* node_;
|
||||
std::string text_;
|
||||
std::vector<std::unique_ptr<vars::Condition>> conditions_;
|
||||
std::vector<std::unique_ptr<vars::Action>> actions_;
|
||||
const Node* node_;
|
||||
const std::string text_;
|
||||
const std::vector<std::unique_ptr<vars::Condition>> conditions_;
|
||||
const std::vector<std::unique_ptr<vars::Action>> actions_;
|
||||
};
|
||||
|
||||
} // namespace libzork::story
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue