View Single Post
Re: [CZ] Changing model directory "on the fly"?
Old
  (#26)
Lazy
Member
 
Lazy's Avatar
 
Status: Offline
Posts: 236
Join Date: Jan 2004
Location: Toronto, Ontario, Canada
Default Re: [CZ] Changing model directory "on the fly"? - 04-07-2005

I never return pointers to local variables, what I did is make the caller pass a pointer to it's own local variable which gets the new string copied into it.

And the only time I convert to backslashes is when I use fopen to check if the file exists or not, but I still have no idea why I'm getting this error.

OR, is hl keeping a pointer to szNewpath when I call PRECACHE_SOUND?
That would explain a lot but I'd assume it makes a copy first.

[Added]
Well, it looks like HL needs a copy of the string.
The problem was solved by changing szNewpath to STRING( ALLOC_STRING( szNewpath ) ).
Bah, I would never keep a string pointer like that.

Thanks PMB, now I can get back to finishing this thing

Last edited by Lazy; 04-07-2005 at 21:41..
  
Reply With Quote