(svn r12855) -Codechange: do not use autoptr's for testing whether certain objects can be build, but check it directly in the pool so we do not have to call destructors in the testing phase. Stations still use the autoptr though.
This commit is contained in:
@@ -15,7 +15,6 @@
|
||||
#include "aircraft.h"
|
||||
#include "newgrf_cargo.h"
|
||||
#include "group.h"
|
||||
#include "misc/autoptr.hpp"
|
||||
#include "strings_func.h"
|
||||
#include "gfx_func.h"
|
||||
#include "functions.h"
|
||||
@@ -516,19 +515,15 @@ CommandCost AddEngineReplacement(EngineRenewList *erl, EngineID old_engine, Engi
|
||||
return CommandCost();
|
||||
}
|
||||
|
||||
er = new EngineRenew(old_engine, new_engine);
|
||||
if (er == NULL) return CMD_ERROR;
|
||||
AutoPtrT<EngineRenew> er_auto_delete = er;
|
||||
|
||||
if (!EngineRenew::CanAllocateItem()) return CMD_ERROR;
|
||||
|
||||
if (flags & DC_EXEC) {
|
||||
er = new EngineRenew(old_engine, new_engine);
|
||||
er->group_id = group;
|
||||
|
||||
/* Insert before the first element */
|
||||
er->next = (EngineRenew *)(*erl);
|
||||
*erl = (EngineRenewList)er;
|
||||
|
||||
er_auto_delete.Detach();
|
||||
}
|
||||
|
||||
return CommandCost();
|
||||
|
Reference in New Issue
Block a user