When I tested this a few months ago, EnterRealtime was not called when taking over via a driver swap.EDIT: Actually, I checked plugin code, and there might be a bug here. I am using member variable mInRealtime in plugin, and set it with rF2 calls ExitRealtime/EnterRealtime. However, ScoringInfoV01 also has mInRealtime, so I need to investigate what is correct value to use here. Thanks for bringing that to my attention.
for (long i = 0; i < info.mNumVehicles; ++i) {
243 VehicleScoringInfoV01 &vinfo = info.mVehicle[i];
244
245 /* If a swap happened, we are not the (original session) player, but we are now in control */
246 /* This is just my current theory atm, not sure it's true */
247 bool is_local_player = vinfo.mControl == 0;
248 if (! (vinfo.mIsPlayer || is_local_player))
249 continue;
250
here are lines from cosimo's code https://github.com/cosimo/rFactor2-DeltaBest/blob/master/Source/DeltaBest.cpp:
Code:for (long i = 0; i < info.mNumVehicles; ++i) { 243 VehicleScoringInfoV01 &vinfo = info.mVehicle[i]; 244 245 /* If a swap happened, we are not the (original session) player, but we are now in control */ 246 /* This is just my current theory atm, not sure it's true */ 247 bool is_local_player = vinfo.mControl == 0; 248 if (! (vinfo.mIsPlayer || is_local_player)) 249 continue; 250
Honestly, I am not clear what is meant by "plugin doesn't survive driver swap"? Does that mean after swap we can't tell which vehicle is player? I would guess there might be combination of flags/values that can be used to guess needed information. My Monitor program only visualizes what I needed so far, but feel free to extend it to show more information, because right now it doesn't show a lot of things available.
When I tested this a few months ago, EnterRealtime was not called when taking over via a driver swap.
here are lines from cosimo's code
Code:247 bool is_local_player = vinfo.mControl == 0;
EDIT2: I think I finally got what you're saying. See implementation of myplugin, it might help![]()
I check if were in real time every update in my plugin and it shouldn't work if it didn't return true so this makes me confused.