コード例 #1
0
ファイル: cellextensions.cpp プロジェクト: Kafou1/openmw
                virtual void execute (Interpreter::Runtime& runtime)
                {
                    Interpreter::Type_Integer x = runtime[0].mInteger;
                    runtime.pop();

                    Interpreter::Type_Integer y = runtime[0].mInteger;
                    runtime.pop();

                    ESM::Position pos;
                    MWBase::World *world = MWBase::Environment::get().getWorld();
                    world->getPlayer().setTeleported(true);
                    world->indexToPosition (x, y, pos.pos[0], pos.pos[1], true);
                    pos.pos[2] = 0;

                    pos.rot[0] = pos.rot[1] = pos.rot[2] = 0;

                    world->changeToExteriorCell (pos);
                    world->fixPosition(world->getPlayerPtr());
                }
コード例 #2
0
ファイル: cellextensions.cpp プロジェクト: Kafou1/openmw
                virtual void execute (Interpreter::Runtime& runtime)
                {
                    std::string cell = runtime.getStringLiteral (runtime[0].mInteger);
                    runtime.pop();

                    ESM::Position pos;
                    MWBase::World *world = MWBase::Environment::get().getWorld();

                    world->getPlayer().setTeleported(true);
                    if (world->findExteriorPosition(cell, pos))
                    {
                        world->changeToExteriorCell(pos);
                        world->fixPosition(world->getPlayerPtr());
                    }
                    else
                    {
                        // Change to interior even if findInteriorPosition()
                        // yields false. In this case position will be zero-point.
                        world->findInteriorPosition(cell, pos);
                        world->changeToInteriorCell(cell, pos);
                    }
                }