Merge branch 'fixes' into main/rendor-staging
[ryzomcore.git] / ryzom / common / src / game_share / pvp_clan.h
blob62d498cbb7f0541c38118bd56ed9bf3aa39b090c
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010-2018 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #ifndef RY_PVP_CLAN_H
18 #define RY_PVP_CLAN_H
20 #include <string>
21 #include "nel/misc/sheet_id.h"
22 #include "people_pd.h"
24 namespace PVP_CLAN
26 // If you change this enum do not forget to update database.xml and local_database.xml
27 enum TPVPClan
29 None,
30 Neutral,
32 BeginClans, // begin of "real" clans (None and Neutral are excluded)
33 BeginCults = BeginClans, // begin the cults section
35 Kami = BeginClans,
36 Karavan,
38 EndCults = Karavan, // end of cults
39 BeginCivs, // begin of civilizations
41 Fyros = BeginCivs,
42 Matis,
43 Tryker,
44 Zorai,
46 EndCivs = Zorai, // end of civs
48 Marauder,
49 EndClans = Marauder, // end of clans
51 Unknown,
52 NbClans = Unknown,
53 NbBits = 4 // number of bits needed to store all valid values (all but Unknown)
56 TPVPClan fromString(const std::string & str);
57 const std::string & toString(TPVPClan clan);
58 std::string toLowerString(TPVPClan clan);
60 uint32 getFactionIndex(TPVPClan clan);
61 TPVPClan getClanFromIndex(uint32 theIndex);
62 NLMISC::CSheetId getFactionSheetId(TPVPClan clan);
63 TPVPClan getClanFromPeople( EGSPD::CPeople::TPeople people );
65 /// For Client Interface, return the define name of the type (eg: "pvp_faction_icon_Kami")
66 std::string toIconDefineString( TPVPClan c );
69 /**
70 * CFactionWar
72 struct CFactionWar
74 TPVPClan Clan1;
75 TPVPClan Clan2;
77 CFactionWar()
79 Clan1 = None;
80 Clan2 = None;
83 void setFactionWar( TPVPClan clan1, TPVPClan clan2 )
85 if( clan1 != clan2 )
87 if( clan1 < BeginClans || clan1 > EndClans )
89 nlwarning("<CFactionWar::setFactionWar> clan1 is invalid : %d", clan1 );
90 return;
92 if( clan2 < BeginClans || clan2 > EndClans )
94 nlwarning("<CFactionWar::setFactionWar> clan2 is invalid : %d", clan2 );
95 return;
97 Clan1 = clan1;
98 Clan2 = clan2;
100 else
102 nlwarning("<CFactionWar::setFactionWar> A clan can't be in war with him");
103 return;
107 bool inPvPFaction( TPVPClan clan1, TPVPClan clan2 ) const
109 return ( (clan1 == Clan1 && clan2 == Clan2) || (clan2 == Clan1 && clan1 == Clan2) );
112 void serial( NLMISC::IStream & f )
114 f.serialEnum( Clan1 );
115 f.serialEnum( Clan2 );
119 } // namespace PVP_CLAN
121 #endif // RY_PVP_CLAN_H