static void write_objects(wap::OutputStream &stream, const std::vector<wap_object> &objects) { for (const wap_object &obj : objects) { auto &objp = obj.properties; stream.write(objp.id, (uint32_t)obj.name.size(), (uint32_t)obj.logic.size(), (uint32_t)obj.image_set.size(), (uint32_t)obj.animation.size(), objp.x, objp.y, objp.z, objp.i, objp.add_flags, objp.dynamic_flags, objp.draw_flags, objp.user_flags, objp.score, objp.points, objp.powerup, objp.damage, objp.smarts, objp.health); write_rect(stream, objp.move_rect); write_rect(stream, objp.hit_rect); write_rect(stream, objp.attack_rect); write_rect(stream, objp.clip_rect); write_rect(stream, objp.user_rects[0]); write_rect(stream, objp.user_rects[1]); stream.write(objp.user_values, objp.x_min, objp.y_min, objp.x_max, objp.y_max, objp.speed_x, objp.speed_y, objp.x_tweak, objp.y_tweak, objp.counter, objp.speed, objp.width, objp.height, objp.direction, objp.face_dir, objp.time_delay, objp.frame_delay, objp.object_type, objp.hit_type_flags, objp.x_move_res, objp.y_move_res); write_string(stream, obj.name); write_string(stream, obj.logic); write_string(stream, obj.image_set); write_string(stream, obj.animation); } }
static void write_tile_descriptions( wap::OutputStream &stream, const std::vector<wap_tile_description> &tile_descriptions) { stream.write(32, 0, (uint32_t)tile_descriptions.size(), 0, 0, 0, 0, 0); for (const wap_tile_description &desc : tile_descriptions) { stream.write(desc.type, 0, desc.width, desc.height); if (desc.type == WAP_TILE_TYPE_SINGLE) { stream.write(desc.inside_attrib); } else { stream.write(desc.outside_attrib, desc.inside_attrib); write_rect(stream, desc.rect); } } }
/** * \brief Save the configuration. */ void bf::configuration::save() const { if ( create_config_file() ) { std::string path ( path_configuration::get_instance().get_config_directory() + s_config_file_name ); std::ofstream f( path.c_str() ); if (f) { f << '\n' << s_section_left << s_main_frame_section << s_section_right << '\n' << s_comment << " Position and size of the main window\n"; write_rect( f, main_rect ); f << '\n'; } } } // configuration::save()