[hlcoders] VSP problem revisit

2010-04-12 Thread C-F Strid
Heyo,

I'm having some problems with a VSP I'm fiddling with. I've already
asked this here, but I gave it a rest and now I want to give it a go
again.

First, have some code:

CON_COMMAND(testOne, This command works)
{
   INetChannel *pNetChan =
static_castINetChannel*(engine-GetPlayerNetInfo(engineClient-GetLocalPlayer()));

   if(pNetChan)
   {
IClient *pClient = static_castIClient 
*(pNetChan-GetMsgHandler());
Warning(pClient-GetClientName());
   }
}

CON_COMMAND(testTwo, This command does not work)
{
INetChannel *pNetChan =
static_castINetChannel*(engineClient-GetNetChannelInfo());

if(pNetChan)
{
//Warning(pNetChan-GetName()); // Works

IClient *pClient = static_castIClient
*(pNetChan-GetMsgHandler()); // No error here either

Warning(pClient-GetClientName()); // Grargh! Game crashes, no
matter if I'm on my own server or not.
}
}

Now, the first CON_COMMAND does not crash. It only works on my own
listen server though, and I want to be able to use it client-side
(there's some background information in my previous mail, but that's
not really relevant to the problem).

The second command does crash, for what reason I don't know. Could
anyone offer any help with this?

Thanks

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



Re: [hlcoders] VSP problem revisit

2010-04-12 Thread Jonas 'Sortie' Termansen
Do you use a NULL pointer after the static cast or do you print a NULL pointer?
___
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders



Re: [hlcoders] VSP problem revisit

2010-04-12 Thread Jonathan White
 IClient *pClient = static_castIClient*(pNetChan-GetMsgHandler()); // No 
 error here either
 Warning(pClient-GetClientName()); // Grargh! Game crashes, no matter if I'm 
 on my own server or not.

Just because static_cast doesn't return an error doesn't mean it
worked. My guess is that GetMsgHandler() is returning an
INetChannelHandler* and you are FORCING it to be IClient* even though
it may not have been created as an IClient. Try using:

IClient *pClient = dynamic_castIClient*(pNetChan-GetMsgHandler());

which will return NULL if it really isn't an IClient type class.

Killermonkey
GE:S

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



[hlcoders] VS2010

2010-04-12 Thread Bob Somers
It's out now, if you haven't heard.

http://www.microsoft.com/visualstudio/en-us/

Did anyone here on the list use the betas or RCs (or even the now the
release version) for compiling source mods? I'd love to upgrade to
VS2010 to get the multi-monitor support, but if it's going to cause me
headaches I'll just stick with VS2008.

--Bob

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