swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Swarm-Support] Also Button Problem(solved)


From: luo pi
Subject: [Swarm-Support] Also Button Problem(solved)
Date: Thu, 10 Apr 2003 20:08:50 -0700 (PDT)

Dear Paul,

With your directions, I have already solved this
problem. I design a "makeProbeAtX:Y:" method in
ModelSwarm, rather than in a separate
class---ProbeMaker, which can reduce many calling
chores between ProbeMake and other classes, and make
the program simple. The source code in
“makeProbeAtX:Y:” method is as follows(Maybe it is
helpful to other persons):

- makeProbeAtX: (unsigned)x Y: (unsigned)y
{ id obj;
  if (x >= 0
      && x < worldSizeX
      && y >= 0
&& y < worldSizeY
    {
      obj = [redindividualworld getObjectAtX: x Y: y];
      if (obj)
        CREATE_PROBE_DISPLAY (obj);
      else  
         {  obj = [yellowindividualworld getObjectAtX:
x Y: y];  
            if (obj)
              CREATE_PROBE_DISPLAY (obj);
            else 
              {  obj = [greenindividualworld
getObjectAtX: x Y: y];  
                 if (obj)
                   CREATE_PROBE_DISPLAY (obj);
                 else
                    GUI_BEEP ();
              }
          }
     }
    else
      [WarningMessage
        raiseEvent: 
          "Object2dDisplay: invalid coordinates to
make probe (%d,%d)\n",
        x, y]; 
  return self;
}
Thank you very much!
                                              Patrick.
L



__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com


reply via email to

[Prev in Thread] Current Thread [Next in Thread]