Exemple #1
0
        void getTask(int xx, int yy, bool isX, int dxy)
        {
            bool notFound;
            TTsk cInd;
            int  x1, y1, x2, y2, dx, dy;

            if (!fLab.chars[xx, yy].isPill())
            {
                return;
            }
            if (isX)
            {
                y1 = yy - 2;
                x1 = xx;
                dy = 1;
                dx = -dxy;
            }
            else
            {
                x1 = xx - 2;
                y1 = yy;
                dx = 1;
                dy = -dxy;
            }
            tskProvider.pointSet(xx, yy);
            do
            {
                cInd = tskProvider.pointGetVal();
                if ((cInd.tskNo == 0) && (cInd.chr == 0))
                {
                    break;                     //not found
                }
                notFound = false;
                x2       = x1;
                y2       = y1;
                if (fLab.chars[xx + dx, yy + dy] == cInd)
                {
                    notFound = true;
                }
                else
                {
                    for (int j = 0; j < 3; j++)
                    {
                        notFound |= ((!fLab.isWallOrOut(xx, y2)) || (!fLab.isWallOrOut(x2, yy))) && (fLab.chars[x2, y2] == cInd);
                        if (notFound)
                        {
                            break;
                        }
                        x2 += dx;
                        y2 += dy;
                    }
                }
                if (!notFound && (fLab.chars[xx - 2, yy] == cInd))
                {
                    y2 = 1;
                }
                if (notFound)
                {
                    tskProvider.tskSelector[cInd.tskNo].skip[cInd.chr] = true;
                }
            } while (notFound);
            fLab.chars[xx, yy] = cInd;
        }