Skip to content

Commit 8dbfe68

Browse files
authored
Obiektowosc#3 Lesson fixes (#72)
* changing lhs to rhs in Island::Coordinates::operator== * fixing Player::getAvailableSpace() * adding empty CMakeLists.txt
1 parent 1776fe1 commit 8dbfe68

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

module2/presentation_solutions.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ public:
6969
Coordinates(size_t pos_x, size_t pos_y)
7070
: pos_x_(pos_x), pos_y_(pos_y) {}
7171
72-
bool operator==(const Coordinates& lhs) const {
73-
return this->pos_x_ == lhs.pos_x_ && this->pos_y_ == lhs.pos_y_;
72+
bool operator==(const Coordinates& rhs) const {
73+
return this->pos_x_ == rhs.pos_x_ && this->pos_y_ == rhs.pos_y_;
7474
}
7575
7676
private:
@@ -247,11 +247,11 @@ Cargo* Player::getCargo(size_t index) const {
247247
}
248248

249249
size_t Player::getAvailableSpace() const {
250-
available_space_ = 0;
250+
size_t total_cargo_amount = 0;
251251
for (const auto cargo : ship_->getCargos()) {
252-
available_space_ += cargo->getAmount();
252+
total_cargo_amount += cargo->getAmount();
253253
}
254-
254+
available_space_ = ship_->getCapacity() - total_cargo_amount;
255255
return available_space_;
256256
}
257257
```

shm/CMakeLists.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)