Merge pull request #883 from JoseJX/FixPPH

EMI: Fix sector names that are substrings - Fixes #873
This commit is contained in:
Joel Teichroeb 2014-06-16 10:54:48 -07:00
commit d4f6d70522

View File

@ -102,7 +102,16 @@ void Lua_V1::IsActorInSector() {
Actor *actor = getactor(actorObj);
const char *name = lua_getstring(nameObj);
Sector *sector = g_grim->getCurrSet()->getSectorBySubstring(name, actor->getPos());
Sector *sector;
if (g_grim->getGameType() == GType_GRIM) {
sector = g_grim->getCurrSet()->getSectorBySubstring(name, actor->getPos());
} else {
sector = g_grim->getCurrSet()->getSectorByName(name);
if (!(sector && sector->isPointInSector(actor->getPos()))) {
sector = nullptr;
}
}
if (sector) {
lua_pushnumber(sector->getSectorId());
lua_pushstring(sector->getName().c_str());
@ -129,9 +138,8 @@ void Lua_V1::IsPointInSector() {
float z = lua_getnumber(zObj);
Math::Vector3d pos(x, y, z);
Sector *sector = g_grim->getCurrSet()->getSectorBySubstring(name);
if (sector && sector->isPointInSector(pos)) {
Sector *sector = g_grim->getCurrSet()->getSectorBySubstring(name, pos);
if (sector) {
lua_pushnumber(sector->getSectorId());
lua_pushstring(sector->getName().c_str());
lua_pushnumber(sector->getType());