Auswertung von P_EXTRA_LOOK optimiert.
Nicht mehr alle Objekte im Inventar pruefen, sondern wenn ein Objekt in
das Living bewegt wird schauen, ob P_EXTRA_LOOK gesetzt ist und in ein
Array eintragen, welches dann von long() ausgewertet wird.
Change-Id: I1fefa021dee06c3d3006d6130b5a9069b76d3dd6
diff --git a/std/living/description.c b/std/living/description.c
index 6353ca9..f512e9c 100644
--- a/std/living/description.c
+++ b/std/living/description.c
@@ -187,6 +187,8 @@
// Extralook-Property speichern und vor manueller Aenderung schuetzen
// EMs duerfen, die wissen hoffentlich, was sie tun.
Set(P_INTERNAL_EXTRA_LOOK, SAVE|PROTECTED, F_MODE_AS);
+ SetProp(P_EXTRA_LOOK_OBS,({}));
+ Set(P_EXTRA_LOOK, PROTECTED, F_MODE_AS);
SetProp(P_CLOTHING,({}));
AddId("Living");
}
@@ -242,12 +244,25 @@
str += tmp;
if (stringp(tmp = QueryProp(P_INTERNAL_EXTRA_LOOK)))
str += tmp;
- for(ob = first_inventory(ME); ob; ob = next_inventory(ob))
- if(exl = ob->QueryProp(P_EXTRA_LOOK))
- str += exl;
- else if(exl = ob->extra_look())
- str += exl; // TO BE REMOVED
-
+ foreach(ob : QueryProp(P_EXTRA_LOOK_OBS))
+ {
+ if(objectp(ob) && environment(ob)==ME)
+ {
+ if((stringp(exl = ob->QueryProp(P_EXTRA_LOOK)))
+ {
+ str += exl;
+ }
+ else if(stringp(exl = ob->extra_look()))
+ {
+ str += exl; // TO BE REMOVED
+ }
+ }
+ else
+ {
+ // Bereinigen
+ SetProp(P_EXTRA_LOOK_OBS,QueryProp(P_EXTRA_LOOK_OBS)-({ob}));
+ }
+ }
if(filter_ldfied = QueryProp(P_TRANSPARENT))
{
@@ -330,3 +345,30 @@
return ([MAT_MISC_LIVING:100]);
}
+public void NotifyInsert(object ob, object oldenv)
+{
+ // Wenn ob mal einen Extralook hat und mal nicht, muss Magier sich was
+ // ueberlegen.
+ if(stringp(ob->QueryProp(P_EXTRA_LOOK)))
+ {
+ SetProp(P_EXTRA_LOOK_OBS,QueryProp(P_EXTRA_LOOK_OBS)+({ob}));
+ }
+
+ // Muss leider auch beachtet werden, sollte aber mal raus fliegen ...
+ if(function_exists("extra_look",ob))
+ {
+ SetProp(P_EXTRA_LOOK_OBS,QueryProp(P_EXTRA_LOOK_OBS)+({ob}));
+ catch(raise_error(
+ "Obsolete lfun extra_look() in "+load_name(ob));
+ publish);
+ }
+}
+
+public void NotifyLeave(object ob, object dest)
+{
+ object *els=QueryProp(P_EXTRA_LOOK_OBS);
+ if(member(els,ob)!=-1)
+ {
+ SetProp(P_EXTRA_LOOK_OBS,QueryProp(els-({ob}));
+ }
+}
diff --git a/std/npc.c b/std/npc.c
index f612f1e..a6d9ce6 100644
--- a/std/npc.c
+++ b/std/npc.c
@@ -169,6 +169,19 @@
_clone_items();
}
+public void NotifyInsert(object ob, object oldenv)
+{
+ restrictions::NotifyInsert(ob,oldenv);
+ description::NotifyInsert(ob,oldenv);
+}
+
+public void NotifyLeave(object ob, object dest)
+{
+ restrictions::NotifyLeave(ob,dest);
+ description::NotifyLeave(ob,dest);
+}
+
+
string _query_race()
{
if (stringp(Query(P_RACE))) return capitalize(Query(P_RACE));
diff --git a/std/player/base.c b/std/player/base.c
index ecc0a84..9d78006 100644
--- a/std/player/base.c
+++ b/std/player/base.c
@@ -282,6 +282,18 @@
GMCP_Room();
}
+public void NotifyInsert(object ob, object oldenv)
+{
+ restrictions::NotifyInsert(ob,oldenv);
+ description::NotifyInsert(ob,oldenv);
+}
+
+public void NotifyLeave(object ob, object dest)
+{
+ restrictions::NotifyLeave(ob,dest);
+ description::NotifyLeave(ob,dest);
+}
+
string Forschung()
{
return LEPMASTER->QueryForschung();