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

Comparing cf.schmorp.de/server/common/loader.C (file contents):
Revision 1.2 by root, Mon Sep 4 11:07:59 2006 UTC vs.
Revision 1.9 by root, Thu Sep 7 14:21:04 2006 UTC

499 if (thawer.get_sint32 ()) \ 499 if (thawer.get_sint32 ()) \
500 SET_FLAG (op, flag); \ 500 SET_FLAG (op, flag); \
501 else \ 501 else \
502 CLEAR_FLAG (op, flag) \ 502 CLEAR_FLAG (op, flag) \
503 503
504int parse_object (object * op, object_thawer & thawer, int map_flags) 504int parse_object (object *op, object_thawer &thawer, int map_flags)
505{ 505{
506 bool ismore = 0; 506 bool ismore = 0;
507 object *op_inv = op->inv;
507 508
508 for (;;) 509 for (;;)
509 { 510 {
510 keyword kw = thawer.get_kv (); 511 keyword kw = thawer.get_kv ();
511 512
512 switch (kw) 513 switch (kw)
513 { 514 {
515 case KW_Object: // uppercase alias
514 case KW_object: 516 case KW_object:
515 thawer.get (op->name); 517 thawer.get (op->name);
516 518
517 if (op->arch != NULL) 519 if (op->arch != NULL)
518 op->arch->name = op->name; 520 op->arch->name = op->name;
554 } 556 }
555 557
556 parse_object (tmp, thawer, map_flags); 558 parse_object (tmp, thawer, map_flags);
557 559
558 if (tmp->arch) 560 if (tmp->arch)
561 {
559 insert_ob_in_ob (tmp, op); 562 // was: insert_ob_in_ob (tmp, op);
563 // but manually adding it can improve map loading times a lot
564 // also, appending instead of prepending keeps the
565 // save ordering the same between repeated load/saves.
566 CLEAR_FLAG (tmp, FLAG_OBJ_ORIGINAL);
567 CLEAR_FLAG (tmp, FLAG_REMOVED);
568
569 if (!op_inv)
570 {
571 op->inv = tmp;
572 tmp->above = 0;
573 }
574 else
575 {
576 while (op_inv->below)
577 op_inv = op_inv->below;
578
579 op_inv->below = tmp;
580 tmp->above = op_inv;
581 }
582
583 tmp->below = 0;
584 tmp->env = op;
585 op_inv = tmp;
586 }
560 else 587 else
561 { 588 {
562 LOG (llevDebug, "Discarding object without arch: %s\n", 589 LOG (llevDebug, "Discarding object without arch: %s\n",
563 tmp->name ? (const char *) tmp->name : "(null)"); 590 tmp->name ? (const char *) tmp->name : "(null)");
564 free_object (tmp); 591 free_object (tmp);
624 op->move_slow |= MOVE_WALK; 651 op->move_slow |= MOVE_WALK;
625 thawer.get (op->move_slow_penalty); 652 thawer.get (op->move_slow_penalty);
626 break; 653 break;
627 654
628 case KW_face: 655 case KW_face:
656 if (const char *str = thawer.get_str ())
629 op->face = &new_faces[FindFace (thawer.get_str (), 0)]; 657 op->face = &new_faces[FindFace (str, 0)];
658 else
659 op->face = 0;
630 break; 660 break;
631 661
632 case KW_x: thawer.get (op->x); break; 662 case KW_x: thawer.get (op->x); break;
633 case KW_y: thawer.get (op->y); break; 663 case KW_y: thawer.get (op->y); break;
664 case KW_Str: // uppercase alias
634 case KW_str: thawer.get (op->stats.Str); break; 665 case KW_str: thawer.get (op->stats.Str); break;
666 case KW_Dex: // uppercase alias
635 case KW_dex: thawer.get (op->stats.Dex); break; 667 case KW_dex: thawer.get (op->stats.Dex); break;
668 case KW_Con: // uppercase alias
636 case KW_con: thawer.get (op->stats.Con); break; 669 case KW_con: thawer.get (op->stats.Con); break;
670 case KW_Wis: // uppercase alias
637 case KW_wis: thawer.get (op->stats.Wis); break; 671 case KW_wis: thawer.get (op->stats.Wis); break;
672 case KW_Cha: // uppercase alias
638 case KW_cha: thawer.get (op->stats.Cha); break; 673 case KW_cha: thawer.get (op->stats.Cha); break;
674 case KW_Int: // uppercase alias
639 case KW_int: thawer.get (op->stats.Int); break; 675 case KW_int: thawer.get (op->stats.Int); break;
676 case KW_Pow: // uppercase alias
640 case KW_pow: thawer.get (op->stats.Pow); break; 677 case KW_pow: thawer.get (op->stats.Pow); break;
641 case KW_hp: thawer.get (op->stats.hp); break; 678 case KW_hp: thawer.get (op->stats.hp); break;
642 case KW_maxhp: thawer.get (op->stats.maxhp); break; 679 case KW_maxhp: thawer.get (op->stats.maxhp); break;
643 case KW_sp: thawer.get (op->stats.sp); break; 680 case KW_sp: thawer.get (op->stats.sp); break;
644 case KW_maxsp: thawer.get (op->stats.maxsp); break; 681 case KW_maxsp: thawer.get (op->stats.maxsp); break;
965 1002
966 case KW_editable: 1003 case KW_editable:
967 case KW_editor_folder: 1004 case KW_editor_folder:
968 break; 1005 break;
969 1006
1007 case KW_More: // uppercase alias
970 case KW_more: 1008 case KW_more:
971 /* We need to record that this is a multipart object, 1009 /* We need to record that this is a multipart object,
972 * so the calling function can glue things back together 1010 * so the calling function can glue things back together
973 */ 1011 */
974 ismore = 1; 1012 ismore = 1;
996 thawer.line += strlen (thawer.line) + 1; 1034 thawer.line += strlen (thawer.line) + 1;
997 1035
998 break; 1036 break;
999 1037
1000 default: 1038 default:
1001 printf ("kw abort %d\n", kw);//D 1039 LOG (llevError, "UNSUPPORTED KEYWORD IN MAP: \"%s\", bug in normaliser. skipping.\n", keyword_str [kw]);
1002 abort (); 1040 break;
1003 } 1041 }
1004 } 1042 }
1005} 1043}
1006 1044
1007/* 1045/*
1028 * as appropriate in op. 1066 * as appropriate in op.
1029 * 1067 *
1030 * This function appears to be used in only 2 places - in crossedit to 1068 * This function appears to be used in only 2 places - in crossedit to
1031 * override values and in c_wiz to mutate values. 1069 * override values and in c_wiz to mutate values.
1032 */ 1070 */
1071int
1033int set_variable(object *op,char *buf) { 1072set_variable(object *op, char *buf)
1073{
1074 return 0;
1034#if 0 1075#if 0
1035 int retval; 1076 int retval;
1036 object_thawer thawer (0); 1077 object_thawer thawer (0);
1037 1078
1038 strcpy(msgbuf, ""); 1079 strcpy(msgbuf, "");
1095 1136
1096void init_vars() { 1137void init_vars() {
1097} 1138}
1098 1139
1099/* This returns a string of the integer movement type */ 1140/* This returns a string of the integer movement type */
1141#if 0
1142// unused function
1100static char* get_string_move_type(MoveType mt) 1143static char* get_string_move_type(MoveType mt)
1101{ 1144{
1102 static char retbuf[MAX_BUF], retbuf_all[MAX_BUF]; 1145 static char retbuf[MAX_BUF], retbuf_all[MAX_BUF];
1103 int i, all_count=0, count; 1146 int i, all_count=0, count;
1104 1147
1132 * 'all -walk -fly_low' - it is shorter to return 'fly_high swim' 1175 * 'all -walk -fly_low' - it is shorter to return 'fly_high swim'
1133 */ 1176 */
1134 if (all_count <=1) return retbuf_all+1; 1177 if (all_count <=1) return retbuf_all+1;
1135 else return retbuf+1; 1178 else return retbuf+1;
1136} 1179}
1137 1180#endif
1138 1181
1139// compare *op against *tmp and output differences 1182// compare *op against *tmp and output differences
1140void 1183void
1141put (object_freezer &f, object *op, object *tmp) 1184put (object_freezer &f, object *op, object *tmp)
1142{ 1185{
1173 if (op->lore != tmp->lore) f.put (KW_lore, KW_endlore, op->lore); 1216 if (op->lore != tmp->lore) f.put (KW_lore, KW_endlore, op->lore);
1174 1217
1175 CMP_OUT (other_arch); 1218 CMP_OUT (other_arch);
1176 CMP_OUT (face); 1219 CMP_OUT (face);
1177 1220
1221 if (!op->face || !op->face->name)
1222 printf ("ERRFACE<%s,%s, face %p,%p, fname%s>\n", &tmp->name, &op->name, tmp->face, op->face, op->face ? &op->face->name : "<noface>");//D
1223
1178 if (op->animation_id != tmp->animation_id) 1224 if (op->animation_id != tmp->animation_id)
1179 if (op->animation_id) 1225 if (op->animation_id)
1180 { 1226 {
1181 f.put (KW_animation, animations[GET_ANIM_ID (op)].name); 1227 f.put (KW_animation, animations[GET_ANIM_ID (op)].name);
1182 1228
1183 if (!QUERY_FLAG (op, FLAG_ANIMATE)) 1229 if (!QUERY_FLAG (op, FLAG_ANIMATE))
1184 f.put (KW_is_animated, 0); 1230 f.put (KW_is_animated, (sint32)0);
1185 } 1231 }
1186 else 1232 else
1187 f.put (KW_animation, "NONE"); 1233 f.put (KW_animation, (const char *)0);
1188 1234
1189 CMP_OUT2 (str , stats.Str); 1235 CMP_OUT2 (str , stats.Str);
1190 CMP_OUT2 (dex , stats.Dex); 1236 CMP_OUT2 (dex , stats.Dex);
1191 CMP_OUT2 (con , stats.Con); 1237 CMP_OUT2 (con , stats.Con);
1192 CMP_OUT2 (wis , stats.Wis); 1238 CMP_OUT2 (wis , stats.Wis);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines