Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit c66eb52

Browse files
authored
Merge pull request #73 from cortex-command-community/GI71-ExplosiveTimersResetting
Gi71 explosive timers resetting
2 parents e6e4416 + d4eb011 commit c66eb52

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
### Added
9+
10+
### Changed
11+
12+
### Removed
13+
14+
### Fixed
15+
16+
- Explosives (and other thrown devices) will no longer reset their explosion triggering timer when they're picked up ([Issue #71](https://github.com/cortex-command-community/Cortex-Command-Community-Project-Source/issues/71))
817

918
## [0.0.1.0] - 2020-01-27
1019

Entities/ThrownDevice.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ namespace RTE {
66
////////////////////////////////////////////////////////////////////////////////////////////////////
77

88
void ThrownDevice::Clear() {
9-
m_ThrownTmr.Reset();
109
m_ActivationSound.Reset();
1110
m_StartThrowOffset.Reset();
1211
m_EndThrowOffset.Reset();
@@ -35,8 +34,6 @@ namespace RTE {
3534

3635
m_MOType = MovableObject::TypeThrownDevice;
3736

38-
m_ThrownTmr = reference.m_ThrownTmr;
39-
4037
m_ActivationSound = reference.m_ActivationSound;
4138

4239
m_StartThrowOffset = reference.m_StartThrowOffset;
@@ -105,6 +102,19 @@ namespace RTE {
105102
Clear();
106103
}
107104

105+
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
106+
107+
void ThrownDevice::ResetAllTimers() {
108+
double elapsedTime;
109+
if (m_Activated) {
110+
elapsedTime = m_ActivationTmr.GetElapsedSimTimeMS();
111+
}
112+
HeldDevice::ResetAllTimers();
113+
if (m_Activated) {
114+
m_ActivationTmr.SetElapsedSimTimeMS(elapsedTime);
115+
}
116+
}
117+
108118
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
109119

110120
void ThrownDevice::Activate() {

Entities/ThrownDevice.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ namespace RTE {
7676
/// <summary>
7777
/// Resets all the timers used by this (e.g. emitters, etc). This is to prevent backed up emissions from coming out all at once while this has been held dormant in an inventory.
7878
/// </summary>
79-
virtual void ResetAllTimers() { HeldDevice::ResetAllTimers(); m_ThrownTmr.Reset(); }
79+
virtual void ResetAllTimers();
8080

8181
/// <summary>
8282
/// Activates this Device as long as it's not set to activate when released or it has no parent.
@@ -144,8 +144,6 @@ namespace RTE {
144144
protected:
145145
static Entity::ClassInfo m_sClass; //! ClassInfo for this class
146146

147-
Timer m_ThrownTmr; //! Timer for timing how long ago this ThrownDevice was thrown
148-
149147
Sound m_ActivationSound; //! Activation sound
150148

151149
Vector m_StartThrowOffset; //! The position offset at which a throw of this Device begins

0 commit comments

Comments
 (0)