Fix bugs when moving signs

Signs could not be repositioned on top of another sign (dependent on
the indices of the two signs), and could not be placed after selecting
an element from the menu.
This commit is contained in:
jacksonmj 2012-04-29 00:34:56 +01:00
parent 34bfd77aa5
commit 38057065c2
2 changed files with 8 additions and 6 deletions

View File

@ -150,15 +150,17 @@ void add_sign_ui(pixel *vid_buf, int mx, int my)
int x0=(XRES-192)/2,y0=(YRES-80)/2,b=1,bq;
ui_edit ed;
// check if it is an existing sign
for (i=0; i<MAXSIGNS; i++)
if (signs[i].text[0])
{
if (i == MSIGN)
// if currently moving a sign, stop doing so
if (MSIGN!=-1)
{
MSIGN = -1;
return;
}
// check if it is an existing sign
for (i=0; i<MAXSIGNS; i++)
if (signs[i].text[0])
{
get_sign_pos(i, &x, &y, &w, &h);
if (mx>=x && mx<=x+w && my>=y && my<=y+h)
break;

View File

@ -2305,7 +2305,7 @@ int main(int argc, char *argv[])
}
}
if (c==WL_SIGN+100)
if (c==WL_SIGN+100 || MSIGN!=-1) // if sign tool is selected or a sign is being moved
{
if (!bq)
add_sign_ui(vid_buf, x, y);