-
Notifications
You must be signed in to change notification settings - Fork 87
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
base: shm
Are you sure you want to change the base?
Shm 2 #106
Conversation
Co-authored-by: Kacu <[email protected]>
#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]>
Co-authored-by: Kacu <[email protected]>
Co-authored-by: Kacu <[email protected]>
Co-authored-by: Kacu <[email protected]>
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]>
Co-authored-by: Kacu <[email protected]>
Co-authored-by: Kacu <[email protected]>
There was a problem hiding this 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(); |
There was a problem hiding this comment.
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
std::random_device randomDevice; | ||
std::mt19937 randomEngine(randomDevice()); |
There was a problem hiding this comment.
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
case Rarity::Common: | ||
return getBasePrice() / 3; | ||
|
||
case Rarity::Rare: | ||
return getBasePrice() / 2; | ||
|
||
case Rarity::Epic: | ||
return getBasePrice(); | ||
|
||
case Rarity::Legendary: | ||
return getBasePrice() * 4; | ||
} |
There was a problem hiding this comment.
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.
horizonLimit_(100), | ||
islands_(generateIslands(10)), |
There was a problem hiding this comment.
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))); |
There was a problem hiding this comment.
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");
There was a problem hiding this comment.
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...
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; |
There was a problem hiding this comment.
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
// Store(Time* time); | ||
|
||
// ~Store() override; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
???
// 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); | ||
|
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be virtual
Exit function and confirm
No description provided.