Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit 02dea04

Browse files
committed
Changed Scene::GetOptionalArea failure message to be a warning not an error
Changed RandomX failure message to be a warning not an error
1 parent 9617058 commit 02dea04

File tree

3 files changed

+25
-23
lines changed

3 files changed

+25
-23
lines changed

Entities/Scene.h

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -922,26 +922,28 @@ const SceneObject * PickPlacedActorInRange(int whichSet, Vector &scenePoint, int
922922

923923
bool HasArea(std::string areaName);
924924

925-
926-
//////////////////////////////////////////////////////////////////////////////////////////
927-
// Method: GetArea
928-
//////////////////////////////////////////////////////////////////////////////////////////
929-
// Description: Gets a specific Area identified by a name. Ownership is NOT transferred!
930-
// Arguments: The name of the Area to try to get.
931-
// Return value: A pointer to the Area asked for. 0 if no Area of that name was found.
932-
933-
Area * GetArea(std::string areaName);
934-
935-
//////////////////////////////////////////////////////////////////////////////////////////
936-
// Method: GetNonRequiredArea
937-
//////////////////////////////////////////////////////////////////////////////////////////
938-
// Description: Gets a specific Area identified by a name. Ownership is NOT transferred!
939-
// Using this function will not add the area to the list of required areas
940-
// which Scenario GUI uses to show compatible areas.
941-
// Arguments: The name of the Area to try to get.
942-
// Return value: A pointer to the Area asked for. 0 if no Area of that name was found.
943-
944-
Area * GetOptionalArea(std::string areaName) { return GetArea(areaName); };
925+
/// <summary>
926+
/// Gets a specified Area identified by name. Ownership is NOT transferred!
927+
/// </summary>
928+
/// <param name="areaName">The name of the Area to try to get.</param>
929+
/// <param name="luaWarnNotError">Whether to warn or error in the Lua console. True is warn, false is error.</param>
930+
/// <returns>A pointer to the Area asked for, or nullptr if no Area of that name was found.</returns>
931+
Area * GetArea(const std::string_view &areaName, bool luaWarnNotError);
932+
933+
/// <summary>
934+
/// Gets a specified Area identified by name, showing a Lua error if it's not found. Ownership is NOT transferred!
935+
/// </summary>
936+
/// <param name="areaName">The name of the Area to try to get.</param>
937+
/// <returns>A pointer to the Area asked for, or nullptr if no Area of that name was found.</returns>
938+
Area * GetArea(const std::string &areaName) { return GetArea(areaName, false); }
939+
940+
/// <summary>
941+
/// Gets a specified Area identified by name, showing a Lua warning if it's not found. Ownership is NOT transferred!
942+
/// Using this function will not add the area to the list of required areas which Scenario GUI uses to show compatible areas.
943+
/// </summary>
944+
/// <param name="areaName">The name of the Area to try to get.</param>
945+
/// <returns>A pointer to the Area asked for, or nullptr if no Area of that name was found.</returns>
946+
Area * GetOptionalArea(const std::string &areaName) { return GetArea(areaName, true); };
945947

946948

947949
//////////////////////////////////////////////////////////////////////////////////////////

Lua/LuaAdaptersEntities.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ namespace RTE {
6666
if (!entityPreset) { entityPreset = g_PresetMan.GetRandomBuyableOfGroupFromTech(groupName, #TYPE, g_PresetMan.GetModuleID("Base.rte")); } \
6767
if (!entityPreset) { entityPreset = g_PresetMan.GetRandomBuyableOfGroupFromTech("Any", #TYPE, moduleSpaceID); } \
6868
if (!entityPreset) { \
69-
g_ConsoleMan.PrintString(std::string("ERROR: Could not find any ") + std::string(#TYPE) + std::string(" defined in a Group called \"") + groupName + std::string("\" in module ") + g_PresetMan.GetDataModuleName(moduleSpaceID) + "!"); \
69+
g_ConsoleMan.PrintString(std::string("WARNING: Could not find any ") + std::string(#TYPE) + std::string(" defined in a Group called \"") + groupName + std::string("\" in module ") + g_PresetMan.GetDataModuleName(moduleSpaceID) + "!"); \
7070
return nullptr; \
7171
} \
7272
return dynamic_cast<TYPE *>(entityPreset->Clone()); \
@@ -77,7 +77,7 @@ namespace RTE {
7777
if (!entityPreset) { entityPreset = g_PresetMan.GetRandomBuyableOfGroupFromTech(groupName, #TYPE, g_PresetMan.GetModuleID("Base.rte")); } \
7878
if (!entityPreset) { entityPreset = g_PresetMan.GetRandomBuyableOfGroupFromTech("Any", #TYPE, moduleSpaceID); } \
7979
if (!entityPreset) { \
80-
g_ConsoleMan.PrintString(std::string("ERROR: Could not find any ") + std::string(#TYPE) + std::string(" defined in a Group called \"") + groupName + std::string("\" in module ") + dataModuleName + "!"); \
80+
g_ConsoleMan.PrintString(std::string("WARNING: Could not find any ") + std::string(#TYPE) + std::string(" defined in a Group called \"") + groupName + std::string("\" in module ") + dataModuleName + "!"); \
8181
return nullptr; \
8282
} \
8383
return dynamic_cast<TYPE *>(entityPreset->Clone()); \

Lua/LuaBindingsEntities.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,7 @@ namespace RTE {
10411041
.def_readwrite("Areas", &Scene::m_AreaList, luabind::return_stl_iterator)
10421042
.def("SetArea", &Scene::SetArea)
10431043
.def("HasArea", &Scene::HasArea)
1044-
.def("GetArea", &Scene::GetArea)
1044+
.def("GetArea", (Scene::Area * (Scene:: *)(const std::string &areaName)) &Scene::GetArea)
10451045
.def("GetOptionalArea", &Scene::GetOptionalArea)
10461046
.def("WithinArea", &Scene::WithinArea)
10471047
.def("ResetPathFinding", &Scene::ResetPathFinding)

0 commit comments

Comments
 (0)