Skip to content

Commit 8261673

Browse files
authored
Merge pull request #243 from Architector4/patch-undefined-stuff
2 parents d58b94e + 1a85d38 commit 8261673

File tree

8 files changed

+22
-19
lines changed

8 files changed

+22
-19
lines changed

Source/Entities/ADoor.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -465,11 +465,6 @@ void ADoor::Update() {
465465

466466
Actor::Update();
467467

468-
// Start the spinning out of control animation for the motor, start it slow
469-
if (!m_Door) {
470-
m_SpriteAnimDuration *= 4;
471-
}
472-
473468
if (m_SpriteAnimMode == LOOPWHENOPENCLOSE && m_FrameCount > 1 && (m_DoorState == OPENING || m_DoorState == CLOSING) && m_SpriteAnimTimer.IsPastSimMS(m_SpriteAnimDuration)) {
474469
m_Frame = (m_Frame + 1) % m_FrameCount;
475470
m_SpriteAnimTimer.Reset();

Source/Entities/Actor.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,6 +1047,7 @@ float Actor::EstimateDigStrength() const {
10471047
}
10481048

10491049
float Actor::EstimateJumpHeight() const {
1050+
// Sentinel value that is explicitly checked for within pathfinder code.
10501051
return FLT_MAX;
10511052
}
10521053

Source/Entities/Actor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ namespace RTE {
668668
/// @return The actor's dig strength.
669669
virtual float EstimateDigStrength() const;
670670

671-
/// Estimates how high this actor can jump.
671+
/// Estimates how high this actor can jump. Default implementation returns FLT_MAX.
672672
/// @return The actor's jump height.
673673
virtual float EstimateJumpHeight() const;
674674

Source/Managers/WindowMan.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,12 +675,14 @@ void WindowMan::DisplaySwitchOut() const {
675675
SDL_SetCursor(nullptr);
676676
}
677677

678-
void WindowMan::HandleWindowExposedEvent(void *userdata, SDL_Event *event) {
678+
bool WindowMan::HandleWindowExposedEvent(void *userdata, SDL_Event *event) {
679679
if (event->type == SDL_EVENT_WINDOW_EXPOSED) {
680680
g_WindowMan.SetViewportLetterboxed();
681681
g_WindowMan.ClearBackbuffer(false);
682682
g_WindowMan.UploadFrame();
683683
}
684+
685+
return true;
684686
}
685687

686688
void WindowMan::QueueWindowEvent(const SDL_Event& windowEvent) {

Source/Managers/WindowMan.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ namespace RTE {
168168
#pragma endregion
169169

170170
#pragma region Concrete Methods
171-
/// SDL_EventFilter to hadnle window exposed events for live resize.
172-
static void HandleWindowExposedEvent(void* userdata, SDL_Event* event);
171+
/// SDL_EventFilter to handle window exposed events for live resize.
172+
static bool HandleWindowExposedEvent(void* userdata, SDL_Event* event);
173173

174174
/// Adds an SDL_Event to the Event queue for processing on Update.
175175
/// @param windowEvent The SDL window event to queue.

Source/Menus/ScenarioActivityConfigGUI.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ ScenarioActivityConfigGUI::ScenarioActivityConfigGUI(GUIControlManager* parentCo
6565
m_CPULockLabel = dynamic_cast<GUILabel*>(m_GUIControlManager->GetControl("LabelCPUTeamLock"));
6666
m_StartErrorLabel = dynamic_cast<GUILabel*>(m_GUIControlManager->GetControl("LabelStartError"));
6767
m_StartGameButton = dynamic_cast<GUIButton*>(m_GUIControlManager->GetControl("ButtonStartGame"));
68-
69-
m_TechListFetched = false;
7068
}
7169

7270
void ScenarioActivityConfigGUI::PopulateTechComboBoxes() {

Source/Menus/ScenarioActivityConfigGUI.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,16 @@ namespace RTE {
6565

6666
GUIControlManager* m_GUIControlManager; //!< The GUIControlManager which holds all the GUIControls of this menu. Not owned by this.
6767

68-
const GameActivity* m_SelectedActivity; //!< The Activity this ScenarioActivityConfigGUI is configuring.
69-
const GameActivity* m_PreviouslySelectedActivity; //!< The Activity this ScenarioActivityConfigGUI was configuring last, before it got was disabled.
70-
Scene* m_SelectedScene; //!< The Scene the selected Activity will be using.
71-
int m_LockedCPUTeam = Activity::Teams::NoTeam; //!< Which team the CPU is locked to, if any.
68+
const GameActivity* m_SelectedActivity {}; //!< The Activity this ScenarioActivityConfigGUI is configuring.
69+
const GameActivity* m_PreviouslySelectedActivity {}; //!< The Activity this ScenarioActivityConfigGUI was configuring last, before it got was disabled.
70+
Scene* m_SelectedScene {}; //!< The Scene the selected Activity will be using.
71+
int m_LockedCPUTeam { Activity::Teams::NoTeam }; //!< Which team the CPU is locked to, if any.
7272

7373
bool m_StartingGoldAdjustedManually {}; //!< Whether the player adjusted the starting gold, meaning it should stop automatically adjusting to the difficulty setting default starting gold where applicable.
7474

7575
Timer m_StartGameButtonBlinkTimer; //!< Timer for blinking the start game button.
7676

77-
bool m_TechListFetched; //!< Whether the tech list was fetched and each team's ComboBox was populated with it, even if no valid tech modules were added.
77+
bool m_TechListFetched {}; //!< Whether the tech list was fetched and each team's ComboBox was populated with it, even if no valid tech modules were added.
7878

7979
/// GUI elements that compose the Activity setup box.
8080
GUICollectionBox* m_ActivityConfigBox;

Source/System/PathFinder.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,16 @@ int PathFinder::CalculatePath(Vector start, Vector end, std::list<Vector>& pathR
172172
// Actors capable of jumping/jetpacking can jump upwards.
173173
s_JumpHeight = jumpHeight;
174174

175-
// How high up we can jump from this node
176-
s_JumpHeightVertical = std::max(1, static_cast<int>(jumpHeight / (m_NodeDimension * c_MPP))); // min of 1 so automovers work a bit better
177-
s_JumpHeightDiagonal = std::max(1, static_cast<int>((jumpHeight * 0.7F) / (m_NodeDimension * c_MPP)));
175+
// How high up we can jump from this node.
176+
if(jumpHeight == FLT_MAX) {
177+
// Probably quite high.
178+
s_JumpHeightVertical = INT_MAX;
179+
s_JumpHeightDiagonal = INT_MAX;
180+
} else {
181+
// Assume at least 1 so automovers work a bit better
182+
s_JumpHeightVertical = std::max(1, static_cast<int>(jumpHeight / (m_NodeDimension * c_MPP)));
183+
s_JumpHeightDiagonal = std::max(1, static_cast<int>((jumpHeight * 0.7F) / (m_NodeDimension * c_MPP)));
184+
}
178185

179186
// Actors capable of digging can use s_DigStrength to modify the node adjacency cost.
180187
s_DigStrength = digStrength;

0 commit comments

Comments
 (0)