Skip to content
This repository was archived by the owner on Jul 6, 2022. It is now read-only.

Commit 403c087

Browse files
committed
Fixing HUD issues with Van's regional map code.
1 parent 2436f39 commit 403c087

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

app/index.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@
132132
<div class="{{status}}">
133133
<h2>{{status}}</h2>
134134
{{#each neighbors}}
135-
{{#if name}}
136-
<h3>{{hostiles}} hostile{{#if hostiles}}s{{/if}} in {{name}}</h3>
135+
{{#if system.name}}
136+
<h3>{{hostiles}} hostile{{#if hostiles}}s{{/if}} in {{system.name}}</h3>
137137
{{/if}}
138138
{{/each}}
139139
</div>
@@ -169,15 +169,13 @@ <h3>{{hostiles}} hostile{{#if hostiles}}s{{/if}} in {{name}}</h3>
169169

170170
<script type="text/x-handlebars-template" id="scanTemplate">
171171
<div class="scan">
172-
173172
<table class="description" onclick="ScanList.toggleCollapse(this);">
174173
<tr>
175174
<td class="reported-by"><a href="javascript:CCPEVE.showInfo(1377, {{reporterId}});">{{reporter}}</a> shared scan results</td>
176175
<td class="system"><a href="javascript:CCPEVE.showInfo(5,{{systemId}});">{{systemName}}</a></td>
177176
<td class="reported-at">{{time}}</td>
178177
</tr>
179178
</table>
180-
181179
<div class="results-container collapsible">
182180
<ul class="actions">
183181
<li><a class="btn" onclick="scanFilter(this, 'grid');">On Grid</a></li>

app/js/SystemMap.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ var SystemMap = {
88

99
// let's count things
1010
hostile_count: function(system) {
11+
if (system == undefined) { return 0; }
1112
return (system.name !== undefined ) ? $.grep(Data.hostiles, function(h) { return system.name === h.systemName; }).length : 0
1213
},
1314

1415
friendly_count: function(system) {
16+
if (system == undefined) { return 0; }
1517
return (system.name !== undefined ) ? $.grep(Data.members, function(h) { return system.name === h.systemName; }).length : 0
1618
},
1719

@@ -247,12 +249,12 @@ var SystemMap = {
247249
updateHud: function(system_name) {
248250
var system = {name: system_name}
249251
system.neighbors = $.map(SystemMap.links, function(n) {
250-
if (n.target.name === system_name) {
251-
n.source.hostiles = SystemMap.hostile_count(n.source);
252+
if (n.target.system && n.target.system.name === system_name) {
253+
n.source.hostiles = SystemMap.hostile_count(n.source.system);
252254
return n.source;
253255
}
254-
if (n.source.name === system_name) {
255-
n.target.hostiles = SystemMap.hostile_count(n.target);
256+
if (n.source.system && n.source.system.name === system_name) {
257+
n.target.hostiles = SystemMap.hostile_count(n.target.system);
256258
return n.target;
257259
}
258260
});

0 commit comments

Comments
 (0)