Rename stdext::shared_object_ptr to compile in gcc 4.6
This commit is contained in:
parent
8e437e27c7
commit
03b8241bbc
|
@ -33,11 +33,11 @@ class ScheduledEvent;
|
|||
class FileStream;
|
||||
class BinaryTree;
|
||||
|
||||
typedef stdext::shared_object_ptr<Module> ModulePtr;
|
||||
typedef stdext::shared_object_ptr<Event> EventPtr;
|
||||
typedef stdext::shared_object_ptr<ScheduledEvent> ScheduledEventPtr;
|
||||
typedef stdext::shared_object_ptr<FileStream> FileStreamPtr;
|
||||
typedef stdext::shared_object_ptr<BinaryTree> BinaryTreePtr;
|
||||
typedef boost::intrusive_ptr<Module> ModulePtr;
|
||||
typedef boost::intrusive_ptr<Event> EventPtr;
|
||||
typedef boost::intrusive_ptr<ScheduledEvent> ScheduledEventPtr;
|
||||
typedef boost::intrusive_ptr<FileStream> FileStreamPtr;
|
||||
typedef boost::intrusive_ptr<BinaryTree> BinaryTreePtr;
|
||||
|
||||
typedef std::vector<BinaryTreePtr> BinaryTreeVec;
|
||||
|
||||
|
|
|
@ -44,21 +44,21 @@ class ParticleSystem;
|
|||
class ParticleEffect;
|
||||
class ParticleEffectType;
|
||||
|
||||
typedef stdext::shared_object_ptr<Image> ImagePtr;
|
||||
typedef stdext::shared_object_ptr<Texture> TexturePtr;
|
||||
typedef stdext::shared_object_ptr<AnimatedTexture> AnimatedTexturePtr;
|
||||
typedef stdext::shared_object_ptr<BitmapFont> BitmapFontPtr;
|
||||
typedef stdext::shared_object_ptr<CachedText> CachedTextPtr;
|
||||
typedef stdext::shared_object_ptr<FrameBuffer> FrameBufferPtr;
|
||||
typedef stdext::shared_object_ptr<Shader> ShaderPtr;
|
||||
typedef stdext::shared_object_ptr<ShaderProgram> ShaderProgramPtr;
|
||||
typedef stdext::shared_object_ptr<PainterShaderProgram> PainterShaderProgramPtr;
|
||||
typedef stdext::shared_object_ptr<Particle> ParticlePtr;
|
||||
typedef stdext::shared_object_ptr<ParticleEmitter> ParticleEmitterPtr;
|
||||
typedef stdext::shared_object_ptr<ParticleAffector> ParticleAffectorPtr;
|
||||
typedef stdext::shared_object_ptr<ParticleSystem> ParticleSystemPtr;
|
||||
typedef stdext::shared_object_ptr<ParticleEffect> ParticleEffectPtr;
|
||||
typedef stdext::shared_object_ptr<ParticleEffectType> ParticleEffectTypePtr;
|
||||
typedef boost::intrusive_ptr<Image> ImagePtr;
|
||||
typedef boost::intrusive_ptr<Texture> TexturePtr;
|
||||
typedef boost::intrusive_ptr<AnimatedTexture> AnimatedTexturePtr;
|
||||
typedef boost::intrusive_ptr<BitmapFont> BitmapFontPtr;
|
||||
typedef boost::intrusive_ptr<CachedText> CachedTextPtr;
|
||||
typedef boost::intrusive_ptr<FrameBuffer> FrameBufferPtr;
|
||||
typedef boost::intrusive_ptr<Shader> ShaderPtr;
|
||||
typedef boost::intrusive_ptr<ShaderProgram> ShaderProgramPtr;
|
||||
typedef boost::intrusive_ptr<PainterShaderProgram> PainterShaderProgramPtr;
|
||||
typedef boost::intrusive_ptr<Particle> ParticlePtr;
|
||||
typedef boost::intrusive_ptr<ParticleEmitter> ParticleEmitterPtr;
|
||||
typedef boost::intrusive_ptr<ParticleAffector> ParticleAffectorPtr;
|
||||
typedef boost::intrusive_ptr<ParticleSystem> ParticleSystemPtr;
|
||||
typedef boost::intrusive_ptr<ParticleEffect> ParticleEffectPtr;
|
||||
typedef boost::intrusive_ptr<ParticleEffectType> ParticleEffectTypePtr;
|
||||
typedef std::vector<ShaderPtr> ShaderList;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -30,6 +30,6 @@ class LuaObject;
|
|||
|
||||
typedef std::function<int(LuaInterface*)> LuaCppFunction;
|
||||
typedef std::unique_ptr<LuaCppFunction> LuaCppFunctionPtr;
|
||||
typedef stdext::shared_object_ptr<LuaObject> LuaObjectPtr;
|
||||
typedef boost::intrusive_ptr<LuaObject> LuaObjectPtr;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -152,18 +152,18 @@ namespace luabinder
|
|||
|
||||
/// Create member function lambdas
|
||||
template<typename Ret, typename C, typename... Args>
|
||||
std::function<Ret(const stdext::shared_object_ptr<C>&, const Args&...)> make_mem_func(Ret (C::* f)(Args...)) {
|
||||
std::function<Ret(const boost::intrusive_ptr<C>&, const Args&...)> make_mem_func(Ret (C::* f)(Args...)) {
|
||||
auto mf = std::mem_fn(f);
|
||||
return [=](const stdext::shared_object_ptr<C>& obj, const Args&... args) mutable -> Ret {
|
||||
return [=](const boost::intrusive_ptr<C>& obj, const Args&... args) mutable -> Ret {
|
||||
if(!obj)
|
||||
throw LuaException("failed to call a member function because the passed object is nil");
|
||||
return mf(obj.get(), args...);
|
||||
};
|
||||
}
|
||||
template<typename C, typename... Args>
|
||||
std::function<void(const stdext::shared_object_ptr<C>&, const Args&...)> make_mem_func(void (C::* f)(Args...)) {
|
||||
std::function<void(const boost::intrusive_ptr<C>&, const Args&...)> make_mem_func(void (C::* f)(Args...)) {
|
||||
auto mf = std::mem_fn(f);
|
||||
return [=](const stdext::shared_object_ptr<C>& obj, const Args&... args) mutable -> void {
|
||||
return [=](const boost::intrusive_ptr<C>& obj, const Args&... args) mutable -> void {
|
||||
if(!obj)
|
||||
throw LuaException("failed to call a member function because the passed object is nil");
|
||||
mf(obj.get(), args...);
|
||||
|
@ -186,7 +186,7 @@ namespace luabinder
|
|||
/// Bind member functions
|
||||
template<typename C, typename Ret, class FC, typename... Args>
|
||||
LuaCppFunction bind_mem_fun(Ret (FC::* f)(Args...)) {
|
||||
typedef typename std::tuple<stdext::shared_object_ptr<FC>, typename remove_const_ref<Args>::type...> Tuple;
|
||||
typedef typename std::tuple<boost::intrusive_ptr<FC>, typename remove_const_ref<Args>::type...> Tuple;
|
||||
auto lambda = make_mem_func<Ret,FC>(f);
|
||||
return bind_fun_specializer<typename remove_const_ref<Ret>::type,
|
||||
decltype(lambda),
|
||||
|
@ -209,7 +209,7 @@ namespace luabinder
|
|||
LuaCppFunction bind_mem_fun(int (C::*f)(LuaInterface*)) {
|
||||
auto mf = std::mem_fn(f);
|
||||
return [=](LuaInterface* lua) -> int {
|
||||
auto obj = lua->castValue<stdext::shared_object_ptr<C>>(1);
|
||||
auto obj = lua->castValue<boost::intrusive_ptr<C>>(1);
|
||||
lua->remove(1);
|
||||
return mf(obj, lua);
|
||||
};
|
||||
|
|
|
@ -111,7 +111,7 @@ bool luavalue_cast(int index, LuaObjectPtr& obj);
|
|||
|
||||
template<class T>
|
||||
typename std::enable_if<std::is_base_of<LuaObject, T>::value, bool>::type
|
||||
luavalue_cast(int index, stdext::shared_object_ptr<T>& ptr);
|
||||
luavalue_cast(int index, boost::intrusive_ptr<T>& ptr);
|
||||
|
||||
// std::function
|
||||
template<typename Ret, typename... Args>
|
||||
|
@ -186,7 +186,7 @@ push_luavalue(const T& obj) {
|
|||
|
||||
template<class T>
|
||||
typename std::enable_if<std::is_base_of<LuaObject, T>::value, bool>::type
|
||||
luavalue_cast(int index, stdext::shared_object_ptr<T>& ptr) {
|
||||
luavalue_cast(int index, boost::intrusive_ptr<T>& ptr) {
|
||||
LuaObjectPtr obj;
|
||||
if(!luavalue_cast(index, obj))
|
||||
return false;
|
||||
|
|
|
@ -34,10 +34,10 @@ class Connection;
|
|||
class Protocol;
|
||||
class Server;
|
||||
|
||||
typedef stdext::shared_object_ptr<InputMessage> InputMessagePtr;
|
||||
typedef stdext::shared_object_ptr<OutputMessage> OutputMessagePtr;
|
||||
typedef stdext::shared_object_ptr<Connection> ConnectionPtr;
|
||||
typedef stdext::shared_object_ptr<Protocol> ProtocolPtr;
|
||||
typedef stdext::shared_object_ptr<Server> ServerPtr;
|
||||
typedef boost::intrusive_ptr<InputMessage> InputMessagePtr;
|
||||
typedef boost::intrusive_ptr<OutputMessage> OutputMessagePtr;
|
||||
typedef boost::intrusive_ptr<Connection> ConnectionPtr;
|
||||
typedef boost::intrusive_ptr<Protocol> ProtocolPtr;
|
||||
typedef boost::intrusive_ptr<Server> ServerPtr;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -30,8 +30,8 @@ class OTMLDocument;
|
|||
class OTMLParser;
|
||||
class OTMLEmitter;
|
||||
|
||||
typedef stdext::shared_object_ptr<OTMLNode> OTMLNodePtr;
|
||||
typedef stdext::shared_object_ptr<OTMLDocument> OTMLDocumentPtr;
|
||||
typedef boost::intrusive_ptr<OTMLNode> OTMLNodePtr;
|
||||
typedef boost::intrusive_ptr<OTMLDocument> OTMLDocumentPtr;
|
||||
typedef std::vector<OTMLNodePtr> OTMLNodeList;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -38,11 +38,11 @@ class StreamSoundSource;
|
|||
class CombinedSoundSource;
|
||||
class OggSoundFile;
|
||||
|
||||
typedef stdext::shared_object_ptr<SoundSource> SoundSourcePtr;
|
||||
typedef stdext::shared_object_ptr<SoundFile> SoundFilePtr;
|
||||
typedef stdext::shared_object_ptr<SoundBuffer> SoundBufferPtr;
|
||||
typedef stdext::shared_object_ptr<StreamSoundSource> StreamSoundSourcePtr;
|
||||
typedef stdext::shared_object_ptr<CombinedSoundSource> CombinedSoundSourcePtr;
|
||||
typedef stdext::shared_object_ptr<OggSoundFile> OggSoundFilePtr;
|
||||
typedef boost::intrusive_ptr<SoundSource> SoundSourcePtr;
|
||||
typedef boost::intrusive_ptr<SoundFile> SoundFilePtr;
|
||||
typedef boost::intrusive_ptr<SoundBuffer> SoundBufferPtr;
|
||||
typedef boost::intrusive_ptr<StreamSoundSource> StreamSoundSourcePtr;
|
||||
typedef boost::intrusive_ptr<CombinedSoundSource> CombinedSoundSourcePtr;
|
||||
typedef boost::intrusive_ptr<OggSoundFile> OggSoundFilePtr;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -28,9 +28,6 @@
|
|||
|
||||
namespace stdext {
|
||||
|
||||
template<typename T>
|
||||
using shared_object_ptr = boost::intrusive_ptr<T>;
|
||||
|
||||
class shared_object
|
||||
{
|
||||
public:
|
||||
|
@ -44,16 +41,16 @@ public:
|
|||
bool is_unique_ref() { return m_refs == 1; }
|
||||
unsigned long ref_count() { return m_refs; }
|
||||
template<typename T>
|
||||
shared_object_ptr<T> self_cast() { return shared_object_ptr<T>(static_cast<T*>(this)); }
|
||||
boost::intrusive_ptr<T> self_cast() { return boost::intrusive_ptr<T>(static_cast<T*>(this)); }
|
||||
template<typename T>
|
||||
shared_object_ptr<T> dynamic_self_cast() { return shared_object_ptr<T>(dynamic_cast<T*>(this)); }
|
||||
boost::intrusive_ptr<T> dynamic_self_cast() { return boost::intrusive_ptr<T>(dynamic_cast<T*>(this)); }
|
||||
|
||||
private:
|
||||
unsigned int m_refs;
|
||||
};
|
||||
|
||||
template<class T, typename... Args>
|
||||
shared_object_ptr<T> make_shared_object(Args... args) { return shared_object_ptr<T>(new T(args...)); }
|
||||
boost::intrusive_ptr<T> make_shared_object(Args... args) { return boost::intrusive_ptr<T>(new T(args...)); }
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -36,15 +36,15 @@ class UIGridLayout;
|
|||
class UIAnchorLayout;
|
||||
class UIParticles;
|
||||
|
||||
typedef stdext::shared_object_ptr<UIWidget> UIWidgetPtr;
|
||||
typedef stdext::shared_object_ptr<UIParticles> UIParticlesPtr;
|
||||
typedef stdext::shared_object_ptr<UITextEdit> UITextEditPtr;
|
||||
typedef stdext::shared_object_ptr<UILayout> UILayoutPtr;
|
||||
typedef stdext::shared_object_ptr<UIBoxLayout> UIBoxLayoutPtr;
|
||||
typedef stdext::shared_object_ptr<UIHorizontalLayout> UIHorizontalLayoutPtr;
|
||||
typedef stdext::shared_object_ptr<UIVerticalLayout> UIVerticalLayoutPtr;
|
||||
typedef stdext::shared_object_ptr<UIGridLayout> UIGridLayoutPtr;
|
||||
typedef stdext::shared_object_ptr<UIAnchorLayout> UIAnchorLayoutPtr;
|
||||
typedef boost::intrusive_ptr<UIWidget> UIWidgetPtr;
|
||||
typedef boost::intrusive_ptr<UIParticles> UIParticlesPtr;
|
||||
typedef boost::intrusive_ptr<UITextEdit> UITextEditPtr;
|
||||
typedef boost::intrusive_ptr<UILayout> UILayoutPtr;
|
||||
typedef boost::intrusive_ptr<UIBoxLayout> UIBoxLayoutPtr;
|
||||
typedef boost::intrusive_ptr<UIHorizontalLayout> UIHorizontalLayoutPtr;
|
||||
typedef boost::intrusive_ptr<UIVerticalLayout> UIVerticalLayoutPtr;
|
||||
typedef boost::intrusive_ptr<UIGridLayout> UIGridLayoutPtr;
|
||||
typedef boost::intrusive_ptr<UIAnchorLayout> UIAnchorLayoutPtr;
|
||||
|
||||
typedef std::deque<UIWidgetPtr> UIWidgetList;
|
||||
|
||||
|
|
|
@ -50,25 +50,25 @@ class House;
|
|||
class Town;
|
||||
class CreatureType;
|
||||
|
||||
typedef stdext::shared_object_ptr<MapView> MapViewPtr;
|
||||
typedef stdext::shared_object_ptr<Tile> TilePtr;
|
||||
typedef stdext::shared_object_ptr<Thing> ThingPtr;
|
||||
typedef stdext::shared_object_ptr<Item> ItemPtr;
|
||||
typedef stdext::shared_object_ptr<Container> ContainerPtr;
|
||||
typedef stdext::shared_object_ptr<Creature> CreaturePtr;
|
||||
typedef stdext::shared_object_ptr<Monster> MonsterPtr;
|
||||
typedef stdext::shared_object_ptr<Npc> NpcPtr;
|
||||
typedef stdext::shared_object_ptr<Player> PlayerPtr;
|
||||
typedef stdext::shared_object_ptr<LocalPlayer> LocalPlayerPtr;
|
||||
typedef stdext::shared_object_ptr<Effect> EffectPtr;
|
||||
typedef stdext::shared_object_ptr<Missile> MissilePtr;
|
||||
typedef stdext::shared_object_ptr<AnimatedText> AnimatedTextPtr;
|
||||
typedef stdext::shared_object_ptr<StaticText> StaticTextPtr;
|
||||
typedef stdext::shared_object_ptr<ThingType> ThingTypePtr;
|
||||
typedef stdext::shared_object_ptr<ItemType> ItemTypePtr;
|
||||
typedef stdext::shared_object_ptr<House> HousePtr;
|
||||
typedef stdext::shared_object_ptr<Town> TownPtr;
|
||||
typedef stdext::shared_object_ptr<CreatureType> CreatureTypePtr;
|
||||
typedef boost::intrusive_ptr<MapView> MapViewPtr;
|
||||
typedef boost::intrusive_ptr<Tile> TilePtr;
|
||||
typedef boost::intrusive_ptr<Thing> ThingPtr;
|
||||
typedef boost::intrusive_ptr<Item> ItemPtr;
|
||||
typedef boost::intrusive_ptr<Container> ContainerPtr;
|
||||
typedef boost::intrusive_ptr<Creature> CreaturePtr;
|
||||
typedef boost::intrusive_ptr<Monster> MonsterPtr;
|
||||
typedef boost::intrusive_ptr<Npc> NpcPtr;
|
||||
typedef boost::intrusive_ptr<Player> PlayerPtr;
|
||||
typedef boost::intrusive_ptr<LocalPlayer> LocalPlayerPtr;
|
||||
typedef boost::intrusive_ptr<Effect> EffectPtr;
|
||||
typedef boost::intrusive_ptr<Missile> MissilePtr;
|
||||
typedef boost::intrusive_ptr<AnimatedText> AnimatedTextPtr;
|
||||
typedef boost::intrusive_ptr<StaticText> StaticTextPtr;
|
||||
typedef boost::intrusive_ptr<ThingType> ThingTypePtr;
|
||||
typedef boost::intrusive_ptr<ItemType> ItemTypePtr;
|
||||
typedef boost::intrusive_ptr<House> HousePtr;
|
||||
typedef boost::intrusive_ptr<Town> TownPtr;
|
||||
typedef boost::intrusive_ptr<CreatureType> CreatureTypePtr;
|
||||
|
||||
typedef std::vector<ThingPtr> ThingList;
|
||||
typedef std::vector<ThingTypePtr> ThingTypeList;
|
||||
|
@ -81,8 +81,8 @@ typedef std::unordered_map<Position, TilePtr, PositionHasher> TileMap;
|
|||
class ProtocolLogin;
|
||||
class ProtocolGame;
|
||||
|
||||
typedef stdext::shared_object_ptr<ProtocolGame> ProtocolGamePtr;
|
||||
typedef stdext::shared_object_ptr<ProtocolLogin> ProtocolLoginPtr;
|
||||
typedef boost::intrusive_ptr<ProtocolGame> ProtocolGamePtr;
|
||||
typedef boost::intrusive_ptr<ProtocolLogin> ProtocolLoginPtr;
|
||||
|
||||
// ui
|
||||
class UIItem;
|
||||
|
@ -90,9 +90,9 @@ class UICreature;
|
|||
class UIMap;
|
||||
class UIProgressRect;
|
||||
|
||||
typedef stdext::shared_object_ptr<UIItem> UIItemPtr;
|
||||
typedef stdext::shared_object_ptr<UICreature> UICreaturePtr;
|
||||
typedef stdext::shared_object_ptr<UIMap> UIMapPtr;
|
||||
typedef stdext::shared_object_ptr<UIProgressRect> UIProgressRectPtr;
|
||||
typedef boost::intrusive_ptr<UIItem> UIItemPtr;
|
||||
typedef boost::intrusive_ptr<UICreature> UICreaturePtr;
|
||||
typedef boost::intrusive_ptr<UIMap> UIMapPtr;
|
||||
typedef boost::intrusive_ptr<UIProgressRect> UIProgressRectPtr;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1079,6 +1079,13 @@ void Game::mount(bool mount)
|
|||
m_mounted = mount;
|
||||
}
|
||||
|
||||
void Game::requestItemInfo(const ItemPtr& item, int index)
|
||||
{
|
||||
if(!canPerformGameAction())
|
||||
return;
|
||||
m_protocolGame->sendRequestItemInfo(item->getId(), item->getSubType(), index);
|
||||
}
|
||||
|
||||
void Game::ping()
|
||||
{
|
||||
if(!m_protocolGame || !m_protocolGame->isConnected())
|
||||
|
|
|
@ -231,7 +231,7 @@ public:
|
|||
void mount(bool mount);
|
||||
|
||||
// 910 only
|
||||
//void requestItemInfo();
|
||||
void requestItemInfo(const ItemPtr& item, int index);
|
||||
//void reportRuleViolation2();
|
||||
void ping();
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@ void Item::setId(uint32 id)
|
|||
{
|
||||
if(!g_things.isValidDatId(id, ThingCategoryItem))
|
||||
id = 0;
|
||||
//m_otbId = g_things.findOtbForClientId(id)->getServerId();
|
||||
//m_otbId = g_things.findItemTypeByClientId(id)->getServerId();
|
||||
m_id = id;
|
||||
m_otbId = 0;
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ void OTClient::registerLuaFunctions()
|
|||
g_lua.bindSingletonFunction("g_things", "getDatSignature", &ThingTypeManager::getDatSignature, &g_things);
|
||||
g_lua.bindSingletonFunction("g_things", "getThingType", &ThingTypeManager::getThingType, &g_things);
|
||||
g_lua.bindSingletonFunction("g_things", "getItemType", &ThingTypeManager::getItemType, &g_things);
|
||||
g_lua.bindSingletonFunction("g_things", "findItemTypeByClientId", &ThingTypeManager::findItemTypeByClientId, &g_things);
|
||||
g_lua.bindSingletonFunction("g_things", "findThingTypeByAttr", &ThingTypeManager::findThingTypeByAttr, &g_things);
|
||||
g_lua.bindSingletonFunction("g_things", "findItemTypeByCategory", &ThingTypeManager::findItemTypeByCategory, &g_things);
|
||||
|
||||
|
@ -164,7 +165,6 @@ void OTClient::registerLuaFunctions()
|
|||
g_lua.bindSingletonFunction("g_game", "inspectNpcTrade", &Game::inspectNpcTrade, &g_game);
|
||||
g_lua.bindSingletonFunction("g_game", "buyItem", &Game::buyItem, &g_game);
|
||||
g_lua.bindSingletonFunction("g_game", "sellItem", &Game::sellItem, &g_game);
|
||||
g_lua.bindSingletonFunction("g_game", "ping", &Game::ping, &g_game);
|
||||
g_lua.bindSingletonFunction("g_game", "closeNpcTrade", &Game::closeNpcTrade, &g_game);
|
||||
g_lua.bindSingletonFunction("g_game", "requestTrade", &Game::requestTrade, &g_game);
|
||||
g_lua.bindSingletonFunction("g_game", "inspectTrade", &Game::inspectTrade, &g_game);
|
||||
|
@ -179,6 +179,8 @@ void OTClient::registerLuaFunctions()
|
|||
g_lua.bindSingletonFunction("g_game", "requestQuestLine", &Game::requestQuestLine, &g_game);
|
||||
g_lua.bindSingletonFunction("g_game", "equipItem", &Game::equipItem, &g_game);
|
||||
g_lua.bindSingletonFunction("g_game", "mount", &Game::mount, &g_game);
|
||||
g_lua.bindSingletonFunction("g_game", "requestItemInfo", &Game::requestItemInfo, &g_game);
|
||||
g_lua.bindSingletonFunction("g_game", "ping", &Game::ping, &g_game);
|
||||
g_lua.bindSingletonFunction("g_game", "canPerformGameAction", &Game::canPerformGameAction, &g_game);
|
||||
g_lua.bindSingletonFunction("g_game", "canReportBugs", &Game::canReportBugs, &g_game);
|
||||
g_lua.bindSingletonFunction("g_game", "checkBotProtection", &Game::checkBotProtection, &g_game);
|
||||
|
@ -333,6 +335,7 @@ void OTClient::registerLuaFunctions()
|
|||
g_lua.registerClass<ThingType>();
|
||||
g_lua.bindClassMemberFunction<ThingType>("getId", &ThingType::getId);
|
||||
g_lua.bindClassMemberFunction<ThingType>("getMarketData", &ThingType::getMarketData);
|
||||
g_lua.bindClassMemberFunction<ThingType>("getClothSlot", &ThingType::getClothSlot);
|
||||
|
||||
g_lua.registerClass<Item, Thing>();
|
||||
g_lua.bindClassStaticFunction<Item>("create", &Item::create);
|
||||
|
|
|
@ -103,7 +103,7 @@ public:
|
|||
void sendRequestQuestLog();
|
||||
void sendRequestQuestLine(int questId);
|
||||
void sendNewNewRuleViolation(int reason, int action, const std::string& characterName, const std::string& comment, const std::string& translation);
|
||||
void sendRequestItemInfo(int itemId, int index);
|
||||
void sendRequestItemInfo(int itemId, int subType, int index);
|
||||
|
||||
protected:
|
||||
void onConnect();
|
||||
|
|
|
@ -1280,12 +1280,18 @@ void ProtocolGame::parseChannelEvent(const InputMessagePtr& msg)
|
|||
|
||||
void ProtocolGame::parseItemInfo(const InputMessagePtr& msg)
|
||||
{
|
||||
std::vector<std::tuple<ItemPtr, std::string>> list;
|
||||
int size = msg->getU8();
|
||||
for(int i=0;i<size;++i) {
|
||||
msg->getU16(); // id
|
||||
msg->getU8(); // subtype
|
||||
msg->getString(); // description
|
||||
ItemPtr item(new Item);
|
||||
item->setId(msg->getU16());
|
||||
item->setCountOrSubType(msg->getU8());
|
||||
|
||||
std::string desc = msg->getString();
|
||||
list.push_back(std::make_tuple(item, desc));
|
||||
}
|
||||
|
||||
g_lua.callGlobalField("g_game", "onItemInfo", list);
|
||||
}
|
||||
|
||||
void ProtocolGame::parsePlayerInventory(const InputMessagePtr& msg)
|
||||
|
|
|
@ -733,11 +733,11 @@ void ProtocolGame::sendNewNewRuleViolation(int reason, int action, const std::st
|
|||
send(msg);
|
||||
}
|
||||
|
||||
void ProtocolGame::sendRequestItemInfo(int itemId, int index)
|
||||
void ProtocolGame::sendRequestItemInfo(int itemId, int subType, int index)
|
||||
{
|
||||
OutputMessagePtr msg(new OutputMessage);
|
||||
msg->addU8(Proto::ClientRequestItemInfo);
|
||||
msg->addU8(1); // count, 1 for just one item
|
||||
msg->addU8(subType);
|
||||
msg->addU16(itemId);
|
||||
msg->addU8(index);
|
||||
send(msg);
|
||||
|
|
|
@ -193,7 +193,7 @@ void ThingTypeManager::addItemType(const ItemTypePtr& itemType)
|
|||
m_itemTypes[id] = itemType;
|
||||
}
|
||||
|
||||
const ItemTypePtr& ThingTypeManager::findOtbForClientId(uint16 id)
|
||||
const ItemTypePtr& ThingTypeManager::findItemTypeByClientId(uint16 id)
|
||||
{
|
||||
if(m_itemTypes.empty())
|
||||
return m_nullItemType;
|
||||
|
|
|
@ -41,7 +41,7 @@ public:
|
|||
void parseItemType(uint16 id, TiXmlElement *elem);
|
||||
|
||||
void addItemType(const ItemTypePtr& itemType);
|
||||
const ItemTypePtr& findOtbForClientId(uint16 id);
|
||||
const ItemTypePtr& findItemTypeByClientId(uint16 id);
|
||||
|
||||
const ThingTypePtr& getNullThingType() { return m_nullThingType; }
|
||||
const ItemTypePtr& getNullItemType() { return m_nullItemType; }
|
||||
|
|
Loading…
Reference in New Issue