aboutsummaryrefslogtreecommitdiff
path: root/advtrains_train_track
Commit message (Expand)AuthorAge
* Added alternative recipes, falling back on the default: items as they seem to...Maverick27972021-03-06
* Add some missing craft recipesorwell962021-02-19
* Make is_node_loaded() checks also for mesecon interactions and digiline_send(...orwell962021-02-04
* Add 3-way turnouts and y-turnouts (both diverging)Blockhead2020-09-11
* Deprecate old 4590 crossingsBlockhead2020-08-21
* Add two new sets of diamond crossing typesBlockhead2020-08-21
* Move recipes to train_track and add crossing recipesBlockhead2020-07-10
* Add perpendicular and 45/90 degree crossing railsBlockhead2020-07-06
* Move train_load() function into advtrains_train_trackorwell962017-12-18
* do not register wagons in the advtrains namespace automaticallyorwell962017-11-22
* Moved default train track to separate mod, for integration with advcarts.Gabriel Pérez-Cerezo2017-10-25
l com"> This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef STATICOBJECT_HEADER #define STATICOBJECT_HEADER #include "irrlichttypes_bloated.h" #include <string> #include <sstream> #include <list> #include <map> #include "debug.h" struct StaticObject { u8 type; v3f pos; std::string data; StaticObject(): type(0), pos(0,0,0) { } StaticObject(u8 type_, v3f pos_, const std::string &data_): type(type_), pos(pos_), data(data_) { } void serialize(std::ostream &os); void deSerialize(std::istream &is, u8 version); }; class StaticObjectList { public: /* Inserts an object to the container. Id must be unique (active) or 0 (stored). */ void insert(u16 id, StaticObject obj) { if(id == 0) { m_stored.push_back(obj); } else { if(m_active.find(id) != m_active.end()) { dstream<<"ERROR: StaticObjectList::insert(): " <<"id already exists"<<std::endl; assert(0); return; } m_active[id] = obj; } } void remove(u16 id) { assert(id != 0); if(m_active.find(id) == m_active.end()) { dstream<<"WARNING: StaticObjectList::remove(): id="<<id <<" not found"<<std::endl; return; } m_active.erase(id); } void serialize(std::ostream &os); void deSerialize(std::istream &is); /* NOTE: When an object is transformed to active, it is removed from m_stored and inserted to m_active. The caller directly manipulates these containers. */ std::list<StaticObject> m_stored; std::map<u16, StaticObject> m_active; private: }; #endif