Permalink
Browse files

Make hasattrval() useful when empty_attrs is off.

  • Loading branch information...
talvo committed Oct 11, 2017
1 parent 501b463 commit 381d40e616ecbff0be172af8c80e56f52a28c30c
Showing with 27 additions and 5 deletions.
  1. +1 −0 CHANGES.186
  2. +1 −1 game/txt/hlp/pennfunc.hlp
  3. +17 −1 game/txt/hlp/pennv186.hlp
  4. +8 −3 src/fundb.c
View
@@ -33,6 +33,7 @@ Minor changes:
* MySQL Stored Procedures should now work without causing 'Out of sync' errors. Patch by Mercutio. [1100]
* Make log rotation more robust. [SW]
* fraction() now takes a second arg; fraction(1.5,true) returns "1 1/2", rather than "3/2". [MG]
* hasattrval() now returns 0 for attributes containing a single space when the empty_attrs config option is false. [MG]
Hardcode:
* Upgrade random number generator to SFMT 1.5.1. [SW]
@@ -1686,7 +1686,7 @@ See also: gt(), lt(), lte(), eq(), neq(), lmath()
hasattrp() also checks for <attribute> on <object>'s parent/ancestor.
hasattrval() only returns 1 if <attribute> exists and is non-empty.
hasattrval() only returns 1 if <attribute> exists and is non-empty. An "empty" attr is one containing a null value (if the empty_attrs config option is on), or one containing a single space (if the option is off).
hasattrpval() is like hasattrval() but also checks parents.
View
@@ -18,13 +18,29 @@ Fixes:
* Fix overflow bug in mapsql(). [MG]
* elements() would very rarely give an extra delimiter. Reported by Ashen-Shugar. [1108-MG]
* Missing null termination in 'buy' fixed by CLDawes. [1128]
* Fix an off-by-one error in switch handling code that could cause a crash on startup. [SW]
* Fix an issue with table() not fitting maximum number of columns in a line. Reported by Degraine. [1119-SW].
* Fix an issue where writes to a socket sometimes shut down the connection needlessly. [1136-SW]
Major changes:
* Supports client charset negotiation of UTF-8. This means the mush can send and recieve UTF-8, but still uses latin-1 internally. Unicode characters that aren't part of latin-1 are not supported. Yet. [SW]
Minor changes:
* Upgrade random number generator to SFMT 1.5.1. [SW]
* New @lock/chown controls who can @chown a CHOWN_OK object. Suggested by Frakir. [1127-MG]
* The 'buy' command now pays the vendor, rather than the money disappearing into a black hole. Suggested by moniker, patch by CLDawes. [1128]
* Help changes by Xperta, Trinsec, Elwyndas and others. [MG]
* MySQL Stored Procedures should now work without causing 'Out of sync' errors. Patch by Mercutio. [1100]
* Make log rotation more robust. [SW]
* fraction() now takes a second arg; fraction(1.5,true) returns "1 1/2", rather than "3/2". [MG]
* hasattrval() now returns 0 for attributes containing a single space when the empty_attrs config option is false. [MG]
Hardcode:
* Upgrade random number generator to SFMT 1.5.1. [SW]
* Use a better seed for the RNG on Windows. [SW]
* mkcmds.pl uses a better way to generate temporary files. [SW]
* Use clang-format instead of GNU indent to format source code. [SW]
* Use poll(2) instead of select(2) for the main game event loop. [SW]
* Slave procceses use prctl(2) on Linux to be notified of the mush exiting instead of checking periodically. [SW]
& 1.8.6p1
Version 1.8.6 patchlevel 1 Mar 29, 2017
View
@@ -231,9 +231,14 @@ FUNCTION(fun_hasattr)
else
a = atr_get_noparent(thing, upcasestr(attrib));
if (a && Can_Read_Attr(executor, thing, a)) {
if (strchr(called_as, 'V'))
safe_chr(*AL_STR(a) ? '1' : '0', buff, bp);
else
if (strchr(called_as, 'V')) {
if (!*AL_STR(a))
safe_chr('0', buff, bp);
else if (!EMPTY_ATTRS && *AL_STR(a) && *AL_STR(a) == ' ' && !(AL_STR(a))[1])
safe_chr('0', buff, bp);
else
safe_chr('1', buff, bp);
} else
safe_chr('1', buff, bp);
return;
} else if (a || !Can_Examine(executor, thing)) {

0 comments on commit 381d40e

Please sign in to comment.