File: CompositeEffect.cpp

package info (click to toggle)
freespace2 24.0.2%2Brepack-1
  • links: PTS, VCS
  • area: non-free
  • in suites: trixie
  • size: 43,188 kB
  • sloc: cpp: 583,107; ansic: 21,729; python: 1,174; sh: 464; makefile: 248; xml: 181
file content (42 lines) | stat: -rw-r--r-- 1,131 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "particle/particle.h"
#include "particle/ParticleEffect.h"
#include "particle/ParticleSource.h"
#include "particle/effects/CompositeEffect.h"

namespace particle {
namespace effects {
CompositeEffect::CompositeEffect(const SCP_string& name) : ParticleEffect(name) {}

bool CompositeEffect::processSource(ParticleSource*) {
	UNREACHABLE("Processing a composite source is not supported! This was caused by a coding error, get a coder!");
	return false;
}

void CompositeEffect::parseValues(bool) {
	while (optional_string("+Child effect:")) {
		auto effectId = internal::parseEffectElement();
		if (effectId.isValid()) {
			ParticleEffectPtr effect = ParticleManager::get()->getEffect(effectId);

			if (effect->getType() == EffectType::Composite) {
				error_display(0,
							  "A composite effect cannot contain more composite effects! The effect as not been added.");
			}
			else {
				addEffect(effect);
			}
		}
	}
}

void CompositeEffect::pageIn() {
	for (auto& effect : m_childEffects) {
		effect->pageIn();
	}
}

void CompositeEffect::addEffect(ParticleEffectPtr effect) {
	m_childEffects.push_back(effect);
}
}
}