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.143 by root, Mon Nov 9 19:17:58 2009 UTC vs.
Revision 1.147 by root, Wed Nov 11 18:06:46 2009 UTC

330 330
331 if (!name_pl) 331 if (!name_pl)
332 name_pl = name; 332 name_pl = name;
333 333
334 /* objects now have a materialname. try to patch it in */ 334 /* objects now have a materialname. try to patch it in */
335 if (!(is_weapon () && level > 0)) 335 if (material == MATERIAL_NULL && !(is_weapon () && level > 0))
336 set_materialname (this, map ? map->difficulty : 5, 0); 336 select_material (this, map ? map->difficulty : 5);
337 337
338 /* only do these when program is first run - a bit 338 /* only do these when program is first run - a bit
339 * excessive to do this at every run - most of this is 339 * excessive to do this at every run - most of this is
340 * really just to catch any errors - program will still run, but 340 * really just to catch any errors - program will still run, but
341 * not in the ideal fashion. 341 * not in the ideal fashion.
725 case KW_invisible: f.get (invisible); break; 725 case KW_invisible: f.get (invisible); break;
726 case KW_magic: f.get (magic); break; 726 case KW_magic: f.get (magic); break;
727 case KW_state: f.get (state); break; 727 case KW_state: f.get (state); break;
728 case KW_move_slow_penalty: f.get (move_slow_penalty); break; 728 case KW_move_slow_penalty: f.get (move_slow_penalty); break;
729 case KW_material: f.get (materials); break; //TODO: nuke 729 case KW_material: f.get (materials); break; //TODO: nuke
730 case KW_materialname: f.get (materialname); break; 730
731 case KW_materialname:
732 {
733 shstr sh;
734 f.get (sh);
735 material = name_to_material (sh);
736 }
737 break;
731 738
732 /* These are the new values */ 739 /* These are the new values */
733 case KW_move_block: set_move (move_block, f.get_str ()); break; 740 case KW_move_block: set_move (move_block, f.get_str ()); break;
734 case KW_move_allow: set_move (move_allow, f.get_str ()); break; 741 case KW_move_allow: set_move (move_allow, f.get_str ()); break;
735 case KW_move_type: set_move (move_type, f.get_str ()); break; 742 case KW_move_type: set_move (move_type, f.get_str ()); break;
852 case KW_reflect_missile: GET_FLAG (this, FLAG_REFL_MISSILE); break; 859 case KW_reflect_missile: GET_FLAG (this, FLAG_REFL_MISSILE); break;
853 case KW_reflect_spell: GET_FLAG (this, FLAG_REFL_SPELL); break; 860 case KW_reflect_spell: GET_FLAG (this, FLAG_REFL_SPELL); break;
854 case KW_no_magic: GET_FLAG (this, FLAG_NO_MAGIC); break; 861 case KW_no_magic: GET_FLAG (this, FLAG_NO_MAGIC); break;
855 case KW_no_drop: GET_FLAG (this, FLAG_NO_DROP); break; 862 case KW_no_drop: GET_FLAG (this, FLAG_NO_DROP); break;
856 case KW_random_movement: GET_FLAG (this, FLAG_RANDOM_MOVE); break; 863 case KW_random_movement: GET_FLAG (this, FLAG_RANDOM_MOVE); break;
857 case KW_no_fix_player: GET_FLAG (this, FLAG_NO_FIX_PLAYER); break;
858 case KW_is_lightable: GET_FLAG (this, FLAG_IS_LIGHTABLE); break; 864 case KW_is_lightable: GET_FLAG (this, FLAG_IS_LIGHTABLE); break;
859 case KW_tear_down: GET_FLAG (this, FLAG_TEAR_DOWN); break; 865 case KW_tear_down: GET_FLAG (this, FLAG_TEAR_DOWN); break;
860 case KW_can_use_shield: GET_FLAG (this, FLAG_USE_SHIELD); break; 866 case KW_can_use_shield: GET_FLAG (this, FLAG_USE_SHIELD); break;
861 case KW_can_cast_spell: GET_FLAG (this, FLAG_CAST_SPELL); break; 867 case KW_can_cast_spell: GET_FLAG (this, FLAG_CAST_SPELL); break;
862 case KW_can_use_scroll: GET_FLAG (this, FLAG_USE_SCROLL); break; 868 case KW_can_use_scroll: GET_FLAG (this, FLAG_USE_SCROLL); break;
1168 KW_unaggressive, 1174 KW_unaggressive,
1169 KW_reflect_missile, 1175 KW_reflect_missile,
1170 /* 40 */ 1176 /* 40 */
1171 KW_reflect_spell, 1177 KW_reflect_spell,
1172 KW_no_magic, 1178 KW_no_magic,
1173 KW_no_fix_player, 1179 KW_NULL,
1174 KW_is_lightable, 1180 KW_is_lightable,
1175 KW_tear_down, 1181 KW_tear_down,
1176 KW_run_away, 1182 KW_run_away,
1177 KW_NULL, // pass_thru 1183 KW_NULL, // pass_thru
1178 KW_NULL, // an_pass_thru 1184 KW_NULL, // an_pass_thru
1295 1301
1296 CMP_OUT (name); 1302 CMP_OUT (name);
1297 CMP_OUT (name_pl); 1303 CMP_OUT (name_pl);
1298 1304
1299 CMP_OUT (speed); 1305 CMP_OUT (speed);
1300 CMP_OUT (speed_left); 1306
1307 // speed_left is a major time-burner, and has good locality, so
1308 // we use a simple lookup-cache to avoid the very slow printf.
1309 if (op->speed_left != arch->speed_left)
1310 {
1311 static double last_speed_left = 0.;
1312 static char last_speed_left_str [256] = "speed_left 0\n";
1313 static int last_speed_left_len = sizeof ("speed_left 0\n") - 1;
1314
1315 if (last_speed_left != op->speed_left)
1316 {
1317 last_speed_left = op->speed_left;
1318 last_speed_left_len = sizeof ("speed_left ") - 1
1319 + sprintf (last_speed_left_str + sizeof ("speed_left ") - 1, "%.7g\n", last_speed_left);
1320 }
1321
1322 f.add (last_speed_left_str, last_speed_left_len);
1323 }
1301 1324
1302 CMP_OUT (title); 1325 CMP_OUT (title);
1303 CMP_OUT (race); 1326 CMP_OUT (race);
1304 CMP_OUT (slaying); 1327 CMP_OUT (slaying);
1305 CMP_OUT (skill); 1328 CMP_OUT (skill);
1359 CMP_OUT (attack_movement); 1382 CMP_OUT (attack_movement);
1360 CMP_OUT (nrof); 1383 CMP_OUT (nrof);
1361 CMP_OUT (level); 1384 CMP_OUT (level);
1362 CMP_OUT (attacktype); 1385 CMP_OUT (attacktype);
1363 1386
1364 // using memcmp here seems to be a loss - us gcc vectorising? 1387 // using memcmp here seems to be a loss - is gcc vectorising?
1365 for (int i = 0; i < NROFATTACKS; i++) 1388 for (int i = 0; i < NROFATTACKS; i++)
1366 if (expect_false (op->resist[i] != arch->resist[i])) 1389 if (expect_false (op->resist[i] != arch->resist[i]))
1367 f.put (resist_save[i], op->resist[i]); 1390 f.put (resist_save[i], op->resist[i]);
1368 1391
1369 CMP_OUT (path_attuned); 1392 CMP_OUT (path_attuned);
1370 CMP_OUT (path_repelled); 1393 CMP_OUT (path_repelled);
1371 CMP_OUT (path_denied); 1394 CMP_OUT (path_denied);
1395
1372 CMP_OUT2 (material, materials);//TODO: nuke 1396 CMP_OUT2 (material, materials);//TODO: nuke
1373 CMP_OUT (materialname); 1397 if (op->material != arch->material)
1398 f.put (KW_materialname, op->material->name);
1399
1374 CMP_OUT (value); 1400 CMP_OUT (value);
1375 CMP_OUT (carrying); 1401 CMP_OUT (carrying);
1376 CMP_OUT (weight); 1402 CMP_OUT (weight);
1377 CMP_OUT (invisible); 1403 CMP_OUT (invisible);
1378 CMP_OUT (state); 1404 CMP_OUT (state);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines