ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/loader.C
(Generate patch)

Comparing deliantra/server/common/loader.C (file contents):
Revision 1.147 by root, Wed Nov 11 18:06:46 2009 UTC vs.
Revision 1.148 by root, Wed Nov 11 23:27:56 2009 UTC

1287 *ptr++ = '\n'; 1287 *ptr++ = '\n';
1288 1288
1289 f.alloc (ptr - cur); 1289 f.alloc (ptr - cur);
1290 } 1290 }
1291 1291
1292#define CMP_OUT(v) if (expect_false (op->v != arch->v)) f.put (KW_ ## v, op->v) 1292#define CMP_OUT(v) if (expect_false (op->v != arch->v)) f.put (KW (v), op->v)
1293#define CMP_OUT2(k,v) if (expect_false (op->v != arch->v)) f.put (KW_ ## k, op->v) 1293#define CMP_OUT2(k,v) if (expect_false (op->v != arch->v)) f.put (KW (k), op->v)
1294 1294
1295 CMP_OUT (x); 1295 CMP_OUT (x);
1296 CMP_OUT (y); 1296 CMP_OUT (y);
1297 1297
1298 CMP_OUT (type); 1298 CMP_OUT (type);
1329 1329
1330 CMP_OUT (tag); 1330 CMP_OUT (tag);
1331 CMP_OUT (custom_name); 1331 CMP_OUT (custom_name);
1332 1332
1333 if (object *owner = op->owner) 1333 if (object *owner = op->owner)
1334 f.put (KW_owner, static_cast<const char *>(owner->ref ())); 1334 f.put (KW(owner), static_cast<const char *>(owner->ref ()));
1335 1335
1336 // memory, attacked_by, chosen_skill, spellitem, spell, current_weapon, arch not saved 1336 // memory, attacked_by, chosen_skill, spellitem, spell, current_weapon, arch not saved
1337 1337
1338 CMP_OUT (other_arch); 1338 CMP_OUT (other_arch);
1339 1339
1340 if (op->msg != arch->msg ) f.put (KW_msg , KW_endmsg , op->msg ); 1340 if (op->msg != arch->msg ) f.put (KW(msg) , KW(endmsg) , op->msg );
1341 if (op->lore != arch->lore) f.put (KW_lore, KW_endlore, op->lore); 1341 if (op->lore != arch->lore) f.put (KW(lore), KW(endlore), op->lore);
1342 1342
1343 if (op->face != arch->face ) f.put (KW_face , op->face ? &faces [op->face ] : 0); 1343 if (op->face != arch->face ) f.put (KW(face) , op->face ? &faces [op->face ] : 0);
1344 if (op->sound != arch->sound ) f.put (KW_sound , op->sound ? &faces [op->sound ] : 0); 1344 if (op->sound != arch->sound ) f.put (KW(sound) , op->sound ? &faces [op->sound ] : 0);
1345 if (op->sound_destroy != arch->sound_destroy) f.put (KW_sound_destroy, op->sound_destroy ? &faces [op->sound_destroy] : 0); 1345 if (op->sound_destroy != arch->sound_destroy) f.put (KW(sound_destroy), op->sound_destroy ? &faces [op->sound_destroy] : 0);
1346 1346
1347 if (op->animation_id != arch->animation_id) 1347 if (op->animation_id != arch->animation_id)
1348 if (op->has_anim ()) 1348 if (op->has_anim ())
1349 f.put (KW_animation, op->anim ().name); 1349 f.put (KW(animation), op->anim ().name);
1350 else 1350 else
1351 { 1351 {
1352 f.put (KW_animation, (const char *)0); 1352 f.put (KW(animation));
1353 op->flag [FLAG_ANIMATE] = false; // TODO: why force to false here? 1353 op->flag [FLAG_ANIMATE] = false; // TODO: why force to false here?
1354 } 1354 }
1355 1355
1356 CMP_OUT2 (str, stats.Str); 1356 CMP_OUT2 (str, stats.Str);
1357 CMP_OUT2 (dex, stats.Dex); 1357 CMP_OUT2 (dex, stats.Dex);
1393 CMP_OUT (path_repelled); 1393 CMP_OUT (path_repelled);
1394 CMP_OUT (path_denied); 1394 CMP_OUT (path_denied);
1395 1395
1396 CMP_OUT2 (material, materials);//TODO: nuke 1396 CMP_OUT2 (material, materials);//TODO: nuke
1397 if (op->material != arch->material) 1397 if (op->material != arch->material)
1398 f.put (KW_materialname, op->material->name); 1398 f.put (KW(materialname), op->material->name);
1399 1399
1400 CMP_OUT (value); 1400 CMP_OUT (value);
1401 CMP_OUT (carrying); 1401 CMP_OUT (carrying);
1402 CMP_OUT (weight); 1402 CMP_OUT (weight);
1403 CMP_OUT (invisible); 1403 CMP_OUT (invisible);
1409 CMP_OUT (last_eat); 1409 CMP_OUT (last_eat);
1410 CMP_OUT (glow_radius); 1410 CMP_OUT (glow_radius);
1411 1411
1412 if (op->flag [FLAG_IS_LINKED]) 1412 if (op->flag [FLAG_IS_LINKED])
1413 if (auto (ol, op->find_link ())) 1413 if (auto (ol, op->find_link ()))
1414 f.put (KW_connected, ol->id); 1414 f.put (KW(connected), ol->id);
1415 1415
1416 CMP_OUT (randomitems); 1416 CMP_OUT (randomitems);
1417 CMP_OUT2 (container, weight_limit); 1417 CMP_OUT2 (container, weight_limit);
1418 1418
1419 CMP_OUT (run_away); 1419 CMP_OUT (run_away);
1439 CMP_OUT (move_slow_penalty); 1439 CMP_OUT (move_slow_penalty);
1440 1440
1441 object::flags_t diff = (op->flag ^ arch->flag) & flagmask; 1441 object::flags_t diff = (op->flag ^ arch->flag) & flagmask;
1442 1442
1443 if (diff [FLAG_OBJ_ORIGINAL]) 1443 if (diff [FLAG_OBJ_ORIGINAL])
1444 f.put (flag_names [FLAG_OBJ_ORIGINAL], op->flag [FLAG_OBJ_ORIGINAL] ? "1" : "0"); 1444 f.put (flag_names [FLAG_OBJ_ORIGINAL], op->flag [FLAG_OBJ_ORIGINAL] ? CS(1) : CS(0));
1445 1445
1446 diff.reset (FLAG_OBJ_ORIGINAL); 1446 diff.reset (FLAG_OBJ_ORIGINAL);
1447 1447
1448 // quickly test whether any other flags differ 1448 // quickly test whether any other flags differ
1449 if (expect_true (diff.any ())) 1449 if (expect_true (diff.any ()))
1450 for (int i = 0; i < NUM_FLAGS; i++) 1450 for (int i = 0; i < NUM_FLAGS; i++)
1451 if (expect_false (diff [i])) 1451 if (expect_false (diff [i]))
1452 f.put (flag_names [i], op->flag [i] ? "1" : "0"); 1452 f.put (flag_names [i], op->flag [i] ? CS(1) : CS(0));
1453 1453
1454 // save body locations. gcc's memcmp does an abysmal job when used 1454 // save body locations. gcc's memcmp does an abysmal job when used
1455 for (int i = 0; i < NUM_BODY_LOCATIONS; i++) 1455 for (int i = 0; i < NUM_BODY_LOCATIONS; i++)
1456 if (expect_false (op->slot[i].info != arch->slot[i].info)) 1456 if (expect_false (op->slot[i].info != arch->slot[i].info))
1457 f.put (body_locations[i].save_name, op->slot[i].info); 1457 f.put (body_locations[i].save_name, op->slot[i].info);
1463 * the only place this is not set is when saving the player. 1463 * the only place this is not set is when saving the player.
1464 */ 1464 */
1465bool 1465bool
1466object::write (object_freezer &f) 1466object::write (object_freezer &f)
1467{ 1467{
1468 if (is_arch ()) 1468 if (expect_false (is_arch ()))
1469 { 1469 {
1470 f.put (KW_object, arch->archname); 1470 f.put (KW(object), arch->archname);
1471 write_diff (f, this, archetype::empty); 1471 write_diff (f, this, archetype::empty);
1472 } 1472 }
1473 else 1473 else
1474 { 1474 {
1475 f.put (KW_arch, arch->archname); 1475 f.put (KW(arch), arch->archname);
1476 write_diff (f, this, arch); 1476 write_diff (f, this, arch);
1477 } 1477 }
1478 1478
1479 for (object *tmp = inv; tmp; tmp = tmp->below) 1479 for (object *tmp = inv; tmp; tmp = tmp->below)
1480 tmp->write (f); 1480 tmp->write (f);
1481 1481
1482 f.put (this); 1482 f.put (this);
1483 f.put (KW_end); 1483 f.put (KW(end));
1484 1484
1485 return true; 1485 return true;
1486} 1486}
1487 1487
1488///////////////////////////////////////////////////////////////////////////// 1488/////////////////////////////////////////////////////////////////////////////

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines