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
0a61c08a0e
commit
0b16d5f92b
@ -1,10 +1,13 @@
|
||||
#include "lib.hh"
|
||||
|
||||
#include "prep/prep.hh"
|
||||
|
||||
#include <vector>
|
||||
|
||||
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<Action> actions = {Action::HEAL};
|
||||
Role role2(actions);
|
||||
}
|
||||
|
||||
int functionToTest(int a) {
|
||||
|
||||
@ -2,13 +2,41 @@
|
||||
|
||||
#include "timeUtils.hh"
|
||||
|
||||
#include <initializer_list>
|
||||
|
||||
int add(int a, int 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):
|
||||
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);
|
||||
}
|
||||
|
||||
@ -47,12 +47,17 @@ struct Event;
|
||||
|
||||
struct Role {
|
||||
std::vector<Action> actions;
|
||||
|
||||
Role(std::initializer_list<Action> actions);
|
||||
Role(std::vector<Action> 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<Action> causedBy;
|
||||
std::vector<Action> influenced;
|
||||
|
||||
Event(std::string title, uint32_t utcTimestampCreatedAt, uint32_t numberNight, bool isVisible);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
Reference in New Issue
Block a user