mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-30 08:15:37 +00:00
Allow '^' escape characters in books
http://forum.openmw.org/viewtopic.php?f=2&t=3373&p=37584&sid=1a0b015e6716b1bced37fd398ef876c7
This commit is contained in:
parent
b5dc3953a4
commit
ed57293e54
2 changed files with 13 additions and 12 deletions
|
@ -26,13 +26,14 @@ namespace Interpreter{
|
|||
return a.length() > b.length();
|
||||
}
|
||||
|
||||
std::string fixDefinesReal(std::string text, char eschar, bool isBook, Context& context)
|
||||
std::string fixDefinesReal(std::string text, bool dialogue, Context& context)
|
||||
{
|
||||
unsigned int start = 0;
|
||||
std::ostringstream retval;
|
||||
for(unsigned int i = 0; i < text.length(); i++)
|
||||
{
|
||||
if(text[i] == eschar)
|
||||
char eschar = text[i];
|
||||
if(eschar == '%' || eschar == '^')
|
||||
{
|
||||
retval << text.substr(start, i - start);
|
||||
std::string temp = Misc::StringUtils::lowerCase(text.substr(i+1, 100));
|
||||
|
@ -113,7 +114,7 @@ namespace Interpreter{
|
|||
retval << context.getCurrentCellName();
|
||||
}
|
||||
|
||||
else if(eschar == '%' && !isBook) { // In Dialogue, not messagebox
|
||||
else if(!dialogue) { // In Dialogue, not messagebox
|
||||
if( (found = check(temp, "faction", &i, &start))){
|
||||
retval << context.getNPCFaction();
|
||||
}
|
||||
|
@ -207,15 +208,15 @@ namespace Interpreter{
|
|||
return retval.str ();
|
||||
}
|
||||
|
||||
std::string fixDefinesDialog(std::string text, Context& context){
|
||||
return fixDefinesReal(text, '%', false, context);
|
||||
std::string fixDefinesDialog(const std::string& text, Context& context){
|
||||
return fixDefinesReal(text, true, context);
|
||||
}
|
||||
|
||||
std::string fixDefinesMsgBox(std::string text, Context& context){
|
||||
return fixDefinesReal(text, '^', false, context);
|
||||
std::string fixDefinesMsgBox(const std::string& text, Context& context){
|
||||
return fixDefinesReal(text, false, context);
|
||||
}
|
||||
|
||||
std::string fixDefinesBook(std::string text, Context& context){
|
||||
return fixDefinesReal(text, '%', true, context);
|
||||
std::string fixDefinesBook(const std::string& text, Context& context){
|
||||
return fixDefinesReal(text, false, context);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
#include "context.hpp"
|
||||
|
||||
namespace Interpreter{
|
||||
std::string fixDefinesDialog(std::string text, Context& context);
|
||||
std::string fixDefinesMsgBox(std::string text, Context& context);
|
||||
std::string fixDefinesBook(std::string text, Context& context);
|
||||
std::string fixDefinesDialog(const std::string& text, Context& context);
|
||||
std::string fixDefinesMsgBox(const std::string& text, Context& context);
|
||||
std::string fixDefinesBook(const std::string& text, Context& context);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue