diff --git a/src/simulation/Sign.cpp b/src/simulation/Sign.cpp index 7ba94afda..f6b8420f9 100644 --- a/src/simulation/Sign.cpp +++ b/src/simulation/Sign.cpp @@ -31,25 +31,38 @@ std::string sign::getText(Simulation *sim) else sprintf(buff, "Temp: 0.00"); //...temperature } - else if (sregexp(signText, "^{[ct]:[0-9]*|.*}$")==0) - { - int sldr, startm; - memset(buff, 0, sizeof(buff)); - for (sldr=3; signText[sldr-1] != '|'; sldr++) - startm = sldr + 1; - sldr = startm; - while (signText[sldr] != '}') - { - buff[sldr - startm] = signText[sldr]; - sldr++; - } - } else { - sprintf(buff, "%s", signText); + int match=0; + const char* r; + const char* e; + if (signText[0]=='{' && (signText[1]=='c' || signText[1]=='t') && signText[2]==':' && signText[3]>='0' && signText[3]<='9') + { + const char* p=signText+4; + while (*p>='0' && *p<='9') + p++; + if (*p=='|') + { + r=p+1; + while (*p) + p++; + if (p[-1]=='}') + { + match=1; + e=p; + } + } + } + if (match) + { + strcpy(buff, r); + buff[e-r-1]=0; + } + else + strcpy(buff, signText); } - return std::string(buff,256); + return std::string(buff); } void sign::pos(std::string signText, int & x0, int & y0, int & w, int & h)