{t:15100|text} to open a forum thread (will try to add more shortcuts later)

This commit is contained in:
jacob1 2012-10-02 21:31:39 -04:00 committed by Simon Robertshaw
parent 7c0ba094b8
commit 71db872e64
4 changed files with 15 additions and 6 deletions

View File

@ -536,7 +536,7 @@ bool GameController::MouseUp(int x, int y, unsigned button)
(*iter).pos(signx, signy, signw, signh);
if (x>=signx && x<=signx+signw && y>=signy && y<=signy+signh)
{
if (sregexp((*iter).text.c_str(), "^{c:[0-9]*|.*}$")==0)
if (sregexp((*iter).text.c_str(), "^{[c|t]:[0-9]*|.*}$")==0)
{
const char * signText = (*iter).text.c_str();
char buff[256];
@ -551,7 +551,16 @@ bool GameController::MouseUp(int x, int y, unsigned button)
int tempSaveID = format::StringToNumber<int>(std::string(buff));
if (tempSaveID)
{
if ((*iter).text.c_str()[1] == 'c')
OpenSavePreview(tempSaveID, 0);
else if ((*iter).text.c_str()[1] == 't')
{
char url[256];
sprintf(url, "http://powdertoy.co.uk/Discussions/Thread/View.html?Thread=%i", tempSaveID);
OpenURI(url);
}
}
break;
}
}

View File

@ -199,7 +199,7 @@ void SignWindow::DoDraw()
sprintf(buff, "Temp: 0.00"); //...temperature
g->drawtext(x+3, y+3, buff, 255, 255, 255, 255);
}
else if (sregexp(currentSign.text.c_str(), "^{c:[0-9]*|.*}$")==0)
else if (sregexp(currentSign.text.c_str(), "^{[c|t]:[0-9]*|.*}$")==0)
{
int sldr, startm;
memset(buff, 0, sizeof(buff));

View File

@ -848,7 +848,7 @@ void Renderer::DrawSigns()
sprintf(buff, "Temp: 0.00"); //...temperature
drawtext(x+3, y+3, buff, 255, 255, 255, 255);
}
else if (sregexp(signs[i].text.c_str(), "^{c:[0-9]*|.*}$")==0)
else if (sregexp(signs[i].text.c_str(), "^{[c|t]:[0-9]*|.*}$")==0)
{
int sldr, startm;
memset(buff, 0, sizeof(buff));

View File

@ -28,7 +28,7 @@ void sign::pos(int & x0, int & y0, int & w, int & h)
{
w = Graphics::textwidth("Temp: 0000.00");
}
else if (sregexp(text.c_str(), "^{c:[0-9]*|.*}$")==0)
else if (sregexp(text.c_str(), "^{[c|t]:[0-9]*|.*}$")==0)
{
int sldr, startm;
char buff[256];