Clean up the mess around entity types between client and server - #5276
Open
FileEX wants to merge 3 commits into
Open
Clean up the mess around entity types between client and server#5276FileEX wants to merge 3 commits into
FileEX wants to merge 3 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, the MTA codebase has separate enums for entity and element types. On the client side,
eClientEntityTypeis used for MTA element types, while on the server side, the types are defined directly in theCElementclass. Additionally, the client has aneEntityTypeenum representing GTA entity types at the game-engine level.To work around this,
CClientGamealso defines a separate enum containing the element types. This enum is used as theentityTypeIdinCEntityAddPacketto map entity types from the server to the client. This results in a lot of unnecessary complexity and spaghetti code.This PR introduces a single shared enum for both sides in the
ElementTypenamespace, withEntityTypeused to distinguish GTA entity types from MTA element types.This PR is not backwards compatible, so the
NETCODEversion is bumped. Otherwise,entityTypeIdvalues sent by the server would no longer match the correspondingElementTypevalues on the client.The PR was tested by creating vehicles and peds and verifying that they are correctly created on the client.