[comp.sources.bugs] xroach problems.

Edmund.Stephen-Smith@comp.vuw.ac.nz (Edmund Stephen-Smith) (03/30/91)

In article <1509@culhua.prg.ox.ac.uk> bush@ecs.ox.ac.uk (Mark Bush) writes:
[...]
>you'll find that the roach moves at a reasonable speed, but that most of the
>time it is un-painted.  It seems to flash on for a brief moment.  At least
>that's how it runs on all the Suns I've compiled it on.
>
>Anyone else seen this?  I've had only a quick glance at the source so far
>and I can't see yet what the problem is.

The problem seems to be that the roaches are undrawn and then redrawn 
in two separate loops.  First they are *all* deleted then *all* redrawn.  
By merging the loops, so that each roach in turn is deleted then redrawn, 
they appear much more solid.

Diff follows (ie. delete the five lines with minus signs at the front),

Ed.


*** xroach.c~   Sat Mar 30 13:51:26 1991
--- xroach.c    Sat Mar 30 13:55:28 1991
***************
*** 407,417 ****
        if (roach->intX >= 0) {
            XClearArea(display, rootWin, roach->intX, roach->intY,
                roach->rp->width, roach->rp->height, False);
-       }
-     }
-
-     for (rx=0; rx<curRoaches; rx++) {
-       roach = &roaches[rx];

        if (!roach->hidden) {
            roach->intX = roach->x;
--- 407,412 ----
-- 
Edmund Stephen-Smith               crunch@comp.vuw.ac.nz   

ake@dayton.saic.com (Earle Ake) (03/30/91)

In article <1991Mar30.021403.7505@comp.vuw.ac.nz>, Edmund.Stephen-Smith@comp.vuw.ac.nz (Edmund Stephen-Smith) writes:

> Diff follows (ie. delete the five lines with minus signs at the front),
> 
> Ed.
> 
> 
> *** xroach.c~   Sat Mar 30 13:51:26 1991
> --- xroach.c    Sat Mar 30 13:55:28 1991
> ***************
> *** 407,417 ****
>         if (roach->intX >= 0) {
>             XClearArea(display, rootWin, roach->intX, roach->intY,
>                 roach->rp->width, roach->rp->height, False);
> -       }
> -     }
> -
> -     for (rx=0; rx<curRoaches; rx++) {
> -       roach = &roaches[rx];
> 
>         if (!roach->hidden) {
>             roach->intX = roach->x;
> --- 407,412 ----


	I think the patch should have been:


*** xroach.c~   Sat Mar 30 13:51:26 1991
--- xroach.c    Sat Mar 30 13:55:28 1991
***************
*** 407,417 ****
        if (roach->intX >= 0) {
            XClearArea(display, rootWin, roach->intX, roach->intY,
                roach->rp->width, roach->rp->height, False);
        }
-     }
-
-     for (rx=0; rx<curRoaches; rx++) {
-       roach = &roaches[rx];

        if (!roach->hidden) {
            roach->intX = roach->x;
--- 407,413 ----

	You still need the "}" in 410 to close off the if statement above it.

Earle
_____________________________________________________________________________
             ____ ____    ___
Earle Ake   /___ /___/ / /     Science Applications International Corporation
           ____//   / / /__                 Dayton, Ohio
-----------------------------------------------------------------------------
Internet: ake@dayton.saic.com        uucp: dayvb!ake         SPAN: 28284::ake

stevef@bony1.bony.com (Steve Faiwiszewski) (04/02/91)

In article <1991Mar30.021403.7505@comp.vuw.ac.nz> Edmund.Stephen-Smith@comp.vuw.ac.nz (Edmund Stephen-Smith) writes:
>In article <1509@culhua.prg.ox.ac.uk> bush@ecs.ox.ac.uk (Mark Bush) writes:
>[...]
>>you'll find that the roach moves at a reasonable speed, but that most of the
>>time it is un-painted.  It seems to flash on for a brief moment.  At least
>>that's how it runs on all the Suns I've compiled it on...
>
>...Diff follows (ie. delete the five lines with minus signs at the front),

I guess this is truly a "bug fix", eh? ;-)

-- 
=======================================================================
Internet: stevef@bony1.bony.COM  |          The Bank Of New York
                                 |          ~~~~~~~~~~~~~~~~~~~~        
bang : uunet!bony1!stevef        |        Reality is Nobody's Dream