--- deliantra/server/common/loader.C 2006/09/03 22:45:55 1.1 +++ deliantra/server/common/loader.C 2006/09/04 17:27:13 1.6 @@ -511,6 +511,7 @@ switch (kw) { + case KW_Object: // uppercase alias case KW_object: thawer.get (op->name); @@ -556,7 +557,22 @@ parse_object (tmp, thawer, map_flags); if (tmp->arch) - insert_ob_in_ob (tmp, op); + { + // was: insert_ob_in_ob (tmp, op); + // but manually adding it can improve map loading times a lot + CLEAR_FLAG (tmp, FLAG_OBJ_ORIGINAL); + CLEAR_FLAG (tmp, FLAG_REMOVED); + tmp->env = op; + + if (!op->inv) + op->inv = tmp; + else + { + tmp->below = op->inv; + tmp->below->above = tmp; + op->inv = tmp; + } + } else { LOG (llevDebug, "Discarding object without arch: %s\n", @@ -626,17 +642,27 @@ break; case KW_face: - op->face = &new_faces[FindFace (thawer.get_str (), 0)]; + if (const char *str = thawer.get_str ()) + op->face = &new_faces[FindFace (str, 0)]; + else + op->face = 0; break; case KW_x: thawer.get (op->x); break; case KW_y: thawer.get (op->y); break; + case KW_Str: // uppercase alias case KW_str: thawer.get (op->stats.Str); break; + case KW_Dex: // uppercase alias case KW_dex: thawer.get (op->stats.Dex); break; + case KW_Con: // uppercase alias case KW_con: thawer.get (op->stats.Con); break; + case KW_Wis: // uppercase alias case KW_wis: thawer.get (op->stats.Wis); break; + case KW_Cha: // uppercase alias case KW_cha: thawer.get (op->stats.Cha); break; + case KW_Int: // uppercase alias case KW_int: thawer.get (op->stats.Int); break; + case KW_Pow: // uppercase alias case KW_pow: thawer.get (op->stats.Pow); break; case KW_hp: thawer.get (op->stats.hp); break; case KW_maxhp: thawer.get (op->stats.maxhp); break; @@ -967,6 +993,7 @@ case KW_editor_folder: break; + case KW_More: // uppercase alias case KW_more: /* We need to record that this is a multipart object, * so the calling function can glue things back together @@ -986,15 +1013,19 @@ return LL_EOF; case KW_ERROR: - set_ob_key_value(op, thawer.line, thawer.last_value, true); + set_ob_key_value (op, thawer.line, thawer.last_value, true); //printf ("addkv(%s,%s)\n", thawer.line, thawer.get_str());//D - // skip line, ugly - thawer.line = thawer.last_value + strlen (thawer.last_value) + 1; + //TODO: skip line, ugly, factor parsing better + if (thawer.last_value) + thawer.line = thawer.last_value; + + thawer.line += strlen (thawer.line) + 1; + break; default: - printf ("kw abort %d\n", kw);//D + printf ("kw abort %s\n", keyword_str [kw]);//D abort (); } } @@ -1131,7 +1162,6 @@ else return retbuf+1; } - // compare *op against *tmp and output differences void put (object_freezer &f, object *op, object *tmp) @@ -1171,16 +1201,19 @@ CMP_OUT (other_arch); CMP_OUT (face); + if (!op->face || !op->face->name) + printf ("ERRFACE<%s,%s, face %p,%p, fname%s>\n", &tmp->name, &op->name, tmp->face, op->face, op->face ? &op->face->name : "");//D + if (op->animation_id != tmp->animation_id) if (op->animation_id) { f.put (KW_animation, animations[GET_ANIM_ID (op)].name); if (!QUERY_FLAG (op, FLAG_ANIMATE)) - f.put (KW_is_animated, 0); + f.put (KW_is_animated, (sint32)0); } else - f.put (KW_animation, "NONE"); + f.put (KW_animation, (const char *)0); CMP_OUT2 (str , stats.Str); CMP_OUT2 (dex , stats.Dex); @@ -1274,7 +1307,7 @@ for (i = 0; i <= NUM_FLAGS; i++) if (flag_names [i] && (QUERY_FLAG (op, i) != QUERY_FLAG (tmp, i))) - f.put (flag_names [i], QUERY_FLAG (op, i) ? "1" : 0); + f.put (flag_names [i], QUERY_FLAG (op, i) ? "1" : "0"); /* Save body locations */ for (i = 0; i < NUM_BODY_LOCATIONS; i++)