Merge branch 'master' into jgrpp

# Conflicts:
#	src/station_cmd.cpp
#	src/vehicle_gui.cpp
pull/434/head
Jonathan G Rennison 2 years ago
commit ac1071f4fc

@ -583,8 +583,8 @@ Company *DoStartupNewCompany(DoStartupNewCompanyFlag flags, CompanyID company)
c->inaugurated_year = _cur_year;
/* If starting a player company in singleplayer and a favorite company manager face is selected, choose it. Otherwise, use a random face.
* In a network game, we'll choose the favorite face later in CmdCompanyCtrl to sync it to all clients. */
if (_company_manager_face != 0 && !is_ai && !_networking) {
* In a network game, we'll choose the favorite face later in CmdCompanyCtrl to sync it to all clients, but we choose it here for the first (host) company. */
if (_company_manager_face != 0 && !is_ai) {
c->face = _company_manager_face;
} else {
RandomCompanyManagerFaceBits(c->face, (GenderEthnicity)Random(), false, false);

@ -212,9 +212,11 @@ static void DrawCategories(const Rect &r)
static void DrawPrice(Money amount, int left, int right, int top, TextColour colour)
{
StringID str = STR_FINANCES_NEGATIVE_INCOME;
if (amount < 0) {
if (amount == 0) {
str = STR_FINANCES_ZERO_INCOME;
} else if (amount < 0) {
amount = -amount;
str++;
str = STR_FINANCES_POSITIVE_INCOME;
}
SetDParam(0, amount);
DrawString(left, right, top, str, colour, SA_RIGHT);

@ -4736,6 +4736,7 @@ STR_FINANCES_SECTION_INFRASTRUCTURE_COSTS :{GOLD}Infrastru
STR_FINANCES_SECTION_INFRASTRUCTURE_INCOME :{GOLD}Infrastructure Sharing
STR_FINANCES_NEGATIVE_INCOME :-{CURRENCY_LONG}
STR_FINANCES_ZERO_INCOME :{CURRENCY_LONG}
STR_FINANCES_POSITIVE_INCOME :+{CURRENCY_LONG}
STR_FINANCES_NET_PROFIT :{WHITE}Net Profit
STR_FINANCES_BANK_BALANCE_TITLE :{WHITE}Bank Balance

@ -127,11 +127,11 @@ void MusicSystem::BuildPlaylists()
/* Load custom playlists
* Song index offsets are 1-based, zero indicates invalid/end-of-list value */
for (uint i = 0; i < NUM_SONGS_PLAYLIST; i++) {
if (_settings_client.music.custom_1[i] > 0) {
if (_settings_client.music.custom_1[i] > 0 && _settings_client.music.custom_1[i] <= NUM_SONGS_AVAILABLE) {
PlaylistEntry entry(set, _settings_client.music.custom_1[i] - 1);
if (entry.IsValid()) this->standard_playlists[PLCH_CUSTOM1].push_back(entry);
}
if (_settings_client.music.custom_2[i] > 0) {
if (_settings_client.music.custom_2[i] > 0 && _settings_client.music.custom_2[i] <= NUM_SONGS_AVAILABLE) {
PlaylistEntry entry(set, _settings_client.music.custom_2[i] - 1);
if (entry.IsValid()) this->standard_playlists[PLCH_CUSTOM2].push_back(entry);
}

@ -1350,15 +1350,17 @@ static const NWidgetPart _nested_client_list_widgets[] = {
NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_CL_CLIENT_NAME_EDIT), SetMinimalSize(12, 14), SetDataTip(SPR_RENAME, STR_NETWORK_CLIENT_LIST_PLAYER_NAME_EDIT_TOOLTIP),
EndContainer(),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(NWID_VERTICAL),
NWidget(WWT_MATRIX, COLOUR_GREY, WID_CL_MATRIX), SetMinimalSize(180, 0), SetResize(1, 1), SetFill(1, 1), SetMatrixDataTip(1, 0, STR_NULL), SetScrollbar(WID_CL_SCROLLBAR),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(NWID_VERTICAL),
NWidget(WWT_MATRIX, COLOUR_GREY, WID_CL_MATRIX), SetMinimalSize(180, 0), SetResize(1, 1), SetFill(1, 1), SetMatrixDataTip(1, 0, STR_NULL), SetScrollbar(WID_CL_SCROLLBAR),
NWidget(WWT_PANEL, COLOUR_GREY),
NWidget(WWT_TEXT, COLOUR_GREY, WID_CL_CLIENT_COMPANY_COUNT), SetFill(1, 0), SetMinimalTextLines(1, 0), SetResize(1, 0), SetPadding(2, 1, 2, 1), SetAlignment(SA_CENTER), SetDataTip(STR_NETWORK_CLIENT_LIST_CLIENT_COMPANY_COUNT, STR_NULL),
EndContainer(),
NWidget(NWID_VERTICAL),
NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_CL_SCROLLBAR),
NWidget(WWT_RESIZEBOX, COLOUR_GREY),
EndContainer(),
EndContainer(),
NWidget(NWID_VERTICAL),
NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_CL_SCROLLBAR),
NWidget(WWT_RESIZEBOX, COLOUR_GREY),
EndContainer(),
EndContainer(),
};
@ -2129,21 +2131,19 @@ public:
}
}
virtual void OnMouseLoop() override
void OnMouseOver(Point pt, int widget) override
{
if (GetWidgetFromPos(this, _cursor.pos.x - this->left, _cursor.pos.y - this->top) != WID_CL_MATRIX) {
this->hover_index = -1;
this->SetDirty();
return;
}
NWidgetBase *nwi = this->GetWidget<NWidgetBase>(WID_CL_MATRIX);
int y = _cursor.pos.y - this->top - nwi->pos_y - 2;
int index = y / this->line_height;
if (index != this->hover_index) {
this->hover_index = index;
this->SetDirty();
if (widget != WID_CL_MATRIX) {
if (this->hover_index != -1) {
this->hover_index = -1;
this->SetWidgetDirty(WID_CL_MATRIX);
}
} else {
int index = this->GetRowFromWidget(pt.y, widget, 0, -1);
if (index != this->hover_index) {
this->hover_index = index;
this->SetWidgetDirty(WID_CL_MATRIX);
}
}
}
};

@ -498,7 +498,7 @@ void Station::UpdateVirtCoord()
SetDParam(0, this->index);
SetDParam(1, this->facilities);
this->sign.UpdatePosition(ShouldShowBaseStationViewportLabel(this) ? ZOOM_LVL_DRAW_SPR : ZOOM_LVL_END, pt.x, pt.y, STR_VIEWPORT_STATION);
this->sign.UpdatePosition(ShouldShowBaseStationViewportLabel(this) ? ZOOM_LVL_DRAW_SPR : ZOOM_LVL_END, pt.x, pt.y, STR_VIEWPORT_STATION, STR_VIEWPORT_STATION_TINY);
if (_viewport_sign_kdtree_valid) _viewport_sign_kdtree.Insert(ViewportSignKdtreeItem::MakeStation(this->index));

@ -3651,6 +3651,9 @@ public:
if (v->type == VEH_TRAIN) {
this->SetWidgetLoweredState(WID_VV_FORCE_PROCEED, Train::From(v)->force_proceed == TFP_SIGNAL);
this->SetWidgetDisabledState(WID_VV_FORCE_PROCEED, !can_control);
}
if (v->type == VEH_TRAIN || v->type == VEH_ROAD) {
this->SetWidgetDisabledState(WID_VV_TURN_AROUND, !can_control);
}

@ -43,7 +43,7 @@ void Waypoint::UpdateVirtCoord()
if (_viewport_sign_kdtree_valid && this->sign.kdtree_valid) _viewport_sign_kdtree.Remove(ViewportSignKdtreeItem::MakeWaypoint(this->index));
SetDParam(0, this->index);
this->sign.UpdatePosition(ShouldShowBaseStationViewportLabel(this) ? ZOOM_LVL_DRAW_SPR : ZOOM_LVL_END, pt.x, pt.y - 32 * ZOOM_LVL_BASE, STR_VIEWPORT_WAYPOINT);
this->sign.UpdatePosition(ShouldShowBaseStationViewportLabel(this) ? ZOOM_LVL_DRAW_SPR : ZOOM_LVL_END, pt.x, pt.y - 32 * ZOOM_LVL_BASE, STR_VIEWPORT_WAYPOINT, STR_VIEWPORT_WAYPOINT_TINY);
if (_viewport_sign_kdtree_valid) _viewport_sign_kdtree.Insert(ViewportSignKdtreeItem::MakeWaypoint(this->index));

Loading…
Cancel
Save