83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
};
bool
noteditmode()
{
correctsel();
if (!editmode)
conoutf("this function is only allowed in edit mode");
return !editmode;
};
bool
noselection()
{
if (!selset)
conoutf("no selection");
return !selset;
};
#define EDITSEL \
if (noteditmode() || noselection()) \
return;
#define EDITSELMP \
|
|
|
|
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
};
bool
noteditmode()
{
correctsel();
if (!editmode)
conoutf(@"this function is only allowed in edit mode");
return !editmode;
};
bool
noselection()
{
if (!selset)
conoutf(@"no selection");
return !selset;
};
#define EDITSEL \
if (noteditmode() || noselection()) \
return;
#define EDITSELMP \
|
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
|
};
void
editundo()
{
EDITMP;
if (undos.empty()) {
conoutf("nothing more to undo");
return;
};
block *p = undos.pop();
blockpaste(*p);
free(p);
};
|
|
|
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
|
};
void
editundo()
{
EDITMP;
if (undos.empty()) {
conoutf(@"nothing more to undo");
return;
};
block *p = undos.pop();
blockpaste(*p);
free(p);
};
|
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
|
};
void
paste()
{
EDITMP;
if (!copybuf) {
conoutf("nothing to paste");
return;
};
sel.xs = copybuf->xs;
sel.ys = copybuf->ys;
correctsel();
if (!selset || sel.xs != copybuf->xs || sel.ys != copybuf->ys) {
conoutf("incorrect selection");
return;
};
makeundo();
copybuf->x = sel.x;
copybuf->y = sel.y;
blockpaste(*copybuf);
};
|
|
|
|
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
|
};
void
paste()
{
EDITMP;
if (!copybuf) {
conoutf(@"nothing to paste");
return;
};
sel.xs = copybuf->xs;
sel.ys = copybuf->ys;
correctsel();
if (!selset || sel.xs != copybuf->xs || sel.ys != copybuf->ys) {
conoutf(@"incorrect selection");
return;
};
makeundo();
copybuf->x = sel.x;
copybuf->y = sel.y;
blockpaste(*copybuf);
};
|
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
|
void
edittype(int type)
{
EDITSEL;
if (type == CORNER &&
(sel.xs != sel.ys || sel.xs == 3 || sel.xs > 4 && sel.xs != 8 ||
sel.x & ~-sel.xs || sel.y & ~-sel.ys)) {
conoutf("corner selection must be power of 2 aligned");
return;
};
edittypexy(type, sel);
addmsg(1, 6, SV_EDITS, sel.x, sel.y, sel.xs, sel.ys, type);
};
void
|
|
|
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
|
void
edittype(int type)
{
EDITSEL;
if (type == CORNER &&
(sel.xs != sel.ys || sel.xs == 3 || sel.xs > 4 && sel.xs != 8 ||
sel.x & ~-sel.xs || sel.y & ~-sel.ys)) {
conoutf(@"corner selection must be power of 2 aligned");
return;
};
edittypexy(type, sel);
addmsg(1, 6, SV_EDITS, sel.x, sel.y, sel.xs, sel.ys, type);
};
void
|