print_permafeats.cc 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #include <iostream>
  2. #include <stdexcept>
  3. #include "../serialize.h"
  4. #include "../common_types.h"
  5. #include "../permafeats.h"
  6. int main(int argc, char** argv) {
  7. try {
  8. try {
  9. serialize::Source source("permafeats.dat");
  10. while (1) {
  11. try {
  12. permafeats::key_t key;
  13. permafeats::pt xy;
  14. tag_t tag;
  15. serialize::read(source, key);
  16. serialize::read(source, xy);
  17. serialize::read(source, tag);
  18. bool walk = true;
  19. bool water = false;
  20. if (tag.null()) {
  21. serialize::read(source, walk);
  22. serialize::read(source, water);
  23. }
  24. std::cout << key.worldz << ":" << key.worldx << ":" << key.worldy
  25. << " " << xy.first << "," << xy.second
  26. << " " << tag.v << " " << walk << " " << water << std::endl;
  27. } catch (std::exception& e) {
  28. std::cout << "OOPS: " << e.what() << std::endl;
  29. break;
  30. } catch (...) {
  31. break;
  32. }
  33. }
  34. } catch (...) {
  35. }
  36. } catch (std::exception& e) {
  37. std::cerr << "Fatal error: " << e.what() << std::endl;
  38. return 1;
  39. } catch (...) {
  40. std::cerr << "Unknown fatal error." << std::endl;
  41. return 1;
  42. }
  43. return 0;
  44. }