本文整理汇总了C++中CCharacter::GetFullName方法的典型用法代码示例。如果您正苦于以下问题:C++ CCharacter::GetFullName方法的具体用法?C++ CCharacter::GetFullName怎么用?C++ CCharacter::GetFullName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCharacter
的用法示例。
在下文中一共展示了CCharacter::GetFullName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DeleteCustomHero
void DeleteCustomHero(std::string hero_full_name)
{
CCharacter *hero = GetCustomHero(hero_full_name);
if (!hero) {
fprintf(stderr, "Custom hero \"%s\" doesn't exist.\n", hero_full_name.c_str());
}
if (CurrentCustomHero == hero) {
CurrentCustomHero = NULL;
}
//delete hero save file
std::string path = Parameters::Instance.GetUserDirectory();
if (!GameName.empty()) {
path += "/";
path += GameName;
}
path += "/";
path += "heroes/";
if (hero->Custom) {
path += "custom/";
}
path += hero->GetFullName();
path += ".lua";
if (CanAccessFile(path.c_str())) {
unlink(path.c_str());
}
CustomHeroes.erase(std::remove(CustomHeroes.begin(), CustomHeroes.end(), hero), CustomHeroes.end());
delete hero;
}
示例2: ChangeCustomHeroCivilization
void ChangeCustomHeroCivilization(std::string hero_full_name, std::string civilization_name, std::string new_hero_name, std::string new_hero_dynasty_name)
{
if (!hero_full_name.empty()) {
CCharacter *hero = GetCustomHero(hero_full_name);
if (!hero) {
fprintf(stderr, "Custom hero \"%s\" doesn't exist.\n", hero_full_name.c_str());
}
int civilization = PlayerRaces.GetRaceIndexByName(civilization_name.c_str());
if (civilization != -1) {
//delete old hero save file
std::string path = Parameters::Instance.GetUserDirectory();
if (!GameName.empty()) {
path += "/";
path += GameName;
}
path += "/";
path += "heroes/";
if (hero->Custom) {
path += "custom/";
}
path += hero->GetFullName();
path += ".lua";
if (CanAccessFile(path.c_str())) {
unlink(path.c_str());
}
//now, update the hero
hero->Civilization = civilization;
int new_unit_type_id = PlayerRaces.GetCivilizationClassUnitType(hero->Civilization, GetUnitTypeClassIndexByName(hero->Type->Class));
if (new_unit_type_id != -1) {
hero->Type = const_cast<CUnitType *>(&(*UnitTypes[new_unit_type_id]));
hero->Name = new_hero_name;
hero->Dynasty = new_hero_dynasty_name;
SaveHero(hero);
}
}
}
}