space928 / Omsi-Extensions

Omsi hooking and modding sdk
GNU Lesser General Public License v3.0
17 stars 3 forks source link

Fixed player vehicle reading in BasicCLI example #101

Closed Katecpo closed 2 months ago

Katecpo commented 6 months ago

Description

Currently, if the player change his current vehicle, the variable "playerVehicle" will not get the latest reading from memory, resulting in getting forever the first bus informations the player drive

Katecpo commented 2 months ago

Worth considering the impact of fetching the vehicle each iteration, though for a basic CLI example its probably ok.

Think about caching for a bigger project

Thank you for the review :) Yes you're right it's not ideal, I've updated my code to bind the "VehicleChangedEvent" so the variable is not fetched on every iteration ;)