Jamie Fox Posted September 21, 2003 Report Posted September 21, 2003 Thanks for the in-depth documentation on the structure and usage of FSUIPC's NWI. A few questions though: The documentation for Area 2 (Weather Setting Area) states that "when setting weather you set it ALL. In other words, you supply every aspect of the weather." Does this apply when using the commands for which (presumably) weather data is not really relevant: NW_CLEAR, NW_DYNAMICS, NW_ACTIVATE Can these commands simply be used by writing to 2 bytes at offset 0xC800 or do they need to be sent alongside an entire weather structure? With the other 4 commands (NW_SET, NW_SETEXACT, NW_SET_PENDING, and NEW_SETEXACT_PENDING) it makes sense to write the whole weather structure though. By the way, I can only count seven commands rather than eight as documented? Secondly, what is to be done when not wanting to use a particular part of a structure? For example, the NewWeather.NewWind.SpeedFract parameter I might not want to use (obviously the instance of the struct would have a different name); will it be ignored if I set it to 0? Leaving any part of the struct uninitialised would presumably be very unpredictable! What are unused parts to be set to?
Pete Dowson Posted September 21, 2003 Report Posted September 21, 2003 The documentation for Area 2 (Weather Setting Area) states that "when setting weather you set it ALL. In other words, you supply every aspect of the weather." Does this apply when using the commands for which (presumably) weather data is not really relevant: NW_CLEAR, NW_DYNAMICS, NW_ACTIVATE Can these commands simply be used by writing to 2 bytes at offset 0xC800 or do they need to be sent alongside an entire weather structure? Just send the needed bytes -- the uCommand filed of 2 bytes for CLEAR and ACTIVATE, but enough to include the uDynamics filed for DYNAMICS. Sorry if that is confusing -- the question hadn't arisen before publication! By the way, I can only count seven commands rather than eight as documented? Ah! You win the prize! :lol: I'll change it now I know. Secondly, what is to be done when not wanting to use a particular part of a structure? For example, the NewWeather.NewWind.SpeedFract parameter I might not want to use (obviously the instance of the struct would have a different name); will it be ignored if I set it to 0? Leaving any part of the struct uninitialised would presumably be very unpredictable! What are unused parts to be set to? Declare your structure and zero it initially (if your compiler doesn't guarantee zero initialisation). Fields which are part of structures won't be "ignored" if they are zero -- zero is taken to mean zero. A zero fraction is .0. Regards, Pete
Jamie Fox Posted September 21, 2003 Author Report Posted September 21, 2003 but enough to include the uDynamics filed for DYNAMICS Could this be done by writing to (0xC800, 2) and (0xC80C, 2) (in a single _Process()) rather than filling the bits inbetween on the struct? If I wanted to not change the whole weather, but just one part (eg temperature) I couldn't do this by just writing 0s to everything else, and sending just the temperature, because this would clear everything else? To change just temperature, I'd have to read the entire structure, change the temperature, then write it all back. Correct? If this is indeed the case then it does make perfect sense, I don't know what I was thinking of before! Just to verify I've got this all write: CLEAR and ACTIVATE can be used by writing 2 bytes to 0xC800, and nothing else. DYNAMICS can be used by writing 2 bytes to 0xC800 and 2 bytes for the dynamics to 0xC80c. SET(_PENDING) and SETEXACT(_PENDING) need the full set of details so should be written as 1024 bytes to 0xC800, using the supplied NewWeather struct. I think it all makes sense now!
Jamie Fox Posted September 21, 2003 Author Report Posted September 21, 2003 a) Set dynamics to zero, then clear all weather. This can be done in one FSUIPC_Process. Leave a little delay afterwards. Surely this requires at least two calls to FSUIPC_Process: one for NW_DYNAMICS, and one for NW_CLEAR. Or does NW_CLEAR look at dynamics too?
Pete Dowson Posted September 21, 2003 Report Posted September 21, 2003 [quote name="Jamie Fox Could this be done by writing to (0xC800' date=' 2) and (0xC80C, 2) (in a single _Process()) rather than filling the bits inbetween on the struct?[/quote] Yes, but the other way around -- FSUIPC will need the dynamics value as soon as it seens the command. Same consideration applies to all these things in FSUIPC. Use the the one Process call, so it all gets written at once, but make the activating wrte the last, as that's when it happens. If I wanted to not change the whole weather, but just one part (eg temperature) I couldn't do this by just writing 0s to everything else, and sending just the temperature, because this would clear everything else? Correct. There are no facilities in FS2004 at all for me to set or change just one aspect of the weather. It all gets written together. If you only want to change one thing you'd need to read everything first copy use the same data, with your changes, when writing. To change just temperature, I'd have to read the entire structure, change the temperature, then write it all back. Correct? Exactly. I think it all makes sense now! Good. Pete
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now