diff --git a/engine/server/library/serverGame/src/shared/object/CreatureObject.cpp b/engine/server/library/serverGame/src/shared/object/CreatureObject.cpp index 07ada2df..4bc2186b 100755 --- a/engine/server/library/serverGame/src/shared/object/CreatureObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/CreatureObject.cpp @@ -1773,28 +1773,17 @@ void CreatureObject::initializeFirstTimeObject() //-- Get ourselves into a reasonable locomotion state. updateMovementInfo(); + // create the default weapon + initializeDefaultWeapon(); + + // set the current weapon + WeaponObject * weapon = getReadiedWeapon(); + if (weapon != NULL) + setCurrentWeapon(*weapon); + //Quick error check since all creatures should have a default weapon - std::string creature = getTemplateName(); - - //transport shuttles and other animated ships are "Creatures" but don't need weapons - //and throw warns if we try to give them one - //in their templates, most are marked "HACK" so let's just silence stuff for those - if (creature.find("object/creature/npc/theme_park") == std::string::npos) - { - // create the default weapon - initializeDefaultWeapon(); - - // set the current weapon - WeaponObject * weapon = getReadiedWeapon(); - if (weapon != NULL) - setCurrentWeapon(*weapon); - - //Quick error check since all creatures should have a default weapon - std::string creature = getTemplateName(); - - WARNING_STRICT_FATAL(!getDefaultWeapon(), ("Creature %s (%s) has no default " - "weapon", getNetworkId().getValueString().c_str(), getTemplateName())); - } + WARNING_STRICT_FATAL(!getDefaultWeapon(), ("Creature %s (%s) has no default " + "weapon", getNetworkId().getValueString().c_str(), getTemplateName())); const ServerCreatureObjectTemplate * myTemplate = safe_cast(getObjectTemplate()); Unicode::String newName = NameManager::getInstance().generateRandomName(ConfigServerGame::getCharacterNameGeneratorDirectory(), myTemplate->getNameGeneratorType()); @@ -3020,7 +3009,7 @@ void CreatureObject::initializeDefaultWeapon() if (weaponTemplate == NULL) { WARNING(true, ("Creature template %s has no valid default weapon!", getTemplateName())); - + // try to use the fallback weapon weaponTemplate = dynamic_cast(ObjectTemplateList::fetch(ConfigServerGame::getFallbackDefaultWeapon())); @@ -3030,15 +3019,12 @@ void CreatureObject::initializeDefaultWeapon() WeaponObject * const weapon = safe_cast(ServerWorld::createNewObject(*weaponTemplate, *this, s_defaultWeaponSlotId, false)); if (weapon != NULL) - { weapon->setAsDefaultWeapon(true); - } -#ifdef _DEBUG else { WARNING_STRICT_FATAL(true, ("CreatureObject::initializeDefaultWeapon unable to create default weapon %s for creature %s", weaponTemplate->getName(), getNetworkId().getValueString().c_str())); } -#endif + weaponTemplate->releaseReference(); } }