diff --git a/src/lib.cpp b/src/lib.cpp index 3b103d4..3175e00 100644 --- a/src/lib.cpp +++ b/src/lib.cpp @@ -20,24 +20,6 @@ enum VALIDATION_STATUS { ACTION_VALID, }; -void run() { - const Action kill = Action("kill", true); - const Action heal = Action("heal", true); - const Action vote = Action("vote", true); - Role role1({vote, kill, heal}); - Role role2({heal}); - Event event1 = Event("Event 1", 1710087355, 1, true, {}, {}); - Event event2 = Event("Event 2", 1710087363, 1, true, {kill}, {}); - Event event3 = Event("Event 3", 1710087369, 1, true, {}, {kill}); - std::vector relatedEvents({event2, event3}); - Player player1 = Player(69, "player1", role1, PlayerStatus::ALIVE); - Player player2 = Player(420, "player2", role1, PlayerStatus::ALIVE); - Room room1(1, "Room 1", 1710087364, RoomStatus::IN_PROGRESS, {player1, player2}); - Room room2(2, "Room 2", 1710087384, RoomStatus::ENDED, {}); - int actionValidated = validateAction(&player1, &kill, &room1, &relatedEvents, &player2); - printf("The action validation result is %u\n", actionValidated); -} - int validateAction( Player *actor, const Action *action, Room *room, std::vector *relatedEvents, Player *target = nullptr) { if (!actor) { diff --git a/src/lib.hh b/src/lib.hh index 547d50f..72ad37b 100644 --- a/src/lib.hh +++ b/src/lib.hh @@ -1,7 +1,5 @@ #include "prep/prep.hh" -void run(); - bool playerBelongsToRoom(Player *player, Room *room); bool actionBelongsToRole(Role *role, const Action *action); bool isActionAllowed(const Action *action, std::vector *relevantEvents); diff --git a/src/main.cpp b/src/main.cpp index 81a2ad1..17e0f09 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3,6 +3,20 @@ #include int main(int argc, char *argv[]) { - run(); + const Action kill = Action("kill", true); + const Action heal = Action("heal", true); + const Action vote = Action("vote", true); + Role role1({vote, kill, heal}); + Role role2({heal}); + Event event1 = Event("Event 1", 1710087355, 1, true, {}, {}); + Event event2 = Event("Event 2", 1710087363, 1, true, {kill}, {}); + Event event3 = Event("Event 3", 1710087369, 1, true, {}, {kill}); + std::vector relatedEvents({event2, event3}); + Player player1 = Player(69, "player1", role1, PlayerStatus::ALIVE); + Player player2 = Player(420, "player2", role1, PlayerStatus::ALIVE); + Room room1(1, "Room 1", 1710087364, RoomStatus::IN_PROGRESS, {player1, player2}); + Room room2(2, "Room 2", 1710087384, RoomStatus::ENDED, {}); + int actionValidated = validateAction(&player1, &kill, &room1, &relatedEvents, &player2); + printf("The action validation result is %u\n", actionValidated); return EXIT_SUCCESS; }