From 274abeec5c6fe6449fae1eca1ae9582b1dbd0261 Mon Sep 17 00:00:00 2001 From: Paul Merrill Date: Thu, 5 Apr 2012 22:01:41 -0700 Subject: [PATCH] cleanup exportTile --- src/tile.cpp | 40 ++++++++++++---------------------------- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/src/tile.cpp b/src/tile.cpp index 635160c..60da019 100644 --- a/src/tile.cpp +++ b/src/tile.cpp @@ -215,8 +215,9 @@ Exit pythonNewExit(std::string area, int x, int y, double z) void exportTile() { - boost::python::class_ - ("FlagManipulator", boost::python::no_init) + using namespace boost::python; + + class_ ("FlagManipulator", no_init) .add_property("nowalk", &FlagManip::isNowalk, &FlagManip::setNowalk) .add_property("nowalk_player", @@ -224,50 +225,33 @@ void exportTile() .add_property("nowalk_npc", &FlagManip::isNowalkNPC, &FlagManip::setNowalkNPC) ; - boost::python::class_ - ("TileBase", boost::python::no_init) + class_ ("TileBase", no_init) .add_property("flags", &TileBase::flagManip) .add_property("type", make_function( static_cast (&TileBase::getType), - boost::python::return_value_policy< - boost::python::reference_existing_object - >() - ), - &TileBase::setType - ) + return_value_policy()), + &TileBase::setType) .def("onEnterScripts", &TileBase::onEnterScripts) .def("onLeaveScripts", &TileBase::onLeaveScripts) .def("onUseScripts", &TileBase::onUseScripts) ; - boost::python::class_ > - ("Tile", boost::python::no_init) + class_ > ("Tile", no_init) .def_readonly("x", &Tile::x) .def_readonly("y", &Tile::y) .def_readonly("z", &Tile::z) .add_property("exit", make_function( static_cast (&Tile::getNormalExit), - boost::python::return_value_policy< - boost::python::reference_existing_object - >() - ), - &Tile::setNormalExit - ) + return_value_policy()), + &Tile::setNormalExit) .def("offset", &Tile::offset, - boost::python::return_value_policy< - boost::python::reference_existing_object - >() - ) + return_value_policy()) ; - boost::python::class_ > - ("TileType", boost::python::no_init) + class_ > ("TileType", no_init) ; - boost::python::class_ - ("Exit", boost::python::init< - const std::string, int, int, double - >()) + class_ ("Exit", no_init) .def_readwrite("area", &Exit::area) .def_readwrite("coord", &Exit::coord) ; -- 2.11.4.GIT