diff options
| author | mniip <mniip@mniip.com> | 2013-08-22 12:52:14 (GMT) |
|---|---|---|
| committer | mniip <mniip@mniip.com> | 2013-08-22 13:51:19 (GMT) |
| commit | 4e9fe8b8e731d2edd5de254c0fd7b9162ebb0c77 (patch) | |
| tree | 950a1418596876dd4dcaf07dea91866cb824e9c4 /src/gui/game/SignTool.cpp | |
| parent | 95c01bcf0af64eed9e843346f3ff013cc7197cef (diff) | |
| download | powder-4e9fe8b8e731d2edd5de254c0fd7b9162ebb0c77.zip powder-4e9fe8b8e731d2edd5de254c0fd7b9162ebb0c77.tar.gz | |
regexless gameModel
Diffstat (limited to 'src/gui/game/SignTool.cpp')
| -rw-r--r-- | src/gui/game/SignTool.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/gui/game/SignTool.cpp b/src/gui/game/SignTool.cpp index 87ed59e..a71f8e2 100644 --- a/src/gui/game/SignTool.cpp +++ b/src/gui/game/SignTool.cpp @@ -177,16 +177,30 @@ void SignWindow::DoDraw() for(std::vector<sign>::iterator iter = sim->signs.begin(), end = sim->signs.end(); iter != end; ++iter) { sign & currentSign = *iter; - int x, y, w, h, dx, dy; + int x, y, w, h, dx, dy, match=0; Graphics * g = ui::Engine::Ref().g; std::string text = currentSign.getText(sim); + const char* str = currentSign.text.c_str(); currentSign.pos(text, x, y, w, h); g->clearrect(x, y, w+1, h); g->drawrect(x, y, w+1, h, 192, 192, 192, 255); - if (sregexp(currentSign.text.c_str(), "^{[ct]:[0-9]*|.*}$")) - g->drawtext(x+3, y+3, text, 255, 255, 255, 255); - else + if (str[0]=='{' && (str[1]=='c' || str[1]=='t') && str[2]==':' && str[3]>='0' && str[3]<='9') + { + const char* p=str+4; + while (*p>='0' && *p<='9') + p++; + if (*p=='|') + { + while (*p) + p++; + if (p[-1]=='}') + match=1; + } + } + if (match) g->drawtext(x+3, y+3, text, 0, 191, 255, 255); + else + g->drawtext(x+3, y+3, text, 255, 255, 255, 255); x = currentSign.x; y = currentSign.y; |
