MCPcopy Create free account
hub / github.com/assaultcube/AC / backupeditundo

Function backupeditundo

source/src/editing.cpp:579–606  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

577}
578
579int backupeditundo(vector<uchar> &buf, int undolimit, int redolimit)
580{
581 int numundo = 0;
582 vector<uchar> tmp;
583 loopvrev(undos)
584 {
585 tmp.setsize(0);
586 undolimit -= rlencodeundo(10, tmp, undos[i]);
587 if(undolimit < 0) break;
588 buf.put(tmp.getbuf(), tmp.length());
589 numundo++;
590 #ifdef _DEBUG
591 if(worldiodebug) clientlogf(" written undo x %d, y %d, xs %d, ys %d, compressed length %d", undos[i]->x, undos[i]->y, undos[i]->xs, undos[i]->ys, tmp.length());
592 #endif
593 }
594 loopvrev(redos)
595 {
596 tmp.setsize(0);
597 redolimit -= rlencodeundo(20, tmp, redos[i]);
598 if(redolimit < 0) break;
599 buf.put(tmp.getbuf(), tmp.length());
600 #ifdef _DEBUG
601 if(worldiodebug) clientlogf(" written redo x %d, y %d, xs %d, ys %d, compressed length %d", redos[i]->x, redos[i]->y, redos[i]->xs, redos[i]->ys, tmp.length());
602 #endif
603 }
604 putuint(buf, 0);
605 return numundo;
606}
607
608vector<block *> copybuffers;
609void *copytexconfig = NULL;

Callers 2

packheaderextrasFunction · 0.85
xmapMethod · 0.85

Calls 1

putuintFunction · 0.85

Tested by

no test coverage detected