| 635 | COMMAND(copy, ""); |
| 636 | |
| 637 | void paste() |
| 638 | { |
| 639 | EDITSEL("paste"); |
| 640 | bool mp = multiplayer(NULL); |
| 641 | if(mp) |
| 642 | { |
| 643 | loopv(copybuffers) if(copybuffers[i]->xs * copybuffers[i]->ys > MAXNETBLOCKSQR) |
| 644 | { |
| 645 | conoutf("\f3copied area too big for multiplayer pasting"); |
| 646 | return; |
| 647 | } |
| 648 | } |
| 649 | if(!copybuffers.length()) { conoutf("nothing to paste"); return; } |
| 650 | |
| 651 | uchar usedslots[256] = { 0 }, *texmap = NULL; |
| 652 | if(!mp) |
| 653 | { |
| 654 | loopv(copybuffers) blocktexusage(*copybuffers[i], usedslots); |
| 655 | if(sels.length() && copytexconfig) texmap = texconfig_paste(copytexconfig, usedslots); |
| 656 | } |
| 657 | |
| 658 | loopv(sels) |
| 659 | { |
| 660 | block sel = sels[i]; |
| 661 | int selx = sel.x; |
| 662 | int sely = sel.y; |
| 663 | |
| 664 | loopvj(copybuffers) |
| 665 | { |
| 666 | block *copyblock = copybuffers[j]; |
| 667 | int dx = copyblock->x - copybuffers[0]->x, dy = copyblock->y - copybuffers[0]->y; |
| 668 | |
| 669 | sel.xs = copyblock->xs; |
| 670 | sel.ys = copyblock->ys; |
| 671 | sel.x = selx + dx; |
| 672 | sel.y = sely + dy; |
| 673 | if(!correctsel(sel) || sel.xs!=copyblock->xs || sel.ys!=copyblock->ys) { conoutf("incorrect selection"); return; } |
| 674 | makeundo(sel); |
| 675 | blockpaste(*copyblock, sel.x, sel.y, true, texmap); |
| 676 | if(mp) netblockpaste(*copyblock, sel.x, sel.y, true); |
| 677 | } |
| 678 | } |
| 679 | } |
| 680 | COMMAND(paste, ""); |
| 681 | |
| 682 | void tofronttex() // maintain most recently used of the texture lists when applying texture |
nothing calls this directly
no test coverage detected