Archived

This topic is now archived and is closed to further replies.

n4gix

TrafficRadar / TCAS for XML version 2.0. Beta testers?

Recommended Posts

Hi all of you, reworked my traffic radar for XML to accomodate a lot of suggestions and requests. If no one has any additions I'll upload it it on Monday.In the complete package all files will be together, I had to split it up.

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

I fixed a number of compiler warnings in an earlier version related to using deprecated string functions. So the original one I have now compiles without warnings.If I get a chance to do the same to this version on VS (if it needs it), I'll send it to you if you want.I am still amazed that you figured all this out, and there was not really an Arne there for you to ask questions!

Share this post


Link to post
Share on other sites

Ah, yes I forgot. My primay compiler is still VC++ 6.0, but with Visual C++ 2005 you'll get a lot of warnings, since the string handling syntax changed. I didn't think about making source code that is compatible to both compiler versions at the same time. BTW how can you eliminate the warning to "strcpy" in ConvertPropertyToString()? OK the whole method is not really necessary, but that's not the point.

Share this post


Link to post
Share on other sites

I'll look into that as I reach it. I guess I'll chronical here what I do on VS 2005 to get this to compile without warnings.So for the first installment:Well after creating an empty project and adding existing source and header files to it the first problem run into in an attempted build is:Compiling...TrafficRadarXML.cppc:documents and settingspatrickmy documentsvisual studio 2005projectsgauge projectstrafficradarxml2GdiPlusRadar.h(26) : warning C4005: 'UNICODE' : macro redefinition command-line arguments : see previous definition of 'UNICODE'GdiPlusRadar.cppc:documents and settingspatrickmy documentsvisual studio 2005projectsgauge projectstrafficradarxml2GdiPlusRadar.h(26) : warning C4005: 'UNICODE' : macro redefinition command-line arguments : see previous definition of 'UNICODE'Within GdiPlusRadar.h I do this:#pragma once#include #include // Definition of ULONG_PTR unsigned int#include using namespace Gdiplus;#include "..incfs9gauges.h" // Available for all projects#include "TrafficData.h"(vs.)/*#include "fs9gauges.h"#include "TrafficData.h"#ifndef SAFE_DELETE #define SAFE_DELETE(classp) if((classp)) delete (classp); (classp) =NULL#endif//SAFE_DELETE#ifndef ULONG_PTR #define ULONG_PTR unsigned int#endif#define UNICODE//Check also://http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdicpp/GDIPlus/GDIPlusreference.asp#include using namespace Gdiplus;*/as it is cleaner, an elimninates redefinition problem.------Use:#pragma once(vs.)#ifndef GDIPLUSRADAR_H#define GDIPLUSRADAR_H// Code here#enddef // GDIPLUSRADAR_H

Share this post


Link to post
Share on other sites

//------------------------------------------------------------------// Compiler warning://------------------------------------------------------------------GdiPlusRadar.cpp.GdiPlusRadar.cpp(30) : warning C4996: 'sprintf' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestdio.h(345) : see declaration of 'sprintf' Message: 'This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'//------------------------------------------------------------------// Solution//------------------------------------------------------------------/* Existing code - line 30sprintf(m_tooltip,"ID: %s ALT: %dft GS: %.0fkt TRK: %.0f

Share this post


Link to post
Share on other sites

//------------------------------------------------------------------// Compiler warning://------------------------------------------------------------------.GdiPlusRadar.cpp(77) : warning C4996: 'swprintf' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludeswprintf.inl(85) : see declaration of 'swprintf' Message: 'swprintf has been changed to conform with the ISO C standard, adding an extra character count parameter. To use traditional Microsoft swprintf, set _CRT_NON_CONFORMING_SWPRINTFS.'.GdiPlusRadar.cpp(78) : warning C4996: 'swprintf' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludeswprintf.inl(85) : see declaration of 'swprintf' Message: 'swprintf has been changed to conform with the ISO C standard, adding an extra character count parameter. To use traditional Microsoft swprintf, set _CRT_NON_CONFORMING_SWPRINTFS.'//------------------------------------------------------------------// Solution://------------------------------------------------------------------ swprintf(altstring,L"%+03d",ROUND(pai_data->dlt_alt/100)); swprintf(idstring,L"%S",pai_data->atc_id);change to: swprintf_s(altstring, sizeof(altstring),L"%+03d",ROUND(pai_data->dlt_alt/100)); swprintf_s(idstring, sizeof(idstring),L"%S",pai_data->atc_id);Patrick

Share this post


Link to post
Share on other sites

In similar fashion I updated all the other functions and finally this one in the constructor:.GdiPlusRadar.cpp(369) : warning C4996: 'wcscpy' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(250) : see declaration of 'wcscpy' Message: 'This function or variable may be unsafe. Consider using wcscpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.' wcscpy(m_symbolfont,FONT_TYPE);to: wcscpy_s(m_symbolfont, sizeof(m_symbolfont), FONT_TYPE);//---------------------------------------------------------Finally, for this file, we get a whole lot of warnings:.GdiPlusRadar.cpp(425) : warning C4267: 'argument' : conversion from 'size_t' to 'INT', possible loss of data.GdiPlusRadar.cpp(428) : warning C4267: 'argument' : conversion from 'size_t' to 'INT', possible loss of data.GdiPlusRadar.cpp(459) : warning C4267: 'argument' : conversion from 'size_t' to 'INT', possible loss of data.GdiPlusRadar.cpp(462) : warning C4267: 'argument' : conversion from 'size_t' to 'INT', possible loss of data.GdiPlusRadar.cpp(491) : warning C4267: 'argument' : conversion from 'size_t' to 'INT', possible loss of data.GdiPlusRadar.cpp(493) : warning C4267: 'argument' : conversion from 'size_t' to 'INT', possible loss of data.GdiPlusRadar.cpp(502) : warning C4267: 'argument' : conversion from 'size_t' to 'INT', possible loss of data.GdiPlusRadar.cpp(504) : warning C4267: 'argument' : conversion from 'size_t' to 'INT', possible loss of data.GdiPlusRadar.cpp(568) : warning C4267: 'argument' : conversion from 'size_t' to 'INT', possible loss of data.GdiPlusRadar.cpp(570) : warning C4267: 'argument' : conversion from 'size_t' to 'INT', possible loss of data.GdiPlusRadar.cpp(611) : warning C4267: 'argument' : conversion from 'size_t' to 'INT', possible loss of data.GdiPlusRadar.cpp(613) : warning C4267: 'argument' : conversion from 'size_t' to 'INT', possible loss of dataAs there appears to be no alternative, I just cast with (int), although probably should use the newer form, this is shorter. m_graphics->MeasureString(altstring, (int)wcslen(altstring), &font,PointF(x+m_symbol_factor*ABVSTR_OFFSET_X,y+m_symbol_factor*ABVSTR_OFFSET_Y),&stringFormat, &boundRect); Now this file compiles without error or warning.Hope this is helpful or interesting.Patrick

Share this post


Link to post
Share on other sites

In case you want the completed file, I've attached it.Patrick

Share this post


Link to post
Share on other sites

In TrafficData.cppTrafficData.cpp.TrafficData.cpp(55) : warning C4996: 'strncpy' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(156) : see declaration of 'strncpy' Message: 'This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.Change:strncpy(pai_data->atc_id, m_ptraffic_info->GetPlayerName(ai_id), MAX_CHARS_ATC_ID);to:strncpy_s(pai_data->atc_id, MAX_CHARS_ATC_ID, m_ptraffic_info->GetPlayerName(ai_id), MAX_CHARS_ATC_ID);and this file compiles without warnings.Patrick

Share this post


Link to post
Share on other sites

And in XMLCCallbacks.cpp we have the following warnings which can be fixed in similar fashion to ones I have already posted:XMLCCallbacks.cpp.XMLCCallbacks.cpp(361) : warning C4996: 'strncpy' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(156) : see declaration of 'strncpy' Message: 'This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'.XMLCCallbacks.cpp(443) : warning C4996: 'stricmp' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp' Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'.XMLCCallbacks.cpp(632) : warning C4996: 'sprintf' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestdio.h(345) : see declaration of 'sprintf' Message: 'This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'.XMLCCallbacks.cpp(672) : warning C4996: 'stricmp' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp' Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'.XMLCCallbacks.cpp(719) : warning C4996: 'stricmp' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp' Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'.XMLCCallbacks.cpp(746) : warning C4996: 'stricmp' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp' Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'.XMLCCallbacks.cpp(752) : warning C4996: 'stricmp' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp' Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'.XMLCCallbacks.cpp(759) : warning C4996: 'stricmp' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp' Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'.XMLCCallbacks.cpp(766) : warning C4996: 'stricmp' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp' Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'.XMLCCallbacks.cpp(773) : warning C4996: 'stricmp' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp' Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'.XMLCCallbacks.cpp(778) : warning C4996: 'stricmp' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp' Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'.XMLCCallbacks.cpp(783) : warning C4996: 'stricmp' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp' Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'.XMLCCallbacks.cpp(788) : warning C4996: 'stricmp' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp' Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'.XMLCCallbacks.cpp(793) : warning C4996: 'stricmp' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp' Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'.XMLCCallbacks.cpp(798) : warning C4996: 'stricmp' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp' Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'.XMLCCallbacks.cpp(803) : warning C4996: 'stricmp' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp' Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'.XMLCCallbacks.cpp(808) : warning C4996: 'stricmp' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp' Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'.XMLCCallbacks.cpp(813) : warning C4996: 'stricmp' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp' Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'.XMLCCallbacks.cpp(818) : warning C4996: 'stricmp' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp' Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'.XMLCCallbacks.cpp(835) : warning C4996: 'strcpy' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(73) : see declaration of 'strcpy' Message: 'This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'.XMLCCallbacks.cpp(838) : warning C4996: 'strcpy' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(73) : see declaration of 'strcpy' Message: 'This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'.XMLCCallbacks.cpp(841) : warning C4996: 'strcpy' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(73) : see declaration of 'strcpy' Message: 'This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'.XMLCCallbacks.cpp(844) : warning C4996: 'strcpy' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(73) : see declaration of 'strcpy' Message: 'This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'.XMLCCallbacks.cpp(847) : warning C4996: 'strcpy' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(73) : see declaration of 'strcpy' Message: 'This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'.XMLCCallbacks.cpp(850) : warning C4996: 'strcpy' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(73) : see declaration of 'strcpy' Message: 'This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'.XMLCCallbacks.cpp(853) : warning C4996: 'strcpy' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(73) : see declaration of 'strcpy' Message: 'This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'.XMLCCallbacks.cpp(856) : warning C4996: 'strcpy' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(73) : see declaration of 'strcpy' Message: 'This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'.XMLCCallbacks.cpp(859) : warning C4996: 'strcpy' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(73) : see declaration of 'strcpy' Message: 'This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'.XMLCCallbacks.cpp(862) : warning C4996: 'strcpy' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(73) : see declaration of 'strcpy' Message: 'This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'.XMLCCallbacks.cpp(865) : warning C4996: 'strcpy' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(73) : see declaration of 'strcpy' Message: 'This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'.XMLCCallbacks.cpp(868) : warning C4996: 'strcpy' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(73) : see declaration of 'strcpy' Message: 'This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'.XMLCCallbacks.cpp(871) : warning C4996: 'strcpy' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(73) : see declaration of 'strcpy' Message: 'This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'.XMLCCallbacks.cpp(874) : warning C4996: 'strcpy' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(73) : see declaration of 'strcpy' Message: 'This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'Patrick

Share this post


Link to post
Share on other sites

Put it in the 737 & CRJs HSI works great and thanks to you. Only the weather radar left to do now!! LOL. Paul

Share this post


Link to post
Share on other sites

Thanks for this marvellous module, it opens up endless possibilities for me in the J35J project. I added a parameter to change between boresight and top-down radar, it works perfectly. Just one thing I cannot figure out: how to get the graphic elements permanently bright. Is this not possible with the combination XML and GDI+? Or am I missing something here?/Thomas

Share this post


Link to post
Share on other sites

OMG I forgot that one. Too much coffee I suppose. Or not enough. ;o) Thanks!

Share this post


Link to post
Share on other sites

I noticed that it is not easy to make version of the TrafficRadarXML.dll that compiles with ALL versions of Visual Studio, I designed it for 6.0. So the question is: if everybody uses the 2005 edition, I switch to it, so only one version is needed. We have to stick with Visual Studio anyway, BCC doesn't allow a certain call which is needed for the ITrafficInfo interface (static_cast to abstract class), and GCC doesn't like the abstract class definition in fs9gauges.h at all, if I recall that right. So the question is VC 2005 or 6.0? I can do both, but I want to support only one version.

Share this post


Link to post
Share on other sites

HiI think VC2005 as it is freely available from Microsoft and also its a newer version than VC6.BrgdsEugen

Share this post


Link to post
Share on other sites

Arne, no matter which way you go, someone's going to wind up with some conversion problems... ;)While I've never had any (huge) problems converting a v6.0 project in .NET 2003, I've had quite a few problems with "downgrading" a .NET 2005 set of source files to a .NET 2003 project. ;)

Share this post


Link to post
Share on other sites

>I noticed that it is not easy to make version of the>TrafficRadarXML.dll that compiles with ALL versions of Visual>Studio, I designed it for 6.0. So the question is: if>everybody uses the 2005 edition, I switch to it, so only one>version is needed. We have to stick with Visual Studio anyway,>BCC doesn't allow a certain call which is needed for the>ITrafficInfo interface (static_cast to abstract class), and>GCC doesn't like the abstract class definition in fs9gauges.h>at all, if I recall that right. So the question is VC 2005 or>6.0? I can do both, but I want to support only one version.If VC 6.0 can't use the new secure library functions, then I wouldn't compile code in it just for security reasons. Unless you want to develop something with an older SDK for an outdated OS like Win2000 or something, I'd switch.If you like, I'd be happy to finish the conversion and send it to you.Patrick

Share this post


Link to post
Share on other sites

>No need. I made the conversion to VC 2005. Even backward>compability should be possible with some strategically placed>defines (e.g. #define sprintf_s sprintf). Funnily enough, the>only point where I can't use the almost 1-1 replacement is at>the interface to an "outdated" SDK: FS9 Panel SDK, strcpy_s>uses one parameter more then strcpy and at taht point I have>to cheat anyway. >I'm putting the finishing touches on the package and will>upload the seond version of my TrafficRadarXML.dll soon.Hahah. I hear you. I really don't consider it a SDK though, just a header (.h) file. I'm talking about the Platform SDK, or DirectX SDK, etc.Anyway, excellent work demonstrating your excellent programming skills.Patrick

Share this post


Link to post
Share on other sites

Hi,With the TrafficRadarXML.dll in the modules folder the sim won't start.Do I have to add something in the fs9.cfg?Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

Strange, there is no need to add anything to fs9.cfg. The module registers itself. Can you confirm it is TrafficRadarXML.dll or something related? Removing the DLL from the moduls dir and restarting FS. The gauges should show up, but lack functionality.What System do you use? Only XP and maybe 2003 have the gdiplus.dll included. E.g. with 2000 and 98 place a copy in the FS folder, look in my new upload for a download source, or "borrow" from a XP System. It might be possible that the default font might not work. Try a 'Font="Arial"' or similar entry for the s, at least a font that is guranteed on your system.

Share this post


Link to post
Share on other sites

Arne,It is the TrafficRadarXML.dll.(After removing status quo ante)I have Windows XP.I did put the gdiplus.dll in the fs root dir and after that startup was totally impossible.Without I at least had a startup screen.I changed the font and that is visible in the gauge.So still quite strange.Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

I downloaded the TrafficRadar XML Version 2.0 and installed it per the instructions. When I launch FS9 with WIN XP I get an error "Unable to load some aircraft - TrafficRadarXML.dll". I did a check on the dll and it said I was missing msvcr80d.dll which was required to use the dll. How can I fix this? Regards, Bob.

Share this post


Link to post
Share on other sites

Might be a problem, becasue I compiled it with VC++ 2005. I recompiled it with VC++6.0 and I didn't have the problem on an old Win98 installation (XP is fine with both compiled versions for me, but I have the compilers installed on it). Let me know if this fixes it.

Share this post


Link to post
Share on other sites