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.
Description:
Addresses JSON 302 bug.
Observed behavior:
The client is using a "file exists" check to determine if a map was base game or usermap, assuming all base game and DLC files should always be present. This check resulted in unintended behavior when connecting to a server where-- if the client was missing a map-- the client would expect the usermap_hash when parsing the jsonInfo object from the server's CURL string. This missing json object key would result in a hanging connection state which required a full client restart. Users would simply received a JSON 302 error and have to restart the client if this happened.
Typically affected users were those who did not own the MWR DLC.
Expected behavior:
Joining a server which is hosting a map you do not own should result in a client error notification explaining they don't have the map, and then the client should return to the main MP lobby or the main menu screen.
Changes:
map_exists()
function which returns the map type for a file as an enum or the enum valueMISSING
if the file doesn't actually exist in the filesystem.is_dlc_map()
check which parses map strings for the 4 dlc map base namesset_new_map()
andconnect_to_server_tcp()
functions which handle disconnecting and notifying the player of missing files instead of crashing the game or putting the client in a bugged state.TODO:
In the future I would like to further improve the map file checks to include a LUT of all base game filenames so we can separate the exists() and is_stock_map() functions properly. The client should NOT be using exists to determine the difference between stock maps and usermaps.