Author: sagamusix
Date: Mon May 20 20:50:15 2024
New Revision: 20831
URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20831
Log:
[Ref] Modernize EffectWriter.
Modified:
trunk/OpenMPT/soundlib/pattern.h
Modified: trunk/OpenMPT/soundlib/pattern.h
==============================================================================
--- trunk/OpenMPT/soundlib/pattern.h Tue May 14 22:59:34 2024 (r20830)
+++ trunk/OpenMPT/soundlib/pattern.h Mon May 20 20:50:15 2024 (r20831)
@@ -150,7 +150,7 @@
friend class CPattern;
// Row advance mode
- enum RetryMode
+ enum RetryMode : uint8
{
rmIgnore, // If effect can't be written, abort.
rmTryNextRow, // If effect can't be written, try next row.
@@ -159,8 +159,8 @@
public:
// Constructors with effect commands
- EffectWriter(EffectCommand cmd, ModCommand::PARAM param) : m_command(cmd), m_param(param), m_isVolEffect(false) { Init(); }
- EffectWriter(VolumeCommand cmd, ModCommand::VOL param) : m_volcmd(cmd), m_vol(param), m_isVolEffect(true) { Init(); }
+ EffectWriter(EffectCommand cmd, ModCommand::PARAM param) : m_command(cmd), m_param(param), m_isVolEffect(false) { }
+ EffectWriter(VolumeCommand cmd, ModCommand::VOL param) : m_volcmd(cmd), m_vol(param), m_isVolEffect(true) { }
// Additional constructors:
// Set row in which writing should start
@@ -174,9 +174,9 @@
EffectWriter &RetryPreviousRow() { m_retryMode = rmTryPreviousRow; return *this; }
protected:
- RetryMode m_retryMode;
- ROWINDEX m_row;
- CHANNELINDEX m_channel;
+ ROWINDEX m_row = 0;
+ CHANNELINDEX m_channel = CHANNELINDEX_INVALID; // Any channel by default
+ RetryMode m_retryMode = rmIgnore;
union
{
@@ -189,19 +189,9 @@
ModCommand::VOL m_vol;
};
- bool m_retry : 1;
- bool m_allowMultiple : 1;
- bool m_isVolEffect : 1;
-
- // Common data initialisation
- void Init()
- {
- m_row = 0;
- m_channel = CHANNELINDEX_INVALID; // Any channel
- m_retryMode = rmIgnore; // If effect couldn't be written, abort.
- m_retry = true;
- m_allowMultiple = false; // Stop if same type of effect is encountered
- }
+ bool m_retry = true;
+ bool m_allowMultiple = true;
+ bool m_isVolEffect = false;
};
|