]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fix crash when entering "color" command while playing a demo
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 25 May 2006 03:43:58 +0000 (03:43 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 25 May 2006 03:43:58 +0000 (03:43 +0000)
fixed values printed by bottomcolor/topcolor commands (so bottomcolor no longer reports the whole color like color does, instead just the pants color)

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6375 d7cf8633-e32d-0410-b094-e92efae38249

host_cmd.c

index 8ed2a8560671d4552ebd3fffa23bc382320f13fc..2d34b90a9274601920fcdee6b43defec7e5503f7 100644 (file)
@@ -1126,7 +1126,7 @@ void Host_Color(int changetop, int changebottom)
                        CL_SetInfo("topcolor", va("%i", top), true, false, false, false);
                if (changebottom >= 0)
                        CL_SetInfo("bottomcolor", va("%i", bottom), true, false, false, false);
-               if (cls.protocol != PROTOCOL_QUAKEWORLD)
+               if (cls.protocol != PROTOCOL_QUAKEWORLD && cls.netcon)
                {
                        MSG_WriteByte(&cls.netcon->message, clc_stringcmd);
                        MSG_WriteString(&cls.netcon->message, va("color %i %i", top, bottom));
@@ -1191,7 +1191,7 @@ void Host_TopColor_f(void)
 {
        if (Cmd_Argc() == 1)
        {
-               Con_Printf("\"topcolor\" is \"%i\"\n", cl_color.integer >> 4);
+               Con_Printf("\"topcolor\" is \"%i\"\n", (cl_color.integer >> 4) & 15);
                Con_Print("topcolor <0-15>\n");
                return;
        }
@@ -1203,7 +1203,7 @@ void Host_BottomColor_f(void)
 {
        if (Cmd_Argc() == 1)
        {
-               Con_Printf("\"bottomcolor\" is \"%i\"\n", cl_color.integer);
+               Con_Printf("\"bottomcolor\" is \"%i\"\n", cl_color.integer & 15);
                Con_Print("bottomcolor <0-15>\n");
                return;
        }