Skip to content

[GEN][ZH] Fix Hero Radar icon garrison issues introduced by #1035 #1267

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 16, 2025

Conversation

xezon
Copy link

@xezon xezon commented Jul 12, 2025

This change fixes #1246, which was introduced with #1035 and #1240. There were actually 3 bugs remaining:

  1. Hero Radar icons on garrisoned building were not removed or updated from the Radar
  2. Hero Radar icons would stack inside garrisons
  3. Hero Radar icons would move to fire ports when shooting, which looked irritating

To fix that, I reinstanted the "calcHero" code that the original EA code had, in combination with code that takes care of cleaning up the object pointers to avoid dangling.


I did experiment with several implementations and there are many pitfalls when doing it just not the right way. I tried removing and adding Geros and Buildings containing Heros on containing and uncontaining, but that was doomed with Saveload, because after Load the order of containment is not favourable for this to work.

TODO

  • Replicate in Generals

@xezon xezon added Bug Something is not working right, typically is user facing GUI For graphical user interface Minor Severity: Minor < Major < Critical < Blocker ThisProject The issue was introduced by this project, or this task is specific to this project labels Jul 12, 2025
@Caball009 Caball009 added Major Severity: Minor < Major < Critical < Blocker and removed Minor Severity: Minor < Major < Critical < Blocker labels Jul 15, 2025
@Caball009
Copy link

Caball009 commented Jul 15, 2025

This fixes a crash for me probably introduced by the recent changes to the hero radar.

I tried to load a save game from a couple of weeks ago and got a crash here because m_containListSize was 1, but the list itself was empty:

// If I am empty, say no.
if( m_containListSize < 1 )
return NULL;
if( !m_redirectionActivated )
return NULL;// Shut off early to allow death to happen without my bunker having
// trouble finding me to say goodbye as messages get sucked up the pipe to him.
Object *myGuy = m_containList.front();
if( myGuy )

Callstack:

generalszh.exe!std::list<Object *,std::allocator<Object *>>::front() Line 1220
generalszh.exe!OverlordContain::getRedirectedContain() Line 189
generalszh.exe!OverlordContain::iterateContained(void(*)(Object *, void *) func, void * userData, bool reverse) Line 350
generalszh.exe!Object::isHero() Line 2037
generalszh.exe!W3DRadar::onLocalRadarObjectAdded(const RadarObject * radarObject) Line 1458
generalszh.exe!W3DRadar::rebuildCachedHeroObjectList() Line 1484
generalszh.exe!W3DRadar::xfer(Xfer * xfer) Line 856

Copy link

@Mauller Mauller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@xezon xezon force-pushed the xezon/fix-hero-radar-2 branch from f90615f to 7d29b52 Compare July 16, 2025 21:06
@xezon
Copy link
Author

xezon commented Jul 16, 2025

Replicated to Generals without conflicts.

@xezon xezon merged commit 8821d8c into TheSuperHackers:main Jul 16, 2025
15 checks passed
@xezon xezon deleted the xezon/fix-hero-radar-2 branch July 16, 2025 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is not working right, typically is user facing GUI For graphical user interface Major Severity: Minor < Major < Critical < Blocker ThisProject The issue was introduced by this project, or this task is specific to this project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hero icon in garrison is bugged
3 participants