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}));
+ }
+}