… | |
… | |
1224 | *ptr++ = '\n'; |
1224 | *ptr++ = '\n'; |
1225 | |
1225 | |
1226 | f.alloc (ptr - cur); |
1226 | f.alloc (ptr - cur); |
1227 | } |
1227 | } |
1228 | |
1228 | |
1229 | #define CMP_OUT(v) if (expect_false (op->v != arch->v)) f.put (KW (v), op->v) |
1229 | #define CMP_OUT(v) if (ecb_expect_false (op->v != arch->v)) f.put (KW (v), op->v) |
1230 | #define CMP_OUT2(k,v) if (expect_false (op->v != arch->v)) f.put (KW (k), op->v) |
1230 | #define CMP_OUT2(k,v) if (ecb_expect_false (op->v != arch->v)) f.put (KW (k), op->v) |
1231 | |
1231 | |
1232 | CMP_OUT (x); |
1232 | CMP_OUT (x); |
1233 | CMP_OUT (y); |
1233 | CMP_OUT (y); |
1234 | |
1234 | |
1235 | CMP_OUT (type); |
1235 | CMP_OUT (type); |
… | |
… | |
1324 | CMP_OUT (level); |
1324 | CMP_OUT (level); |
1325 | CMP_OUT (attacktype); |
1325 | CMP_OUT (attacktype); |
1326 | |
1326 | |
1327 | // using memcmp here seems to be a loss - is gcc vectorising? |
1327 | // using memcmp here seems to be a loss - is gcc vectorising? |
1328 | for (int i = 0; i < NROFATTACKS; i++) |
1328 | for (int i = 0; i < NROFATTACKS; i++) |
1329 | if (expect_false (op->resist[i] != arch->resist[i])) |
1329 | if (ecb_expect_false (op->resist[i] != arch->resist[i])) |
1330 | f.put (resist_save[i], op->resist[i]); |
1330 | f.put (resist_save[i], op->resist[i]); |
1331 | |
1331 | |
1332 | CMP_OUT (path_attuned); |
1332 | CMP_OUT (path_attuned); |
1333 | CMP_OUT (path_repelled); |
1333 | CMP_OUT (path_repelled); |
1334 | CMP_OUT (path_denied); |
1334 | CMP_OUT (path_denied); |
… | |
… | |
1386 | f.put (flag_names [FLAG_OBJ_ORIGINAL], op->flag [FLAG_OBJ_ORIGINAL] ? CS(1) : CS(0)); |
1386 | f.put (flag_names [FLAG_OBJ_ORIGINAL], op->flag [FLAG_OBJ_ORIGINAL] ? CS(1) : CS(0)); |
1387 | |
1387 | |
1388 | diff.reset (FLAG_OBJ_ORIGINAL); |
1388 | diff.reset (FLAG_OBJ_ORIGINAL); |
1389 | |
1389 | |
1390 | // quickly test whether any other flags differ |
1390 | // quickly test whether any other flags differ |
1391 | if (expect_true (diff.any ())) |
1391 | if (ecb_expect_true (diff.any ())) |
1392 | for (int i = 0; i < NUM_FLAGS; i++) |
1392 | for (int i = 0; i < NUM_FLAGS; i++) |
1393 | if (expect_false (diff [i])) |
1393 | if (ecb_expect_false (diff [i])) |
1394 | f.put (flag_names [i], op->flag [i] ? CS(1) : CS(0)); |
1394 | f.put (flag_names [i], op->flag [i] ? CS(1) : CS(0)); |
1395 | #else |
1395 | #else |
1396 | // use sgi extensions |
1396 | // use sgi extensions |
1397 | for (int i = diff._Find_first (); i < diff.size (); i = diff._Find_next (i)) |
1397 | for (int i = diff._Find_first (); i < diff.size (); i = diff._Find_next (i)) |
1398 | f.put (flag_names [i], op->flag [i] ? CS(1) : CS(0)); |
1398 | f.put (flag_names [i], op->flag [i] ? CS(1) : CS(0)); |
1399 | #endif |
1399 | #endif |
1400 | |
1400 | |
1401 | // save body locations. gcc's memcmp does an abysmal job when used |
1401 | // save body locations. gcc's memcmp does an abysmal job when used |
1402 | for (int i = 0; i < NUM_BODY_LOCATIONS; ++i) |
1402 | for (int i = 0; i < NUM_BODY_LOCATIONS; ++i) |
1403 | if (expect_false (op->slot[i].info != arch->slot[i].info)) |
1403 | if (ecb_expect_false (op->slot[i].info != arch->slot[i].info)) |
1404 | f.put (body_locations[i].kw, op->slot[i].info); |
1404 | f.put (body_locations[i].kw, op->slot[i].info); |
1405 | } |
1405 | } |
1406 | |
1406 | |
1407 | /* |
1407 | /* |
1408 | * Dumps all variables in an object to a file. |
1408 | * Dumps all variables in an object to a file. |
… | |
… | |
1410 | * the only place this is not set is when saving the player. |
1410 | * the only place this is not set is when saving the player. |
1411 | */ |
1411 | */ |
1412 | bool |
1412 | bool |
1413 | object::write (object_freezer &f) |
1413 | object::write (object_freezer &f) |
1414 | { |
1414 | { |
1415 | if (expect_false (is_arch ())) |
1415 | if (ecb_expect_false (is_arch ())) |
1416 | { |
1416 | { |
1417 | f.put (KW(object), arch->archname); |
1417 | f.put (KW(object), arch->archname); |
1418 | write_diff (f, this, archetype::empty); |
1418 | write_diff (f, this, archetype::empty); |
1419 | } |
1419 | } |
1420 | else |
1420 | else |