(svn r14933) -Codechange: check the whether a pool item can be constructed instead of trying to make it and check for NULL.

This commit is contained in:
rubidium
2009-01-09 14:59:02 +00:00
parent 331b8dd7d4
commit f0b0691bfe
7 changed files with 88 additions and 115 deletions

View File

@@ -609,22 +609,23 @@ static EffectTickProc * const _effect_tick_procs[] = {
Vehicle *CreateEffectVehicle(int x, int y, int z, EffectVehicleType type)
{
if (!Vehicle::CanAllocateItem()) return NULL;
Vehicle *v = new EffectVehicle();
if (v != NULL) {
v->subtype = type;
v->x_pos = x;
v->y_pos = y;
v->z_pos = z;
v->tile = 0;
v->UpdateDeltaXY(INVALID_DIR);
v->vehstatus = VS_UNCLICKABLE;
v->subtype = type;
v->x_pos = x;
v->y_pos = y;
v->z_pos = z;
v->tile = 0;
v->UpdateDeltaXY(INVALID_DIR);
v->vehstatus = VS_UNCLICKABLE;
_effect_init_procs[type](v);
_effect_init_procs[type](v);
VehiclePositionChanged(v);
BeginVehicleMove(v);
EndVehicleMove(v);
VehiclePositionChanged(v);
BeginVehicleMove(v);
EndVehicleMove(v);
}
return v;
}