diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2020-10-30 12:26:48 +0100 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2020-10-30 12:26:48 +0100 |
commit | 51787d2240b8836b31e38e0590090bbb9041d8c2 (patch) | |
tree | 9d18db6661cc208a1ae4dba8097437a6a09ab39c /CastleManager.cpp | |
parent | f873d61f36a46c42cc444dcb596f0d354ae3d202 (diff) | |
parent | 822b531a4f9b8120f1126fbaec085b8b6fab4c57 (diff) |
Merge branch 'master' of https://github.com/simonsan/Age_of_Empires_II_Definitive-Edition-SDKHEADmaster
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'CastleManager.cpp')
-rw-r--r-- | CastleManager.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/CastleManager.cpp b/CastleManager.cpp index 373d6e5..6b85e36 100644 --- a/CastleManager.cpp +++ b/CastleManager.cpp @@ -11,6 +11,7 @@ bool warningEnabled = true; int notification = 0; +ThreadSafeQueue<std::string> localMessages; ThreadSafeQueue<std::string> teamMessages; ThreadSafeQueue<std::string> allMessages; @@ -39,13 +40,13 @@ void CastleManager::OnUnitCreated(Unit* unit) { return; } - Player* owningPlayer = unit->pOwner; - if (!owningPlayer || owningPlayer == Engine::Get()->GetLocalPlayer()) + Player* owningPlayer = unit->GetOwner(); + if (!owningPlayer /*|| owningPlayer == Engine::Get()->GetLocalPlayer()*/) { return; } - if (strcmp("CSTL", unit->pUnitData->name) == 0) + if (strcmp("CSTL", unit->GetUnitData()->GetName()) == 0) { std::string message = std::string(owningPlayer->name) + " is building a castle!"; const char* charMessage = message.c_str(); @@ -53,7 +54,7 @@ void CastleManager::OnUnitCreated(Unit* unit) switch (notification) { case 0: - Engine::Get()->PrintNotification(charMessage); + localMessages.push(message); break; case 1: teamMessages.push(message); @@ -69,6 +70,13 @@ void CastleManager::OnUnitCreated(Unit* unit) void CastleManager::OnMenuMainWindow() { + if (!localMessages.isEmpty()) + { + std::string message; + localMessages.pop(message); + Engine::Get()->PrintNotification(message.c_str()); + } + if (!teamMessages.isEmpty()) { std::string message; |