//-------------------------------------------------------------------------------------------------- std::string DoSubstitution ( const std::string& originalString, const parseTree::Content_t* contentPtr, std::set<std::string>* usedVarsPtr ) //-------------------------------------------------------------------------------------------------- { std::string oldDir; // Check to see if we were given a context to work with... if (contentPtr != NULL) { // Currently we only populate CURDIR. However in the future we may add other variables based on // where the fragment where the text came from. oldDir = envVars::Get("CURDIR"); envVars::Set("CURDIR", path::MakeAbsolute(path::GetContainingDir(contentPtr->filePtr->path))); } // Actually subsitute any variables in the string now. auto result = DoSubstitution(originalString, usedVarsPtr); // Restore the old value of CURDIR if we had changed it before. if (contentPtr != NULL) { envVars::Set("CURDIR", oldDir); } return result; }
//-------------------------------------------------------------------------------------------------- std::string DoSubstitution ( const Token_t* tokenPtr, std::set<std::string>* usedVarsPtr ) //-------------------------------------------------------------------------------------------------- { return DoSubstitution(tokenPtr->text, tokenPtr, usedVarsPtr); }
static void ShoveChatStr (const char *str, BYTE who) { FString substBuff; if (str[0] == '/' && (str[1] == 'm' || str[1] == 'M') && (str[2] == 'e' || str[2] == 'E')) { // This is a /me message str += 3; who |= 2; } Net_WriteByte (DEM_SAY); Net_WriteByte (who); if (!chat_substitution || !DoSubstitution (substBuff, str)) { Net_WriteString (str); } else { Net_WriteString (substBuff); } }