X-Git-Url: http://git.tdb.fi/?p=r2c2.git;a=blobdiff_plain;f=source%2Flibr2c2%2Ftrain.cpp;h=43723779fbb89f2cfba327659f81aa4410883a38;hp=b1fbc6a76ebb1bf4ad02f85d981f465fef1a1759;hb=e8b19bb2711913226580b93ba127b0628839c10d;hpb=f0aa8913aa1f4df37b87dcedbc257febb0e101a1 diff --git a/source/libr2c2/train.cpp b/source/libr2c2/train.cpp index b1fbc6a..4372377 100644 --- a/source/libr2c2/train.cpp +++ b/source/libr2c2/train.cpp @@ -417,6 +417,10 @@ void Train::save(list &st) const st.push_back(ss); } + const VehicleType::FunctionMap &func_map = loco_type.get_functions(); + for(VehicleType::FunctionMap::const_iterator i=func_map.begin(); i!=func_map.end(); ++i) + st.push_back((DataFile::Statement("function"), i->first, static_cast(functions&(1<first)))); + // XXX Need more generic way of saving AI state for(list::const_iterator i=ais.begin(); i!=ais.end(); ++i) { @@ -593,6 +597,7 @@ Train::Loader::Loader(Train &t): blocks_valid(true) { add("blocks", &Loader::blocks); + add("function", &Loader::function); add("name", &Loader::name); add("quantized_speed", &Loader::quantized_speed); add("router", &Loader::router); @@ -615,6 +620,11 @@ void Train::Loader::blocks() load_sub(obj.allocator); } +void Train::Loader::function(unsigned f, bool s) +{ + obj.set_function(f, s); +} + void Train::Loader::name(const string &n) { obj.set_name(n);