--- deliantra/server/common/arch.C 2007/07/01 05:00:17 1.68
+++ deliantra/server/common/arch.C 2007/11/08 19:43:23 1.71
@@ -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 (©) 2002,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
*/
#include
@@ -38,7 +38,7 @@
* MSW 2003-04-29
*/
-bool loading_arch; // ugly flag to object laoder etc. to suppress/request special processing
+archetype *loading_arch; // ugly flag to object laoder etc. to suppress/request special processing
// the hashtable
typedef std::tr1::unordered_map
@@ -301,7 +301,7 @@
archetype::unlink ()
{
ht.erase (archname);
- if (!strcmp (&archname, "Gaea")) fprintf (stderr, "oI\n");//D
+
if (archetypes.contains (this))
archetypes.erase (this);
}
@@ -333,6 +333,9 @@
name = "(null)";
}
+ if (loading_arch && !strcmp (&loading_arch->archname, name))
+ return loading_arch;
+
archetype *at = find (name);
if (!at)
@@ -349,8 +352,6 @@
{
assert (f.kw == KW_object);
- loading_arch = true; // hack to tell parse_kv et al. to behave
-
std::vector parts;
coroapi::cede_to_tick_every (10);
@@ -383,10 +384,16 @@
}
#endif
- if (!at->parse_kv (f))
+ loading_arch = at; // hack to tell parse_kv et al. to behave
+ bool parse_ok = at->parse_kv (f);
+ loading_arch = 0;
+
+ if (!parse_ok)
goto fail;
+ loading_arch = at; // hack to tell parse_kv et al. to behave
at->post_load_check ();
+ loading_arch = 0;
parts.push_back (at);
@@ -402,8 +409,6 @@
}
}
- loading_arch = false;
-
{
auto (at, parts.begin ());
@@ -477,7 +482,6 @@
for (auto (p, parts.begin ()); p != parts.end (); ++p)
(*p)->destroy (true);
- loading_arch = false;
return 0;
}
@@ -514,6 +518,12 @@
return op;
}
+object *
+archetype::instance ()
+{
+ return arch_to_object (this);
+}
+
/*
* Creates an object. This function is called by get_archetype()
* if it fails to find the appropriate archetype.