diff --git a/dCommon/dEnums/eGameMessageType.h b/dCommon/dEnums/eGameMessageType.h index 8dd0cf63..129acf7a 100644 --- a/dCommon/dEnums/eGameMessageType.h +++ b/dCommon/dEnums/eGameMessageType.h @@ -1603,7 +1603,7 @@ BEGIN_ENUM_WITH_VALUES(eGameMessageType, uint16_t) DECLARE_ENUM_ELEMENT_WITH_VALUE(UPDATE_FORGED_ITEM, 1768) DECLARE_ENUM_ELEMENT_WITH_VALUE(CAN_ITEMS_BE_REFORGED, 1769) DECLARE_ENUM_ELEMENT_WITH_VALUE(NOTIFY_CLIENT_RAIL_START_FAILED, 1771) - DECLARE_ENUM_ELEMENT_WITH_VALUE(GET_IS_ON_RAIL, 177) + DECLARE_ENUM_ELEMENT_WITH_VALUE(GET_IS_ON_RAIL, 1772) END_ENUM_WITH_VALUES(eGameMessageType, uint16_t) #endif //!__EGAMEMESSAGETYPE__H__ diff --git a/dCommon/dEnums/eWorldMessageType.h b/dCommon/dEnums/eWorldMessageType.h index 4b3e2a03..2e243b35 100644 --- a/dCommon/dEnums/eWorldMessageType.h +++ b/dCommon/dEnums/eWorldMessageType.h @@ -1,43 +1,47 @@ -#ifndef __EWORLDMESSAGETYPE__H__ -#define __EWORLDMESSAGETYPE__H__ +#if (!defined(__EWORLDMESSAGETYPE__H__) || defined(GENERATE_ENUM_STRINGS)) + +#if (!defined(__EWORLDMESSAGETYPE__H__)) + #define __EWORLDMESSAGETYPE__H__ +#endif #include +#include "StringifyEnums.h" -enum class eWorldMessageType : uint32_t { - VALIDATION = 1, // Session info - CHARACTER_LIST_REQUEST, - CHARACTER_CREATE_REQUEST, - LOGIN_REQUEST, // Character selected - GAME_MSG, - CHARACTER_DELETE_REQUEST, - CHARACTER_RENAME_REQUEST, - HAPPY_FLOWER_MODE_NOTIFY, - SLASH_RELOAD_MAP, // Reload map cmp - SLASH_PUSH_MAP_REQUEST, // Push map req cmd - SLASH_PUSH_MAP, // Push map cmd - SLASH_PULL_MAP, // Pull map cmd - LOCK_MAP_REQUEST, - GENERAL_CHAT_MESSAGE, // General chat message - HTTP_MONITOR_INFO_REQUEST, - SLASH_DEBUG_SCRIPTS, // Debug scripts cmd - MODELS_CLEAR, - EXHIBIT_INSERT_MODEL, - LEVEL_LOAD_COMPLETE, // Character data request - TMP_GUILD_CREATE, - ROUTE_PACKET, // Social? - POSITION_UPDATE, - MAIL, - WORD_CHECK, // Whitelist word check - STRING_CHECK, // Whitelist string check - GET_PLAYERS_IN_ZONE, - REQUEST_UGC_MANIFEST_INFO, - BLUEPRINT_GET_ALL_DATA_REQUEST, - CANCEL_MAP_QUEUE, - HANDLE_FUNNESS, - FAKE_PRG_CSR_MESSAGE, - REQUEST_FREE_TRIAL_REFRESH, - GM_SET_FREE_TRIAL_STATUS, - UI_HELP_TOP_5 = 91 -}; +BEGIN_ENUM_WITH_VALUES(eWorldMessageType, uint32_t) + DECLARE_ENUM_ELEMENT_WITH_VALUE(VALIDATION, 1) // Session info + DECLARE_ENUM_ELEMENT_WITH_VALUE(CHARACTER_LIST_REQUEST, 2) + DECLARE_ENUM_ELEMENT_WITH_VALUE(CHARACTER_CREATE_REQUEST, 3) + DECLARE_ENUM_ELEMENT_WITH_VALUE(LOGIN_REQUEST, 4) // Character selected + DECLARE_ENUM_ELEMENT_WITH_VALUE(GAME_MSG, 5) + DECLARE_ENUM_ELEMENT_WITH_VALUE(CHARACTER_DELETE_REQUEST, 6) + DECLARE_ENUM_ELEMENT_WITH_VALUE(CHARACTER_RENAME_REQUEST, 7) + DECLARE_ENUM_ELEMENT_WITH_VALUE(HAPPY_FLOWER_MODE_NOTIFY, 8) + DECLARE_ENUM_ELEMENT_WITH_VALUE(SLASH_RELOAD_MAP, 9) // Reload map cmp + DECLARE_ENUM_ELEMENT_WITH_VALUE(SLASH_PUSH_MAP_REQUEST, 10) // Push map req cmd + DECLARE_ENUM_ELEMENT_WITH_VALUE(SLASH_PUSH_MAP, 11) // Push map cmd + DECLARE_ENUM_ELEMENT_WITH_VALUE(SLASH_PULL_MAP, 12) // Pull map cmd + DECLARE_ENUM_ELEMENT_WITH_VALUE(LOCK_MAP_REQUEST, 13) + DECLARE_ENUM_ELEMENT_WITH_VALUE(GENERAL_CHAT_MESSAGE, 14) // General chat message + DECLARE_ENUM_ELEMENT_WITH_VALUE(HTTP_MONITOR_INFO_REQUEST, 15) + DECLARE_ENUM_ELEMENT_WITH_VALUE(SLASH_DEBUG_SCRIPTS, 16) // Debug scripts cmd + DECLARE_ENUM_ELEMENT_WITH_VALUE(MODELS_CLEAR, 17) + DECLARE_ENUM_ELEMENT_WITH_VALUE(EXHIBIT_INSERT_MODEL, 18) + DECLARE_ENUM_ELEMENT_WITH_VALUE(LEVEL_LOAD_COMPLETE, 19) // Character data request + DECLARE_ENUM_ELEMENT_WITH_VALUE(TMP_GUILD_CREATE, 20) + DECLARE_ENUM_ELEMENT_WITH_VALUE(ROUTE_PACKET, 21) // Social? + DECLARE_ENUM_ELEMENT_WITH_VALUE(POSITION_UPDATE, 22) + DECLARE_ENUM_ELEMENT_WITH_VALUE(MAIL, 23) + DECLARE_ENUM_ELEMENT_WITH_VALUE(WORD_CHECK, 24) // Whitelist word check + DECLARE_ENUM_ELEMENT_WITH_VALUE(STRING_CHECK, 25) // Whitelist string check + DECLARE_ENUM_ELEMENT_WITH_VALUE(GET_PLAYERS_IN_ZONE, 26) + DECLARE_ENUM_ELEMENT_WITH_VALUE(REQUEST_UGC_MANIFEST_INFO, 27) + DECLARE_ENUM_ELEMENT_WITH_VALUE(BLUEPRINT_GET_ALL_DATA_REQUEST, 28) + DECLARE_ENUM_ELEMENT_WITH_VALUE(CANCEL_MAP_QUEUE, 29) + DECLARE_ENUM_ELEMENT_WITH_VALUE(HANDLE_FUNNESS, 30) + DECLARE_ENUM_ELEMENT_WITH_VALUE(FAKE_PRG_CSR_MESSAGE, 31) + DECLARE_ENUM_ELEMENT_WITH_VALUE(REQUEST_FREE_TRIAL_REFRESH, 32) + DECLARE_ENUM_ELEMENT_WITH_VALUE(GM_SET_FREE_TRIAL_STATUS, 33) + DECLARE_ENUM_ELEMENT_WITH_VALUE(UI_HELP_TOP_5, 91) +END_ENUM_WITH_VALUES(eWorldMessageType, uint32_t) #endif //!__EWORLDMESSAGETYPE__H__ diff --git a/dGame/dComponents/RebuildComponent.cpp b/dGame/dComponents/RebuildComponent.cpp index 5359dee0..bcdf4f70 100644 --- a/dGame/dComponents/RebuildComponent.cpp +++ b/dGame/dComponents/RebuildComponent.cpp @@ -197,18 +197,17 @@ void RebuildComponent::Update(float deltaTime) { DestroyableComponent* destComp = builder->GetComponent(); if (!destComp) break; - int newImagination = destComp->GetImagination(); - ++m_DrainedImagination; - --newImagination; + const int32_t imaginationCostRemaining = m_TakeImagination - m_DrainedImagination; + + const int32_t newImagination = destComp->GetImagination() - 1; destComp->SetImagination(newImagination); Game::entityManager->SerializeEntity(builder); - if (newImagination <= 0) { + if (newImagination <= 0 && imaginationCostRemaining > 0) { CancelRebuild(builder, eQuickBuildFailReason::OUT_OF_IMAGINATION, true); break; } - } if (m_Timer >= m_CompleteTime && m_DrainedImagination >= m_TakeImagination) { diff --git a/dGame/dComponents/RebuildComponent.h b/dGame/dComponents/RebuildComponent.h index bb097edd..b67747aa 100644 --- a/dGame/dComponents/RebuildComponent.h +++ b/dGame/dComponents/RebuildComponent.h @@ -285,7 +285,7 @@ private: float m_CompleteTime = 0; /** - * The imagination that's deducted when compeleting the rebuild + * The imagination that's deducted when completing the rebuild */ int m_TakeImagination = 0; diff --git a/dGame/dGameMessages/GameMessageHandler.cpp b/dGame/dGameMessages/GameMessageHandler.cpp index dd582065..2665de94 100644 --- a/dGame/dGameMessages/GameMessageHandler.cpp +++ b/dGame/dGameMessages/GameMessageHandler.cpp @@ -38,8 +38,6 @@ #include "ePlayerFlag.h" #include "dConfig.h" -using namespace std; - void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const SystemAddress& sysAddr, LWOOBJID objectID, eGameMessageType messageID) { CBITSTREAM; diff --git a/dGame/dUtilities/StringifyEnums.cpp b/dGame/dUtilities/StringifyEnums.cpp index 88ecb2d1..d186bf7b 100644 --- a/dGame/dUtilities/StringifyEnums.cpp +++ b/dGame/dUtilities/StringifyEnums.cpp @@ -2,5 +2,6 @@ #include #include "eGameMessageType.h" +#include "eWorldMessageType.h" -#undef GENERATE_ENUM_STRINGS // Stop string generation \ No newline at end of file +#undef GENERATE_ENUM_STRINGS // Stop string generation diff --git a/dWorldServer/WorldServer.cpp b/dWorldServer/WorldServer.cpp index 5fc0393a..c1f40fac 100644 --- a/dWorldServer/WorldServer.cpp +++ b/dWorldServer/WorldServer.cpp @@ -1244,7 +1244,10 @@ void HandlePacket(Packet* packet) { } default: - LOG("Unknown world packet received: %i", int(packet->data[3])); + const auto data = packet->data[3]; + const uint32_t worldMessageId = static_cast(data); + const char* worldMessageString = eWorldMessageType_as_string(static_cast(data)); + LOG("Unknown world packet received: (%4i) %s", worldMessageId, worldMessageString); } }