MCPcopy Create free account
hub / github.com/TurningWheel/Barony / redo

Function redo

src/editor.cpp:1229–1263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1227}
1228
1229void redo()
1230{
1231 node_t* node;
1232
1233 if ( redospot == NULL )
1234 {
1235 return;
1236 }
1237 selectedEntity[0] = NULL;
1238 free(map.tiles);
1239 free(camera.vismap);
1240 map_t* undomap = (map_t*)redospot->element;
1241 map.width = undomap->width;
1242 map.height = undomap->height;
1243 map.tiles = (Sint32*) malloc(sizeof(Sint32) * map.width * map.height * MAPLAYERS);
1244 camera.vismap = (bool*) malloc(sizeof(bool) * map.height * map.width);
1245 memset(camera.vismap, 0, sizeof(bool) * map.height * map.width);
1246 memcpy(map.tiles, undomap->tiles, sizeof(Sint32)*undomap->width * undomap->height * MAPLAYERS);
1247 list_FreeAll(map.entities);
1248 for ( node = undomap->entities->first; node != NULL; node = node->next )
1249 {
1250 Entity* entity = newEntity(((Entity*)node->element)->sprite, 1, map.entities, nullptr);
1251
1252 setSpriteAttributes(entity, (Entity*)node->element, (Entity*)node->element);
1253 }
1254 if ( undospot != NULL )
1255 {
1256 undospot = undospot->next;
1257 }
1258 else
1259 {
1260 undospot = redospot->prev;
1261 }
1262 redospot = redospot->next;
1263}
1264
1265void processCommandLine(int argc, char** argv)
1266{

Callers 1

buttonRedoFunction · 0.85

Calls 3

list_FreeAllFunction · 0.85
newEntityFunction · 0.85
setSpriteAttributesFunction · 0.85

Tested by

no test coverage detected