Kai Antweiler <[EMAIL PROTECTED]> writes:

> ...  Fixing it should be as simple as
> reverting every part of that new "forbiddenzone around buildings"
> feature in recent cvs and checking that no other patches rely on
> it.
>
> I attach the complete diff:

...

> +void Building::addForbiddenZoneToUpgradeArea(void)
> +{
> +     int midPosX=posX-type->decLeft;
> +     int midPosY=posY-type->decTop;
> +
> +     int targetLevelTypeNum=-1;
> +     if (constructionResultState==UPGRADE)
> +             targetLevelTypeNum=type->nextLevel;
> +     else if (constructionResultState==REPAIR)
> +             targetLevelTypeNum=type->prevLevel;

The above line looks extremely suspicious!  Shouldn't it be using the
_current_ level for this?  Or does prevLevel mean something other than
“previous level”?

> +     else
> +             assert(false);
> +
> +     BuildingType 
> *targetBt=globalContainer->buildingsTypes.get(targetLevelTypeNum);
> +     int newPosX=midPosX+targetBt->decLeft;
> +     int newPosY=midPosY+targetBt->decTop;
> +     int newWidth=targetBt->width;
> +     int newHeight=targetBt->height;
> +     for(int nx=0; nx<newWidth; ++nx)
> +     {
> +             for(int ny=0; ny<newHeight; ++ny)
> +             {
> +                     
> owner->map->addHiddenForbidden(owner->map->normalizeX(newPosX+nx), 
> owner->map->normalizeY(newPosY+ny), owner->teamNumber); 
> +             }
> +     }
> +}
> +
> +
> +
> +void Building::removeForbiddenZoneFromUpgradeArea(void)
> +{
> +     int midPosX=posX-type->decLeft;
> +     int midPosY=posY-type->decTop;
> +
> +     int targetLevelTypeNum=-1;
> +     if (constructionResultState==UPGRADE)
> +             targetLevelTypeNum=type->nextLevel;
> +     else if (constructionResultState==REPAIR)
> +             targetLevelTypeNum=type->prevLevel;

Again, looks suspicious.

> +     else
> +             assert(false);
> +
> +     BuildingType 
> *targetBt=globalContainer->buildingsTypes.get(targetLevelTypeNum);
> +     int newPosX=midPosX+targetBt->decLeft;
> +     int newPosY=midPosY+targetBt->decTop;
> +     int newWidth=targetBt->width;
> +     int newHeight=targetBt->height;
> +     for(int nx=0; nx<newWidth; ++nx)
> +     {
> +             for(int ny=0; ny<newHeight; ++ny)
> +             {
> +                     
> owner->map->removeHiddenForbidden(owner->map->normalizeX(newPosX+nx), 
> owner->map->normalizeY(newPosY+ny), owner->teamNumber); 
> +             }
> +     }
> +}

-- 
Joe


_______________________________________________
glob2-devel mailing list
[EMAIL PROTECTED]
http://lists.nongnu.org/mailman/listinfo/glob2-devel

Reply via email to