Skip to content

Commit

Permalink
Fix for: If 2525B is not loaded, getBasicSymbolID errors out when cal…
Browse files Browse the repository at this point in the history
…led with no symStd parameter #29
  • Loading branch information
Michael Spinelli committed Mar 16, 2018
1 parent 7cbca12 commit c35965e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 22 deletions.
4 changes: 2 additions & 2 deletions web/js/src/armyc2/c2sd/renderer/utilities/SymbolDefTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ armyc2.c2sd.renderer.utilities.SymbolDefTable = (function () {
else
symbolMap = symbolMapC;

if(symbolMap[symbolID] !== undefined)
if(symbolMap && symbolMap[symbolID] !== undefined)
{
return symbolMap[symbolID];
}
Expand All @@ -259,7 +259,7 @@ armyc2.c2sd.renderer.utilities.SymbolDefTable = (function () {
else
symbolMap = symbolMapC;

if(symbolMap[symbolID] !== undefined)
if(symbolMap && symbolMap[symbolID] !== undefined)
{
return true;
}
Expand Down
31 changes: 13 additions & 18 deletions web/js/src/armyc2/c2sd/renderer/utilities/SymbolUtilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,36 +28,31 @@ armyc2.c2sd.renderer.utilities.SymbolUtilities.rendererSettings = armyc2.c2sd.re
{
basic = scheme + '*' + basic.charAt(2) + '*' + basic.substring(4, 10) + "*****";

var i = symStd || 0;
for(; i < 2; i++)
var std = armyc2.c2sd.renderer.utilities.RendererSettings.getSymbologyStandard();
if(symStd !== undefined)
std = symStd;

var has = armyc2.c2sd.renderer.utilities.UnitDefTable.hasUnitDef(basic, std);
var temp = null;
if(!has)
{
var has = armyc2.c2sd.renderer.utilities.UnitDefTable.hasUnitDef(basic, i);
var temp = null;
temp = basic.substr(0,10) + "H****";
has = armyc2.c2sd.renderer.utilities.UnitDefTable.hasUnitDef(temp, std);
if(has)
{
i=3;
basic = temp;
}
else
{
temp = basic.substr(0,10) + "H****";
has = armyc2.c2sd.renderer.utilities.UnitDefTable.hasUnitDef(temp, i);
temp = basic.substr(0,10) + "MO***";
has = armyc2.c2sd.renderer.utilities.UnitDefTable.hasUnitDef(temp, std);
if(has)
{
basic = temp;
i=3;
}
else
{
temp = basic.substr(0,10) + "MO***";
has = armyc2.c2sd.renderer.utilities.UnitDefTable.hasUnitDef(temp, i);
if(has)
{
basic = temp;
i=3;
}
}
}
}

}
else if (scheme === 'G') //tactical graphic
{
Expand Down
4 changes: 2 additions & 2 deletions web/js/src/armyc2/c2sd/renderer/utilities/UnitDefTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ armyc2.c2sd.renderer.utilities.UnitDefTable = (function () {
else
symbolMap = symbolMapC;

if(symbolMap[symbolID] !== undefined)
if(symbolMap && symbolMap[symbolID] !== undefined)
{
return symbolMap[symbolID];
}
Expand All @@ -167,7 +167,7 @@ armyc2.c2sd.renderer.utilities.UnitDefTable = (function () {
else
symbolMap = symbolMapC;

if(symbolMap[symbolID] !== undefined)
if(symbolMap && symbolMap[symbolID] !== undefined)
{
return true;
}
Expand Down

0 comments on commit c35965e

Please sign in to comment.