diff --git a/main.cc b/main.cc index 95eaf37..1184dbc 100644 --- a/main.cc +++ b/main.cc @@ -16,6 +16,7 @@ #include "connection.h" #include "main.h" #include "map.h" +#include "rawio.h" int tick_id = 0; @@ -43,6 +44,11 @@ main(int argc, char *argv[]) class map map(argc < 2 ? 40 : atoi(argv[1]), argc < 3 ? 20 : atoi(argv[2])); int herbs = argc < 4 ? map.w * map.h / world::herb_rate : atoi(argv[3]); + #ifdef RAWIO + if(rawio_cfg(&map)==-1) + std::cout<<"rawio_cfg: Cannost open cfg file"< +#include + +int rawio_map(map *map) +{ + std::ofstream mapout; + mapout.open("rawio_map",std::ios::out|std::ios::trunc); + if(mapout.is_open()) + { + for (int y = 0; y < map->h; y++) + { + for (int x = 0; x < map->w; x++) + mapout << map->tile_at(x, y).symbol(); + mapout << std::endl; + } + mapout.close(); + return 0; + } + return -1;//cannot open outstream +} + +int rawio_cfg(map *map) +{ + std::ofstream cfgout; + cfgout.open("rawio_cfg",std::ios::out|std::ios::trunc); + if(cfgout.is_open()) + { + cfgout<w<h<