… | |
… | |
927 | for (unordered_vector<object *>::iterator i = mortals.begin (); i != mortals.end ();) |
927 | for (unordered_vector<object *>::iterator i = mortals.begin (); i != mortals.end ();) |
928 | if ((*i)->refcnt) |
928 | if ((*i)->refcnt) |
929 | ++i; // further delay freeing |
929 | ++i; // further delay freeing |
930 | else |
930 | else |
931 | { |
931 | { |
|
|
932 | //printf ("free_mortal(%p,%ld,%ld)\n", *i, pticks, (*i)->count);//D |
932 | //freed.push_back (*i);//D |
933 | //freed.push_back (*i);//D |
933 | delete *i; |
934 | delete *i; |
934 | mortals.erase (i); |
935 | mortals.erase (i); |
935 | } |
936 | } |
936 | |
937 | |
… | |
… | |
953 | } |
954 | } |
954 | |
955 | |
955 | void object::link () |
956 | void object::link () |
956 | { |
957 | { |
957 | count = ++ob_count; |
958 | count = ++ob_count; |
|
|
959 | uuid = gen_uuid (); |
958 | |
960 | |
959 | prev = 0; |
961 | prev = 0; |
960 | next = objects; |
962 | next = objects; |
961 | |
963 | |
962 | if (objects) |
964 | if (objects) |
… | |
… | |
965 | objects = this; |
967 | objects = this; |
966 | } |
968 | } |
967 | |
969 | |
968 | void object::unlink () |
970 | void object::unlink () |
969 | { |
971 | { |
970 | count = 0; |
972 | //count = 0;//D |
971 | uuid = gen_uuid (); |
973 | if (!prev && !next) return;//D |
972 | |
974 | |
973 | if (this == objects) |
975 | if (this == objects) |
974 | objects = next; |
976 | objects = next; |
975 | |
977 | |
976 | /* Remove this object from the list of used objects */ |
978 | /* Remove this object from the list of used objects */ |
977 | if (prev) |
|
|
978 | { |
|
|
979 | prev->next = next; |
979 | if (prev) prev->next = next; |
|
|
980 | if (next) next->prev = prev; |
|
|
981 | |
980 | prev = 0; |
982 | prev = 0; |
981 | } |
|
|
982 | |
|
|
983 | if (next) |
|
|
984 | { |
|
|
985 | next->prev = prev; |
|
|
986 | next = 0; |
983 | next = 0; |
987 | } |
|
|
988 | } |
984 | } |
989 | |
985 | |
990 | object *object::create () |
986 | object *object::create () |
991 | { |
987 | { |
992 | object *op; |
988 | object *op; |
… | |
… | |
1026 | |
1022 | |
1027 | if (!QUERY_FLAG (this, FLAG_REMOVED)) |
1023 | if (!QUERY_FLAG (this, FLAG_REMOVED)) |
1028 | remove_ob (this); |
1024 | remove_ob (this); |
1029 | |
1025 | |
1030 | SET_FLAG (this, FLAG_FREED); |
1026 | SET_FLAG (this, FLAG_FREED); |
|
|
1027 | |
|
|
1028 | //printf ("free(%p,%ld,%ld)\n", this, pticks, count);//D |
1031 | |
1029 | |
1032 | if (more) |
1030 | if (more) |
1033 | { |
1031 | { |
1034 | more->free (free_inventory); |
1032 | more->free (free_inventory); |
1035 | more = 0; |
1033 | more = 0; |
… | |
… | |
2735 | |
2733 | |
2736 | if (tempfile == NULL) |
2734 | if (tempfile == NULL) |
2737 | { |
2735 | { |
2738 | LOG (llevError, "Error - Unable to access load object temp file\n"); |
2736 | LOG (llevError, "Error - Unable to access load object temp file\n"); |
2739 | return NULL; |
2737 | return NULL; |
2740 | }; |
2738 | } |
|
|
2739 | |
2741 | fprintf (tempfile, obstr); |
2740 | fprintf (tempfile, obstr); |
2742 | fclose (tempfile); |
2741 | fclose (tempfile); |
2743 | |
2742 | |
2744 | op = get_object (); |
2743 | op = get_object (); |
2745 | |
2744 | |