Elaztek Developer Hub
Blamite Game Engine - blam!  00453.06.08.26.0624.blamite
The core library for the Blamite Game Engine.
tag_load.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "../console.h"
4 
8 #include "core.h"
9 
11 {
18  {
19  public:
21  {
22  name = "tag_load";
23  description = "loads a tag from an available cache file or from the engine tags folder";
24  syntax = "tag_load <string>";
25 
27  }
28 
29  BlamResult Execute(std::vector<std::string> arguments)
30  {
31  if (arguments.size() > 0)
32  {
33  std::string args_compiled = "";
34 
35  for (int i = 0; i < arguments.size(); i++)
36  {
37  args_compiled += arguments.at(i);
38 
39  if (i != arguments.size() - 1)
40  {
41  args_compiled += " ";
42  }
43  }
44 
45  BlamResult load_result = Blam::Content::Tags::LoadTagFromFile(args_compiled, false);
46 
47  if (BR_SUCCEEDED(load_result))
48  {
49  Blam::Logger::LogEvent("loaded tag at " + args_compiled);
50  }
51  else
52  {
53  Blam::Logger::LogEvent("failed to load tag at " + args_compiled + " (load result was " + std::to_string(load_result) + ")", WSV_WARNING);
54  }
55  }
56 
57  return BlamResult::Success_OK;
58  }
59  };
60 }
tag_io.h
Blam::Logger::LogEvent
BLAM void LogEvent(std::string message)
Logs a message to the log and/or console.
Definition: aliases.cpp:130
BlamConsoleCommand::description
std::string description
An optional description of the command. Shown when using the classify command.
Definition: console.h:36
logger.h
Blam::Resources::Console::TagLoadCommand
Class for the tag_load command.
Definition: tag_load.hpp:17
BlamConsoleCommand
Class used to represent a console command.
Definition: console.h:33
Blam::Content::Tags::LoadTagFromFile
BLAM BlamResult LoadTagFromFile(std::string tag_path, bool reload_if_already_loaded=true)
Loads a tag from the engine's tag directory (default is '.
Definition: tag_io.cpp:319
BlamConsoleCommand::name
std::string name
The name of the console command.
Definition: console.h:35
Blam::Resources::Console::TagLoadCommand::TagLoadCommand
TagLoadCommand()
Definition: tag_load.hpp:20
BlamConsoleCommand::syntax
std::string syntax
The syntax information for the command. Shown to the user when using the help command with an argumen...
Definition: console.h:37
BlamConsoleCommand::type
BlamCommandType type
The type of command this is. See #Blam::Resources::Console::BlamCommandType for more information.
Definition: console.h:40
tags.h
Blam::Resources::Console
Namespace for things relating to the debug console.
Definition: abort.hpp:5
Blam::Resources::Console::TagLoadCommand::Execute
BlamResult Execute(std::vector< std::string > arguments)
Called upon command execution.
Definition: tag_load.hpp:29
BlamCommandType::Builtin
@ Builtin
A command that is hard-coded into the engine.