mirror of
				https://github.com/DarkflameUniverse/DarkflameServer.git
				synced 2025-10-31 20:52:01 +00:00 
			
		
		
		
	Merge pull request #714 from DarkflameUniverse/macro-formatting
Macro formatting consistency
This commit is contained in:
		| @@ -1,2 +1,5 @@ | ||||
| # format codebase | ||||
| 19e77a38d837ce781ba0ca6ea8e78b67a6e3b5a5 | ||||
|  | ||||
| # add semi-colons to macros consistently | ||||
| 9e4ce24fd2851e65df776dd9c57bcb0d45f4453a | ||||
|   | ||||
| @@ -730,9 +730,9 @@ void ChatPacketHandler::SendTeamInviteConfirm(PlayerData* receiver, bool bLeader | ||||
| 	bitStream.Write(receiver->playerID); | ||||
|  | ||||
| 	//portion that will get routed: | ||||
| 	CMSGHEADER | ||||
| 	CMSGHEADER; | ||||
|  | ||||
| 		bitStream.Write(receiver->playerID); | ||||
| 	bitStream.Write(receiver->playerID); | ||||
| 	bitStream.Write(GAME_MSG::GAME_MSG_TEAM_INVITE_CONFIRM); | ||||
|  | ||||
| 	bitStream.Write(bLeaderIsFreeTrial); | ||||
| @@ -757,9 +757,9 @@ void ChatPacketHandler::SendTeamStatus(PlayerData* receiver, LWOOBJID i64LeaderI | ||||
| 	bitStream.Write(receiver->playerID); | ||||
|  | ||||
| 	//portion that will get routed: | ||||
| 	CMSGHEADER | ||||
| 	CMSGHEADER; | ||||
|  | ||||
| 		bitStream.Write(receiver->playerID); | ||||
| 	bitStream.Write(receiver->playerID); | ||||
| 	bitStream.Write(GAME_MSG::GAME_MSG_TEAM_GET_STATUS_RESPONSE); | ||||
|  | ||||
| 	bitStream.Write(i64LeaderID); | ||||
| @@ -782,9 +782,9 @@ void ChatPacketHandler::SendTeamSetLeader(PlayerData* receiver, LWOOBJID i64Play | ||||
| 	bitStream.Write(receiver->playerID); | ||||
|  | ||||
| 	//portion that will get routed: | ||||
| 	CMSGHEADER | ||||
| 	CMSGHEADER; | ||||
|  | ||||
| 		bitStream.Write(receiver->playerID); | ||||
| 	bitStream.Write(receiver->playerID); | ||||
| 	bitStream.Write(GAME_MSG::GAME_MSG_TEAM_SET_LEADER); | ||||
|  | ||||
| 	bitStream.Write(i64PlayerID); | ||||
| @@ -799,9 +799,9 @@ void ChatPacketHandler::SendTeamAddPlayer(PlayerData* receiver, bool bIsFreeTria | ||||
| 	bitStream.Write(receiver->playerID); | ||||
|  | ||||
| 	//portion that will get routed: | ||||
| 	CMSGHEADER | ||||
| 	CMSGHEADER; | ||||
|  | ||||
| 		bitStream.Write(receiver->playerID); | ||||
| 	bitStream.Write(receiver->playerID); | ||||
| 	bitStream.Write(GAME_MSG::GAME_MSG_TEAM_ADD_PLAYER); | ||||
|  | ||||
| 	bitStream.Write(bIsFreeTrial); | ||||
| @@ -828,9 +828,9 @@ void ChatPacketHandler::SendTeamRemovePlayer(PlayerData* receiver, bool bDisband | ||||
| 	bitStream.Write(receiver->playerID); | ||||
|  | ||||
| 	//portion that will get routed: | ||||
| 	CMSGHEADER | ||||
| 	CMSGHEADER; | ||||
|  | ||||
| 		bitStream.Write(receiver->playerID); | ||||
| 	bitStream.Write(receiver->playerID); | ||||
| 	bitStream.Write(GAME_MSG::GAME_MSG_TEAM_REMOVE_PLAYER); | ||||
|  | ||||
| 	bitStream.Write(bDisband); | ||||
| @@ -854,9 +854,9 @@ void ChatPacketHandler::SendTeamSetOffWorldFlag(PlayerData* receiver, LWOOBJID i | ||||
| 	bitStream.Write(receiver->playerID); | ||||
|  | ||||
| 	//portion that will get routed: | ||||
| 	CMSGHEADER | ||||
| 	CMSGHEADER; | ||||
|  | ||||
| 		bitStream.Write(receiver->playerID); | ||||
| 	bitStream.Write(receiver->playerID); | ||||
| 	bitStream.Write(GAME_MSG::GAME_MSG_TEAM_SET_OFF_WORLD_FLAG); | ||||
|  | ||||
| 	bitStream.Write(i64PlayerID); | ||||
|   | ||||
| @@ -31,10 +31,10 @@ using namespace std; | ||||
|  | ||||
| void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const SystemAddress& sysAddr, LWOOBJID objectID, GAME_MSG messageID) { | ||||
|  | ||||
| 	CBITSTREAM | ||||
| 	CBITSTREAM; | ||||
|  | ||||
| 		// Get the entity | ||||
| 		Entity* entity = EntityManager::Instance()->GetEntity(objectID); | ||||
| 	// Get the entity | ||||
| 	Entity* entity = EntityManager::Instance()->GetEntity(objectID); | ||||
|  | ||||
| 	User* usr = UserManager::Instance()->GetUser(sysAddr); | ||||
|  | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -12,8 +12,8 @@ | ||||
| #include "dServer.h" | ||||
|  | ||||
| void ChatPackets::SendChatMessage(const SystemAddress& sysAddr, char chatChannel, const std::string& senderName, LWOOBJID playerObjectID, bool senderMythran, const std::u16string& message) { | ||||
| 	CBITSTREAM | ||||
| 		PacketUtils::WriteHeader(bitStream, CHAT, MSG_CHAT_GENERAL_CHAT_MESSAGE); | ||||
| 	CBITSTREAM; | ||||
| 	PacketUtils::WriteHeader(bitStream, CHAT, MSG_CHAT_GENERAL_CHAT_MESSAGE); | ||||
|  | ||||
| 	bitStream.Write(static_cast<uint64_t>(0)); | ||||
| 	bitStream.Write(chatChannel); | ||||
| @@ -30,12 +30,12 @@ void ChatPackets::SendChatMessage(const SystemAddress& sysAddr, char chatChannel | ||||
| 	} | ||||
| 	bitStream.Write(static_cast<uint16_t>(0)); | ||||
|  | ||||
| 	SEND_PACKET_BROADCAST | ||||
| 	SEND_PACKET_BROADCAST; | ||||
| } | ||||
|  | ||||
| void ChatPackets::SendSystemMessage(const SystemAddress& sysAddr, const std::u16string& message, const bool broadcast) { | ||||
| 	CBITSTREAM | ||||
| 		PacketUtils::WriteHeader(bitStream, CHAT, MSG_CHAT_GENERAL_CHAT_MESSAGE); | ||||
| 	CBITSTREAM; | ||||
| 	PacketUtils::WriteHeader(bitStream, CHAT, MSG_CHAT_GENERAL_CHAT_MESSAGE); | ||||
|  | ||||
| 	bitStream.Write(static_cast<uint64_t>(0)); | ||||
| 	bitStream.Write(static_cast<char>(4)); | ||||
|   | ||||
| @@ -8,8 +8,8 @@ | ||||
| #include <string> | ||||
|  | ||||
| void MasterPackets::SendPersistentIDRequest(dServer* server, uint64_t requestID) { | ||||
| 	CBITSTREAM | ||||
| 		PacketUtils::WriteHeader(bitStream, MASTER, MSG_MASTER_REQUEST_PERSISTENT_ID); | ||||
| 	CBITSTREAM; | ||||
| 	PacketUtils::WriteHeader(bitStream, MASTER, MSG_MASTER_REQUEST_PERSISTENT_ID); | ||||
| 	bitStream.Write(requestID); | ||||
| 	server->SendToMaster(&bitStream); | ||||
| } | ||||
|   | ||||
| @@ -34,7 +34,7 @@ void WorldPackets::SendLoadStaticZone(const SystemAddress& sysAddr, float x, flo | ||||
|  | ||||
| 	bitStream.Write(static_cast<uint32_t>(0));     // Change this to eventually use 4 on activity worlds | ||||
|  | ||||
| 	SEND_PACKET | ||||
| 	SEND_PACKET; | ||||
| } | ||||
|  | ||||
| void WorldPackets::SendCharacterList(const SystemAddress& sysAddr, User* user) { | ||||
| @@ -85,28 +85,28 @@ void WorldPackets::SendCharacterList(const SystemAddress& sysAddr, User* user) { | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	SEND_PACKET | ||||
| 	SEND_PACKET; | ||||
| } | ||||
|  | ||||
| void WorldPackets::SendCharacterCreationResponse(const SystemAddress& sysAddr, eCreationResponse response) { | ||||
| 	RakNet::BitStream bitStream; | ||||
| 	PacketUtils::WriteHeader(bitStream, CLIENT, MSG_CLIENT_CHARACTER_CREATE_RESPONSE); | ||||
| 	bitStream.Write(response); | ||||
| 	SEND_PACKET | ||||
| 	SEND_PACKET; | ||||
| } | ||||
|  | ||||
| void WorldPackets::SendCharacterRenameResponse(const SystemAddress& sysAddr, eRenameResponse response) { | ||||
| 	RakNet::BitStream bitStream; | ||||
| 	PacketUtils::WriteHeader(bitStream, CLIENT, MSG_CLIENT_CHARACTER_RENAME_RESPONSE); | ||||
| 	bitStream.Write(response); | ||||
| 	SEND_PACKET | ||||
| 	SEND_PACKET; | ||||
| } | ||||
|  | ||||
| void WorldPackets::SendCharacterDeleteResponse(const SystemAddress& sysAddr, bool response) { | ||||
| 	RakNet::BitStream bitStream; | ||||
| 	PacketUtils::WriteHeader(bitStream, CLIENT, MSG_CLIENT_DELETE_CHARACTER_RESPONSE); | ||||
| 	bitStream.Write(static_cast<uint8_t>(response)); | ||||
| 	SEND_PACKET | ||||
| 	SEND_PACKET; | ||||
| } | ||||
|  | ||||
| void WorldPackets::SendTransferToWorld(const SystemAddress& sysAddr, const std::string& serverIP, uint32_t serverPort, bool mythranShift) { | ||||
| @@ -117,14 +117,14 @@ void WorldPackets::SendTransferToWorld(const SystemAddress& sysAddr, const std:: | ||||
| 	bitStream.Write(static_cast<uint16_t>(serverPort)); | ||||
| 	bitStream.Write(static_cast<uint8_t>(mythranShift)); | ||||
|  | ||||
| 	SEND_PACKET | ||||
| 	SEND_PACKET; | ||||
| } | ||||
|  | ||||
| void WorldPackets::SendServerState(const SystemAddress& sysAddr) { | ||||
| 	RakNet::BitStream bitStream; | ||||
| 	PacketUtils::WriteHeader(bitStream, CLIENT, MSG_CLIENT_SERVER_STATES); | ||||
| 	bitStream.Write(static_cast<uint8_t>(1)); //If the server is receiving this request, it probably is ready anyway. | ||||
| 	SEND_PACKET | ||||
| 	SEND_PACKET; | ||||
| } | ||||
|  | ||||
| void WorldPackets::SendCreateCharacter(const SystemAddress& sysAddr, Entity* entity, const std::string& xmlData, const std::u16string& username, int32_t gm) { | ||||
| @@ -184,13 +184,13 @@ void WorldPackets::SendCreateCharacter(const SystemAddress& sysAddr, Entity* ent | ||||
| #endif | ||||
|  | ||||
| 	PacketUtils::SavePacket("chardata.bin", (const char*)bitStream.GetData(), static_cast<uint32_t>(bitStream.GetNumberOfBytesUsed())); | ||||
| 	SEND_PACKET | ||||
| 		Game::logger->Log("WorldPackets", "Sent CreateCharacter for ID: %llu", entity->GetObjectID()); | ||||
| 	SEND_PACKET; | ||||
| 	Game::logger->Log("WorldPackets", "Sent CreateCharacter for ID: %llu", entity->GetObjectID()); | ||||
| } | ||||
|  | ||||
| void WorldPackets::SendChatModerationResponse(const SystemAddress& sysAddr, bool requestAccepted, uint32_t requestID, const std::string& receiver, std::vector<std::pair<uint8_t, uint8_t>> unacceptedItems) { | ||||
| 	CBITSTREAM | ||||
| 		PacketUtils::WriteHeader(bitStream, CLIENT, MSG_CLIENT_CHAT_MODERATION_STRING); | ||||
| 	CBITSTREAM; | ||||
| 	PacketUtils::WriteHeader(bitStream, CLIENT, MSG_CLIENT_CHAT_MODERATION_STRING); | ||||
|  | ||||
| 	bitStream.Write<uint8_t>(unacceptedItems.empty()); // Is sentence ok? | ||||
| 	bitStream.Write<uint16_t>(0x16); // Source ID, unknown | ||||
| @@ -209,17 +209,17 @@ void WorldPackets::SendChatModerationResponse(const SystemAddress& sysAddr, bool | ||||
| 		bitStream.Write<uint16_t>(0); | ||||
| 	} | ||||
|  | ||||
| 	SEND_PACKET | ||||
| 	SEND_PACKET; | ||||
| } | ||||
|  | ||||
| void WorldPackets::SendGMLevelChange(const SystemAddress& sysAddr, bool success, uint8_t highestLevel, uint8_t prevLevel, uint8_t newLevel) { | ||||
| 	CBITSTREAM | ||||
| 		PacketUtils::WriteHeader(bitStream, CLIENT, MSG_CLIENT_MAKE_GM_RESPONSE); | ||||
| 	CBITSTREAM; | ||||
| 	PacketUtils::WriteHeader(bitStream, CLIENT, MSG_CLIENT_MAKE_GM_RESPONSE); | ||||
|  | ||||
| 	bitStream.Write<uint8_t>(success); | ||||
| 	bitStream.Write<uint16_t>(highestLevel); | ||||
| 	bitStream.Write<uint16_t>(prevLevel); | ||||
| 	bitStream.Write<uint16_t>(newLevel); | ||||
|  | ||||
| 	SEND_PACKET | ||||
| 	SEND_PACKET; | ||||
| } | ||||
|   | ||||
| @@ -772,9 +772,9 @@ void HandlePacket(Packet* packet) { | ||||
|  | ||||
| 			Game::logger->Log("MasterServer", "Got affirmation request of transfer %llu", requestID); | ||||
|  | ||||
| 			CBITSTREAM | ||||
| 			CBITSTREAM; | ||||
|  | ||||
| 				PacketUtils::WriteHeader(bitStream, MASTER, MSG_MASTER_AFFIRM_TRANSFER_RESPONSE); | ||||
| 			PacketUtils::WriteHeader(bitStream, MASTER, MSG_MASTER_AFFIRM_TRANSFER_RESPONSE); | ||||
| 			bitStream.Write(requestID); | ||||
| 			Game::server->SendToMaster(&bitStream); | ||||
|  | ||||
|   | ||||
| @@ -14,47 +14,47 @@ std::unique_ptr<AMFValue> ReadFromBitStream(RakNet::BitStream* bitStream) { | ||||
| } | ||||
|  | ||||
| int ReadAMFUndefinedFromBitStream() { | ||||
| 	CBITSTREAM | ||||
| 		bitStream.Write<uint8_t>(0x00); | ||||
| 	CBITSTREAM; | ||||
| 	bitStream.Write<uint8_t>(0x00); | ||||
| 	std::unique_ptr<AMFValue> res(ReadFromBitStream(&bitStream)); | ||||
| 	ASSERT_EQ(res->GetValueType(), AMFValueType::AMFUndefined); | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| int ReadAMFNullFromBitStream() { | ||||
| 	CBITSTREAM | ||||
| 		bitStream.Write<uint8_t>(0x01); | ||||
| 	CBITSTREAM; | ||||
| 	bitStream.Write<uint8_t>(0x01); | ||||
| 	std::unique_ptr<AMFValue> res(ReadFromBitStream(&bitStream)); | ||||
| 	ASSERT_EQ(res->GetValueType(), AMFValueType::AMFNull); | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| int ReadAMFFalseFromBitStream() { | ||||
| 	CBITSTREAM | ||||
| 		bitStream.Write<uint8_t>(0x02); | ||||
| 	CBITSTREAM; | ||||
| 	bitStream.Write<uint8_t>(0x02); | ||||
| 	std::unique_ptr<AMFValue> res(ReadFromBitStream(&bitStream)); | ||||
| 	ASSERT_EQ(res->GetValueType(), AMFValueType::AMFFalse); | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| int ReadAMFTrueFromBitStream() { | ||||
| 	CBITSTREAM | ||||
| 		bitStream.Write<uint8_t>(0x03); | ||||
| 	CBITSTREAM; | ||||
| 	bitStream.Write<uint8_t>(0x03); | ||||
| 	std::unique_ptr<AMFValue> res(ReadFromBitStream(&bitStream)); | ||||
| 	ASSERT_EQ(res->GetValueType(), AMFValueType::AMFTrue); | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| int ReadAMFIntegerFromBitStream() { | ||||
| 	CBITSTREAM | ||||
| 	CBITSTREAM; | ||||
| 	{ | ||||
| 		bitStream.Write<uint8_t>(0x04); | ||||
| 	// 127 == 01111111 | ||||
| 	bitStream.Write<uint8_t>(127); | ||||
| 	std::unique_ptr<AMFValue> res(ReadFromBitStream(&bitStream)); | ||||
| 	ASSERT_EQ(res->GetValueType(), AMFValueType::AMFInteger); | ||||
| 	// Check that the max value of a byte can be read correctly | ||||
| 	ASSERT_EQ(static_cast<AMFIntegerValue*>(res.get())->GetIntegerValue(), 127); | ||||
| 		// 127 == 01111111 | ||||
| 		bitStream.Write<uint8_t>(127); | ||||
| 		std::unique_ptr<AMFValue> res(ReadFromBitStream(&bitStream)); | ||||
| 		ASSERT_EQ(res->GetValueType(), AMFValueType::AMFInteger); | ||||
| 		// Check that the max value of a byte can be read correctly | ||||
| 		ASSERT_EQ(static_cast<AMFIntegerValue*>(res.get())->GetIntegerValue(), 127); | ||||
| 	} | ||||
| 	bitStream.Reset(); | ||||
| 	{ | ||||
| @@ -95,8 +95,8 @@ int ReadAMFIntegerFromBitStream() { | ||||
| } | ||||
|  | ||||
| int ReadAMFDoubleFromBitStream() { | ||||
| 	CBITSTREAM | ||||
| 		bitStream.Write<uint8_t>(0x05); | ||||
| 	CBITSTREAM; | ||||
| 	bitStream.Write<uint8_t>(0x05); | ||||
| 	bitStream.Write<double>(25346.4f); | ||||
| 	std::unique_ptr<AMFValue> res(ReadFromBitStream(&bitStream)); | ||||
| 	ASSERT_EQ(res->GetValueType(), AMFValueType::AMFDouble); | ||||
| @@ -105,8 +105,8 @@ int ReadAMFDoubleFromBitStream() { | ||||
| } | ||||
|  | ||||
| int ReadAMFStringFromBitStream() { | ||||
| 	CBITSTREAM | ||||
| 		bitStream.Write<uint8_t>(0x06); | ||||
| 	CBITSTREAM; | ||||
| 	bitStream.Write<uint8_t>(0x06); | ||||
| 	bitStream.Write<uint8_t>(0x0F); | ||||
| 	std::string toWrite = "stateID"; | ||||
| 	for (auto e : toWrite) bitStream.Write<char>(e); | ||||
| @@ -117,9 +117,9 @@ int ReadAMFStringFromBitStream() { | ||||
| } | ||||
|  | ||||
| int ReadAMFArrayFromBitStream() { | ||||
| 	CBITSTREAM | ||||
| 		// Test empty AMFArray | ||||
| 		bitStream.Write<uint8_t>(0x09); | ||||
| 	CBITSTREAM; | ||||
| 	// Test empty AMFArray | ||||
| 	bitStream.Write<uint8_t>(0x09); | ||||
| 	bitStream.Write<uint8_t>(0x01); | ||||
| 	bitStream.Write<uint8_t>(0x01); | ||||
| 	{ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Aaron Kimbrell
					Aaron Kimbrell