sfxExplGenNames or sfxExplGens?

sfxExplGenNames or sfxExplGens?

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
coolfile
Posts: 6
Joined: 17 Oct 2009, 11:51

sfxExplGenNames or sfxExplGens?

Post by coolfile »

I read the UnitDef.cpp and found a new property named sfxExplGenNames of unit definition, but it isn't be used anywhere else, is it?
New Version:

Code: Select all

LuaTable sfxTable = udTable.SubTable("SFXTypes");
LuaTable expTable = sfxTable.SubTable("explosionGenerators");

for (int expNum = 1; expNum <= 1024; expNum++) {
	std::string expsfx = expTable.GetString(expNum, "");

	if (expsfx == "") {
		break;
	} else {
		sfxExplGenNames.push_back(expsfx);
	}
}
Comparing to the old version, sfxExplGens isn't handled in the new code. So, how to get sfx id from its name for function EmitSfx?
Old Version:

Code: Select all

LuaTable sfxTable = udTable.SubTable("SFXTypes");
LuaTable expTable = sfxTable.SubTable("explosionGenerators");
for (int expNum = 1; expNum <= 1024; expNum++) {
	string expsfx = expTable.GetString(expNum, "");
	if (expsfx == "") {
		break;
	} else {
		ud.sfxExplGens.push_back(explGenHandler->LoadGenerator(expsfx));
	}
}
Is sfxExplGenNames going to work together with sfxExplGens which is still used in function CUnitScript::EmitSfx? If yes, how to use sfx by name referenced in SFXTypes?
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: sfxExplGenNames or sfxExplGens?

Post by jK »

Instead of asking very deep engine related things, you should perhaps just say:
1. what your goal is
2. what you are doing atm
(and as the last!) 3. assumptions why/where your `code` fails

Note: it's nice to see ppl reading the source code, still your question points to the wrong end.
coolfile
Posts: 6
Joined: 17 Oct 2009, 11:51

Re: sfxExplGenNames or sfxExplGens?

Post by coolfile »

No practical purpose, I just tried to understand how the things happen and found something interesting. It seems EmitSfx can't work with unit-ceg in new version. Is it a bug? I'm not sure.
Post Reply

Return to “Engine”