Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shm 2 #106

Open
wants to merge 25 commits into
base: shm
Choose a base branch
from
Open

Shm 2 #106

wants to merge 25 commits into from

Conversation

Ptysiek
Copy link

@Ptysiek Ptysiek commented Aug 21, 2021

No description provided.

ziobron and others added 25 commits June 11, 2021 19:12
#11)

* 6 moved definitions from Fortune.hpp file into Fortune.cpp source file

* 6 changed Fortune class into namespace

Co-authored-by: Kacu <[email protected]>
* 20 created new class Fruit

* 20 created new class Alcohol

* 20 created new class Item

* 20 turned Cargo class into interface

* 20 created load and unload operations inside Ship class

Co-authored-by: Kacu <[email protected]>
* 14 created Store class

* 14 created new classes Time and Observer

* 14 connected observer with five classes

Co-authored-by: Kacu <[email protected]>
* 13 created new class Delegate

* 13 implemented nextDay operations inside Ship and Store classes

Co-authored-by: Kacu <[email protected]>
Copy link
Collaborator

@nauka-programowania-MA nauka-programowania-MA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This project is not completed. I can't grant you points. Ofc. you have observer but implemented in the wrong way (missing D'tor) you have a lot of commented code.


class Delegate {
public:
// ~Delegate();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should have virtual D'tor when one or more methods are virtual

Comment on lines +3 to +4
std::random_device randomDevice;
std::mt19937 randomEngine(randomDevice());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't make it global, move them to class

Comment on lines +10 to +21
case Rarity::Common:
return getBasePrice() / 3;

case Rarity::Rare:
return getBasePrice() / 2;

case Rarity::Epic:
return getBasePrice();

case Rarity::Legendary:
return getBasePrice() * 4;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to always multiply. So common should be 1, rare eg. 3 etc.. Dividing always makes trouble in testing, because you lose precision.

Comment on lines +5 to +6
horizonLimit_(100),
islands_(generateIslands(10)),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this 2 magic numbers constexpr

std::vector<Island> islands;
islands.reserve(xyPositions.size() / 2);
for (size_t i = 1; i < xyPositions.size(); i += 2) {
islands.emplace_back(Island::Coordinates(xyPositions.at(i - 1), xyPositions.at(i)));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when you use ecmplae_back you provide arguments immediately to C'tor, if you want to create an object and insert it better use push_back.

like vec.empalce_back(5, "ala");

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In other cases, you use copy or move C'tor...

Comment on lines +13 to +25
Done,
Lack_of_money,
Lack_of_cargo,
Lack_of_space
};

Time* time_;
std::vector<std::unique_ptr<Cargo>> cargo_;

public:
// Store(Time* time);

// ~Store() override;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should make it default and overrdie

Comment on lines +23 to +25
// Store(Time* time);

// ~Store() override;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

???

Comment on lines +29 to +41
// Cargo* GetCargo(const size_t pos);

// Response Buy(Cargo* cargo, size_t amount, Player* player);

// Response Sell(Cargo* caergo, size_t amount, Player* player);

// friend std::ostream& operator<<(std::ostream& out, const Store& store);

private:
// void GenerateCargo();

// Cargo* FindMatchCargo(Cargo* cargo);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

???

return *this;
}

// ObserverIT GetObserverIt(Observer* obs);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

???

struct Observer {
virtual void nextDay() = 0;

// virtual ~Observer();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be virtual

BarTes8 pushed a commit to BarTes8/object-oriented-programming that referenced this pull request Sep 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants