Skip to content

Commit 6c184c7

Browse files
committed
Log error when a TaskForceTechnoEntry cannot be created
1 parent 7430ffa commit 6c184c7

4 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/TSMapEditor/Config/Translations/en/Translation_en.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ MapLoader.ReadTubes.InvalidTube=Invalid tube entry: {0}
111111
MapLoader.MissingWeapon=Unable to find INI section for weapon {0}! Please check your Rules or the map's INI code for references to this weapon and either remove them, or implement the weapon properly.
112112
MapSetup.MapLoadErrors.Title=Errors while loading map
113113
MapSetup.MapLoadErrors.Description=One or more errors were encountered while loading the map:@@{0}
114+
TaskForce.ParseTaskForce.FailedToCreateTechnoEntry=Unable to create techno entry "{0}" for TaskForce "{1}" ({2})!
114115

115116
; *************************************************
116117
; Map

src/TSMapEditor/Constants.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ namespace TSMapEditor
44
{
55
public static class Constants
66
{
7-
public const string ReleaseVersion = "1.7.10";
7+
public const string ReleaseVersion = "1.7.11";
88

99
public static int CellSizeX = 48;
1010
public static int CellSizeY = 24;

src/TSMapEditor/Extensions/ListExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public static void ReadTaskForces(this List<TaskForce> taskForceList, IniFile in
1818
if (string.IsNullOrWhiteSpace(kvp.Value))
1919
continue;
2020

21-
var taskForce = TaskForce.ParseTaskForce(rules, iniFile.GetSection(kvp.Value));
21+
var taskForce = TaskForce.ParseTaskForce(rules, iniFile.GetSection(kvp.Value), errorLogger);
2222
if (taskForce == null)
2323
{
2424
errorLogger(string.Format(Translate("ListExtensions.TaskForceParseError",

src/TSMapEditor/Models/TaskForce.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public void Write(IniSection section)
192192
section.SetIntValue(nameof(Group), Group);
193193
}
194194

195-
public static TaskForce ParseTaskForce(Rules rules, IniSection taskforceSection)
195+
public static TaskForce ParseTaskForce(Rules rules, IniSection taskforceSection, Action<string> errorLogger)
196196
{
197197
if (taskforceSection == null)
198198
return null;
@@ -212,7 +212,10 @@ public static TaskForce ParseTaskForce(Rules rules, IniSection taskforceSection)
212212

213213
var entry = TaskForceTechnoEntry.CreateEntry(rules, value);
214214
if (entry == null)
215+
{
216+
errorLogger(Translate(taskForce, "ParseTaskForce.FailedToCreateTechnoEntry", string.Format("Unable to create techno entry \"{0}\" for TaskForce \"{1}\" ({2})!", value, taskForce.Name, taskForce.ININame)));
215217
break;
218+
}
216219

217220
taskForce.TechnoTypes[i] = entry;
218221
}

0 commit comments

Comments
 (0)