Of course, I did read the whole section, sorry I couldn’t help it.
Here is what I came up with:
void SB_Effect(EffectType effect, EffectLocation location) override {
switch (effect) {
case EFFECT_SABERMODE: MultiPropHelpers::announcemode(&SFX_sabermode); return;
case EFFECT_BLASTERMODE: MultiPropHelpers::announcemode(&SFX_blastermode); return;
case EFFECT_DETONATORMODE: MultiPropHelpers::announcemode(&SFX_detonatormode); return;
case EFFECT_JETPACKMODE: MultiPropHelpers::announcemode(&SFX_jetpackmode); return;
case EFFECT_MORSECODEMODE: morsecodemode(); /* General invitation to transmit */ return;
}
switch (currentMode) {
case Prop_Mode::SABER: Saber::SB_Effect(effect, location); break;
case Prop_Mode::BLASTER: Blaster::SB_Effect(effect, location); break;
case Prop_Mode::DETONATOR: Detonator::SB_Effect(effect, location); break;
case Prop_Mode::JETPACK: Jetpack::SB_Effect(effect, location); break;
case Prop_Mode::MORSECODE: MorseCode::SB_Effect(effect, location); break;
}
}
Is this starting to look better, or am I still way-off ?
Please find my latest multi_prop.h with much reduced repetition.
multi_prop.h (20.2 KB)
Is it still too repetitive ? I tried to reduce the repetition further but it ended up using a lot more memory (3x as much - however, it was with plug-in 4.1.0 and I didn’t have the time to retry with 3.6.0, so I might “re-visit” that code later, once I know the rest is better)