mirror of
https://github.com/jorenchik/testing-spring-2024.git
synced 2025-10-21 20:10:36 +00:00
feat: add player to the room
This commit is contained in:
parent
db4a4be369
commit
23345ba89f
@ -16,8 +16,6 @@ enum VALIDATION_STATUS {
|
||||
};
|
||||
|
||||
void run() {
|
||||
Room room1(1, "Room 1", 1710087364, RoomStatus::IN_PROGRESS);
|
||||
Room room2(2, "Room 2", 1710087384, RoomStatus::ENDED);
|
||||
const Action kill = Action("kill", true);
|
||||
const Action heal = Action("heal", true);
|
||||
const Action vote = Action("vote", true);
|
||||
@ -29,6 +27,8 @@ void run() {
|
||||
std::vector<Event> relatedEvents({event2, event3});
|
||||
Player player1 = Player("player1", role1, PlayerStatus::ALIVE);
|
||||
Player player2 = Player("player2", role1, PlayerStatus::ALIVE);
|
||||
Room room1(1, "Room 1", 1710087364, RoomStatus::IN_PROGRESS, {player1, player2});
|
||||
Room room2(2, "Room 2", 1710087384, RoomStatus::ENDED, {player1, player2});
|
||||
int actionValidated = validateAction(&player1, &kill, &room1, &relatedEvents, &player2);
|
||||
std::cout << actionValidated << std::endl;
|
||||
}
|
||||
|
||||
@ -35,10 +35,21 @@ Player::Player(std::string username, Role role, PlayerStatus playerStatus):
|
||||
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, std::vector<Player> players):
|
||||
id(id),
|
||||
title(title),
|
||||
status(status) {
|
||||
status(status),
|
||||
players(players) {
|
||||
this->utcTimestampCreatedAt = createUTCTimestamp(utcTimestampCreatedAt);
|
||||
}
|
||||
|
||||
Room::Room(uint32_t id,
|
||||
std::string title,
|
||||
uint32_t utcTimestampCreatedAt,
|
||||
RoomStatus status,
|
||||
std::initializer_list<Player> players):
|
||||
Room(id, title, utcTimestampCreatedAt, status, std::vector<Player>(players)) {
|
||||
this->utcTimestampCreatedAt = createUTCTimestamp(utcTimestampCreatedAt);
|
||||
}
|
||||
|
||||
|
||||
@ -65,8 +65,15 @@ struct Room {
|
||||
std::string title;
|
||||
std::tm *utcTimestampCreatedAt;
|
||||
RoomStatus status;
|
||||
std::vector<Player> players;
|
||||
|
||||
Room(uint32_t id, std::string title, uint32_t utcTimestampCreatedAt, RoomStatus status);
|
||||
Room(
|
||||
uint32_t id, std::string title, uint32_t utcTimestampCreatedAt, RoomStatus status, std::vector<Player> players);
|
||||
Room(uint32_t id,
|
||||
std::string title,
|
||||
uint32_t utcTimestampCreatedAt,
|
||||
RoomStatus status,
|
||||
std::initializer_list<Player> players);
|
||||
};
|
||||
|
||||
struct Event {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user