Elaztek Developer Hub
Blamite Game Engine - blam!  00398.09.22.23.2015.blamite
The core library for the Blamite Game Engine.
map_name.hpp
Go to the documentation of this file.
1 #include "../console.h"
2 
3 #include <Strings/components/utils/io/io.h>
4 
9 #include "core.h"
10 
12 {
19  {
20  public:
22  {
23  name = "map_name";
24  description = "the same as game_start: launches a game for debugging purposes";
25  aliases = { "level_name", "scenario_name", "game_start" };
26 
28  }
29 
30  BlamCommandResult onCommand(std::vector<std::string> arguments)
31  {
32  std::string file_path = "";
33 
34  for (int i = 0; i < arguments.size(); i++)
35  {
36  file_path += arguments.at(i);
37 
38  if (i != (arguments.size() - 1))
39  {
40  file_path += " ";
41  }
42  }
43 
45  {
46  if (BlamStrings::Utils::IO::FileExists(ENGINE_DATA_PATH(BlamEngineDataFolder::Maps) + file_path))
47  {
48  Blam::Logger::LogEvent("cache file support is not yet available", WSV_WARNING);
49  }
50  else
51  {
52  Blam::Logger::LogEvent("could not find any scenario named '" + file_path + "'", WSV_WARNING);
53  }
54  }
56  {
57  if (BlamStrings::Utils::IO::FileExists(ENGINE_DATA_PATH(BlamEngineDataFolder::Tags) + file_path))
58  {
60  }
61  else if (BlamStrings::Utils::IO::FileExists(USER_DATA_PATH(BlamUserDataFolder::Tags) + file_path))
62  {
64  }
65  else
66  {
67  Blam::Logger::LogEvent("could not find any scenario named '" + file_path + "'", WSV_WARNING);
68  }
69  }
70  else
71  {
72  Blam::Logger::LogEvent("could not search for scenario, build is using an unknown runtime configuration?", WSV_NONE);
73  }
74 
75  return BlamCommandResult::Ok;
76  }
77  };
78 }
BlamContentSource::Cache
@ Cache
The engine will load all content from cache files.
BlamCommandType::Builtin
@ Builtin
A command that is hard-coded into the engine.
Blam::Logger::LogEvent
BLAM void LogEvent(std::string message)
Logs a message to the log and/or console.
Definition: aliases.cpp:142
BlamConsoleCommand::description
std::string description
An optional description of the command. Shown when using the classify command.
Definition: console.h:59
logger.h
BlamEngineDataFolder::Tags
@ Tags
Directory used for reading engine tags. Defaults to ./tags/
BlamConsoleCommand
Class used to represent a console command.
Definition: console.h:56
USER_DATA_PATH
#define USER_DATA_PATH(path)
Macro to quickly access a user data folder.
Definition: config.h:43
Blam::Resources::Console::MapNameCommand::MapNameCommand
MapNameCommand()
Definition: map_name.hpp:21
BlamContentSource::Tags
@ Tags
The engine will load all content from tags.
BlamCommandResult
BlamCommandResult
Indicates the return state of a console command.
Definition: console.h:22
ENGINE_DATA_PATH
#define ENGINE_DATA_PATH(path)
Macro to quickly access a game engine data folder.
Definition: config.h:36
BlamConsoleCommand::name
std::string name
The name of the console command.
Definition: console.h:58
BlamEngineDataFolder::Maps
@ Maps
Directory used for storing built-in cache files. Defaults to ./maps/
Blam::Resources::Console::MapNameCommand
Class for the map_name command.
Definition: map_name.hpp:18
engine_definitions.h
Blam::Content::Tags::LoadScenarioTag
BLAM_EXT_API void LoadScenarioTag(std::string tag_path)
Loads a new scenario tag.
Definition: scenario.cpp:77
Blam::GetContentSource
BLAM BlamContentSource GetContentSource()
Retrieves the current content source.
Definition: engine_definitions.cpp:32
BlamConsoleCommand::type
BlamCommandType type
The type of command this is. See #Blam::Resources::Console::BlamCommandType for more information.
Definition: console.h:63
Blam::Resources::Console::MapNameCommand::onCommand
BlamCommandResult onCommand(std::vector< std::string > arguments)
Called upon command execution.
Definition: map_name.hpp:30
core.h
scenario.h
config.h
BlamConsoleCommand::aliases
std::vector< std::string > aliases
A list of aliases for the command. Executing any of these instead of the command name will behave the...
Definition: console.h:61
BlamUserDataFolder::Tags
@ Tags
Directory storing user-created tags. Defaults to {DataRoot}/tags/.
BlamCommandResult::Ok
@ Ok
The command was run without error.
Blam::Resources::Console
Namespace for things relating to the debug console.
Definition: abort.hpp:5