mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-09 20:08:57 +03:00
Pushed some FGD work
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
enum class ClassPropertyType {
|
||||
String,
|
||||
Integer,
|
||||
|
||||
@@ -70,10 +70,30 @@ namespace Nuake {
|
||||
bool FGDFile::Export()
|
||||
{
|
||||
Ref<Project> project = Engine::GetProject();
|
||||
std::string path = project->TrenchbroomPath + "games/" + project->Name + "/" + project->Name + ".fgd";
|
||||
|
||||
if (project->Name.empty())
|
||||
{
|
||||
Logger::Log("Failed to create game configuration file: project name cannot be empty", "trenchbroom", CRITICAL);
|
||||
return false;
|
||||
}
|
||||
|
||||
FGDSerializer::BeginFGDFile(path);
|
||||
// Create the games/PROJECT_NAME/ directories if they don't exist.
|
||||
const std::string gamesDirectoryPath = project->TrenchbroomPath + "/../games/";
|
||||
if (!FileSystem::DirectoryExists(gamesDirectoryPath, true))
|
||||
{
|
||||
FileSystem::MakeDirectory(gamesDirectoryPath, true);
|
||||
}
|
||||
|
||||
const std::string configDirectoryPath = gamesDirectoryPath + project->Name;
|
||||
if (!FileSystem::DirectoryExists(configDirectoryPath, true))
|
||||
{
|
||||
FileSystem::MakeDirectory(configDirectoryPath, true);
|
||||
Logger::Log("Created game config directory: " + configDirectoryPath, "trenchbrrom");
|
||||
}
|
||||
|
||||
// Write the file
|
||||
const std::string filePath = configDirectoryPath + "/" + project->Name + ".fgd";
|
||||
FGDSerializer::BeginFGDFile(filePath);
|
||||
|
||||
for (auto& b : BaseEntities)
|
||||
{
|
||||
|
||||
@@ -10,7 +10,8 @@ namespace Nuake {
|
||||
Brush, Point, Base, None
|
||||
};
|
||||
|
||||
class FGDFile : ISerializable {
|
||||
class FGDFile : ISerializable
|
||||
{
|
||||
public:
|
||||
std::string Path;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user