|
@@ -23,13 +23,12 @@
|
|
|
#include "cargotype.h"
|
|
|
#include "newgrf.h"
|
|
|
#include "newgrf_commons.h"
|
|
|
#include "newgrf_industries.h"
|
|
|
#include "newgrf_industrytiles.h"
|
|
|
#include "newgrf_callbacks.h"
|
|
|
#include "misc/autoptr.hpp"
|
|
|
#include "autoslope.h"
|
|
|
#include "transparency.h"
|
|
|
#include "water.h"
|
|
|
#include "strings_func.h"
|
|
|
#include "tile_cmd.h"
|
|
|
#include "functions.h"
|
|
@@ -1589,23 +1588,25 @@ static Industry *CreateNewIndustryHelper
|
|
|
const Town *t = CheckMultipleIndustryInTown(tile, type);
|
|
|
if (t == NULL) return NULL;
|
|
|
|
|
|
if (!CheckIfIndustryIsAllowed(tile, type, t)) return NULL;
|
|
|
if (!CheckSuitableIndustryPos(tile)) return NULL;
|
|
|
|
|
|
Industry *i = new Industry(tile);
|
|
|
if (i == NULL) return NULL;
|
|
|
AutoPtrT<Industry> i_auto_delete = i;
|
|
|
if (!Industry::CanAllocateItem()) return NULL;
|
|
|
|
|
|
if (flags & DC_EXEC) {
|
|
|
Industry *i = new Industry(tile);
|
|
|
if (!custom_shape_check) CheckIfCanLevelIndustryPlatform(tile, DC_EXEC, it, type);
|
|
|
DoCreateNewIndustry(i, tile, type, it, itspec_index, t, OWNER_NONE);
|
|
|
i_auto_delete.Detach();
|
|
|
|
|
|
return i;
|
|
|
}
|
|
|
|
|
|
return i;
|
|
|
/* We need to return a non-NULL pointer to tell we have created an industry.
|
|
|
* However, we haven't created a real one (no DC_EXEC), so return a fake one. */
|
|
|
return GetIndustry(0);
|
|
|
}
|
|
|
|
|
|
/** Build/Fund an industry
|
|
|
* @param tile tile where industry is built
|
|
|
* @param flags of operations to conduct
|
|
|
* @param p1 various bitstuffed elements
|