mirror of
https://github.com/RTimothyEdwards/magic.git
synced 2026-08-22 14:17:43 +02:00
First cut of pulling the TT_SIDE bit out of the tile database
and forcing it to be passed as an argument to all the callback functions for the search routines that require it. Magic now compiles and runs with the new code, but there are a number of known issues that need to be fixed up. Committing now so that I can rebase on the last update to the master branch.
This commit is contained in:
+21
-9
@@ -2396,8 +2396,10 @@ CmdContact(
|
||||
CCStruct ccs;
|
||||
Rect area;
|
||||
LinkedRect *lr = NULL;
|
||||
int cmdContactFunc(Tile *tile, CCStruct *ccs); /* Forward declaration */
|
||||
int cmdContactEraseFunc(Tile *tile, LinkedRect **lr); /* Forward declaration */
|
||||
|
||||
/* Forward declarations */
|
||||
int cmdContactFunc(Tile *tile, TileType dinfo, CCStruct *ccs);
|
||||
int cmdContactEraseFunc(Tile *tile, TileType dinfo, LinkedRect **lr);
|
||||
|
||||
windCheckOnlyWindow(&w, DBWclientID);
|
||||
if ((w == (MagWindow *) NULL) || (w->w_client != DBWclientID))
|
||||
@@ -2531,11 +2533,14 @@ CmdContact(
|
||||
int
|
||||
cmdContactFunc(
|
||||
Tile *tile,
|
||||
TileType dinfo,
|
||||
CCStruct *ccs)
|
||||
{
|
||||
TileType stype;
|
||||
TileTypeBitMask smask;
|
||||
int cmdContactFunc2(Tile *tile, CCStruct *ccs); /* Forward declaration */
|
||||
|
||||
/* Forward declaration */
|
||||
int cmdContactFunc2(Tile *tile, TileType dinfo, CCStruct *ccs);
|
||||
|
||||
TiToRect(tile, &ccs->area);
|
||||
GeoClip(&ccs->area, &ccs->clip);
|
||||
@@ -2545,7 +2550,7 @@ cmdContactFunc(
|
||||
break;
|
||||
|
||||
TTMaskSetOnlyType(&smask, stype);
|
||||
DBSrPaintArea((Tile *) NULL, ccs->rootDef->cd_planes[DBPlane(stype)],
|
||||
DBSrPaintNMArea((Tile *)NULL, ccs->rootDef->cd_planes[DBPlane(stype)], dinfo,
|
||||
&ccs->area, &smask, cmdContactFunc2, (ClientData)ccs);
|
||||
return 0;
|
||||
}
|
||||
@@ -2553,6 +2558,7 @@ cmdContactFunc(
|
||||
int
|
||||
cmdContactFunc2(
|
||||
Tile *tile,
|
||||
TileType dinfo, /* (unused) */
|
||||
CCStruct *ccs)
|
||||
{
|
||||
LinkedRect *newlr;
|
||||
@@ -2575,6 +2581,7 @@ cmdContactFunc2(
|
||||
int
|
||||
cmdContactEraseFunc(
|
||||
Tile *tile,
|
||||
TileType dinfo, /* (unused) */
|
||||
LinkedRect **lr)
|
||||
{
|
||||
LinkedRect *newlr;
|
||||
@@ -2828,14 +2835,15 @@ CmdCorner(
|
||||
TileTypeBitMask maskBits;
|
||||
Rect editBox;
|
||||
SearchContext scx;
|
||||
extern int cmdCornerFunc(Tile *tile, TreeContext *cxp);
|
||||
bool hasErr = FALSE;
|
||||
int locargc = cmd->tx_argc;
|
||||
|
||||
extern int cmdBevelFunc(Tile *tile, TreeContext *cxp);
|
||||
bool dobevel = FALSE;
|
||||
NMCornerPath cmdPathList;
|
||||
|
||||
/* Forward declarations */
|
||||
extern int cmdCornerFunc(Tile *tile, TileType dinfo, TreeContext *cxp);
|
||||
extern int cmdBevelFunc(Tile *tile, TileType dinfo, TreeContext *cxp);
|
||||
|
||||
if (cmd->tx_argc < 3 || cmd->tx_argc > 5)
|
||||
{
|
||||
TxError("Usage: %s direction1 direction2 [layers]\n",
|
||||
@@ -3030,6 +3038,7 @@ CmdCorner(
|
||||
int
|
||||
cmdCornerFunc(
|
||||
Tile *tile, /* Tile to fill with. */
|
||||
TileType dinfo, /* Split tile information (unused) */
|
||||
TreeContext *cxp) /* Describes state of search. */
|
||||
{
|
||||
Rect r1, r2, r3;
|
||||
@@ -3196,6 +3205,7 @@ AddNewPoint(
|
||||
int
|
||||
cmdBevelFunc(
|
||||
Tile *tile, /* Tile to fill with. */
|
||||
TileType dinfo, /* Split tile information (unused) */
|
||||
TreeContext *cxp) /* Describes state of search. */
|
||||
{
|
||||
Rect r1, r2, r3;
|
||||
@@ -4585,6 +4595,7 @@ CmdDrc(
|
||||
int
|
||||
cmdDropPaintCell(
|
||||
Tile *tile,
|
||||
TileType dinfo,
|
||||
TreeContext *cxp)
|
||||
{
|
||||
CellDef *cellDef = cxp->tc_scx->scx_use->cu_def;
|
||||
@@ -4593,7 +4604,7 @@ cmdDropPaintCell(
|
||||
TileType type;
|
||||
Rect area;
|
||||
|
||||
if (SplitSide(tile))
|
||||
if (dinfo & TT_SIDE)
|
||||
type = SplitRightType(tile);
|
||||
else
|
||||
type = SplitLeftType(tile);
|
||||
@@ -4626,6 +4637,7 @@ cmdDropPaintCell(
|
||||
int
|
||||
cmdDropFunc(
|
||||
Tile *tile,
|
||||
TileType dinfo,
|
||||
ClientData clientData)
|
||||
{
|
||||
TileTypeBitMask tMask, *lMask = (TileTypeBitMask *)clientData;
|
||||
@@ -4636,7 +4648,7 @@ cmdDropFunc(
|
||||
scx.scx_use = EditCellUse;
|
||||
scx.scx_trans = GeoIdentityTransform;
|
||||
|
||||
if (SplitSide(tile))
|
||||
if (dinfo & TT_SIDE)
|
||||
type = SplitRightType(tile);
|
||||
else
|
||||
type = SplitLeftType(tile);
|
||||
|
||||
+16
-6
@@ -102,15 +102,17 @@ struct cmdFPArg
|
||||
int
|
||||
feedPolyFunc(
|
||||
Tile *tile,
|
||||
TileType dinfo,
|
||||
struct cmdFPArg *arg)
|
||||
{
|
||||
Rect area;
|
||||
TiToRect(tile, &area);
|
||||
|
||||
/* (NOTE: Preserve information about the geometry of a diagonal tile) */
|
||||
DBWFeedbackAdd(&area, arg->text, arg->def, FEEDMAGNIFY,
|
||||
arg->style |
|
||||
(TiGetTypeExact(tile) & (TT_DIAGONAL | TT_DIRECTION | TT_SIDE)));
|
||||
/* (preserve information about the geometry of a diagonal tile) */
|
||||
((TiGetTypeExact(tile) | dinfo) &
|
||||
(TT_DIAGONAL | TT_DIRECTION | TT_SIDE)));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -507,13 +509,15 @@ struct cmdFillArea *cmdFillList; /* List of areas to fill. */
|
||||
|
||||
void
|
||||
CmdFill(
|
||||
MagWindow *w, /* Window in which command was invoked. */
|
||||
MagWindow *w, /* Window in which command was invoked. */
|
||||
TxCommand *cmd) /* Describes the command that was invoked. */
|
||||
{
|
||||
TileTypeBitMask maskBits;
|
||||
Rect editBox;
|
||||
SearchContext scx;
|
||||
extern int cmdFillFunc(Tile *tile, TreeContext *cxp);
|
||||
|
||||
/* Forward declaration */
|
||||
extern int cmdFillFunc(Tile *tile, TileType dinfo, TreeContext *cxp);
|
||||
|
||||
if (cmd->tx_argc < 2 || cmd->tx_argc > 3)
|
||||
{
|
||||
@@ -603,11 +607,16 @@ CmdFill(
|
||||
* paint here it may mess up the search. Instead, the procedures
|
||||
* save areas on a list. The list is post-processed to paint the
|
||||
* areas once the search is finished.
|
||||
*
|
||||
* Split tile information is unused because there is no obvious
|
||||
* meaning to "filling" from a split tile, although probably reasonable
|
||||
* methods could be worked out.
|
||||
*/
|
||||
|
||||
int
|
||||
cmdFillFunc(
|
||||
Tile *tile, /* Tile to fill with. */
|
||||
TileType dinfo, /* Split tile information (unused) */
|
||||
TreeContext *cxp) /* Describes state of search. */
|
||||
{
|
||||
Rect r1, r2;
|
||||
@@ -1707,7 +1716,7 @@ checklocal:
|
||||
|
||||
if (locvalid == TRUE)
|
||||
{
|
||||
int findTile(Tile *tile, TileType *rtype);
|
||||
int findTile(Tile *tile, TileType dinfo, TileType *rtype);
|
||||
CellDef *targetdef = use->cu_def;
|
||||
Plane *plane = targetdef->cd_planes[pnum];
|
||||
|
||||
@@ -1841,13 +1850,14 @@ CmdGoto(
|
||||
int
|
||||
findTile(
|
||||
Tile *tile,
|
||||
TileType dinfo,
|
||||
TileType *rtype)
|
||||
{
|
||||
TileType ttype;
|
||||
|
||||
if (IsSplit(tile))
|
||||
{
|
||||
if (SplitSide(tile))
|
||||
if (dinfo & TT_SIDE)
|
||||
ttype = SplitRightType(tile);
|
||||
else
|
||||
ttype = SplitLeftType(tile);
|
||||
|
||||
+7
-3
@@ -61,7 +61,9 @@ static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magi
|
||||
|
||||
int
|
||||
existFunc(
|
||||
Tile *tile)
|
||||
Tile *tile, /* (unused) */
|
||||
TileType dinfo, /* (unused) */
|
||||
ClientData clientdata) /* (unused) */
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@@ -839,7 +841,8 @@ struct linked_id {
|
||||
|
||||
int
|
||||
cmdWhatPrintCell(
|
||||
Tile *tile,
|
||||
Tile *tile, /* (unused) */
|
||||
TileType dinfo, /* (unused) */
|
||||
TreeContext *cxp)
|
||||
{
|
||||
struct linked_id **lid = (struct linked_id **)cxp->tc_filter->tf_arg;
|
||||
@@ -894,6 +897,7 @@ static LabelStore *labelBlockTop, *labelEntry;
|
||||
int
|
||||
cmdFindWhatTileFunc(
|
||||
Tile *tile,
|
||||
TileType dinfo,
|
||||
ClientData clientData)
|
||||
{
|
||||
struct linked_id **lid = (struct linked_id **)clientData;
|
||||
@@ -905,7 +909,7 @@ cmdFindWhatTileFunc(
|
||||
scx.scx_use = EditCellUse;
|
||||
scx.scx_trans = GeoIdentityTransform;
|
||||
|
||||
if (SplitSide(tile))
|
||||
if (dinfo & TT_SIDE)
|
||||
type = SplitRightType(tile);
|
||||
else
|
||||
type = SplitLeftType(tile);
|
||||
|
||||
+13
-6
@@ -211,7 +211,8 @@ CmdExtractTest(
|
||||
|
||||
int
|
||||
tileCountProc(
|
||||
Tile *tile,
|
||||
Tile *tile, /* (unused) */
|
||||
TileType dinfo, /* (unused) */
|
||||
int *tcount)
|
||||
{
|
||||
(*tcount)++;
|
||||
@@ -800,11 +801,13 @@ cmdStatsCount(
|
||||
CellDef *def,
|
||||
struct countClient *cc)
|
||||
{
|
||||
int cmdStatsCountTile(Tile *tile, struct cellInfo *ci);
|
||||
int pNum;
|
||||
struct cellInfo *ci;
|
||||
TileType t;
|
||||
|
||||
/* Forward declaration */
|
||||
int cmdStatsCountTile(Tile *tile, TileType dinfo, struct cellInfo *ci);
|
||||
|
||||
if (def->cd_client)
|
||||
return (1);
|
||||
|
||||
@@ -829,6 +832,7 @@ cmdStatsCount(
|
||||
int
|
||||
cmdStatsCountTile(
|
||||
Tile *tile,
|
||||
TileType dinfo, /* (unused) */
|
||||
struct cellInfo *ci)
|
||||
{
|
||||
TileType type = TiGetType(tile);
|
||||
@@ -1099,17 +1103,18 @@ CmdTsearch(
|
||||
MagWindow *w,
|
||||
TxCommand *cmd)
|
||||
{
|
||||
int cmdTsrFunc(Tile *tp);
|
||||
char *RunStats(int flags, struct tms *lastt, struct tms *deltat);
|
||||
char *rstatp;
|
||||
static TileTypeBitMask mask;
|
||||
static struct tms tlast, tdelta;
|
||||
Rect rtool, rsearch;
|
||||
/**** Rect *ebox; ****/
|
||||
Plane *plane;
|
||||
int i, pNum, count;
|
||||
int usPerSearch, usPerTile, usPerL2, us, boxarea;
|
||||
|
||||
/* Forward declarations */
|
||||
int cmdTsrFunc(Tile *tp, TileType dinfo, ClientData clientdata);
|
||||
char *RunStats(int flags, struct tms *lastt, struct tms *deltat);
|
||||
|
||||
if (cmd->tx_argc < 3 || cmd->tx_argc > 5)
|
||||
{
|
||||
TxError("Usage: tsearch plane count [mask [new|mayo]]\n");
|
||||
@@ -1209,7 +1214,9 @@ CmdTsearch(
|
||||
|
||||
int
|
||||
cmdTsrFunc(
|
||||
Tile *tp)
|
||||
Tile *tp,
|
||||
TileType dinfo, /* (unused) */
|
||||
ClientData clientdata) /* (unused) */
|
||||
{
|
||||
if (cmdTsearchDebug)
|
||||
TxPrintf("%lx\n", (intptr_t) tp);
|
||||
|
||||
Reference in New Issue
Block a user