Accept a ConstPtr in getModel

openmw-38
scrawl 9 years ago
parent d9bbd83b09
commit f258c5c508

@ -45,11 +45,9 @@ namespace MWClass
MWBase::Environment::get().getMechanicsManager()->add(ptr); MWBase::Environment::get().getMechanicsManager()->add(ptr);
} }
std::string Activator::getModel(const MWWorld::Ptr &ptr) const std::string Activator::getModel(const MWWorld::ConstPtr &ptr) const
{ {
MWWorld::LiveCellRef<ESM::Activator> *ref = const MWWorld::LiveCellRef<ESM::Activator> *ref = ptr.get<ESM::Activator>();
ptr.get<ESM::Activator>();
assert(ref->mBase != NULL);
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {

@ -39,7 +39,7 @@ namespace MWClass
static void registerSelf(); static void registerSelf();
virtual std::string getModel(const MWWorld::Ptr &ptr) const; virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
}; };
} }

@ -37,11 +37,9 @@ namespace MWClass
// TODO: add option somewhere to enable collision for placeable objects // TODO: add option somewhere to enable collision for placeable objects
} }
std::string Apparatus::getModel(const MWWorld::Ptr &ptr) const std::string Apparatus::getModel(const MWWorld::ConstPtr &ptr) const
{ {
MWWorld::LiveCellRef<ESM::Apparatus> *ref = const MWWorld::LiveCellRef<ESM::Apparatus> *ref = ptr.get<ESM::Apparatus>();
ptr.get<ESM::Apparatus>();
assert(ref->mBase != NULL);
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {

@ -58,7 +58,7 @@ namespace MWClass
const; const;
///< Generate action for using via inventory menu ///< Generate action for using via inventory menu
virtual std::string getModel(const MWWorld::Ptr &ptr) const; virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const; virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
}; };

@ -43,11 +43,9 @@ namespace MWClass
// TODO: add option somewhere to enable collision for placeable objects // TODO: add option somewhere to enable collision for placeable objects
} }
std::string Armor::getModel(const MWWorld::Ptr &ptr) const std::string Armor::getModel(const MWWorld::ConstPtr &ptr) const
{ {
MWWorld::LiveCellRef<ESM::Armor> *ref = const MWWorld::LiveCellRef<ESM::Armor> *ref = ptr.get<ESM::Armor>();
ptr.get<ESM::Armor>();
assert(ref->mBase != NULL);
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {

@ -81,7 +81,7 @@ namespace MWClass
const; const;
///< Generate action for using via inventory menu ///< Generate action for using via inventory menu
virtual std::string getModel(const MWWorld::Ptr &ptr) const; virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
virtual int getEnchantmentPoints (const MWWorld::Ptr& ptr) const; virtual int getEnchantmentPoints (const MWWorld::Ptr& ptr) const;

@ -40,11 +40,9 @@ namespace MWClass
// TODO: add option somewhere to enable collision for placeable objects // TODO: add option somewhere to enable collision for placeable objects
} }
std::string Book::getModel(const MWWorld::Ptr &ptr) const std::string Book::getModel(const MWWorld::ConstPtr &ptr) const
{ {
MWWorld::LiveCellRef<ESM::Book> *ref = const MWWorld::LiveCellRef<ESM::Book> *ref = ptr.get<ESM::Book>();
ptr.get<ESM::Book>();
assert(ref->mBase != NULL);
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {

@ -60,7 +60,7 @@ namespace MWClass
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr) const; virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr) const;
///< Generate action for using via inventory menu ///< Generate action for using via inventory menu
virtual std::string getModel(const MWWorld::Ptr &ptr) const; virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
virtual int getEnchantmentPoints (const MWWorld::Ptr& ptr) const; virtual int getEnchantmentPoints (const MWWorld::Ptr& ptr) const;

@ -39,11 +39,9 @@ namespace MWClass
// TODO: add option somewhere to enable collision for placeable objects // TODO: add option somewhere to enable collision for placeable objects
} }
std::string Clothing::getModel(const MWWorld::Ptr &ptr) const std::string Clothing::getModel(const MWWorld::ConstPtr &ptr) const
{ {
MWWorld::LiveCellRef<ESM::Clothing> *ref = const MWWorld::LiveCellRef<ESM::Clothing> *ref = ptr.get<ESM::Clothing>();
ptr.get<ESM::Clothing>();
assert(ref->mBase != NULL);
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {

@ -73,7 +73,7 @@ namespace MWClass
const; const;
///< Generate action for using via inventory menu ///< Generate action for using via inventory menu
virtual std::string getModel(const MWWorld::Ptr &ptr) const; virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
virtual int getEnchantmentPoints (const MWWorld::Ptr& ptr) const; virtual int getEnchantmentPoints (const MWWorld::Ptr& ptr) const;

@ -107,11 +107,9 @@ namespace MWClass
MWBase::Environment::get().getMechanicsManager()->add(ptr); MWBase::Environment::get().getMechanicsManager()->add(ptr);
} }
std::string Container::getModel(const MWWorld::Ptr &ptr) const std::string Container::getModel(const MWWorld::ConstPtr &ptr) const
{ {
MWWorld::LiveCellRef<ESM::Container> *ref = const MWWorld::LiveCellRef<ESM::Container> *ref = ptr.get<ESM::Container>();
ptr.get<ESM::Container>();
assert(ref->mBase != NULL);
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {

@ -73,7 +73,7 @@ namespace MWClass
virtual void restock (const MWWorld::Ptr &ptr) const; virtual void restock (const MWWorld::Ptr &ptr) const;
virtual std::string getModel(const MWWorld::Ptr &ptr) const; virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
}; };
} }

@ -175,11 +175,9 @@ namespace MWClass
objects.insertCreature(ptr, model, hasInventoryStore(ptr)); objects.insertCreature(ptr, model, hasInventoryStore(ptr));
} }
std::string Creature::getModel(const MWWorld::Ptr &ptr) const std::string Creature::getModel(const MWWorld::ConstPtr &ptr) const
{ {
MWWorld::LiveCellRef<ESM::Creature> *ref = const MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>();
ptr.get<ESM::Creature>();
assert (ref->mBase != NULL);
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {

@ -100,7 +100,7 @@ namespace MWClass
static void registerSelf(); static void registerSelf();
virtual std::string getModel(const MWWorld::Ptr &ptr) const; virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
virtual bool virtual bool
isActor() const { isActor() const {

@ -78,11 +78,9 @@ namespace MWClass
MWBase::Environment::get().getMechanicsManager()->add(ptr); MWBase::Environment::get().getMechanicsManager()->add(ptr);
} }
std::string Door::getModel(const MWWorld::Ptr &ptr) const std::string Door::getModel(const MWWorld::ConstPtr &ptr) const
{ {
MWWorld::LiveCellRef<ESM::Door> *ref = const MWWorld::LiveCellRef<ESM::Door> *ref = ptr.get<ESM::Door>();
ptr.get<ESM::Door>();
assert(ref->mBase != NULL);
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {

@ -54,7 +54,7 @@ namespace MWClass
static void registerSelf(); static void registerSelf();
virtual std::string getModel(const MWWorld::Ptr &ptr) const; virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
/// 0 = nothing, 1 = opening, 2 = closing /// 0 = nothing, 1 = opening, 2 = closing
virtual int getDoorState (const MWWorld::Ptr &ptr) const; virtual int getDoorState (const MWWorld::Ptr &ptr) const;

@ -43,11 +43,9 @@ namespace MWClass
// TODO: add option somewhere to enable collision for placeable objects // TODO: add option somewhere to enable collision for placeable objects
} }
std::string Ingredient::getModel(const MWWorld::Ptr &ptr) const std::string Ingredient::getModel(const MWWorld::ConstPtr &ptr) const
{ {
MWWorld::LiveCellRef<ESM::Ingredient> *ref = const MWWorld::LiveCellRef<ESM::Ingredient> *ref = ptr.get<ESM::Ingredient>();
ptr.get<ESM::Ingredient>();
assert(ref->mBase != NULL);
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {

@ -55,7 +55,7 @@ namespace MWClass
virtual std::string getInventoryIcon (const MWWorld::Ptr& ptr) const; virtual std::string getInventoryIcon (const MWWorld::Ptr& ptr) const;
///< Return name of inventory icon. ///< Return name of inventory icon.
virtual std::string getModel(const MWWorld::Ptr &ptr) const; virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
virtual float getWeight (const MWWorld::Ptr& ptr) const; virtual float getWeight (const MWWorld::Ptr& ptr) const;

@ -59,11 +59,9 @@ namespace MWClass
MWBase::Environment::get().getMechanicsManager()->add(ptr); MWBase::Environment::get().getMechanicsManager()->add(ptr);
} }
std::string Light::getModel(const MWWorld::Ptr &ptr) const std::string Light::getModel(const MWWorld::ConstPtr &ptr) const
{ {
MWWorld::LiveCellRef<ESM::Light> *ref = const MWWorld::LiveCellRef<ESM::Light> *ref = ptr.get<ESM::Light>();
ptr.get<ESM::Light>();
assert (ref->mBase != NULL);
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {

@ -65,7 +65,7 @@ namespace MWClass
virtual float getRemainingUsageTime (const MWWorld::ConstPtr& ptr) const; virtual float getRemainingUsageTime (const MWWorld::ConstPtr& ptr) const;
///< Returns the remaining duration of the object. ///< Returns the remaining duration of the object.
virtual std::string getModel(const MWWorld::Ptr &ptr) const; virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
virtual float getWeight (const MWWorld::Ptr& ptr) const; virtual float getWeight (const MWWorld::Ptr& ptr) const;

@ -38,11 +38,9 @@ namespace MWClass
// TODO: add option somewhere to enable collision for placeable objects // TODO: add option somewhere to enable collision for placeable objects
} }
std::string Lockpick::getModel(const MWWorld::Ptr &ptr) const std::string Lockpick::getModel(const MWWorld::ConstPtr &ptr) const
{ {
MWWorld::LiveCellRef<ESM::Lockpick> *ref = const MWWorld::LiveCellRef<ESM::Lockpick> *ref = ptr.get<ESM::Lockpick>();
ptr.get<ESM::Lockpick>();
assert(ref->mBase != NULL);
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {

@ -59,7 +59,7 @@ namespace MWClass
const; const;
///< Generate action for using via inventory menu ///< Generate action for using via inventory menu
virtual std::string getModel(const MWWorld::Ptr &ptr) const; virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const; virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;

@ -51,11 +51,9 @@ namespace MWClass
// TODO: add option somewhere to enable collision for placeable objects // TODO: add option somewhere to enable collision for placeable objects
} }
std::string Miscellaneous::getModel(const MWWorld::Ptr &ptr) const std::string Miscellaneous::getModel(const MWWorld::ConstPtr &ptr) const
{ {
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref = const MWWorld::LiveCellRef<ESM::Miscellaneous> *ref = ptr.get<ESM::Miscellaneous>();
ptr.get<ESM::Miscellaneous>();
assert(ref->mBase != NULL);
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {

@ -51,7 +51,7 @@ namespace MWClass
virtual std::string getInventoryIcon (const MWWorld::Ptr& ptr) const; virtual std::string getInventoryIcon (const MWWorld::Ptr& ptr) const;
///< Return name of inventory icon. ///< Return name of inventory icon.
virtual std::string getModel(const MWWorld::Ptr &ptr) const; virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr) virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
const; const;

@ -425,11 +425,9 @@ namespace MWClass
return ref->mBase->mPersistent; return ref->mBase->mPersistent;
} }
std::string Npc::getModel(const MWWorld::Ptr &ptr) const std::string Npc::getModel(const MWWorld::ConstPtr &ptr) const
{ {
MWWorld::LiveCellRef<ESM::NPC> *ref = const MWWorld::LiveCellRef<ESM::NPC> *ref = ptr.get<ESM::NPC>();
ptr.get<ESM::NPC>();
assert(ref->mBase != NULL);
std::string model = "meshes\\base_anim.nif"; std::string model = "meshes\\base_anim.nif";
const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find(ref->mBase->mRace); const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find(ref->mBase->mRace);
@ -437,7 +435,6 @@ namespace MWClass
model = "meshes\\base_animkna.nif"; model = "meshes\\base_animkna.nif";
return model; return model;
} }
std::string Npc::getName (const MWWorld::ConstPtr& ptr) const std::string Npc::getName (const MWWorld::ConstPtr& ptr) const

@ -126,7 +126,7 @@ namespace MWClass
static void registerSelf(); static void registerSelf();
virtual std::string getModel(const MWWorld::Ptr &ptr) const; virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
virtual int getSkill(const MWWorld::Ptr& ptr, int skill) const; virtual int getSkill(const MWWorld::Ptr& ptr, int skill) const;

@ -41,11 +41,9 @@ namespace MWClass
// TODO: add option somewhere to enable collision for placeable objects // TODO: add option somewhere to enable collision for placeable objects
} }
std::string Potion::getModel(const MWWorld::Ptr &ptr) const std::string Potion::getModel(const MWWorld::ConstPtr &ptr) const
{ {
MWWorld::LiveCellRef<ESM::Potion> *ref = const MWWorld::LiveCellRef<ESM::Potion> *ref = ptr.get<ESM::Potion>();
ptr.get<ESM::Potion>();
assert(ref->mBase != NULL);
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {

@ -54,7 +54,7 @@ namespace MWClass
virtual std::string getInventoryIcon (const MWWorld::Ptr& ptr) const; virtual std::string getInventoryIcon (const MWWorld::Ptr& ptr) const;
///< Return name of inventory icon. ///< Return name of inventory icon.
virtual std::string getModel(const MWWorld::Ptr &ptr) const; virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
virtual float getWeight (const MWWorld::Ptr& ptr) const; virtual float getWeight (const MWWorld::Ptr& ptr) const;

@ -38,11 +38,9 @@ namespace MWClass
// TODO: add option somewhere to enable collision for placeable objects // TODO: add option somewhere to enable collision for placeable objects
} }
std::string Probe::getModel(const MWWorld::Ptr &ptr) const std::string Probe::getModel(const MWWorld::ConstPtr &ptr) const
{ {
MWWorld::LiveCellRef<ESM::Probe> *ref = const MWWorld::LiveCellRef<ESM::Probe> *ref = ptr.get<ESM::Probe>();
ptr.get<ESM::Probe>();
assert(ref->mBase != NULL);
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {

@ -59,7 +59,7 @@ namespace MWClass
const; const;
///< Generate action for using via inventory menu ///< Generate action for using via inventory menu
virtual std::string getModel(const MWWorld::Ptr &ptr) const; virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const; virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;

@ -37,11 +37,9 @@ namespace MWClass
// TODO: add option somewhere to enable collision for placeable objects // TODO: add option somewhere to enable collision for placeable objects
} }
std::string Repair::getModel(const MWWorld::Ptr &ptr) const std::string Repair::getModel(const MWWorld::ConstPtr &ptr) const
{ {
MWWorld::LiveCellRef<ESM::Repair> *ref = const MWWorld::LiveCellRef<ESM::Repair> *ref = ptr.get<ESM::Repair>();
ptr.get<ESM::Repair>();
assert(ref->mBase != NULL);
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {

@ -51,7 +51,7 @@ namespace MWClass
virtual std::string getInventoryIcon (const MWWorld::Ptr& ptr) const; virtual std::string getInventoryIcon (const MWWorld::Ptr& ptr) const;
///< Return name of inventory icon. ///< Return name of inventory icon.
virtual std::string getModel(const MWWorld::Ptr &ptr) const; virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr) virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
const; const;

@ -29,11 +29,9 @@ namespace MWClass
physics.addObject(ptr, model); physics.addObject(ptr, model);
} }
std::string Static::getModel(const MWWorld::Ptr &ptr) const std::string Static::getModel(const MWWorld::ConstPtr &ptr) const
{ {
MWWorld::LiveCellRef<ESM::Static> *ref = const MWWorld::LiveCellRef<ESM::Static> *ref = ptr.get<ESM::Static>();
ptr.get<ESM::Static>();
assert(ref->mBase != NULL);
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {

@ -26,7 +26,7 @@ namespace MWClass
static void registerSelf(); static void registerSelf();
virtual std::string getModel(const MWWorld::Ptr &ptr) const; virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
}; };
} }

@ -41,11 +41,9 @@ namespace MWClass
// TODO: add option somewhere to enable collision for placeable objects // TODO: add option somewhere to enable collision for placeable objects
} }
std::string Weapon::getModel(const MWWorld::Ptr &ptr) const std::string Weapon::getModel(const MWWorld::ConstPtr &ptr) const
{ {
MWWorld::LiveCellRef<ESM::Weapon> *ref = const MWWorld::LiveCellRef<ESM::Weapon> *ref = ptr.get<ESM::Weapon>();
ptr.get<ESM::Weapon>();
assert(ref->mBase != NULL);
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {

@ -79,7 +79,7 @@ namespace MWClass
const; const;
///< Generate action for using via inventory menu ///< Generate action for using via inventory menu
virtual std::string getModel(const MWWorld::Ptr &ptr) const; virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const; virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;

@ -291,7 +291,7 @@ namespace MWWorld
{ {
} }
std::string Class::getModel(const MWWorld::Ptr &ptr) const std::string Class::getModel(const MWWorld::ConstPtr &ptr) const
{ {
return ""; return "";
} }

@ -266,7 +266,7 @@ namespace MWWorld
virtual int getServices (const MWWorld::Ptr& actor) const; virtual int getServices (const MWWorld::Ptr& actor) const;
virtual std::string getModel(const MWWorld::Ptr &ptr) const; virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
virtual std::string applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const; virtual std::string applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const;
///< Creates a new record using \a ptr as template, with the given name and the given enchantment applied to it. ///< Creates a new record using \a ptr as template, with the given name and the given enchantment applied to it.

Loading…
Cancel
Save