I have done a first approach to the next idea:
Each user could have in its .raydium folder an indication of its nearest airport/weather station. For example LEMG for me(in Malaga), LFRS for Nantes...
All the applications could then make a call like:
Code:
raydium_weather_update("LEMG");
This code read over internet the last weather report for that airport/station.
Then all that data can easily accessed through a few raydium variables like:
Code:
int raydium_weather_temp;
int raydium_weather_dewpoint;
char raydium_weather_station[10];
int raydium_weather_wind_direction; // -1 means variable wind
int raydium_weather_wind_strength;
int raydium_weather_wind_gusts; // if equal wind strength, then no gusts at all
char raydium_weather_wind_unit[5];
int raydium_weather_visibility; // 0, i think, means no read. Minimum should be 1
char raydium_weather_visibility_unit[5]; //if no unit, the no read of visibility
int raydium_weather_pressure; //Atmospheric pressure
char raydium_weather_pressure_unit[5];
int raydium_weather_pressure_decimal; //Atmospheric pressure, decimal positions
char raydium_weather_observations[1024]; //string with all the observations. NOT WORKING!!!
In this way each game could adapt its weather( weather for raydium is in the TODO) to the real weather in the area of the player.
With that idea, the METAR code from Kees Leune, the curl library and a few headaches, i have done the next horrible example(sorry for the huge post):
EDIT: the post was insanely huge, so i have uploaded the code to pastebin. You can get it from here: http://pastebin.com/f18dbef74If you launch it directly, it will load the weather of Madrid/Spain. You can add the airport/station ICAO code as a new parameter, like this:
Code:
./odyncomp.sh metar.c LFRS
A few ICAO stations are not working properly. If this happen, the app will crash in a ugly way... I have to fix this in a future version.
Still there are a few things to load properly, like list of observations(rain, volcanic ashes...) and lists of clouds. Surely these two things are the more interesting ones for a videogame... you will have to wait a bit.
Comments?