(svn r20248) -Codechange: use a copy-constructor instead of a separate function co clone GRFConfig/GRFError

This commit is contained in:
yexo
2010-07-31 09:32:44 +00:00
parent 1e86effbd3
commit cb5cfd7f8c
3 changed files with 52 additions and 31 deletions

View File

@@ -548,8 +548,7 @@ struct NewGRFWindow : public QueryStringBaseWindow {
}
}
GRFConfig *c = DuplicateGRFConfig(this->avail_sel); // Copy GRF details from scanned list.
c->next = NULL;
GRFConfig *c = new GRFConfig(*this->avail_sel); // Copy GRF details from scanned list.
*list = c; // Append GRF config to configuration list.
/* Select next (or previous, if last one) item in the list. */
@@ -720,7 +719,7 @@ struct NewGRFWindow : public QueryStringBaseWindow {
const GRFConfig *f = FindGRFConfig(c->ident.grfid, compatible ? c->original_md5sum : c->ident.md5sum);
if (f == NULL) continue;
*l = DuplicateGRFConfig(f);
*l = new GRFConfig(*f);
(*l)->next = c->next;
if (active_sel == c) active_sel = *l;