View Single Post
Re: code to get the illumination at any point on the map
Old
  (#48)
Immortal_BLG
Member
 
Status: Offline
Posts: 171
Join Date: Nov 2007
Location: Russian Federation
Default Re: code to get the illumination at any point on the map - 24-03-2012

Quote:
Originally Posted by KWo
Do You mean this function can be written so:
Code:
inline const bool IsSoftwareDrawingMode (void)
{
    #ifdef _LINUX
        return true;    // Always software rendering mode....
    #else    // ifdef _LINUX
        static const bool KWoMode = (IS_DEDICATED_SERVER () || GetModuleHandle ("sw.dll") != NULL);

        return KWoMode;
    #endif    // ifndef _LINUX
}
and it will work the same?
YES.
Quote:
Originally Posted by KWo
So what was the reason it was named the same inside as the global inline const? Just to confuse a noob in C++ programming?
because in fact the variable "isSoftwareDrawingMode" also itself a function "IsSoftwareDrawingMode", but the only reason why I have not written just code:
Code:
inline const bool IsSoftwareDrawingMode (void)
{
    #ifdef _LINUX
        return true;    // Always software rendering mode....
    #else    // ifdef _LINUX
        return IS_DEDICATED_SERVER () || GetModuleHandle ("sw.dll") != NULL;
    #endif    // ifndef _LINUX
}
, because as I wrote before that check must be executed only once for the economy of the CPU speed.....
  
Reply With Quote