Browse Source

add 'const' to reduce possible type errors

tags/0.1.0
wihn2021 3 years ago
parent
commit
f5950fbe19
3 changed files with 15 additions and 10 deletions
  1. +5
    -5
      CAPI/API/include/API.h
  2. +5
    -5
      CAPI/API/include/logic.h
  3. +5
    -0
      CAPI/API/src/API.cpp

+ 5
- 5
CAPI/API/include/API.h View File

@@ -27,11 +27,11 @@ class ILogic

public:
// 获取服务器发来的消息
virtual std::vector<std::shared_ptr<THUAI6::Butcher>> GetButchers() const = 0;
virtual std::vector<std::shared_ptr<THUAI6::Human>> GetHumans() const = 0;
virtual std::vector<std::shared_ptr<THUAI6::Prop>> GetProps() const = 0;
virtual std::shared_ptr<THUAI6::Human> HumanGetSelfInfo() const = 0;
virtual std::shared_ptr<THUAI6::Butcher> ButcherGetSelfInfo() const = 0;
virtual std::vector<std::shared_ptr<const THUAI6::Butcher>> GetButchers() const = 0;
virtual std::vector<std::shared_ptr<const THUAI6::Human>> GetHumans() const = 0;
virtual std::vector<std::shared_ptr<const THUAI6::Prop>> GetProps() const = 0;
virtual std::shared_ptr<const THUAI6::Human> HumanGetSelfInfo() const = 0;
virtual std::shared_ptr<const THUAI6::Butcher> ButcherGetSelfInfo() const = 0;

virtual std::vector<std::vector<THUAI6::PlaceType>> GetFullMap() const = 0;



+ 5
- 5
CAPI/API/include/logic.h View File

@@ -82,11 +82,11 @@ private:

// 获取服务器发来的消息

std::vector<std::shared_ptr<THUAI6::Butcher>> GetButchers() const override;
std::vector<std::shared_ptr<THUAI6::Human>> GetHumans() const override;
std::vector<std::shared_ptr<THUAI6::Prop>> GetProps() const override;
std::shared_ptr<THUAI6::Human> HumanGetSelfInfo() const override;
std::shared_ptr<THUAI6::Butcher> ButcherGetSelfInfo() const override;
std::vector<std::shared_ptr<const THUAI6::Butcher>> GetButchers() const override;
std::vector<std::shared_ptr<const THUAI6::Human>> GetHumans() const override;
std::vector<std::shared_ptr<const THUAI6::Prop>> GetProps() const override;
std::shared_ptr<const THUAI6::Human> HumanGetSelfInfo() const override;
std::shared_ptr<const THUAI6::Butcher> ButcherGetSelfInfo() const override;

std::vector<std::vector<THUAI6::PlaceType>> GetFullMap() const override;



+ 5
- 0
CAPI/API/src/API.cpp View File

@@ -10,3 +10,8 @@ void ButcherAPI::Play(IAI& ai)
{
ai.play(*this);
}

std::vector<std::shared_ptr<const THUAI6::Butcher>> HumanAPI::GetButcher() const
{
return logic.GetButchers();
}

Loading…
Cancel
Save