diff --git a/src/lib.cpp b/src/lib.cpp index 75f8cf9..2b58745 100644 --- a/src/lib.cpp +++ b/src/lib.cpp @@ -1,10 +1,13 @@ -#include "lib.hh" - #include "prep/prep.hh" +#include + void run() { Room room1(1, "Room 1", 1710087364, RoomStatus::IN_PROGRESS); Room room2(2, "Room 2", 1710087384, RoomStatus::ENDED); + Role role1({Action::KILL, Action::HEAL}); + std::vector actions = {Action::HEAL}; + Role role2(actions); } int functionToTest(int a) { diff --git a/src/prep/prep.cpp b/src/prep/prep.cpp index 5d4d199..0cd8665 100644 --- a/src/prep/prep.cpp +++ b/src/prep/prep.cpp @@ -2,13 +2,41 @@ #include "timeUtils.hh" +#include + int add(int a, int b) { return a + b; } +Role::Role(std::initializer_list actions) { + for (auto &a : actions) { + this->actions.push_back(a); + } +} + +Role::Role(std::vector actions) { + for (auto &a : actions) { + this->actions.push_back(a); + } +} + +Player::Player(std::string username, Role role, PlayerStatus playerStatus): + username(username), + role(role), + playerStatus(playerStatus) { +} + Room::Room(uint32_t id, std::string title, uint32_t utcTimestampCreatedAt, RoomStatus status): id(id), title(title), status(status) { this->utcTimestampCreatedAt = createUTCTimestamp(utcTimestampCreatedAt); } + +Event::Event(std::string title, uint32_t utcTimestampCreatedAt, uint32_t numberNight, bool isVisible): + title(title), + utcTimestampCreatedAt(createUTCTimestamp(utcTimestampCreatedAt)), + numberNight(numberNight), + isVisible(isVisible) { + this->utcTimestampCreatedAt = createUTCTimestamp(utcTimestampCreatedAt); +} diff --git a/src/prep/prep.hh b/src/prep/prep.hh index 9a8d1aa..eadd4e6 100644 --- a/src/prep/prep.hh +++ b/src/prep/prep.hh @@ -47,12 +47,17 @@ struct Event; struct Role { std::vector actions; + + Role(std::initializer_list actions); + Role(std::vector actions); }; struct Player { std::string username; Role role; PlayerStatus playerStatus; + + Player(std::string username, Role role, PlayerStatus playerStatus); }; struct Room { @@ -71,6 +76,8 @@ struct Event { bool isVisible; std::vector causedBy; std::vector influenced; + + Event(std::string title, uint32_t utcTimestampCreatedAt, uint32_t numberNight, bool isVisible); }; #endif