extern void div_parse_que(dbref division, const char *command, dbref called_division, dbref player);
extern int queue_attribute_base
(dbref executor, const char *atrname, dbref enactor, int noparent);
+extern ATTR *queue_attribute_getatr(dbref executor, const char *atrname,
+ int noparent);
+extern int queue_attribute_useatr(dbref executor, ATTR *a, dbref enactor);
+
/** Queue the code in an attribute, including parent objects */
#define queue_attribute(a,b,c) queue_attribute_base(a,b,c,0)
/** Queue the code in an attribute, excluding parent objects */
#pragma warning( disable : 4761) /* disable warning re conversion */
#endif
+/** Attribute error - too many attribs */
+#define AE_TOOMANY -4
+/** Attribute error - invalid name */
+#define AE_BADNAME -3
+/** Attribute error - attempt to overwrite a safe attribute */
+#define AE_SAFE -2
+/** Attribute error - general failure */
+#define AE_ERROR -1
+
/* Catchall Attribute any non-standard attributes will conform to this */
ATTR *catchall;
if (Cannot_Write_This_Attr(player, atr, obj, 1, ns_chk, lock_owner)) {
free_atr_locks(atr);
- return 0;
+ return AE_ERROR;
}
free_atr_locks(atr);
if (Cannot_Write_This_Attr(player, atr, obj, 1, ns_chk, lock_owner)) {
free_atr_locks(atr);
missing_name[0] = '\0';
- return 0;
+ return AE_ERROR;
}
free_atr_locks(atr);
*p = '`';
do_log(LT_ERR, player, obj,
T("Attempt by %s(%d) to create too many attributes on %s(%d)"),
Name(player), player, Name(obj), obj);
- return 0;
+ return AE_TOOMANY;
}
return 1;
}
}
-/** Attribute error - invalid name */
-#define AE_BADNAME -3
-/** Attribute error - attempt to overwrite a safe attribute */
-#define AE_SAFE -2
-/** Attribute error - general failure */
-#define AE_ERROR -1
-
/** Add an attribute to an object, safely.
* \verbatim
* This is the function that should be called in hardcode to add
/* make a new atr, if needed */
if (!ptr) {
- if (!can_create_attr(player, thing, atr, flags)) {
+ int res = can_create_attr(player, thing, atr, flags);
+ if (res < 0) {
ooref = tooref;
- return AE_ERROR;
+ return res;
}
strcpy(missing_name, atr);
} else
notify(player, T("That attribute cannot be changed by you."));
return 0;
+ } else if (res == AE_TOOMANY) {
+ notify(player, T("Too many attributes on that object to add another."));
+ return 0;
} else if (!res) {
notify(player, T("No such attribute to reset."));
return 0;
int noparent)
{
ATTR *a;
- char *start, *command;
- dbref powinherit = NOTHING;
- dbref local_ooref;
- a = (noparent ? atr_get_noparent(executor, strupper(atrname)) :
- atr_get(executor, strupper(atrname)));
+ a = queue_attribute_getatr(executor, atrname, noparent);
if (!a)
return 0;
+ queue_attribute_useatr(executor, a, enactor);
+ return 1;
+}
+
+ATTR *
+queue_attribute_getatr(dbref executor, const char *atrname, int noparent)
+{
+ return (noparent ? atr_get_noparent(executor, strupper(atrname)) :
+ atr_get(executor, strupper(atrname)));
+}
+
+int
+queue_attribute_useatr(dbref executor, ATTR *a, dbref enactor)
+{
+ char *start, *command;
+ dbref powinherit = NOTHING;
+ dbref local_ooref;
if(AL_FLAGS(a) & AF_POWINHERIT)
powinherit = atr_on_obj;
start = safe_atr_value(a);
return 1;
}
+
/** Queue an entry on the wait or semaphore queues.
* This function creates and adds a queue entry to the wait queue
* or the semaphore queue. Wait queue entries are sorted by when