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')
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
p = plane.get(v)
@ -23,3 +24,5 @@ end
eressea.write_game(get_turn() .. '.new')
eressea.free_game()
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));
if (!strcmp(zText, "end"))
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);
if (data->version < UIDHASH_VERSION) {
int fx, fy, tx, ty;
@ -632,16 +639,17 @@ int read_borders(gamedata *data)
READ_INT(store, &tid);
from = findregionbyid(fid);
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) {
log_error("%s connection %d has missing regions", zText, bid);
}
if (type->read) {
// skip ahead
connection dummy;
type->read(&dummy, store);
}
type = find_bordertype(zText);
if (type == NULL) {
log_error("[read_borders] unknown connection type '%s' in %s\n", zText, regionname(from, NULL));
assert(type || !"connection type not registered");
continue;
}
if (to == from && type && from) {