mirror of
https://bitbucket.org/theswgsource/src-1.2.git
synced 2026-09-30 15:13:12 -04:00
remove unnecessary null checks
This commit is contained in:
@@ -5450,14 +5450,6 @@ int CreatureObject::getInstrumentVisualId() const
|
||||
return visualId;
|
||||
}
|
||||
|
||||
// last, check the look at target if no weapon is equipped
|
||||
if (!hasWeapon)
|
||||
{
|
||||
int visualId = internalGetInstrumentVisualId(getLookAtTarget());
|
||||
if(visualId)
|
||||
return visualId;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -231,7 +231,6 @@ void FactoryObject::removeDefaultTemplate()
|
||||
Controller* FactoryObject::createDefaultController()
|
||||
{
|
||||
Controller* controller = new TangibleController(this);
|
||||
NOT_NULL(controller);
|
||||
|
||||
setController(controller);
|
||||
return controller;
|
||||
|
||||
@@ -130,7 +130,6 @@ GroupObject::~GroupObject()
|
||||
Controller* GroupObject::createDefaultController()
|
||||
{
|
||||
Controller* controller = new GroupController(this);
|
||||
NOT_NULL(controller);
|
||||
|
||||
setController(controller);
|
||||
return controller;
|
||||
|
||||
@@ -114,7 +114,6 @@ GuildObject::~GuildObject()
|
||||
Controller* GuildObject::createDefaultController()
|
||||
{
|
||||
Controller* controller = new GuildController(this);
|
||||
NOT_NULL(controller);
|
||||
|
||||
setController(controller);
|
||||
return controller;
|
||||
|
||||
@@ -93,7 +93,6 @@ HarvesterInstallationObject::~HarvesterInstallationObject()
|
||||
Controller* HarvesterInstallationObject::createDefaultController(void)
|
||||
{
|
||||
Controller* _controller = new HarvesterInstallationController(this);
|
||||
NOT_NULL(_controller);
|
||||
|
||||
setController(_controller);
|
||||
return _controller;
|
||||
|
||||
@@ -129,7 +129,6 @@ void InstallationObject::removeDefaultTemplate(void)
|
||||
Controller* InstallationObject::createDefaultController(void)
|
||||
{
|
||||
Controller* _controller = new InstallationController(this);
|
||||
NOT_NULL(_controller);
|
||||
|
||||
setController(_controller);
|
||||
return _controller;
|
||||
|
||||
@@ -190,7 +190,6 @@ void ManufactureInstallationObject::endBaselines()
|
||||
Controller* ManufactureInstallationObject::createDefaultController()
|
||||
{
|
||||
Controller* const _controller = new ManufactureInstallationController(this);
|
||||
NOT_NULL(_controller);
|
||||
|
||||
setController(_controller);
|
||||
return _controller;
|
||||
|
||||
@@ -298,38 +298,37 @@ void ManufactureSchematicObject::endBaselines()
|
||||
ServerSynchronizedUi * ManufactureSchematicObject::createSynchronizedUi ()
|
||||
{
|
||||
ManufactureSchematicSynchronizedUi * sync = new ManufactureSchematicSynchronizedUi(*this);
|
||||
if (sync)
|
||||
{
|
||||
// set up the sync ui for our slots
|
||||
int i;
|
||||
int count;
|
||||
const DraftSchematicObject * draft = DraftSchematicObject::getSchematic(
|
||||
m_draftSchematic.get());
|
||||
NOT_NULL(draft);
|
||||
DynamicVariableList::NestedList slots(getObjVars(),OBJVAR_SLOTS);
|
||||
{
|
||||
Crafting::IngredientSlot slotData;
|
||||
count = slots.getCount();
|
||||
for (i = 0; i < count; ++i)
|
||||
{
|
||||
if (getSlot(i, slotData, false))
|
||||
{
|
||||
sync->createNewSlot(slotData.name, slotData.complexity);
|
||||
sync->setSlotType(slotData.name, slotData.ingredientType);
|
||||
sync->setSlotOption(slotData.name, slotData.draftSlotOption);
|
||||
sync->setSlotIndex(slotData.name, slotData.draftSlotIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
count = draft->getExperimentalAttributesCount();
|
||||
// set up the sync ui for our slots
|
||||
int i;
|
||||
int count;
|
||||
const DraftSchematicObject * draft = DraftSchematicObject::getSchematic(
|
||||
m_draftSchematic.get());
|
||||
NOT_NULL(draft);
|
||||
DynamicVariableList::NestedList slots(getObjVars(),OBJVAR_SLOTS);
|
||||
{
|
||||
Crafting::IngredientSlot slotData;
|
||||
count = slots.getCount();
|
||||
for (i = 0; i < count; ++i)
|
||||
{
|
||||
sync->setAttribute(draft->getExperimentalAttribute(i), 0);
|
||||
if (getSlot(i, slotData, false))
|
||||
{
|
||||
sync->createNewSlot(slotData.name, slotData.complexity);
|
||||
sync->setSlotType(slotData.name, slotData.ingredientType);
|
||||
sync->setSlotOption(slotData.name, slotData.draftSlotOption);
|
||||
sync->setSlotIndex(slotData.name, slotData.draftSlotIndex);
|
||||
}
|
||||
}
|
||||
|
||||
sync->setReady();
|
||||
}
|
||||
|
||||
count = draft->getExperimentalAttributesCount();
|
||||
for (i = 0; i < count; ++i)
|
||||
{
|
||||
sync->setAttribute(draft->getExperimentalAttribute(i), 0);
|
||||
}
|
||||
|
||||
sync->setReady();
|
||||
|
||||
return sync;
|
||||
}
|
||||
|
||||
@@ -647,8 +646,7 @@ bool ManufactureSchematicObject::getSlot(int index, Crafting::IngredientSlot & d
|
||||
const DynamicVariableList::NestedList ingredient(slotIngredients,buffer);
|
||||
|
||||
Crafting::ComponentIngredient * const component = new Crafting::ComponentIngredient();
|
||||
if (component == NULL)
|
||||
return false;
|
||||
|
||||
data.ingredients.push_back(Crafting::SimpleIngredientPtr(component));
|
||||
component->count = 1;
|
||||
if (!ingredient.hasItem(OBJVAR_COMPONENT_NAME))
|
||||
|
||||
@@ -238,7 +238,6 @@ PlanetObject::~PlanetObject()
|
||||
Controller* PlanetObject::createDefaultController(void)
|
||||
{
|
||||
Controller* controller = new PlanetController(this);
|
||||
NOT_NULL(controller);
|
||||
|
||||
setController(controller);
|
||||
return controller;
|
||||
|
||||
@@ -100,7 +100,6 @@ void ResourceContainerObject::removeDefaultTemplate(void)
|
||||
Controller* ResourceContainerObject::createDefaultController(void)
|
||||
{
|
||||
Controller* _controller = new ResourceContainerController(this);
|
||||
NOT_NULL(_controller);
|
||||
|
||||
setController(_controller);
|
||||
return _controller;
|
||||
|
||||
@@ -1666,7 +1666,6 @@ void ServerObject::conclude()
|
||||
Controller* ServerObject::createDefaultController(void)
|
||||
{
|
||||
Controller* controller = new ServerController(this);
|
||||
NOT_NULL(controller);
|
||||
|
||||
setController(controller);
|
||||
return controller;
|
||||
|
||||
@@ -1736,7 +1736,6 @@ void TangibleObject::setPvpRegion(Region const * pvpRegion)
|
||||
Controller* TangibleObject::createDefaultController(void)
|
||||
{
|
||||
Controller* controller = new TangibleController(this);
|
||||
NOT_NULL(controller);
|
||||
|
||||
setController(controller);
|
||||
return controller;
|
||||
|
||||
@@ -87,7 +87,6 @@ void UniverseObject::removeDefaultTemplate(void)
|
||||
Controller* UniverseObject::createDefaultController (void)
|
||||
{
|
||||
Controller* controller = new UniverseController(this);
|
||||
NOT_NULL(controller);
|
||||
|
||||
setController(controller);
|
||||
return controller;
|
||||
|
||||
@@ -38,7 +38,6 @@ VehicleObject::~VehicleObject()
|
||||
Controller* VehicleObject::createDefaultController(void)
|
||||
{
|
||||
Controller* controller = new VehicleController(this);
|
||||
NOT_NULL(controller);
|
||||
|
||||
setController(controller);
|
||||
return controller;
|
||||
|
||||
@@ -151,7 +151,6 @@ void WeaponObject::onLoadedFromDatabase()
|
||||
Controller* WeaponObject::createDefaultController(void)
|
||||
{
|
||||
Controller* controller = new WeaponController(this);
|
||||
NOT_NULL(controller);
|
||||
|
||||
setController(controller);
|
||||
return controller;
|
||||
|
||||
Reference in New Issue
Block a user