当前位置: 首页>>代码示例>>C++>>正文


C++ CvCity::isRevealed方法代码示例

本文整理汇总了C++中CvCity::isRevealed方法的典型用法代码示例。如果您正苦于以下问题:C++ CvCity::isRevealed方法的具体用法?C++ CvCity::isRevealed怎么用?C++ CvCity::isRevealed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CvCity的用法示例。


在下文中一共展示了CvCity::isRevealed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: LeaderDiscussion

bool QuietDiplomacy::LeaderDiscussion(CvPlayer* human, CvPlayer* computer, const char* text)
{
    CvAssertMsg(human && computer && text, "Quiet Diplomacy: Assertion error!");
    CvAssertMsg(human->isHuman(), "Quiet Diplomacy: Not a human!");

    // Send a notification.
    CvNotifications* notifications = human->GetNotifications();
    
    if(notifications)
    {
        // Create localized strings.
        // Hardcode some translation strings so DLL can be used alone without XML texts.
        std::string language = Localization::GetCurrentLanguage().GetType();

        std::string message;
        std::string summary;

        if(DoesTextKeyExist("TXT_KEY_QUIETDIPLOMACY_LEADERDISCUSSION_SUMMARY") && 
            DoesTextKeyExist("TXT_KEY_QUIETDIPLOMACY_LEADERDISCUSSION_MESSAGE"))
        {
            // Fetch from the database.
            Localization::String localeSummary = Localization::Lookup("TXT_KEY_QUIETDIPLOMACY_LEADERDISCUSSION_SUMMARY");
            localeSummary << Localization::Lookup(computer->getNameKey());

            Localization::String localeMessage = Localization::Lookup("TXT_KEY_QUIETDIPLOMACY_LEADERDISCUSSION_MESSAGE");
            localeMessage << Localization::Lookup(computer->getNameKey());
            localeMessage << text;

            summary = localeSummary.toUTF8();
            message = localeMessage.toUTF8();
        }
        else
        {
            if(language == "pl_PL")
            {
                // Polish
                Localization::String localeLeader = Localization::Lookup(computer->getNameKey());

                size_t localeLeaderBytes = 0;
                const char* localeLeaderString = localeLeader.toUTF8(localeLeaderBytes, 2);

                summary += "Wiadomo\xc5\x9b\xc4\x87 od ";
                summary.append(localeLeaderString, localeLeaderBytes);

                message += Localization::Lookup(computer->getNameKey()).toUTF8();
                message += ": ";
                message += text;
            }
            else
            {
                // English
                summary += "Message from ";
                summary += Localization::Lookup(computer->getNameKey()).toUTF8();

                message += Localization::Lookup(computer->getNameKey()).toUTF8();
                message += ": ";
                message += text;
            }
        }

        // Get computer's capital.
        int x = -1;
        int y = -1;

        CvCity* computerCapital = computer->getCapitalCity();
        if(computerCapital && computerCapital->isRevealed(human->getTeam(), false))
        {
            x = computerCapital->getX();
            y = computerCapital->getY();
        }

        // Add a notification.
        notifications->Add(NOTIFICATION_PEACE_ACTIVE_PLAYER, message.c_str(), summary.c_str(), x, y, computer->GetID());
    }

    // Inform that we took care of it.
    return true;
}
开发者ID:gunstarpl,项目名称:Civilization-5-Mods,代码行数:78,代码来源:QuietDiplomacy.cpp


注:本文中的CvCity::isRevealed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。