#include "prep.hh" #include "timeUtils.hh" #include int add(int a, int b) { return a + b; } Action::Action(std::string name, bool hasTarget) { this->name = name; this->hasTarget = hasTarget; } bool Action::operator==(const Action &other) const { return this->name == other.name; } 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, std::vector causedBy, std::vector prohibits, std::vector allows): title(title), utcTimestampCreatedAt(createUTCTimestamp(utcTimestampCreatedAt)), numberNight(numberNight), isVisible(isVisible) { this->utcTimestampCreatedAt = createUTCTimestamp(utcTimestampCreatedAt); for (auto &a : causedBy) { this->causedBy.push_back(a); } for (auto &a : prohibits) { this->prohibits.push_back(a); } for (auto &a : allows) { this->allows.push_back(a); } } Event::Event(std::string title, uint32_t utcTimestampCreatedAt, uint32_t numberNight, bool isVisible, std::initializer_list causedBy, std::initializer_list prohibits, std::initializer_list allows): Event(title, utcTimestampCreatedAt, numberNight, isVisible, std::vector(causedBy), std::vector(prohibits), std::vector(allows)) { this->utcTimestampCreatedAt = createUTCTimestamp(utcTimestampCreatedAt); } bool Event::operator<(const Event &right) const { return this->utcTimestampCreatedAt < right.utcTimestampCreatedAt; } bool Event::operator==(const Event &right) const { return this->utcTimestampCreatedAt == right.utcTimestampCreatedAt; } bool Event::operator>(const Event &right) const { return this->utcTimestampCreatedAt > right.utcTimestampCreatedAt; }