diff options
| author | mniip <mniip@mniip.com> | 2013-08-22 15:50:20 (GMT) |
|---|---|---|
| committer | mniip <mniip@mniip.com> | 2013-08-22 15:50:20 (GMT) |
| commit | e2cb5838c6b89bf0f34aa08562d3e3763729cba6 (patch) | |
| tree | a627d039c8cf9952a9843fb11da690e6ab61f1f2 /src/simulation/Sign.cpp | |
| parent | 4a308cbf661bb40efdf53c6632f875c6c393a307 (diff) | |
| download | powder-e2cb5838c6b89bf0f34aa08562d3e3763729cba6.zip powder-e2cb5838c6b89bf0f34aa08562d3e3763729cba6.tar.gz | |
specially per @savask's request, put matcher into a function
returns 0 if no match, returns position of pipe character if there is
Diffstat (limited to 'src/simulation/Sign.cpp')
| -rw-r--r-- | src/simulation/Sign.cpp | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/src/simulation/Sign.cpp b/src/simulation/Sign.cpp index f6b8420..57a8a0d 100644 --- a/src/simulation/Sign.cpp +++ b/src/simulation/Sign.cpp @@ -33,30 +33,11 @@ std::string sign::getText(Simulation *sim) } else { - 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') + int pos=splitsign(signText); + if (pos) { - 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; + strcpy(buff, signText+pos+1); + buff[strlen(signText)-pos-2]=0; } else strcpy(buff, signText); |
