This is a bug, the line should read:
                if ( Q_memcmp( &fog,
CFogController::s_pFogController->m_fog, sizeof(fog) ))

Jay


> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> [EMAIL PROTECTED]
> Sent: Monday, September 04, 2006 11:48 AM
> To: [email protected]
> Subject: [hlcoders] invalid fogcontroller memcmp?
>
> It's not clear to me what this code is trying to accomplish,
> but memcmping a struct is of course always dangerous and
> never a good idea.  In this case, it's actually memcmping an
> inhereted class which is even worse, as the vtable pointer
> gets involved, causing the memcmp to seemingly never succeed.
>
> It's not clear though whether this memcmp might be masking
> some other buggy codepath, so I haven't added a KI yet.
>
> Anyone understand the CFogController?  Do certain maps make
> use of this?
>
> Patch to use correct comparisons:
>
>
> --- src/dlls/fogcontroller.cpp  26 Aug 2006 21:24:29 -0000      1.2
> +++ src/dlls/fogcontroller.cpp  4 Sep 2006 18:43:46 -0000
> @@ -381,8 +381,22 @@
>  {
>         if ( CFogController::s_pFogController )
>         {
> -               if ( Q_memcmp( &fog,
> CFogController::s_pFogController, sizeof(fog) ))
> -               {
> +               if (
> +               fog.enable.Get()               !=
> CFogController::s_pFogController->m_fog.enable.Get()
> +            || fog.blend.Get()                !=
> CFogController::s_pFogController->m_fog.blend.Get()
> +            || fog.dirPrimary.Get()           !=
> CFogController::s_pFogController->m_fog.dirPrimary.Get()
> +            || fog.colorPrimary.Get()         !=
> CFogController::s_pFogController->m_fog.colorPrimary.Get()
> +            || fog.colorSecondary.Get()       !=
> CFogController::s_pFogController->m_fog.colorSecondary.Get()
> +            || fog.start.Get()                !=
> CFogController::s_pFogController->m_fog.start.Get()
> +            || fog.end.Get()                  !=
> CFogController::s_pFogController->m_fog.end.Get()
> +            || fog.farz.Get()                 !=
> CFogController::s_pFogController->m_fog.farz.Get()
> +            || fog.colorPrimaryLerpTo.Get()   !=
> CFogController::s_pFogController->m_fog.colorPrimaryLerpTo.Get()
> +            || fog.colorSecondaryLerpTo.Get() !=
> CFogController::s_pFogController->m_fog.colorSecondaryLerpTo.Get()
> +            || fog.startLerpTo.Get()          !=
> CFogController::s_pFogController->m_fog.startLerpTo.Get()
> +            || fog.endLerpTo.Get()            !=
> CFogController::s_pFogController->m_fog.endLerpTo.Get()
> +            || fog.lerptime.Get()             !=
> CFogController::s_pFogController->m_fog.lerptime.Get()
> +            || fog.duration.Get()             !=
> CFogController::s_pFogController->m_fog.duration.Get()
> +        ) {
>                         fog = CFogController::s_pFogController->m_fog;
>                         return true;
>                 }
>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list
> archives, please visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
>

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to