fivem icon indicating copy to clipboard operation
fivem copied to clipboard

Refine net time sync code for OneSync

Open Disquse opened this issue 1 year ago • 2 comments

Goal of this PR

The goal of this PR is to improve the readability of rage::netTimeSync related code. Additionally, it aims to improve the maintainability of CloneExperiments.cpp by logically splitting certain parts of the file into appropriate chunks. The code refine isn't intended to be a full fledged refactor but rather a first step towards facilitating future refactoring efforts.

I invite everyone to participate in reviewing and suggesting improvements. Please remember that on the current stage I'm not planning to make it more complex than it is right now (i.e. adding abstraction layers, reworking the inner or depended code, etc).

How is this PR achieving the goal

By moving the related code from CloneExperiments.cpp to separate .cpp and .h files, and making some minor tweaks.

This PR applies to the following area(s)

FiveM, RedM

Successfully tested on

Game builds: FiveM: 1604, 2060, 2189, 2372. 2545, 2612, 2699, 2802, 2944, 3095 RedM: 1311, 1355, 1436, 1491

Platforms: Windows

Checklist

  • [x] Code compiles and has been tested successfully.
  • [x] Code explains itself well and/or is documented.
  • [x] My commit message explains what the changes do and what they are for.
  • [x] No extra compilation warnings are added by these changes.

Fixes issues

-

Disquse avatar Feb 09 '24 10:02 Disquse

Besides a few small nitpicks to make myself feel better, I won't look too hard on this as its mostly moving code around.

Does our style guideline include rules on names/ordering/grouping of includes? How netTimeSync is currently structured is a bit unappealing to the eye.

gottfriedleibniz avatar Feb 15 '24 02:02 gottfriedleibniz

One benefit here is that as we start refining/decoupling things - we'll figure out a nice convention that allows us to structure functionality a bit better (e.g., gamecode structure vs. hooking vs. onesync protocols, etc).

gottfriedleibniz avatar Feb 15 '24 03:02 gottfriedleibniz