-
Notifications
You must be signed in to change notification settings - Fork 1
Lostmap #2
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
base: master
Are you sure you want to change the base?
Conversation
leshiy1295
left a comment
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.
С архитектурой - беда
По библиотекам (STL, pugi, SFML, конфиги) - есть, но не всё
Жаль, что очень поздно прислали первую версию - уже не будет времени поправить, как следует...
|
|
||
| class InterLayer; | ||
|
|
||
| #include <SFML/Network.hpp> |
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.
привязки на уровне интерфейса к библиотекам реализации быть не должно
нужно делать либо развязку на уровне классов-адаптеров, либо, например, использовать идиому PIMPL
|
|
||
| ClientParsed::ClientParsed(std::string xml) { | ||
| pugi::xml_parse_result result = doc.load_file(xml.c_str()); //use for filenames | ||
| //pugi::xml_parse_result result = doc.load_string(xml.c_str()); |
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.
в итоговом коде не должно быть комментариев без объяснения, почему они были специально оставлены
| #include <string> | ||
| #include <vector> | ||
| #include <map> | ||
| #include "pugixml.hpp" |
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.
адаптеры/PIMPL
| Spy, | ||
| RollCall}; | ||
|
|
||
| enum Entity_type {NO_ENTITY, BEAR, |
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.
если у вас с сервером используется общий код, то его стоит переиспользовать, в том числе на уровне файлов. Можно относить их в папку common, например...
|
|
||
| void Deck::cardsMove() { | ||
|
|
||
| for (size_t i = 0; i < size(); ++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.
forEach...
| int DropArea::getStrength() { | ||
| if (_card) | ||
| return _card->getStrength(); | ||
| return -1; |
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.
стоит вынести в именованную константу
| private: | ||
| //sf::Image _image; | ||
| //sf::Texture _texture; | ||
| sf::Sprite _sprite; |
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.
снова привязка к SFML на уровне .h файла
|
|
||
| MainWindow::MainWindow() { | ||
|
|
||
| if(!_background.loadFromFile("images/field.jpg")) |
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.
это должно передаваться извне/из конфигурационных файлов
| _partner->setWin(0); | ||
| else | ||
| if (win == -1) | ||
| _partner->setWin(-1); |
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.
ещё более непонятные магические константы...
кажется, что setWin должно быть true/false...
|
|
||
|
|
||
| switch (entity_type) { | ||
| case(BEAR): |
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.
о нет))))
для каждой карты должен быть свой класс)))
или это должно специальным образом проксироваться по категориям в другие классы, которые будут вызывать фабричный метод создания карты...
Клиент для игры CardGame