Game-as-a-Service / Machi-Koro-Cpp

4 stars 1 forks source link

[Enhancement] Change the type of the object in InitGameEvent. #43

Closed HuaYuan-Tseng closed 3 months ago

HuaYuan-Tseng commented 5 months ago

If use pointer to pass the information back to front-end, perhaps will segmentation fault when call a non-exist game_id (#41 ).

To separate the concerns of InitGameEvent and InitGamePresenter, we will modify the pointer type to object type (maybe std::string etc.) in InitGameEvent.

HuaYuan-Tseng commented 4 months ago

Now it can return the error status code normally and would not crash.

SCR-20240515-ttwu
angtsusiong commented 4 months ago

42 Stil Segmentation fault

image

angtsusiong commented 4 months ago

42 Stil Segmentation fault image

image image

HuaYuan-Tseng commented 4 months ago
  1. ArchitectureMarket::cards() return std::map<CardName, int>.
angtsusiong commented 4 months ago
  1. ArchitectureMarket::cards() return std::map<CardName, int>.
std::map<CardName, std::vector<Building*>> ArchitectureMarket::cards() const;

修改成

 std::map<CardName, int> ArchitectureMarket::cards() const;

因為卡堆不必回傳 card* 。當卡片還在卡堆裡,card::operateEffect 不會被 call。