mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-11 08:23:45 +00:00
fix(multiplayer): validate ticket playlists
This commit is contained in:
@@ -51,6 +51,8 @@ func begin_queue(new_ticket_id: String, new_playlist: String) -> bool:
|
||||
func apply_ticket_update(update: Dictionary) -> bool:
|
||||
if not _has_string(update, "ticket_id") or not update.has("revision") or not _valid_revision(update["revision"]) or not update.has("state"):
|
||||
return _request_resync(self.ticket_id)
|
||||
if update.has("playlist") and not _valid_playlist(String(update["playlist"])):
|
||||
return _request_resync(self.ticket_id)
|
||||
if ticket_id.is_empty() or String(update["ticket_id"]) != ticket_id:
|
||||
return _request_resync(self.ticket_id)
|
||||
var incoming_revision := int(update["revision"])
|
||||
@@ -299,3 +301,7 @@ func _valid_revision(value: Variant) -> bool:
|
||||
if value is float:
|
||||
return is_finite(float(value)) and float(value) >= 0.0 and float(value) == floor(float(value))
|
||||
return false
|
||||
|
||||
|
||||
func _valid_playlist(value: String) -> bool:
|
||||
return value == "casual" or value == "ranked"
|
||||
|
||||
Reference in New Issue
Block a user