Website Summary Files Commits Branches @commit @diff @stats
path: root / src
diff options
context:
space:
mode:
Commit0551e368236a644bd169a6f0760c55c4571fc8ba (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-06 11:41:53 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-06 11:41:53 +0300
Files9d535423a0ef03bb1848bd13de3fb7fba5eb9e42 /src
FMI-OOP-P1_TicketSystem-0551e368236a644bd169a6f0760c55c4571fc8ba.tar
FMI-OOP-P1_TicketSystem-0551e368236a644bd169a6f0760c55c4571fc8ba.tar.gz
FMI-OOP-P1_TicketSystem-0551e368236a644bd169a6f0760c55c4571fc8ba.zip
Parentd112289d0d86e66286641a4a1cd450c7db97f5b7 (diff)
Autocommit at 06.05.2022 @ 11:41
3 files changed, 7 insertions, 2 deletions
-rw-r--r--src/Venue/Venue.cpp6
-rw-r--r--src/Venue/Venue.h1
-rw-r--r--src/VenueConsoleUI.cpp2
diff --git a/src/Venue/Venue.cpp b/src/Venue/Venue.cpp
index 3185d7b..01c6a95 100644
--- a/src/Venue/Venue.cpp
+++ b/src/Venue/Venue.cpp
@@ -12,7 +12,7 @@ Venue::Venue(const Hall* halls, unsigned hallCount, const EventSystem& es) {
}
bool Venue::hallExists(unsigned hallIndex) const {
- return hallIndex < halls.get_count();
+ return halls.contain(Hall(hallIndex, 0, 0));
}
bool Venue::hallExists(const Hall& hall) const {
@@ -23,6 +23,10 @@ const List<Hall>& Venue::get_halls() const {
return this->halls;
}
+const Hall& Venue::getHall(unsigned hallIndex) const {
+ return this->halls[this->halls.findIndex(Hall(hallIndex, 0, 0))];
+}
+
EventSystem& Venue::get_es() {
return this->es;
}
diff --git a/src/Venue/Venue.h b/src/Venue/Venue.h
index 2f39bbc..8c0f53e 100644
--- a/src/Venue/Venue.h
+++ b/src/Venue/Venue.h
@@ -18,6 +18,7 @@ public:
bool hallExists(const Hall& hall) const;
const List<Hall>& get_halls() const;
+ const Hall& getHall(unsigned hallIndex) const;
EventSystem& get_es();
};
diff --git a/src/VenueConsoleUI.cpp b/src/VenueConsoleUI.cpp
index af02425..94615c3 100644
--- a/src/VenueConsoleUI.cpp
+++ b/src/VenueConsoleUI.cpp
@@ -130,7 +130,7 @@ void command_createEvent() {
Date date;
inputBox("Enter event date: ", &date);
- handleStatusCode(v->get_es().createEvent(&v->get_halls()[hallIndex], name, date), eventManagementMenu);
+ handleStatusCode(v->get_es().createEvent(&v->getHall(hallIndex), name, date), eventManagementMenu);
}
void command_cancelEvent() {