From: Ari Johnson Date: Mon, 28 Dec 2009 19:02:51 +0000 (+0000) Subject: Add % X-Git-Tag: 0.73p2~27 X-Git-Url: https://git.theari.com/?a=commitdiff_plain;h=099cf36aa82093ba4172461adc1606c3c323b07c;p=cobramush.git Add % (cherry picked from commit b06860b7c9fd01166a3c54ad890f6dfbeed9dca0) --- diff --git a/game/txt/changes/0.73p2 b/game/txt/changes/0.73p2 index 70a6a46..8fb2eea 100644 --- a/game/txt/changes/0.73p2 +++ b/game/txt/changes/0.73p2 @@ -7,6 +7,9 @@ CobraMUSH Version 0.73p2 Version 0.73p2 is a maintenance release of version 0.73. It is the second maintenance release in that series. + Major changes: + * Implement attribute value access by % [AEJ] + Fixes: * Add 'Command' lock to list of exemptions to Pass_Locks power [AEJ] diff --git a/src/parse.c b/src/parse.c index 157276e..df5be49 100644 --- a/src/parse.c +++ b/src/parse.c @@ -736,6 +736,19 @@ process_expression(char *buff, char **bp, char const **str, safe_chr(savec, buff, bp); (*str)++; switch (savec) { + case '<': + savec = **str; + if (!savec) + goto exit_sequence; + for (savec = **str; savec && savec != '>'; savec = **str) { + safe_chr(savec, buff, bp); + (*str)++; + } + if(!savec) + goto exit_sequence; + safe_chr(savec, buff, bp); + (*str)++; + break; case 'Q': case 'q': savec = **str; @@ -893,6 +906,29 @@ process_expression(char *buff, char **bp, char const **str, gender = get_gender(enactor); safe_str(poss[gender], buff, bp); break; + case '<': + if (!**str) + goto exit_sequence; + { + const char *tmp; + char atrname[BUFFER_LEN]; + ATTR *atr; + + for(tmp = *str; *tmp && *tmp != '>'; tmp++) + ; + if(!*tmp || tmp == *str) { + (*str)--; + goto exit_sequence; + } + strncpy(atrname, *str, tmp - *str); + atrname[tmp - *str] = '\0'; + + atr = atr_get(executor, strupper(atrname)); + if(atr) + safe_str(atr_value(atr), buff, bp); + *str = tmp + 1; + } + break; case 'Q': case 'q': /* temporary storage */ nextc = **str;