Merge branch 'fixes' into main/rendor-staging
[ryzomcore.git] / ryzom / common / src / game_share / r2_ligo_config.cpp
blob8e7e8253101293830b9cf653e727d85093df3f8d
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 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 //-----------------------------------------------------------------------------
18 // includes
19 //-----------------------------------------------------------------------------
21 #include "stdpch.h"
23 #include "game_share/r2_ligo_config.h"
24 #include "nel/misc/sstring.h"
25 namespace R2
27 uint32 CR2LigoConfig::getFileStaticAliasMapping(const std::string &fileName) const
29 uint32 filesize = 8;// strlen("r2.0000.");
30 if ( fileName.size() > filesize &&
31 fileName.substr(0, 3) == "r2.")
33 NLMISC::CSString instanceNumber(fileName.substr(3,4));
34 uint32 instance = instanceNumber.atoui();
35 TScenarioType type;
37 if (fileName[8] == 'a') { type = Act;}
38 else type = Base;
39 return getStaticAliasMapping(instance, type);
41 return this->CLigoConfig::getFileStaticAliasMapping(fileName);
45 uint32 CR2LigoConfig::getStaticAliasMapping(uint32 aiInstance, TScenarioType type) const
47 uint32 instance = aiInstance * 2;
48 if (type == Act) { instance +=1; }
49 return (1 << (getStaticAliasSize() - 1) ) + instance;