verify data after deleting planes, do not delete plane 50 (yet)

This commit is contained in:
Enno Rehling 2016-08-14 16:51:25 +02:00
parent e5f5dc6aa4
commit ecffed0577
2 changed files with 20 additions and 9 deletions

View File

@ -14,6 +14,7 @@ require 'eressea.path'
eressea.read_game(get_turn() .. '.dat') eressea.read_game(get_turn() .. '.dat')
ids = {2081501646, 1967748303, 1137, 2000, 1456894557, 1580742069, 1143084084, 285224813, 604912520, 296884068, 50} ids = {2081501646, 1967748303, 1137, 2000, 1456894557, 1580742069, 1143084084, 285224813, 604912520, 296884068, 50}
p=plane.create(50, -7280, -4494, 83, 83, "Regatta")
for k,v in ipairs(ids) do for k,v in ipairs(ids) do
p = plane.get(v) p = plane.get(v)
@ -23,3 +24,5 @@ end
eressea.write_game(get_turn() .. '.new') eressea.write_game(get_turn() .. '.new')
eressea.free_game() eressea.free_game()
eressea.read_game(get_turn() .. '.new') eressea.read_game(get_turn() .. '.new')
write_reports()
eressea.write_game(get_turn() .. '.fix')

View File

@ -616,6 +616,13 @@ int read_borders(gamedata *data)
READ_TOK(store, zText, sizeof(zText)); READ_TOK(store, zText, sizeof(zText));
if (!strcmp(zText, "end")) if (!strcmp(zText, "end"))
break; break;
type = find_bordertype(zText);
if (type == NULL) {
log_error("[read_borders] connection %d type %s is not registered", bid, zText);
assert(type || !"connection type not registered");
}
READ_INT(store, &bid); READ_INT(store, &bid);
if (data->version < UIDHASH_VERSION) { if (data->version < UIDHASH_VERSION) {
int fx, fy, tx, ty; int fx, fy, tx, ty;
@ -632,16 +639,17 @@ int read_borders(gamedata *data)
READ_INT(store, &tid); READ_INT(store, &tid);
from = findregionbyid(fid); from = findregionbyid(fid);
to = findregionbyid(tid); to = findregionbyid(tid);
if (!to || !from) {
log_error("%s connection between missing regions %d and %d", zText, fid, tid);
assert((to && from) || !"connection between missing regions");
}
} }
if (!to || !from) {
type = find_bordertype(zText); if (!to || !from) {
if (type == NULL) { log_error("%s connection %d has missing regions", zText, bid);
log_error("[read_borders] unknown connection type '%s' in %s\n", zText, regionname(from, NULL)); }
assert(type || !"connection type not registered"); if (type->read) {
// skip ahead
connection dummy;
type->read(&dummy, store);
}
continue;
} }
if (to == from && type && from) { if (to == from && type && from) {