mirror of
https://github.com/jorenchik/testing-spring-2024.git
synced 2025-10-21 20:10:36 +00:00
feat[prep]: role, player constructors
This commit is contained in:
parent
45928dd679
commit
6d8e56f962
@ -1,10 +1,13 @@
|
|||||||
#include "lib.hh"
|
|
||||||
|
|
||||||
#include "prep/prep.hh"
|
#include "prep/prep.hh"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
void run() {
|
void run() {
|
||||||
Room room1(1, "Room 1", 1710087364, RoomStatus::IN_PROGRESS);
|
Room room1(1, "Room 1", 1710087364, RoomStatus::IN_PROGRESS);
|
||||||
Room room2(2, "Room 2", 1710087384, RoomStatus::ENDED);
|
Room room2(2, "Room 2", 1710087384, RoomStatus::ENDED);
|
||||||
|
Role role1({Action::KILL, Action::HEAL});
|
||||||
|
std::vector<Action> actions = {Action::HEAL};
|
||||||
|
Role role2(actions);
|
||||||
}
|
}
|
||||||
|
|
||||||
int functionToTest(int a) {
|
int functionToTest(int a) {
|
||||||
|
|||||||
@ -2,13 +2,41 @@
|
|||||||
|
|
||||||
#include "timeUtils.hh"
|
#include "timeUtils.hh"
|
||||||
|
|
||||||
|
#include <initializer_list>
|
||||||
|
|
||||||
int add(int a, int b) {
|
int add(int a, int b) {
|
||||||
return a + b;
|
return a + b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Role::Role(std::initializer_list<Action> actions) {
|
||||||
|
for (auto &a : actions) {
|
||||||
|
this->actions.push_back(a);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Role::Role(std::vector<Action> 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):
|
Room::Room(uint32_t id, std::string title, uint32_t utcTimestampCreatedAt, RoomStatus status):
|
||||||
id(id),
|
id(id),
|
||||||
title(title),
|
title(title),
|
||||||
status(status) {
|
status(status) {
|
||||||
this->utcTimestampCreatedAt = createUTCTimestamp(utcTimestampCreatedAt);
|
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);
|
||||||
|
}
|
||||||
|
|||||||
@ -47,12 +47,17 @@ struct Event;
|
|||||||
|
|
||||||
struct Role {
|
struct Role {
|
||||||
std::vector<Action> actions;
|
std::vector<Action> actions;
|
||||||
|
|
||||||
|
Role(std::initializer_list<Action> actions);
|
||||||
|
Role(std::vector<Action> actions);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Player {
|
struct Player {
|
||||||
std::string username;
|
std::string username;
|
||||||
Role role;
|
Role role;
|
||||||
PlayerStatus playerStatus;
|
PlayerStatus playerStatus;
|
||||||
|
|
||||||
|
Player(std::string username, Role role, PlayerStatus playerStatus);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Room {
|
struct Room {
|
||||||
@ -71,6 +76,8 @@ struct Event {
|
|||||||
bool isVisible;
|
bool isVisible;
|
||||||
std::vector<Action> causedBy;
|
std::vector<Action> causedBy;
|
||||||
std::vector<Action> influenced;
|
std::vector<Action> influenced;
|
||||||
|
|
||||||
|
Event(std::string title, uint32_t utcTimestampCreatedAt, uint32_t numberNight, bool isVisible);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user