Skip to content

Commit

Permalink
Related to bug #950390:
Browse files Browse the repository at this point in the history
Adding some logging to try and track down prism forwarding problems.
  • Loading branch information
DCoderLT committed Mar 13, 2012
1 parent 3fe42bf commit 9f2ee67
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Expand Up @@ -167,3 +167,8 @@
/src/UI/*.save

# /src/Utilities/
*.sln
*.sdf
*.opensdf
*.vcxproj*
*.suo
4 changes: 2 additions & 2 deletions src/Ares.version.h
Expand Up @@ -2,8 +2,8 @@
#define VERSION_H

#define VERSION_MAJOR 12
#define VERSION_MINOR 62
#define VERSION_REVISION 1050
#define VERSION_MINOR 73
#define VERSION_REVISION 1100

#define SAVEGAME_MAGIC ((VERSION_MAJOR << 24) | (VERSION_MINOR << 16) | (VERSION_REVISION))

Expand Down
25 changes: 25 additions & 0 deletions src/Ext/Building/Body.h
Expand Up @@ -31,6 +31,30 @@ class BuildingExt
cPrismForwarding() : SupportTarget(NULL), PrismChargeDelay(0), ModifierReserve(0.0), DamageReserve(0) {
this->Senders.Clear();
};

void AnnounceInvalidPointer(void * ptr, Extension<BuildingClass> *container) {
// based on the game's unchecked use of this pointer at 0x7258DB, I'm going to assume this cast is perfectly safe
auto abs = reinterpret_cast<AbstractClass *>(ptr);
if(auto bld = specific_cast<BuildingClass *>(abs)) {
if(bld == this->SupportTarget) {
Debug::Log("Should remove my support target\n");
}
auto senderIdx = this->Senders.FindItemIndex(&bld);
if(senderIdx != -1) {
Debug::Log("Should remove my sender #%d\n", senderIdx);
}
BuildingTypeExt::cPrismForwarding::RemoveFromNetwork(bld, true);
if(bld == this->SupportTarget) {
_snprintf(Ares::readBuffer, Ares::readLength, "Prism Forwarder (ExtData %p) failed to remove support target\n", container);
Debug::FatalError(true);
}
senderIdx = this->Senders.FindItemIndex(&bld);
if(senderIdx != -1) {
_snprintf(Ares::readBuffer, Ares::readLength, "Prism Forwarder (ExtData %p) failed to remove sender #%d\n", container, senderIdx);
Debug::FatalError(true);
}
}
}
};


Expand Down Expand Up @@ -64,6 +88,7 @@ class BuildingExt

virtual void InvalidatePointer(void *ptr) {
AnnounceInvalidPointer(OwnerBeforeRaid, ptr);
PrismForwarding.AnnounceInvalidPointer(ptr, this);
}

// related to Advanced Rubble
Expand Down

0 comments on commit 9f2ee67

Please sign in to comment.