--- deliantra/server/common/object.C 2007/10/17 22:04:31 1.197
+++ deliantra/server/common/object.C 2008/04/10 15:35:15 1.202
@@ -1,11 +1,11 @@
/*
- * This file is part of Crossfire TRT, the Roguelike Realtime MORPG.
+ * This file is part of Deliantra, the Roguelike Realtime MMORPG.
*
- * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team
+ * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
* Copyright (©) 2001,2007 Mark Wedel & Crossfire Development Team
* Copyright (©) 1992,2007 Frank Tore Johansen
*
- * Crossfire TRT is free software: you can redistribute it and/or modify
+ * Deliantra is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@@ -18,7 +18,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
- * The authors can be reached via e-mail to
+ * The authors can be reached via e-mail to
*/
/* Eneq(@csd.uu.se): Added weight-modifiers in environment of objects.
@@ -35,9 +35,8 @@
#include
-int nrofallocobjects = 0;
-static UUID uuid;
-const uint64 UUID_SKIP = 1<<19;
+UUID UUID::cur;
+static const uint64 UUID_SKIP = 1<<19;
objectvec objects;
activevec actives;
@@ -72,7 +71,7 @@
return;
}
- fprintf (fp, "<1,%llx>\n", (unsigned long long)uuid.seq + UUID_SKIP * 2);
+ fprintf (fp, "<1,%llx>\n", (unsigned long long)UUID::cur.seq + UUID_SKIP * 2);
fclose (fp);
rename (filename2, filename1);
}
@@ -91,7 +90,7 @@
if (errno == ENOENT)
{
LOG (llevInfo, "RESET uid to 1\n");
- uuid.seq = 0;
+ UUID::cur.seq = 0;
write_uuid ();
return;
}
@@ -108,27 +107,27 @@
_exit (1);
}
- uuid.seq = uid;
+ UUID::cur.seq = uid;
write_uuid ();
LOG (llevDebug, "read UID: %" PRId64 "\n", uid);
fclose (fp);
}
UUID
-gen_uuid ()
+UUID::gen ()
{
UUID uid;
- uid.seq = ++uuid.seq;
+ uid.seq = ++cur.seq;
- if (!(uuid.seq & (UUID_SKIP - 1)))
+ if (!(cur.seq & (UUID_SKIP - 1)))
write_uuid ();
return uid;
}
void
-init_uuid ()
+UUID::init ()
{
read_uuid ();
}
@@ -431,12 +430,6 @@
return op;
}
-void
-free_all_object_data ()
-{
- LOG (llevDebug, "%d allocated objects\n", nrofallocobjects);
-}
-
/*
* Sets the owner and sets the skill and exp pointers to owner's current
* skill and experience objects.
@@ -450,6 +443,12 @@
while (owner->owner)
owner = owner->owner;
+ if (flag [FLAG_FREED])
+ {
+ LOG (llevError | logBacktrace, "tried to set owner of %s to %s\n", debug_desc (), owner->debug_desc ());
+ return;
+ }
+
this->owner = owner;
}
@@ -599,7 +598,7 @@
object::instantiate ()
{
if (!uuid.seq) // HACK
- uuid = gen_uuid ();
+ uuid = UUID::gen ();
speed_left = -0.1f;
/* copy the body_info to the body_used - this is only really
@@ -768,7 +767,7 @@
void object::link ()
{
assert (!index);//D
- uuid = gen_uuid ();
+ uuid = UUID::gen ();
count = ++object_count;
refcnt_inc ();
@@ -931,6 +930,7 @@
freed_map->name = "/internal/freed_objects_map";
freed_map->width = 3;
freed_map->height = 3;
+ freed_map->nodrop = 1;
freed_map->alloc ();
freed_map->in_memory = MAP_IN_MEMORY;
@@ -2014,7 +2014,7 @@
* ob doesn't have any move type (when used to place exits)
* so the AND operation in OB_TYPE_MOVE_BLOCK doesn't work.
*/
- if (ob->move_type == 0 && ms.move_block != MOVE_ALL)
+ if (ob && ob->move_type == 0 && ms.move_block != MOVE_ALL)
{
altern [index++] = i;
continue;