diff --git a/Phobos.vcxproj b/Phobos.vcxproj
index 46a498043..6dca99ade 100644
--- a/Phobos.vcxproj
+++ b/Phobos.vcxproj
@@ -24,9 +24,9 @@
+
-
@@ -55,7 +55,6 @@
-
diff --git a/README.md b/README.md
index 5abc62daa..315cd7d86 100644
--- a/README.md
+++ b/README.md
@@ -37,6 +37,7 @@ Credits
- Thrifinesma (Uranusian) - mind control range limit and custom warhead splash list implementation
- SEC-SOME (secsome) - debug info dump hotkey, refactoring, introducing more Ares-derived stuff, disguise removal warhead
- Otamaa (BoredEXE) - help with CellSpread
+- E1 Elite - TileSet 255 and above bridge repair fix
Thanks to everyone who uses Phobos, tests changes and reports bugs! You can show your appreciation and help project by displaying the logo (monochrome version can be found [here](logo-mono.png)) in your client/launcher, [contributing](https://github.com/Phobos-developers/Phobos/wiki/Contributing) or donating to us via links on the right and the `Sponsor` button on top of the repo.
diff --git a/src/Ext/BuildingType/Body.cpp b/src/Ext/BuildingType/Body.cpp
index b3e16d1d2..2a23bb76d 100644
--- a/src/Ext/BuildingType/Body.cpp
+++ b/src/Ext/BuildingType/Body.cpp
@@ -19,8 +19,9 @@ void BuildingTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI) {
this->PowersUp_Owner.Read(exINI, pSection, "PowersUp.Owner");
this->PowersUp_Buildings.Read(exINI, pSection, "PowersUp.Buildings");
- if (this->OwnerObject()->PowersUpBuilding[0] == NULL && this->PowersUp_Buildings.size() > 0)
- strcpy_s(this->OwnerObject()->PowersUpBuilding, BuildingTypeClass::Array->GetItem(this->PowersUp_Buildings[0])->ID);
+
+ if (pThis->PowersUpBuilding[0] == NULL && this->PowersUp_Buildings.size() > 0)
+ strcpy_s(pThis->PowersUpBuilding, BuildingTypeClass::Array->GetItem(this->PowersUp_Buildings[0])->ID);
}
void BuildingTypeExt::ExtData::LoadFromStream(IStream* Stm) {
diff --git a/src/Ext/TechnoType/Body.cpp b/src/Ext/TechnoType/Body.cpp
index 3224887c3..bf92f0ce5 100644
--- a/src/Ext/TechnoType/Body.cpp
+++ b/src/Ext/TechnoType/Body.cpp
@@ -23,8 +23,9 @@ void TechnoTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI) {
this->UIDescription.Read(exINI, pSection, "UIDescription");
this->LowSelectionPriority.Read(exINI, pSection, "LowSelectionPriority");
this->MindControlRangeLimit.Read(exINI, pSection, "MindControlRangeLimit");
+
// Ares 0.A
- this->GroupAs.Read(pINI, "GroupAs", this->GroupAs, this->GroupAs);
+ this->GroupAs.Read(pINI, pSection, "GroupAs");
}
void TechnoTypeExt::ExtData::LoadFromStream(IStream* Stm) {
diff --git a/src/Ext/WeaponType/Body.cpp b/src/Ext/WeaponType/Body.cpp
index e106334d1..ae4a7f0fd 100644
--- a/src/Ext/WeaponType/Body.cpp
+++ b/src/Ext/WeaponType/Body.cpp
@@ -21,12 +21,12 @@ void WeaponTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI) {
}
void WeaponTypeExt::ExtData::LoadFromStream(IStream* Stm) {
- this->DiskLaser_Radius.Load(Stm);
+ // this->DiskLaser_Radius.Load(Stm); // There is no need to this. It is used only for LoadFromINIFile
this->DiskLaser_Circumference.Load(Stm);
}
void WeaponTypeExt::ExtData::SaveToStream(IStream* Stm) const {
- this->DiskLaser_Radius.Save(Stm);
+ // this->DiskLaser_Radius.Save(Stm); // There is no need to this. It is used only for LoadFromINIFile
this->DiskLaser_Circumference.Save(Stm);
}
diff --git a/src/Misc/ExtendedToolTips.cpp b/src/Misc/ExtendedToolTips.cpp
index b19019d71..d109bfc7d 100644
--- a/src/Misc/ExtendedToolTips.cpp
+++ b/src/Misc/ExtendedToolTips.cpp
@@ -59,7 +59,7 @@ void ExtToolTip::CreateHelpText(AbstractType itemType, int itemIndex)
// append Time label
const long rechargeTime = pSW ? pSW->RechargeTime : 0;
- if (rechargeTime) {
+ if (rechargeTime > 0) {
const int sec = (rechargeTime / 15) % 60;
const int min = (rechargeTime / 15) / 60;
diff --git a/src/Misc/Tileset255Fix.cpp b/src/Misc/Tileset255Fix.cpp
new file mode 100644
index 000000000..0152455b9
--- /dev/null
+++ b/src/Misc/Tileset255Fix.cpp
@@ -0,0 +1,21 @@
+
+/* Allow usage of TileSet of 255 and above without making NE-SW broken bridges unrepairable
+
+ When TileSet number crosses 255 in theater INI files, the NE-SW broken bridges
+ become non-repairable. The reason is that the NonMarbleMadnessTile array of size 256
+ overflows when filled and affects the variables like BridgeTopRight1 and BridgeBottomLeft2
+ that come after it. This patch removes the filling of the unused NonMarbleMadnessTile array
+ and its references.
+*/
+
+#include
+
+DEFINE_HOOK(545CE2, Tileset255Fix_RemoveNonMMArrayFill, 0)
+{
+ return 0x545CE9;
+}
+
+DEFINE_HOOK(546C23, Tileset255Fix_RefNonMMArray, 0)
+{
+ return 0x546C8B;
+}