Skip to content
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

[TD] Fixes loading HouseClass and Dino missions. #1004

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions common/region.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@
class RegionClass
{
public:
RegionClass(void)
{
Threat = 0;
RegionClass(void){
//Threat = 0;
};
~RegionClass(void){};
int operator!=(RegionClass const& region)
Expand Down Expand Up @@ -75,6 +74,10 @@ class RegionClass
{
return Threat;
};
void Init()
{
Threat = 0;
}

protected:
int Threat;
Expand Down
5 changes: 4 additions & 1 deletion tiberiandawn/building.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#ifndef BUILDING_H
#define BUILDING_H

#include "ftimer.h"
#include "tarcom.h"
#include "radio.h"
#include "cargo.h"
Expand Down Expand Up @@ -175,7 +176,9 @@ class BuildingClass : public TechnoClass
: Class(0){};
BuildingClass(NoInitClass const& x)
: TechnoClass(x)
, Class(this->Class){};
, Class(this->Class)
, CountDown(x)
, PlacementDelay(x){};
BuildingClass(StructType type, HousesType house);
virtual ~BuildingClass(void);
virtual RTTIType What_Am_I(void) const
Expand Down
3 changes: 3 additions & 0 deletions tiberiandawn/credits.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ class CreditClass
** Constructors, Destructors, and overloaded operators.
*/
CreditClass(void);
CreditClass(NoInitClass const&)
{
}

/*---------------------------------------------------------------------
** Member function prototypes.
Expand Down
3 changes: 2 additions & 1 deletion tiberiandawn/door.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ class DoorClass

public:
DoorClass(void);
DoorClass(NoInitClass const&){};
DoorClass(NoInitClass const& x)
: Control(x){};

bool Time_To_Redraw(void)
{
Expand Down
3 changes: 3 additions & 0 deletions tiberiandawn/house.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,9 @@ HouseClass::HouseClass(HousesType house)
, CapturedBuildings()
, TotalCrates()
{
for (int i = 0; i < MAP_TOTAL_REGIONS; ++i) {
Regions[i].Init();
}

for (HousesType i = HOUSE_FIRST; i < HOUSE_COUNT; i++) {
UnitsKilled[i] = 0;
Expand Down
31 changes: 28 additions & 3 deletions tiberiandawn/house.h
Original file line number Diff line number Diff line change
Expand Up @@ -421,10 +421,35 @@ class HouseClass
{
}
HouseClass(void)
: Class(0){};
: Class(0)
{
for (int i = 0; i < MAP_TOTAL_REGIONS; ++i) {
Regions[i].Init();
}
}
HouseClass(HousesType house);
HouseClass(NoInitClass const&)
: Class(this->Class){};
HouseClass(NoInitClass const& noinit)
: Class(this->Class)
, FreeHarvester(noinit)
, IonCannon(noinit)
, AirStrike(noinit)
, NukeStrike(noinit)
, AlertTime(noinit)
, BorrowedTime(noinit)
, BlitzTime(noinit)
, VisibleCredits(noinit)
, ScreenShakeTime(noinit)
, DamageTime(noinit)
, TeamTime(noinit)
, TriggerTime(noinit)
, SpeakAttackDelay(noinit)
, SpeakPowerDelay(noinit)
, SpeakMoneyDelay(noinit)
, SpeakMaxedDelay(noinit)
, Attack(noinit)
, AITimer(noinit)
{
}
operator HousesType(void) const;

/*---------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions tiberiandawn/mission.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class MissionClass : public ObjectClass
MissionClass(void);
MissionClass(NoInitClass const& x)
: ObjectClass(x)
, Timer(x)
{
}
virtual ~MissionClass(void){};
Expand Down
5 changes: 5 additions & 0 deletions tiberiandawn/saveload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@ bool Save_Misc_Values(FileClass& file)
// This is new...
file.Write(ActionMovie, sizeof(ActionMovie));
file.Write(&TempleIoned, sizeof(TempleIoned));
file.Write(&AreThingiesEnabled, sizeof(AreThingiesEnabled));

return (true);
}
Expand Down Expand Up @@ -752,6 +753,10 @@ bool Load_Misc_Values(FileClass& file)
file.Read(&TempleIoned, sizeof(TempleIoned));
}

if (file.Seek(0, SEEK_CUR) < file.Size()) {
file.Read(&AreThingiesEnabled, sizeof(AreThingiesEnabled));
}

return (true);
}

Expand Down
4 changes: 4 additions & 0 deletions tiberiandawn/super.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ class SuperClass
VoxType ready = VOX_NONE,
VoxType impatient = VOX_NONE,
VoxType suspend = VOX_NONE);
SuperClass(NoInitClass const& noinit)
: Control(noinit)
{
}

bool Suspend(bool on);
bool Enable(bool onetime = false, bool player = false, bool quiet = false);
Expand Down
3 changes: 2 additions & 1 deletion tiberiandawn/team.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ class TeamClass : public AbstractClass
: AbstractClass(x)
, SuspendTimer(x)
, Class(this->Class)
, House(this->House){};
, House(this->House)
, TimeOut(x){};

TeamClass(TeamTypeClass const* team, HouseClass* owner);
virtual ~TeamClass(void);
Expand Down
4 changes: 3 additions & 1 deletion tiberiandawn/techno.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,9 @@ class TechnoClass : public RadioClass,
, CargoClass(x)
, DoorClass(x)
, CrewClass(x)
, House(this->House){};
, House(this->House)
, CloakingDevice(x)
, PrimaryFacing(x){};
virtual ~TechnoClass(void){};

/*
Expand Down
4 changes: 3 additions & 1 deletion tiberiandawn/turret.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ class TurretClass : public DriveClass
TurretClass(UnitType classid, HousesType house);
TurretClass(void);
TurretClass(NoInitClass const& x)
: DriveClass(x){};
: DriveClass(x)
, Reload(x)
, SecondaryFacing(x){};
virtual ~TurretClass(void);

BulletClass* Fire_At(TARGET target, int which);
Expand Down
Loading