Tremulous Forum

Mods => Modding Center => Topic started by: WoGoMo on December 16, 2010, 08:52:31 pm

Title: Alternative Intermission - Problem with loading layout [SOLVED]
Post by: WoGoMo on December 16, 2010, 08:52:31 pm
With reference to the following threads:

http://tremulous.net/forum/index.php?topic=14621.msg211407 (http://tremulous.net/forum/index.php?topic=14621.msg211407)
http://tremulous.net/forum/index.php?topic=14799.0 (http://tremulous.net/forum/index.php?topic=14799.0)

I came up with some code changes to try and add the desired functionality to tremded vm. The patch can be downloaded from http://sirclan.no-ip.org/wogomo/wogomo.patch (http://sirclan.no-ip.org/wogomo/wogomo.patch) which is a diff against the latest gpp branch from svn.

Commands /alienint, /humanint, and /specint all work fine as long as u have the admin privileges and it seems to change the intermission in a running game correctly. /layoutsave also writes the correct data to the layoutfile. However, upon loading a map with the custom layout, both aliens and specs are getting the spec intermission while humans are getting the alien intermission. FAIL!

Cant figure out what I did wrong. Can someone help me?
Title: Re: Alternative Intermission - Problem with loading layout
Post by: Undeference on December 16, 2010, 09:02:53 pm
This is not the way to do it, in my opinion

Code: [Select]
+ if( Q_stricmp( buildName, "alienint" ) )

+ else if( Q_stricmp( buildName, "humanint" ) )

+ else if( Q_stricmp( buildName, "specint" ) )

+ if( Q_stricmp( buildName, "alienint" ) || Q_stricmp( buildName, "humanint" ) || Q_stricmp( buildName, "specint" ) )
Quote from: man 3 strcasecmp
       The  strcasecmp() function compares the two strings s1 and s2, ignoring
       the case of the characters.  It returns an integer less than, equal to,
       or  greater than zero if s1 is found, respectively, to be less than, to
       match, or be greater than s2.
Title: Re: Alternative Intermission - Problem with loading layout
Post by: WoGoMo on December 16, 2010, 09:53:35 pm
Quote from: man 3 strcasecmp
       The  strcasecmp() function compares the two strings s1 and s2, ignoring
       the case of the characters.  It returns an integer less than, equal to,
       or  greater than zero if s1 is found, respectively, to be less than, to
       match, or be greater than s2.

OMG. I've not been coding in C for such a long time I totally forgot about this. Thanks.