properties.cpp 876 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //KGP -- added in for use with HLCSG_NULLIFY_INVISIBLE
  2. #include "csg.h"
  3. #ifdef HLCSG_NULLIFY_INVISIBLE
  4. #include <fstream>
  5. #include <istream>
  6. using namespace std;
  7. set<string> g_invisible_items;
  8. void properties_initialize(const char* filename)
  9. {
  10. if (filename == NULL)
  11. { return; }
  12. if (q_exists(filename))
  13. { Log("Loading null entity list from '%s'\n", filename); }
  14. else
  15. {
  16. Error("Could not find null entity list file '%s'\n", filename);
  17. return;
  18. }
  19. ifstream file(filename,ios::in);
  20. if(!file)
  21. {
  22. file.close();
  23. return;
  24. }
  25. //begin reading list of items
  26. char line[ZHLT3_MAX_VALUE];
  27. memset(line,0,sizeof(char)*4096);
  28. int numitems = 0;
  29. char* str = NULL;
  30. char** list = NULL;
  31. while(!file.eof())
  32. {
  33. string str;
  34. getline(file,str);
  35. if(str.size() < 1)
  36. { continue; }
  37. g_invisible_items.insert(str);
  38. }
  39. file.close();
  40. }
  41. #endif