]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fix segfault with long aliases
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 15 Mar 2008 22:17:33 +0000 (22:17 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 15 Mar 2008 22:17:33 +0000 (22:17 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8211 d7cf8633-e32d-0410-b094-e92efae38249

cl_screen.c
cmd.c

index 25080f0b9ee59000ff4652fe82d5f307e7117d1d..48fb04131bbb2abb50460a98e6716c79b1129555 100644 (file)
@@ -2110,6 +2110,16 @@ void CL_UpdateScreen(void)
        double rendertime1;
        float conwidth, conheight;
 
        double rendertime1;
        float conwidth, conheight;
 
+       // play a bit with the palette
+       palette_rgb_pantscolormap[15][0] = 128 + 127 * sin(cl.time / exp(1) + 0*M_PI/3);
+       palette_rgb_pantscolormap[15][1] = 128 + 127 * sin(cl.time / exp(1) + 2*M_PI/3);
+       palette_rgb_pantscolormap[15][2] = 128 + 127 * sin(cl.time / exp(1) + 4*M_PI/3);
+       palette_rgb_shirtcolormap[15][0] = 128 + 127 * sin(cl.time /  M_PI  + 5*M_PI/3);
+       palette_rgb_shirtcolormap[15][1] = 128 + 127 * sin(cl.time /  M_PI  + 3*M_PI/3);
+       palette_rgb_shirtcolormap[15][2] = 128 + 127 * sin(cl.time /  M_PI  + 1*M_PI/3);
+       memcpy(palette_rgb_pantsscoreboard[15], palette_rgb_pantscolormap[15], sizeof(*palette_rgb_pantscolormap));
+       memcpy(palette_rgb_shirtscoreboard[15], palette_rgb_shirtcolormap[15], sizeof(*palette_rgb_shirtcolormap));
+
        if (vid_hidden || !scr_refresh.integer)
                return;
 
        if (vid_hidden || !scr_refresh.integer)
                return;
 
diff --git a/cmd.c b/cmd.c
index b60ae285324c7706191921f0aafdec6605e71800..4e1fb7297885840f42bbb706e960eede4c06a445 100644 (file)
--- a/cmd.c
+++ b/cmd.c
@@ -169,6 +169,11 @@ void Cbuf_Execute (void)
                                break;
                }
 
                                break;
                }
 
+               /* should never happen
+               if(i >= MAX_INPUTLINE)
+                       i = MAX_INPUTLINE - 1;
+               */
+
                memcpy (line, text, i);
                line[i] = 0;
 
                memcpy (line, text, i);
                line[i] = 0;
 
@@ -824,8 +829,8 @@ Called for aliases and fills in the alias into the cbuffer
 */
 static void Cmd_ExecuteAlias (cmdalias_t *alias)
 {
 */
 static void Cmd_ExecuteAlias (cmdalias_t *alias)
 {
-       static char buffer[ MAX_INPUTLINE + 2 ];
-       static char buffer2[ MAX_INPUTLINE * 2 + 2 ];
+       static char buffer[ MAX_INPUTLINE ];
+       static char buffer2[ MAX_INPUTLINE ];
        Cmd_PreprocessString( alias->value, buffer, sizeof(buffer) - 2, alias );
        // insert at start of command buffer, so that aliases execute in order
        // (fixes bug introduced by Black on 20050705)
        Cmd_PreprocessString( alias->value, buffer, sizeof(buffer) - 2, alias );
        // insert at start of command buffer, so that aliases execute in order
        // (fixes bug introduced by Black on 20050705)