|
@@ -163,15 +163,15 @@ static void PlayerFinancesWndProc(Window
|
|
|
const Player *p = GetPlayer(player);
|
|
|
|
|
|
/* Recheck the size of the window as it might need to be resized due to the local player changing */
|
|
|
int new_height = ((player != _local_player) ? 0 : 12) + ((WP(w, def_d).data_1 != 0) ? 48 : 74 + 10 * EXPENSES_END);
|
|
|
if (w->height != new_height) {
|
|
|
/* Make window dirty before and after resizing */
|
|
|
SetWindowDirty(w);
|
|
|
w->SetDirty();
|
|
|
w->height = new_height;
|
|
|
SetWindowDirty(w);
|
|
|
w->SetDirty();
|
|
|
|
|
|
w->SetWidgetHiddenState(PFW_WIDGET_INCREASE_LOAN, player != _local_player);
|
|
|
w->SetWidgetHiddenState(PFW_WIDGET_REPAY_LOAN, player != _local_player);
|
|
|
}
|
|
|
|
|
|
/* Borrow button only shows when there is any more money to loan */
|
|
@@ -485,13 +485,13 @@ static void SelectPlayerLiveryWndProc(Wi
|
|
|
|
|
|
if (_ctrl_pressed) {
|
|
|
ToggleBit(WP(w, livery_d).sel, j);
|
|
|
} else {
|
|
|
WP(w, livery_d).sel = 1 << j;
|
|
|
}
|
|
|
SetWindowDirty(w);
|
|
|
w->SetDirty();
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
|
|
@@ -889,13 +889,13 @@ static void SelectPlayerFaceWndProc(Wind
|
|
|
|
|
|
/* Load button */
|
|
|
case PFW_WIDGET_LOAD:
|
|
|
*pf = _player_face;
|
|
|
ScaleAllPlayerFaceBits(*pf);
|
|
|
ShowErrorMessage(INVALID_STRING_ID, STR_FACE_LOAD_DONE, 0, 0);
|
|
|
SetWindowDirty(w);
|
|
|
w->SetDirty();
|
|
|
break;
|
|
|
|
|
|
/* 'Player face number' button, view and/or set player face number */
|
|
|
case PFW_WIDGET_FACECODE:
|
|
|
SetDParam(0, *pf);
|
|
|
ShowQueryString(STR_JUST_INT, STR_FACE_FACECODE_CAPTION, 10 + 1, 0, w, CS_NUMERAL);
|
|
@@ -909,27 +909,27 @@ static void SelectPlayerFaceWndProc(Wind
|
|
|
|
|
|
/* Toggle gender (male/female) button */
|
|
|
case PFW_WIDGET_MALE:
|
|
|
case PFW_WIDGET_FEMALE:
|
|
|
SetPlayerFaceBits(*pf, PFV_GENDER, ge, e->we.click.widget - PFW_WIDGET_MALE);
|
|
|
ScaleAllPlayerFaceBits(*pf);
|
|
|
SetWindowDirty(w);
|
|
|
w->SetDirty();
|
|
|
break;
|
|
|
|
|
|
/* Randomize face button */
|
|
|
case PFW_WIDGET_RANDOM_NEW_FACE:
|
|
|
RandomPlayerFaceBits(*pf, ge, WP(w, facesel_d).advanced);
|
|
|
SetWindowDirty(w);
|
|
|
w->SetDirty();
|
|
|
break;
|
|
|
|
|
|
/* Toggle ethnicity (european/african) button */
|
|
|
case PFW_WIDGET_ETHNICITY_EUR:
|
|
|
case PFW_WIDGET_ETHNICITY_AFR:
|
|
|
SetPlayerFaceBits(*pf, PFV_ETHNICITY, ge, e->we.click.widget - PFW_WIDGET_ETHNICITY_EUR);
|
|
|
ScaleAllPlayerFaceBits(*pf);
|
|
|
SetWindowDirty(w);
|
|
|
w->SetDirty();
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
/* For all buttons from PFW_WIDGET_HAS_MOUSTACHE_EARRING to PFW_WIDGET_GLASSES_R is the same function.
|
|
|
* Therefor is this combined function.
|
|
|
* First it checks which PlayerFaceVariable will be change and then
|
|
@@ -962,25 +962,25 @@ static void SelectPlayerFaceWndProc(Wind
|
|
|
case 9: pfv = PFV_GLASSES; break; // Glasses buttons
|
|
|
}
|
|
|
/* 0 == left (_L), 1 == middle or 2 == right (_R) - button click */
|
|
|
IncreasePlayerFaceBits(*pf, pfv, ge, (((e->we.click.widget - PFW_WIDGET_EYECOLOUR_L) % 3) != 0) ? 1 : -1);
|
|
|
}
|
|
|
|
|
|
SetWindowDirty(w);
|
|
|
w->SetDirty();
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
case WE_ON_EDIT_TEXT:
|
|
|
/* Set a new player face number */
|
|
|
if (!StrEmpty(e->we.edittext.str)) {
|
|
|
*pf = strtoul(e->we.edittext.str, NULL, 10);
|
|
|
ScaleAllPlayerFaceBits(*pf);
|
|
|
ShowErrorMessage(INVALID_STRING_ID, STR_FACE_FACECODE_SET, 0, 0);
|
|
|
SetWindowDirty(w);
|
|
|
w->SetDirty();
|
|
|
} else {
|
|
|
ShowErrorMessage(INVALID_STRING_ID, STR_FACE_FACECODE_ERR, 0, 0);
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -1301,13 +1301,13 @@ static void PlayerCompanyWndProc(Window
|
|
|
#endif /* ENABLE_NETWORK */
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
case WE_MOUSELOOP:
|
|
|
/* redraw the window every now and then */
|
|
|
if ((++w->vscroll.pos & 0x1F) == 0) SetWindowDirty(w);
|
|
|
if ((++w->vscroll.pos & 0x1F) == 0) w->SetDirty();
|
|
|
break;
|
|
|
|
|
|
case WE_PLACE_OBJ:
|
|
|
if (DoCommandP(e->we.place.tile, 0, 0, NULL, CMD_BUILD_COMPANY_HQ | CMD_NO_WATER | CMD_MSG(STR_7071_CAN_T_BUILD_COMPANY_HEADQUARTERS)))
|
|
|
ResetObjectToPlace();
|
|
|
w->widget[PCW_WIDGET_BUILD_VIEW_HQ].type = WWT_PUSHTXTBTN; // this button can now behave as a normal push button
|