Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increased net flares to 10 #2690

Closed
wants to merge 7 commits into from
Closed

Conversation

tritonas00
Copy link
Collaborator

@tritonas00 tritonas00 commented Feb 17, 2021

and bumped protocol version to 2.43

goes by hand with RigsOfRods/ror-server#109

closes #2664

not tested yet

@ohlidalp
Copy link
Member

ohlidalp commented Feb 17, 2021

TODO:

  • in "SimConstants.h", add MAX_CLIGHTS=10 with comment //!< See RoRnet::Netmask and enum events in InputEngine.h
  • enlarge Actor::m_net_custom_lights to MAX_CLIGHTS and make it int;
  • in ActorSpawner::InitializeRig(), put for (int i=0; i<MAX_CLIGHTS; ++i) { m_net_custom_lights = -1; }, remove existing code.
  • in Actor::[get/set]CustomLightVisible(), fix up the range check and simplify the code to m_net_custom_lights[number] != -1 and reading/setting ar_flares[m_net_custom_lights[number]].controltoggle_status

What the :: means in C++: https://stackoverflow.com/a/3480366

@tritonas00
Copy link
Collaborator Author

Done (multiple facepalms incoming... 😆)

ohlidalp
ohlidalp previously approved these changes Feb 18, 2021
Copy link
Member

@ohlidalp ohlidalp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work

source/main/physics/Actor.cpp Outdated Show resolved Hide resolved
source/main/physics/Actor.cpp Outdated Show resolved Hide resolved
@tritonas00
Copy link
Collaborator Author

tritonas00 commented Feb 18, 2021

@only-a-ptr

https://github.com/RigsOfRods/rigs-of-rods/pull/2690/files#diff-2b5d30a8bd6eb8a53fefb2a3c3bf32ec559db32ba884c654805afdede400dc5bR4544

maybe it should be if (m_net_custom_lights[number] < ar_flares.size() && ...) ?

@ohlidalp ohlidalp self-requested a review February 19, 2021 12:49
@ohlidalp
Copy link
Member

ohlidalp commented Feb 19, 2021

New requirement based on #2664 (comment)

  • delete int m_net_custom_lights_count, make it bool m_net_custom_light_active[MAX_CLIGHTS]
  • in spawner, assign 'false' instead of -1 in the init loop. Delete all other code.
  • in Actor::UpdateFlareStates(float dt), under the ar_flares[i].controltoggle_status = ! ar_flares[i].controltoggle_status; line, add this:
m_net_custom_light_state[ar_flares[i].controlnumber - 1] = ar_flares[i].controltoggle_status;
  • change the [get/set]CustomLightVisible to just read/write m_net_custom_light_active[number]

That should do the trick. If the code is confusing, I'll explain.

@tritonas00
Copy link
Collaborator Author

tritonas00 commented Feb 20, 2021

Done (i think 😄)

And probably wrong. We send 6 lights
kkk

but we get 1
kk

@ohlidalp
Copy link
Member

ohlidalp commented Apr 6, 2021

Replaced by #2729

@ohlidalp ohlidalp closed this Apr 6, 2021
@tritonas00 tritonas00 deleted the net-flares branch April 8, 2021 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to see user controlled flares in multiplayer
2 participants