Moved file output segment to its own function.
This commit is contained in:
parent
19f97c27c1
commit
4c529c4f82
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user