--- deliantra/server/common/loader.C 2009/11/11 23:27:56 1.148 +++ deliantra/server/common/loader.C 2009/11/16 22:31:13 1.149 @@ -482,7 +482,7 @@ } static void -set_move (MoveType &mt, const char *str) +set_move (MoveType &mt, object_thawer &f) { static const struct flagstr { const char *name; @@ -498,13 +498,9 @@ { "all" , MOVE_ALL }, }; - if (!str) - { - mt = 0; - return; - } + const char *str = f.get_str (); - if (isdigit (*str)) + if (!*str || isdigit (*str)) { mt = atoi (str); return; @@ -512,7 +508,7 @@ mt = 0; - for (str = strtok ((char *) str, " "); str; str = strtok (0, " ")) + for (str = strtok ((char *)str, " "); str; str = strtok (0, " ")) { bool negate = 0; @@ -556,12 +552,11 @@ switch (f.kw) { case KW_uuid: - if (const char *s = f.get_str ()) - if (!uuid.parse (s)) - { - f.parse_warn ("unparseable uuid"); - uuid = UUID::gen (); - } + if (!uuid.parse (f.get_str ())) + { + f.parse_warn ("unparseable uuid"); + uuid = UUID::gen (); + } break; case KW_oid: @@ -636,8 +631,7 @@ CLEAR_FLAG (this, FLAG_ANIMATE); animation_id = 0; - const char *str = f.get_str (); - if (str && (animation_id = find_animation (str))) + if (f.has_value () && (animation_id = find_animation (f.get_str ()))) SET_FLAG (this, FLAG_ANIMATE); //TODO: should not be forced to true here } break; @@ -664,19 +658,29 @@ break; case KW_face: - face = face_find (f.get_str ()); + face = f.has_value () ? face_find (f.get_str ()) : blank_face; break; case KW_sound: - sound = sound_find (f.get_str ()); - if (!sound) - f.parse_warn ("sound not found"); + if (f.has_value ()) + { + sound = sound_find (f.get_str ()); + if (!sound) + f.parse_warn (format ("sound '%s' not found", f.get_str ())); + } + else + sound = 0; break; case KW_sound_destroy: - sound_destroy = sound_find (f.get_str ()); - if (!sound_destroy) - f.parse_warn ("sound not found"); + if (f.has_value ()) + { + sound_destroy = sound_find (f.get_str ()); + if (!sound_destroy) + f.parse_warn (format ("sound '%s' not found", f.get_str ())); + } + else + sound_destroy = 0; break; case KW_x: f.get (x); break; @@ -737,12 +741,12 @@ break; /* These are the new values */ - case KW_move_block: set_move (move_block, f.get_str ()); break; - case KW_move_allow: set_move (move_allow, f.get_str ()); break; - case KW_move_type: set_move (move_type, f.get_str ()); break; - case KW_move_on: set_move (move_on, f.get_str ()); break; - case KW_move_off: set_move (move_off, f.get_str ()); break; - case KW_move_slow: set_move (move_slow, f.get_str ()); break; + case KW_move_block: set_move (move_block, f); break; + case KW_move_allow: set_move (move_allow, f); break; + case KW_move_type: set_move (move_type , f); break; + case KW_move_on: set_move (move_on , f); break; + case KW_move_off: set_move (move_off , f); break; + case KW_move_slow: set_move (move_slow , f); break; /* These are all legacy - any new objects should use the move_ .. values */ case KW_no_pass: @@ -998,7 +1002,7 @@ break; case KW_randomitems: - if (f.get_str ()) + if (f.has_value ()) { randomitems = loading_arch