Changeset 1199
- Timestamp:
- 01/06/08 02:20:00 (9 months ago)
- Files:
-
- 1.8.3/branches/devel/CHANGES.183 (modified) (1 diff)
- 1.8.3/branches/devel/game/txt/hlp/pennfunc.hlp (modified) (1 diff)
- 1.8.3/branches/devel/hdrs/attrib.h (modified) (1 diff)
- 1.8.3/branches/devel/src/attrib.c (modified) (1 diff)
- 1.8.3/branches/devel/src/fundb.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
1.8.3/branches/devel/CHANGES.183
r1187 r1199 27 27 @readcache. 28 28 29 Functions: 30 * controls(<who>,<what>/<attribute>) tests if someone can change or 31 create a specific attribute on an object. By Talvo. 32 29 33 Fixes: 30 34 * Fixes from 1.8.2p9 35 36 31 37 32 38 Version 1.8.3 patchlevel 6 Jan 01, 2008 1.8.3/branches/devel/game/txt/hlp/pennfunc.hlp
r1196 r1199 821 821 See also: CONNECTED 822 822 & CONTROLS() 823 controls(<object>, <victim>) 824 825 This function returns 1 if <object> controls <victim>, or 0, if 826 it does not. If one of the objects does not exist, it will return 827 #-1 ARGN NOT FOUND (where N is the argument which is the invalid 828 object). You must control <object> or <victim>, or have the See_All 829 power, to use this function. 823 controls(<object>, <victim>[/<attribute>]) 824 825 With no <attribute>, this function returns 1 if <object> controls 826 <victim>, or 0, if it does not. With an <attribute>, it will return 1 827 if <object> could successfully set <attribute> on <victim> (or alter 828 <attribute>, if it already exists). If one of the objects does not exist, 829 it will return #-1 ARGN NOT FOUND (where N is the argument which is the 830 invalid object). If <attribute> is not a valid attribute name, it will 831 return #-1 BAD ATTR NAME. You must control <object> or <victim>, or have 832 the See_All power, to use this function. 830 833 831 834 See also: CONTROL 1.8.3/branches/devel/hdrs/attrib.h
r964 r1199 90 90 extern int can_write_attr_internal(dbref player, dbref obj, ATTR *attr, 91 91 int safe); 92 extern int can_edit_attr(dbref player, dbref thing, const char *attrname); 92 93 extern unsigned const char *atr_get_compressed_data(ATTR *atr); 93 94 extern char *atr_value(ATTR *atr); 1.8.3/branches/devel/src/attrib.c
r1135 r1199 390 390 } 391 391 392 /** If the attribute exists on the object, see if the player can modify it. 393 * Otherwise, see if they can create it. 394 * \param player the player trying to set the attr 395 * \param thing the object to check 396 * \param attrname the name of the attribute to check 397 * \retval 0 attribute cannot be changed by player 398 * \retval 1 attribute can be changed by player 399 */ 400 int 401 can_edit_attr(dbref player, dbref thing, const char *attrname) 402 { 403 ATTR *ptr = find_atr_in_list(List(thing), attrname); 404 if (ptr) { 405 if (AF_Safe(ptr) || !Can_Write_Attr(player, thing, ptr)) 406 return 0; 407 } else { 408 return (can_create_attr(player, thing, attrname, 0) == AE_OKAY); 409 } 410 } 411 392 412 /** Utility define for atr_add and can_create_attr */ 393 413 #define set_default_flags(atr,flags) \ 1.8.3/branches/devel/src/fundb.c
r1159 r1199 959 959 { 960 960 dbref it = match_thing(executor, args[0]); 961 dbref thing = match_thing(executor, args[1]); 962 963 if (!GoodObject(it)) 961 dbref thing; 962 char *attrname; 963 964 if (!GoodObject(it)) { 964 965 safe_str(T("#-1 ARG1 NOT FOUND"), buff, bp); 965 else if (!GoodObject(thing)) 966 return; 967 } 968 969 if ((attrname = strchr(args[1], '/')) != NULL) 970 *attrname++ = '\0'; 971 thing = match_thing(executor, args[1]); 972 if (!GoodObject(thing)) { 966 973 safe_str(T("#-1 ARG2 NOT FOUND"), buff, bp); 967 else if (!(controls(executor, it) || controls(executor, thing) 968 || See_All(executor))) 969 safe_str(T(e_perm), buff, bp); 970 else 974 return; 975 } 976 if (!(controls(executor, it) || controls(executor, thing) 977 || See_All(executor))) 978 safe_str(T(e_perm), buff, bp); 979 else if (attrname) { 980 if (!good_atr_name(upcasestr(attrname))) { 981 safe_str(T("#-1 BAD ATTR NAME"), buff, bp); 982 return; 983 } 984 safe_chr(can_edit_attr(it, thing, attrname) ? '1' : '0', buff, bp); 985 } else 971 986 safe_chr(controls(it, thing) ? '1' : '0', buff, bp); 972 987 }
