Browse Source

🦄 refactor(logic.h & logic.cpp):

tags/0.1.0
wihn2021 3 years ago
parent
commit
43bc95f570
1 changed files with 14 additions and 8 deletions
  1. +14
    -8
      CAPI/API/src/logic.cpp

+ 14
- 8
CAPI/API/src/logic.cpp View File

@@ -20,31 +20,37 @@ Logic::Logic(THUAI6::PlayerType type, int64_t ID, THUAI6::ButcherType butcher, T
bufferState = &state[1];
}

std::vector<std::shared_ptr<THUAI6::Butcher>> Logic::GetButchers() const
std::vector<std::shared_ptr<const THUAI6::Butcher>> Logic::GetButchers() const
{
std::lock_guard<std::mutex> lock(mtxState);
return currentState->butchers;
std::vector<std::shared_ptr<const THUAI6::Butcher>> temp;
temp.assign(currentState->butchers.begin(), currentState->butchers.end());
return temp;
}

std::vector<std::shared_ptr<THUAI6::Human>> Logic::GetHumans() const
std::vector<std::shared_ptr<const THUAI6::Human>> Logic::GetHumans() const
{
std::lock_guard<std::mutex> lock(mtxState);
return currentState->humans;
std::vector<std::shared_ptr<const THUAI6::Human>> temp;
temp.assign(currentState->humans.begin(), currentState->humans.end());
return temp;
}

std::vector<std::shared_ptr<THUAI6::Prop>> Logic::GetProps() const
std::vector<std::shared_ptr<const THUAI6::Prop>> Logic::GetProps() const
{
std::lock_guard<std::mutex> lock(mtxState);
return currentState->props;
std::vector<std::shared_ptr<const THUAI6::Prop>> temp;
temp.assign(currentState->props.begin(), currentState->props.end());
return temp;
}

std::shared_ptr<THUAI6::Human> Logic::HumanGetSelfInfo() const
std::shared_ptr<const THUAI6::Human> Logic::HumanGetSelfInfo() const
{
std::lock_guard<std::mutex> lock(mtxState);
return currentState->humanSelf;
}

std::shared_ptr<THUAI6::Butcher> Logic::ButcherGetSelfInfo() const
std::shared_ptr<const THUAI6::Butcher> Logic::ButcherGetSelfInfo() const
{
std::lock_guard<std::mutex> lock(mtxState);
return currentState->butcherSelf;


Loading…
Cancel
Save