mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-04 00:26:39 +00:00 
			
		
		
		
	Accept a ConstPtr in canSell
This commit is contained in:
		
							parent
							
								
									2bc851c7d3
								
							
						
					
					
						commit
						0047a2d330
					
				
					 26 changed files with 27 additions and 28 deletions
				
			
		| 
						 | 
				
			
			@ -144,7 +144,7 @@ namespace MWClass
 | 
			
		|||
        return MWWorld::Ptr(cell.insert(ref), &cell);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    bool Apparatus::canSell (const MWWorld::Ptr& item, int npcServices) const
 | 
			
		||||
    bool Apparatus::canSell (const MWWorld::ConstPtr& item, int npcServices) const
 | 
			
		||||
    {
 | 
			
		||||
        return (npcServices & ESM::NPC::Apparatus) != 0;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -60,7 +60,7 @@ namespace MWClass
 | 
			
		|||
 | 
			
		||||
            virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
 | 
			
		||||
 | 
			
		||||
            virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
 | 
			
		||||
            virtual bool canSell (const MWWorld::ConstPtr& item, int npcServices) const;
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -382,7 +382,7 @@ namespace MWClass
 | 
			
		|||
        return ref->mBase->mData.mEnchant;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    bool Armor::canSell (const MWWorld::Ptr& item, int npcServices) const
 | 
			
		||||
    bool Armor::canSell (const MWWorld::ConstPtr& item, int npcServices) const
 | 
			
		||||
    {
 | 
			
		||||
        return (npcServices & ESM::NPC::Armor)
 | 
			
		||||
                || ((npcServices & ESM::NPC::MagicItems) && !getEnchantment(item).empty());
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -85,7 +85,7 @@ namespace MWClass
 | 
			
		|||
 | 
			
		||||
            virtual int getEnchantmentPoints (const MWWorld::Ptr& ptr) const;
 | 
			
		||||
 | 
			
		||||
            virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
 | 
			
		||||
            virtual bool canSell (const MWWorld::ConstPtr& item, int npcServices) const;
 | 
			
		||||
 | 
			
		||||
            /// Get the effective armor rating, factoring in the actor's skills, for the given armor.
 | 
			
		||||
            virtual int getEffectiveArmorRating(const MWWorld::ConstPtr& armor, const MWWorld::Ptr& actor) const;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -190,7 +190,7 @@ namespace MWClass
 | 
			
		|||
        return ref->mBase->mData.mEnchant;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    bool Book::canSell (const MWWorld::Ptr& item, int npcServices) const
 | 
			
		||||
    bool Book::canSell (const MWWorld::ConstPtr& item, int npcServices) const
 | 
			
		||||
    {
 | 
			
		||||
        return (npcServices & ESM::NPC::Books)
 | 
			
		||||
                || ((npcServices & ESM::NPC::MagicItems) && !getEnchantment(item).empty());
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -66,7 +66,7 @@ namespace MWClass
 | 
			
		|||
 | 
			
		||||
            virtual float getWeight (const MWWorld::Ptr& ptr) const;
 | 
			
		||||
 | 
			
		||||
            virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
 | 
			
		||||
            virtual bool canSell (const MWWorld::ConstPtr& item, int npcServices) const;
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -278,7 +278,7 @@ namespace MWClass
 | 
			
		|||
        return ref->mBase->mData.mEnchant;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    bool Clothing::canSell (const MWWorld::Ptr& item, int npcServices) const
 | 
			
		||||
    bool Clothing::canSell (const MWWorld::ConstPtr& item, int npcServices) const
 | 
			
		||||
    {
 | 
			
		||||
        return (npcServices & ESM::NPC::Clothing)
 | 
			
		||||
                || ((npcServices & ESM::NPC::MagicItems) && !getEnchantment(item).empty());
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -79,7 +79,7 @@ namespace MWClass
 | 
			
		|||
 | 
			
		||||
            virtual float getWeight (const MWWorld::Ptr& ptr) const;
 | 
			
		||||
 | 
			
		||||
            virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
 | 
			
		||||
            virtual bool canSell (const MWWorld::ConstPtr& item, int npcServices) const;
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -181,7 +181,7 @@ namespace MWClass
 | 
			
		|||
        return MWWorld::Ptr(cell.insert(ref), &cell);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    bool Ingredient::canSell (const MWWorld::Ptr& item, int npcServices) const
 | 
			
		||||
    bool Ingredient::canSell (const MWWorld::ConstPtr& item, int npcServices) const
 | 
			
		||||
    {
 | 
			
		||||
        return (npcServices & ESM::NPC::Ingredients) != 0;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -59,7 +59,7 @@ namespace MWClass
 | 
			
		|||
 | 
			
		||||
            virtual float getWeight (const MWWorld::Ptr& ptr) const;
 | 
			
		||||
 | 
			
		||||
            virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
 | 
			
		||||
            virtual bool canSell (const MWWorld::ConstPtr& item, int npcServices) const;
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -213,7 +213,7 @@ namespace MWClass
 | 
			
		|||
        return MWWorld::Ptr(cell.insert(ref), &cell);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    bool Light::canSell (const MWWorld::Ptr& item, int npcServices) const
 | 
			
		||||
    bool Light::canSell (const MWWorld::ConstPtr& item, int npcServices) const
 | 
			
		||||
    {
 | 
			
		||||
        return (npcServices & ESM::NPC::Lights) != 0;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -69,7 +69,7 @@ namespace MWClass
 | 
			
		|||
 | 
			
		||||
            virtual float getWeight (const MWWorld::Ptr& ptr) const;
 | 
			
		||||
 | 
			
		||||
            virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
 | 
			
		||||
            virtual bool canSell (const MWWorld::ConstPtr& item, int npcServices) const;
 | 
			
		||||
 | 
			
		||||
            std::pair<int, std::string> canBeEquipped(const MWWorld::Ptr &ptr, const MWWorld::Ptr &npc) const;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -162,7 +162,7 @@ namespace MWClass
 | 
			
		|||
        return MWWorld::Ptr(cell.insert(ref), &cell);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    bool Lockpick::canSell (const MWWorld::Ptr& item, int npcServices) const
 | 
			
		||||
    bool Lockpick::canSell (const MWWorld::ConstPtr& item, int npcServices) const
 | 
			
		||||
    {
 | 
			
		||||
        return (npcServices & ESM::NPC::Picks) != 0;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -61,7 +61,7 @@ namespace MWClass
 | 
			
		|||
 | 
			
		||||
            virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
 | 
			
		||||
 | 
			
		||||
            virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
 | 
			
		||||
            virtual bool canSell (const MWWorld::ConstPtr& item, int npcServices) const;
 | 
			
		||||
 | 
			
		||||
            virtual float getWeight (const MWWorld::Ptr& ptr) const;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -228,10 +228,9 @@ namespace MWClass
 | 
			
		|||
            return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionSoulgem(ptr));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    bool Miscellaneous::canSell (const MWWorld::Ptr& item, int npcServices) const
 | 
			
		||||
    bool Miscellaneous::canSell (const MWWorld::ConstPtr& item, int npcServices) const
 | 
			
		||||
    {
 | 
			
		||||
        MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
 | 
			
		||||
            item.get<ESM::Miscellaneous>();
 | 
			
		||||
        const MWWorld::LiveCellRef<ESM::Miscellaneous> *ref = item.get<ESM::Miscellaneous>();
 | 
			
		||||
 | 
			
		||||
        return !ref->mBase->mData.mIsKey && (npcServices & ESM::NPC::Misc) && !isGold(item);
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -59,7 +59,7 @@ namespace MWClass
 | 
			
		|||
 | 
			
		||||
            virtual float getWeight (const MWWorld::Ptr& ptr) const;
 | 
			
		||||
 | 
			
		||||
            virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
 | 
			
		||||
            virtual bool canSell (const MWWorld::ConstPtr& item, int npcServices) const;
 | 
			
		||||
 | 
			
		||||
            virtual bool isKey (const MWWorld::ConstPtr &ptr) const;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -175,7 +175,7 @@ namespace MWClass
 | 
			
		|||
        return MWWorld::Ptr(cell.insert(ref), &cell);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    bool Potion::canSell (const MWWorld::Ptr& item, int npcServices) const
 | 
			
		||||
    bool Potion::canSell (const MWWorld::ConstPtr& item, int npcServices) const
 | 
			
		||||
    {
 | 
			
		||||
        return (npcServices & ESM::NPC::Potions) != 0;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -58,7 +58,7 @@ namespace MWClass
 | 
			
		|||
 | 
			
		||||
            virtual float getWeight (const MWWorld::Ptr& ptr) const;
 | 
			
		||||
 | 
			
		||||
            virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
 | 
			
		||||
            virtual bool canSell (const MWWorld::ConstPtr& item, int npcServices) const;
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -162,7 +162,7 @@ namespace MWClass
 | 
			
		|||
        return MWWorld::Ptr(cell.insert(ref), &cell);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    bool Probe::canSell (const MWWorld::Ptr& item, int npcServices) const
 | 
			
		||||
    bool Probe::canSell (const MWWorld::ConstPtr& item, int npcServices) const
 | 
			
		||||
    {
 | 
			
		||||
        return (npcServices & ESM::NPC::Probes) != 0;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -61,7 +61,7 @@ namespace MWClass
 | 
			
		|||
 | 
			
		||||
            virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
 | 
			
		||||
 | 
			
		||||
            virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
 | 
			
		||||
            virtual bool canSell (const MWWorld::ConstPtr& item, int npcServices) const;
 | 
			
		||||
 | 
			
		||||
            virtual float getWeight (const MWWorld::Ptr& ptr) const;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -161,7 +161,7 @@ namespace MWClass
 | 
			
		|||
        return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionRepair(ptr));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    bool Repair::canSell (const MWWorld::Ptr& item, int npcServices) const
 | 
			
		||||
    bool Repair::canSell (const MWWorld::ConstPtr& item, int npcServices) const
 | 
			
		||||
    {
 | 
			
		||||
        return (npcServices & ESM::NPC::RepairItem) != 0;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -67,7 +67,7 @@ namespace MWClass
 | 
			
		|||
 | 
			
		||||
            virtual float getWeight (const MWWorld::Ptr& ptr) const;
 | 
			
		||||
 | 
			
		||||
            virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
 | 
			
		||||
            virtual bool canSell (const MWWorld::ConstPtr& item, int npcServices) const;
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -419,7 +419,7 @@ namespace MWClass
 | 
			
		|||
        return ref->mBase->mData.mEnchant;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    bool Weapon::canSell (const MWWorld::Ptr& item, int npcServices) const
 | 
			
		||||
    bool Weapon::canSell (const MWWorld::ConstPtr& item, int npcServices) const
 | 
			
		||||
    {
 | 
			
		||||
        return (npcServices & ESM::NPC::Weapon)
 | 
			
		||||
                || ((npcServices & ESM::NPC::MagicItems) && !getEnchantment(item).empty());
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -81,7 +81,7 @@ namespace MWClass
 | 
			
		|||
 | 
			
		||||
            virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
 | 
			
		||||
 | 
			
		||||
            virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
 | 
			
		||||
            virtual bool canSell (const MWWorld::ConstPtr& item, int npcServices) const;
 | 
			
		||||
 | 
			
		||||
            virtual float getWeight (const MWWorld::Ptr& ptr) const;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -55,7 +55,7 @@ namespace MWWorld
 | 
			
		|||
        throw std::runtime_error ("class does not represent an actor");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    bool Class::canSell (const MWWorld::Ptr& item, int npcServices) const
 | 
			
		||||
    bool Class::canSell (const MWWorld::ConstPtr& item, int npcServices) const
 | 
			
		||||
    {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -261,7 +261,7 @@ namespace MWWorld
 | 
			
		|||
            virtual void adjustScale(const MWWorld::Ptr& ptr, osg::Vec3f& scale, bool rendering) const;
 | 
			
		||||
            /// @param rendering Indicates if the scale to adjust is for the rendering mesh, or for the collision mesh
 | 
			
		||||
 | 
			
		||||
            virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
 | 
			
		||||
            virtual bool canSell (const MWWorld::ConstPtr& item, int npcServices) const;
 | 
			
		||||
            ///< Determine whether or not \a item can be sold to an npc with the given \a npcServices
 | 
			
		||||
 | 
			
		||||
            virtual int getServices (const MWWorld::Ptr& actor) const;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue