61 lines
1.2 KiB
C++
Raw Normal View History

2015-02-02 15:41:03 +13:00
//
// Author: Michael Cameron
// Email: chronokun@hotmail.com
//
// Libraries Include
#include "libraries.h"
// Local Includes
#include "mapparser.h"
2017-04-11 08:27:10 -07:00
#include "brushdef.hpp"
2015-02-02 15:41:03 +13:00
using namespace std;
// .map files for GTKRadiant
2017-04-11 08:27:10 -07:00
bool writemap(const TWorldSpawn &x,
const char *fn,
void (*f) (std::stringstream &, const vector<TPlanePoints> &)) {
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)
{
2017-04-11 08:27:10 -07:00
OutFile << GetBrushString(krBrush, f);
}
OutFile << "}" << std::endl;
return true;
}
2015-02-02 15:41:03 +13:00
int main(const int _kiArgC, const char** _kppcArgv)
{
// Check we have correct number of parameters
if(_kiArgC < 3)
{
return(3);
}
CMapParser Parser;
const bool kbSuccess = Parser.LoadMap(_kppcArgv[1]);
if(!kbSuccess)
{
return(1);
}
else
{
2017-04-11 08:27:10 -07:00
if (writemap(Parser.m_WorldSpawn, _kppcArgv[2], &brushdef_net)) {
cout << "Successfully exported map." << endl;
} else {
cout << "Failed to write output file." << endl;
}
2015-02-02 15:41:03 +13:00
}
return(0);
2017-04-02 07:04:09 -07:00
}