Skip to content

Commit

Permalink
fix crash on s1 replays due to no ward position data
Browse files Browse the repository at this point in the history
  • Loading branch information
howardchung committed Sep 22, 2024
1 parent 9a39bf2 commit 6553ce7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
8 changes: 6 additions & 2 deletions processors/processExpand.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -608,11 +608,15 @@ function processExpand(entries, meta) {
}
},
obs(e) {
expand({ ...e, type: 'obs', posData: true });
if (e.x && e.y) {
expand({ ...e, type: 'obs', posData: true });
}
expand({ ...e, type: 'obs_log' });
},
sen(e) {
expand({ ...e, type: 'sen', posData: true });
if (e.x && e.y) {
expand({ ...e, type: 'sen', posData: true });
}
expand({ ...e, type: 'sen_log' });
},
obs_left(e) {
Expand Down
16 changes: 10 additions & 6 deletions src/main/java/opendota/Parse.java
Original file line number Diff line number Diff line change
Expand Up @@ -747,9 +747,11 @@ public void onTickStart(Context ctx, boolean synthetic) {

Float vx = getEntityProperty(e, "CBodyComponent.m_vecX", null);
Float vy = getEntityProperty(e, "CBodyComponent.m_vecY", null);

entry.x = getPreciseLocation(cx,vx);
entry.y = getPreciseLocation(cy,vy);

if (cx != null && cy != null) {
entry.x = getPreciseLocation(cx,vx);
entry.y = getPreciseLocation(cy,vy);
}
// System.err.format("%s, %s\n", entry.x, entry.y);
// get the hero's entity name, ex: CDOTA_Hero_Zuus
entry.unit = e.getDtClass().getDtName();
Expand Down Expand Up @@ -991,9 +993,11 @@ private Entry buildWardEntry(Context ctx, Entity e) {

Integer life_state = getEntityProperty(e, "m_lifeState", null);

entry.x = getPreciseLocation(cx,vx);
entry.y = getPreciseLocation(cy,vy);
entry.z = getPreciseLocation(cz,vz);
if (cx != null && cy != null && cz != null) {
entry.x = getPreciseLocation(cx,vx);
entry.y = getPreciseLocation(cy,vy);
entry.z = getPreciseLocation(cz,vz);
}

entry.type = isObserver ? "obs" : "sen";
entry.entityleft = life_state == 1;
Expand Down

0 comments on commit 6553ce7

Please sign in to comment.