Codechange: Pass ContentInfo by reference.
Many functions take a ContentInfo pointer, but do not check for nullptr. Pass by reference instead to assure it is present.
This commit is contained in:
committed by
Peter Nelson
parent
1cfad1474a
commit
7b31f26611
@@ -165,11 +165,11 @@ void BaseNetworkContentDownloadStatusWindow::DrawWidget(const Rect &r, WidgetID
|
||||
}
|
||||
}
|
||||
|
||||
void BaseNetworkContentDownloadStatusWindow::OnDownloadProgress(const ContentInfo *ci, int bytes)
|
||||
void BaseNetworkContentDownloadStatusWindow::OnDownloadProgress(const ContentInfo &ci, int bytes)
|
||||
{
|
||||
if (ci->id != this->cur_id) {
|
||||
this->name = ci->filename;
|
||||
this->cur_id = ci->id;
|
||||
if (ci.id != this->cur_id) {
|
||||
this->name = ci.filename;
|
||||
this->cur_id = ci.id;
|
||||
this->downloaded_files++;
|
||||
}
|
||||
|
||||
@@ -298,10 +298,10 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void OnDownloadProgress(const ContentInfo *ci, int bytes) override
|
||||
void OnDownloadProgress(const ContentInfo &ci, int bytes) override
|
||||
{
|
||||
BaseNetworkContentDownloadStatusWindow::OnDownloadProgress(ci, bytes);
|
||||
include(this->receivedTypes, ci->type);
|
||||
include(this->receivedTypes, ci.type);
|
||||
|
||||
/* When downloading is finished change cancel in ok */
|
||||
if (this->downloaded_bytes == this->total_bytes) {
|
||||
@@ -792,7 +792,7 @@ public:
|
||||
|
||||
const NWidgetBase *checkbox = this->GetWidget<NWidgetBase>(WID_NCL_CHECKBOX);
|
||||
if (click_count > 1 || IsInsideBS(pt.x, checkbox->pos_x, checkbox->current_x)) {
|
||||
_network_content_client.ToggleSelectedState(this->selected);
|
||||
_network_content_client.ToggleSelectedState(*this->selected);
|
||||
this->content.ForceResort();
|
||||
this->content.ForceRebuild();
|
||||
}
|
||||
@@ -870,7 +870,7 @@ public:
|
||||
case WKC_RETURN:
|
||||
if (keycode == WKC_RETURN || !IsWidgetFocused(WID_NCL_FILTER)) {
|
||||
if (this->selected != nullptr) {
|
||||
_network_content_client.ToggleSelectedState(this->selected);
|
||||
_network_content_client.ToggleSelectedState(*this->selected);
|
||||
this->content.ForceResort();
|
||||
this->InvalidateData();
|
||||
}
|
||||
@@ -925,9 +925,9 @@ public:
|
||||
this->vscroll->SetCapacityFromWidget(this, WID_NCL_MATRIX);
|
||||
}
|
||||
|
||||
void OnReceiveContentInfo(const ContentInfo *rci) override
|
||||
void OnReceiveContentInfo(const ContentInfo &rci) override
|
||||
{
|
||||
if (this->auto_select && !rci->IsSelected()) _network_content_client.ToggleSelectedState(rci);
|
||||
if (this->auto_select && !rci.IsSelected()) _network_content_client.ToggleSelectedState(rci);
|
||||
this->content.ForceRebuild();
|
||||
this->InvalidateData(0, false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user