From b06860b7c9fd01166a3c54ad890f6dfbeed9dca0 Mon Sep 17 00:00:00 2001 From: Ari Johnson Date: Mon, 28 Dec 2009 19:02:51 +0000 Subject: [PATCH] Add % --- game/txt/changes/0.73p2 | 3 +++ src/parse.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) 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; -- 2.30.2