diff --git a/ReflexToQ3/main.cpp b/ReflexToQ3/main.cpp index cf9f653..39f3af1 100644 --- a/ReflexToQ3/main.cpp +++ b/ReflexToQ3/main.cpp @@ -9,6 +9,34 @@ #include "mapparser.h" #include "planes.h" +using namespace std; +// .map files for GTKRadiant +bool brushdef_legacy(const TWorldSpawn &x, const char *fn) { + cout << fn << endl; + ofstream OutFile; + OutFile.open(fn); + if(!OutFile.is_open()) + { + return false; + } + + OutFile << "{" << std::endl + << "\"classname\" \"worldspawn\"" << std::endl; + + for(const TBrush& krBrush : x.m_Brushes) + { + OutFile << GetBrushString(krBrush); + } + + OutFile << "}" << std::endl; + return true; +} + +// .map files for NetRadiant +void brushdef(const TWorldSpawn &x, const char *fn) { + +} + int main(const int _kiArgC, const char** _kppcArgv) { // Check we have correct number of parameters @@ -26,23 +54,11 @@ int main(const int _kiArgC, const char** _kppcArgv) } else { - // Open output file - std::ofstream OutFile; - OutFile.open(_kppcArgv[2]); - if(!OutFile.is_open()) - { - return(2); - } - - OutFile << "{" << std::endl - << "\"classname\" \"worldspawn\"" << std::endl; - - for(const TBrush& krBrush : Parser.m_WorldSpawn.m_Brushes) - { - OutFile << GetBrushString(krBrush); - } - - OutFile << "}" << std::endl; + if (brushdef_legacy(Parser.m_WorldSpawn,_kppcArgv[2])) { + cout << "Successfully exported map." << endl; + } else { + cout << "Failed to write output file." << endl; + } } return(0);