-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Segfault when trying to open inventory after acquiring new item via dialogue #531
Comments
Seems that the items given returns inventoryUI null even though from what I can see it is being created. this is really the only difference I could find Elder uses OP 8116 add_mult_objs_to_inven and its remove OP 8117 slim in klamall uses OP 80D8 add_obj_to_inven and works fine. |
The flask is created using I don't know how it worked in the original game, but I presume that when you create an object with location set to 0 then you don't want it to appear on the map. |
This is my workaround for now: --- a/src/VM/Handler/Opcode8116Handler.cpp
+++ b/src/VM/Handler/Opcode8116Handler.cpp
@@ -27,6 +27,7 @@
#include "../../Game/CritterObject.h"
#include "../../Game/Game.h"
#include "../../Game/Object.h"
+#include "../../Game/ObjectFactory.h"
#include "../../Logger.h"
#include "../../State/Location.h"
#include "../../VM/Script.h"
@@ -73,16 +74,19 @@ namespace Falltergeist
return;
}
- inven->push_back(item);
+ Game::ItemObject* copy = item;
if (item->hexagon())
{
auto location = Game::Game::getInstance()->locationState();
if (location)
{
+ copy = (Game::ItemObject*)Game::ObjectFactory::getInstance()->createObject(item->PID());
location->removeObjectFromMap(item);
}
}
+
+ inven->push_back(copy);
}
}
} |
@JanSimek Thanks! I'll check this on weekend when i'll have some time :) |
|
Prevent dangling pointers when removing obj from map. Closes falltergeist#531, cl…
Description
A Segfault when trying to open inventory after acquiring new item via dialogue.
InventoryItem.cpp:137
(render function)System
OS: Ubuntu 17.04 x64
Compiler: GCC
Steps to reproduce
The text was updated successfully, but these errors were encountered: