Modcraft - The community dedicated to quality WoW modding!
Wrath of the Lich King Modding => Miscellaneous => Topic started by: Supora on December 09, 2013, 05:22:06 pm
-
Hey guys. Some days ago I've started to trying to add new faction for WoW. I've already done with dbc's and some core stuff but I can't compile my sources because of error. Original sources contain this part:
static uint32 TeamForRace(uint8 race);
uint32 GetTeam() const { return m_team; }
TeamId GetTeamId() const { return m_team == ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE; }
void setFactionForRace(uint8 race);
And I've changed it to:
static uint32 TeamForRace(uint8 race);
uint32 GetTeam() const { return m_team; }
TeamId GetTeamId() const { if ( m_team == ALLIANCE ) { return TEAM_ALLIANCE; } else if ( m_team == HORDE ) { return TEAM_HORDE;} else if ( m_team == SCOURGE ) { return TEAM_SCOURGE;} else { return TEAM_ALLIANCE;} }
void setFactionForRace(uint8 race);
Maybe it's not a good solution but( I'm not really good at c++)...
And there I've got an error: 'SCOURGE' is undeclared identifier and the same with TEAM_SCOURGE. But I've already edited enum of Team and TeamID in SharedDefines.h(pic (http://img163.imageshack.us/img163/3605/ldd9.jpg)). In Visual Studio it shows this values.
Here is the pic (http://imageshack.us/a/img23/3259/j7lq.jpg):
(http://imageshack.us/a/img23/3259/j7lq.jpg)
So maybe someone can help me to fix this.
Thanks
-
Hey since nobody answered you I'll give it a shot. :)
Your code looks right, except that the default value is horde in the initial code and alliance in yours, but that shouldn't really matter.
It might be the case, that visual studio is unable to to understand the needed order to compile.
That means: If you rightclick your sollution and just create the whole sollution it will try to create each subporject at a time. If your changes to m_team are in a subproject that is compiled after your posted code, then this error might pop up.
So the best way would be to compile the subprojects in order, or at least the one with your enum at first and then the whole sollution afterwards.
I hope that was understandable. >_<
Intellisense might have been updated even if the binaries are still the old uncompiled ones. :)
-
I kinda dont get why you have 2 cases retuning Alliance... I think the last else is unnecessary.
-
Right away...
TeamId GetTeamId() const { return m_team == ALLIANCE ? TEAM_ALLIANCE : m_team == HORDE ? TEAM_HORDE : TEAM_SCOURGE; }
Worked flawlessly for me. Also, just keep the Team enum numbered as it is and just add Scourge as team to the bottom. But that's more codestyle than what not.
-
Thnx Ascathos. Your code worked just fine. Here is the result:
(http://imageshack.com/a/img51/1419/kedk.jpg)