Plow() pass by-pointer const TileTypeBitMask* instead of by-value

sizeof(TileTypeBitMask) == 32
This commit is contained in:
Darryl L. Miles 2025-02-17 09:49:04 +00:00 committed by Tim Edwards
parent 6db34b6aa9
commit bc5a4a0fb1
5 changed files with 10 additions and 9 deletions

View File

@ -212,7 +212,7 @@ wrongNumArgs:
layers = cmd->tx_argc == 2 ? "*,l,subcell,space" : cmd->tx_argv[2];
if (!CmdParseLayers(layers, &mask))
break;
if (Plow(editDef, &editBox, mask, dir))
if (Plow(editDef, &editBox, &mask, dir))
break;
TxPrintf("Reduced plow size to stay within the boundary.\n");

View File

@ -483,13 +483,13 @@ PlowSelection(def, pdistance, direction)
*/
bool
Plow(def, userRect, layers, direction)
CellDef *def; /* Cell being plowed */
Rect *userRect; /* The plow. Interpreted as per direction
Plow(
CellDef *def, /* Cell being plowed */
Rect *userRect, /* The plow. Interpreted as per direction
* below.
*/
TileTypeBitMask layers; /* The initial plow only sees these layers */
int direction; /* One of GEO_NORTH, GEO_SOUTH, GEO_WEST,
const TileTypeBitMask *layersp,/* The initial plow only sees these layers */
int direction) /* One of GEO_NORTH, GEO_SOUTH, GEO_WEST,
* or GEO_EAST.
*/
{
@ -497,6 +497,7 @@ Plow(def, userRect, layers, direction)
extern int plowWidthNumCalls;
extern int plowWidthNumChoices;
#endif /* COUNTWIDTHCALLS */
TileTypeBitMask layers = *layersp; /* TTMaskCopy(&layers, layersp) */
TileTypeBitMask lc;
Rect changedArea;
bool firstTime;

View File

@ -118,7 +118,7 @@ PlowRandomTest(def)
dir = plowGenRandom(0, 3);
plowDir = dirs[dir];
plowGenRect(&def->cd_bbox, &plowRect);
(void) Plow(def, &plowRect, DBAllTypeBits, plowDir);
(void) Plow(def, &plowRect, &DBAllTypeBits, plowDir);
TxPrintf("%s %d %d %d %d\n", dirnames[dir],
plowRect.r_xbot, plowRect.r_ybot,
plowRect.r_xtop, plowRect.r_ytop);

View File

@ -207,7 +207,7 @@ PlowTest(w, cmd)
okTypes = DBAllTypeBits;
if (cmd->tx_argc > 3 && !CmdParseLayers(cmd->tx_argv[3], &okTypes))
return;
if (!Plow(def, &editArea, okTypes, dir))
if (!Plow(def, &editArea, &okTypes, dir))
{
TxPrintf("Reduced plow size since we ran into the barrier.\n");
GeoTransRect(&EditToRootTransform, &editArea, &rootBox);

View File

@ -30,7 +30,7 @@ extern int PlowDRCInit(), PlowDRCFinal();
extern bool PlowDRCLine();
/* Called by CmdPlow() */
extern bool Plow();
extern bool Plow(CellDef *def, Rect *userRect, const TileTypeBitMask *layersp, int direction);
/* Debugging command procedure */
extern int PlowTest();