コード例 #1
0
ファイル: i18n.cpp プロジェクト: e-h-j/freeorion
const std::string& UserString(const std::string& str) {
    const StringTable_& string_table = GetStringTable();
    if (string_table.StringExists(str))
        return GetStringTable().String(str);
    else
        return GetDefaultStringTable().String(str);
}
コード例 #2
0
ファイル: INIT.C プロジェクト: thearttrooper/KappaPC
void InitCommonSymbols(void)
{
    lpIDs = KppGetCommonSymbols(FALSE);
    idInit = KppAddAtom(GetStringTable(IDS_INIT));
    idNoInit = KppAddAtom(GetStringTable(IDS_NOINIT));
    idArrowCursor = KppAddAtom(GetStringTable(IDS_ARROWCUR));
    idBusyCursor = KppAddAtom(GetStringTable(IDS_BUSYCUR));
    idCrossCursor = KppAddAtom(GetStringTable(IDS_CROSSCUR));
}
コード例 #3
0
ファイル: Object.cpp プロジェクト: Wirlie/OpenRCT2
std::string Object::GetString(uint8 index) const
{
    auto sz = GetOverrideString(index);
    if (sz.empty())
    {
        sz = GetStringTable().GetString(index);
    }
    return sz;
}
コード例 #4
0
ファイル: Object.cpp プロジェクト: CraigCraig/OpenRCT2
const utf8 * Object::GetString(uint8 index) const
{
    const utf8 * sz = GetOverrideString(index);
    if (sz == nullptr)
    {
        sz = GetStringTable()->GetString(index);
    }
    return sz != nullptr ? sz : "";
}
コード例 #5
0
void CHLTVClientState::InstallStringTableCallback( char const *tableName )
{
	INetworkStringTable *table = GetStringTable( tableName );

	if ( !table )
		return;

	// Hook instance baseline table
	if ( !Q_strcasecmp( tableName, INSTANCE_BASELINE_TABLENAME ) )
	{
		table->SetStringChangedCallback( m_pHLTV,  HLTV_Callback_InstanceBaseline );
		return;
	}
}
コード例 #6
0
ファイル: BannerObject.cpp プロジェクト: OpenRCT2/OpenRCT2
void BannerObject::ReadJson(IReadObjectContext* context, const json_t* root)
{
    auto properties = json_object_get(root, "properties");

    _legacyType.banner.scrolling_mode = json_integer_value(json_object_get(properties, "scrollingMode"));
    _legacyType.banner.price = json_integer_value(json_object_get(properties, "price"));
    _legacyType.banner.flags = ObjectJsonHelpers::GetFlags<uint8_t>(
        properties,
        {
            { "hasPrimaryColour", BANNER_ENTRY_FLAG_HAS_PRIMARY_COLOUR },
        });

    SetPrimarySceneryGroup(ObjectJsonHelpers::GetString(json_object_get(properties, "sceneryGroup")));

    ObjectJsonHelpers::LoadStrings(root, GetStringTable());
    ObjectJsonHelpers::LoadImages(context, root, GetImageTable());
}
コード例 #7
0
ファイル: BannerObject.cpp プロジェクト: OpenRCT2/OpenRCT2
void BannerObject::ReadLegacy(IReadObjectContext* context, IStream* stream)
{
    stream->Seek(6, STREAM_SEEK_CURRENT);
    _legacyType.banner.scrolling_mode = stream->ReadValue<uint8_t>();
    _legacyType.banner.flags = stream->ReadValue<uint8_t>();
    _legacyType.banner.price = stream->ReadValue<int16_t>();
    _legacyType.banner.scenery_tab_id = stream->ReadValue<uint8_t>();
    stream->Seek(1, STREAM_SEEK_CURRENT);

    GetStringTable().Read(context, stream, OBJ_STRING_ID_NAME);

    rct_object_entry sgEntry = stream->ReadValue<rct_object_entry>();
    SetPrimarySceneryGroup(&sgEntry);

    GetImageTable().Read(context, stream);

    // Validate properties
    if (_legacyType.large_scenery.price <= 0)
    {
        context->LogError(OBJECT_ERROR_INVALID_PROPERTY, "Price can not be free or negative.");
    }

    // Add banners to 'Signs and items for footpaths' group, rather than lumping them in the Miscellaneous tab.
    // Since this is already done the other way round for original items, avoid adding those to prevent duplicates.
    auto identifier = GetIdentifier();

    auto& objectRepository = context->GetObjectRepository();
    auto item = objectRepository.FindObject(identifier);
    if (item != nullptr)
    {
        auto sourceGame = item->GetFirstSourceGame();
        if (sourceGame == OBJECT_SOURCE_WACKY_WORLDS || sourceGame == OBJECT_SOURCE_TIME_TWISTER
            || sourceGame == OBJECT_SOURCE_CUSTOM)
        {
            auto scgPathX = Object::GetScgPathXHeader();
            SetPrimarySceneryGroup(&scgPathX);
        }
    }
}
コード例 #8
0
ファイル: MENUINIT.C プロジェクト: thearttrooper/KappaPC
static void Init_MenuSlotNames(void)
{
    if (hMenuSlotNameIDs && lpMenuSNs)
    {
        GLOBALUNLOCK(hMenuSlotNameIDs);
        GlobalFree(hMenuSlotNameIDs);
    }

    hMenuSlotNameIDs = GLOBALALLOC(GHND, sizeof(MENU_SLOT_NAME_IDS));
    lpMenuSNs = (MENUSLOTNAMEIDS) GLOBALLOCK(hMenuSlotNameIDs);

    lpMenuSNs->idXSN = KppAddAtom(GetStringTable(IDS_X));
    lpMenuSNs->idYSN = KppAddAtom(GetStringTable(IDS_Y));
    lpMenuSNs->idSelectorsSN = KppAddAtom(GetStringTable(IDS_SELECTORS));
    lpMenuSNs->idSelectorTitlesSN =
    KppAddAtom(GetStringTable(IDS_SELECTORTITLES));
    lpMenuSNs->idCheckedSelectorsSN =
    KppAddAtom(GetStringTable(IDS_CHECKED));
    lpMenuSNs->idDisabledSelectorsSN =
    KppAddAtom(GetStringTable(IDS_DISABLED));
    lpMenuSNs->idDefaultMessageSN =
    KppAddAtom(GetStringTable(IDS_DEFAULTMESSAGE));
}
コード例 #9
0
ファイル: Object.cpp プロジェクト: Wirlie/OpenRCT2
std::string Object::GetString(sint32 language, uint8 index) const
{
    return GetStringTable().GetString(language, index);
}
コード例 #10
0
ファイル: nucage.cpp プロジェクト: rustamserg/PLAINX
BOOL CNucAge::ProcessState(E_STATE eState, DWORD dwCurrTick)
{
    switch (eState.dwStateID) {
        case ES_STARTENGINE:
            // init resources
            AddResource("data\\cursor.dat", "cursor");
            AddResource("data\\sand.dat", "sand");
            AddResource("data\\actor.dat", "actor");
            AddResource("data\\gamegui.dat", "gamegui");

            // init scenes
            AddScene("scenes\\gamegui.scn", "gamegui", "gamegui");
            AddScene("scenes\\level.scn", "level", "sand");
            AddScene("scenes\\actor.scn", "actor", "actor");

            // create game objects
            g_pLevel = new CLevel();
            g_pRlPlayer = new CPlayer();
            g_pShPlayer = new CPlayer();
            g_pGtm = new CGameTime();
            g_pKeys = new CKeys();
            g_pMenu = new CGameMenu();
			g_pHelp = new CHelpDlg();
			g_pOptions = new COptionsDlg();

            // set players name
            strcpy(g_pRlPlayer->m_szName, "rlplayer");
            strcpy(g_pShPlayer->m_szName, "shplayer");
            g_pRlPlayer->m_bIsReal = TRUE;
            g_pShPlayer->m_bIsReal = FALSE;

            // add mouse support
            CreateMouse("cursor");

            // add listeners
            GetScene("level")->AddListener(g_pLevel, "main");
            GetScene("actor")->AddListener(g_pRlPlayer, g_pRlPlayer->m_szName);
            GetScene("actor")->AddListener(g_pShPlayer, g_pShPlayer->m_szName);
            GetScene("gamegui")->AddListener(g_pGtm, "time");
            GetScene("gamegui")->AddListener(g_pKeys, "keys");
			GetScene("gamegui")->AddListener(g_pMenu, "main");
			GetScene("gamegui")->AddListener(g_pHelp, "help");
			GetScene("gamegui")->AddListener(g_pOptions, "options");

            GetScene("level")->SetVisible(FALSE);
            GetScene("actor")->SetVisible(FALSE);

			// create fonts
			GetScene("gamegui")->GetStringManager()->CreateFont("fonts\\fonts.fnt", "greenfnt");
			GetScene("gamegui")->GetStringManager()->CreateFont("fonts\\fonts.fnt", "buttonfnt");
			GetScene("gamegui")->GetStringManager()->CreateFont("fonts\\fonts.fnt", "redfnt");
			GetScene("gamegui")->GetStringManager()->CreateFont("fonts\\fonts.fnt", "labelfnt");

			// init string table
			GetStringTable()->Init("strings.dat");
			GetStringTable()->SetLocale("en");

			// init audio
			GetAudio()->LoadGroup("sfx\\sound.sfx", "sound");

			// we start game from menu screen
			SetRTIntVar(NA_RT_GAME_STATE, GS_MENU);

			// create game variable object
			AddVars("game.ini", "config");

			// get world size value
			int iLevel, iWorldSize;
			GetVars("config")->GetInt(L_GROUP, "config", "worldsize", 0, &iWorldSize);
			if (iWorldSize <= 0 || iWorldSize > 25) iWorldSize = 25;
			SetRTIntVar(NA_RT_WORLD_SIZE, iWorldSize);

			// get current level value
			GetVars("config")->GetInt(L_GROUP, "config", "curlvl", 0, &iLevel);
			if (iLevel >= NA_NUM_WORLDS*iWorldSize) iLevel = NA_NUM_WORLDS*iWorldSize - 1;
			SetRTIntVar(NA_RT_CURR_LEVEL_NUMBER, iLevel);
			SetRTIntVar(NA_RT_MINI_LEVEL_NUMBER, iLevel);

			// get maximum achieved number of levels
			GetVars("config")->GetInt(L_GROUP, "config", "maxlvl", 0, &iLevel);
			if (iLevel >= NA_NUM_WORLDS*iWorldSize) iLevel = NA_NUM_WORLDS*iWorldSize - 1;
			SetRTIntVar(NA_RT_MAX_LEVEL_NUMBER, iLevel);

			// sync current level with max level
			if (GetRTIntVar(NA_RT_CURR_LEVEL_NUMBER) > iLevel)
			{
				SetRTIntVar(NA_RT_CURR_LEVEL_NUMBER, iLevel);
				SetRTIntVar(NA_RT_MINI_LEVEL_NUMBER, iLevel);
			}

			// update audio
			int iSndVol, iMusVol;
			BOOL fMute;
			GetVars("config")->GetInt(L_GROUP, "config", "mute", 0, &fMute);
			GetVars("config")->GetInt(L_GROUP, "config", "sndvol", 0, &iSndVol);
			GetVars("config")->GetInt(L_GROUP, "config", "musvol", 0, &iMusVol);

			GetAudio()->SetSFXVolume(iSndVol);
			GetAudio()->SetMusicVolume("backlogo", iMusVol);
			GetAudio()->SetMute(fMute);

			SetRTStringVar(NA_RT_BACK_MUSIC, "backlogo");
			GetAudio()->PlayMusic("backlogo");

			//turn on music check
			PostState(ES_ENGINE_CHECKMUSIC, 0, 0);
			break;
		case ES_ENGINE_CHECKMUSIC:
			//check if back music stop then play it again
			if (!GetAudio()->IsMusicPlay(GetRTStringVar(NA_RT_BACK_MUSIC))) {
				GetAudio()->StopMusic(GetRTStringVar(NA_RT_BACK_MUSIC));
				GetAudio()->PlayMusic(GetRTStringVar(NA_RT_BACK_MUSIC));
			}
			return FALSE;
	}
	return TRUE;
}
コード例 #11
0
ファイル: i18n.cpp プロジェクト: adrianbroher/freeorion
const std::string& Language() {
    std::lock_guard<std::recursive_mutex> stringtable_lock(stringtable_access_mutex);
    return GetStringTable().Language();
}
コード例 #12
0
ファイル: i18n.cpp プロジェクト: adrianbroher/freeorion
bool UserStringExists(const std::string& str) {
    std::lock_guard<std::recursive_mutex> stringtable_lock(stringtable_access_mutex);
    if (GetStringTable().StringExists(str))
        return true;
    return GetDefaultStringTable().StringExists(str);
}
コード例 #13
0
ファイル: MENUINIT.C プロジェクト: thearttrooper/KappaPC
void PEXPORT KppInitMenus(void)
{
    EXPID idExp;
    LISTID idVars;

    /* Define cursors */
    hHourGlass = LoadCursor(NULL, IDC_WAIT);

    /* Global variables under Menu */
    idDisplayCall = KppAddAtom(GetStringTable(IDS_DISPLAYCALL));
    idInitMenu = KppAddAtom(GetStringTable(IDS_INITMENU));
    idPrepareMenu = KppAddAtom(GetStringTable(IDS_PREPAREMENU));
    idownerStr = KppAddAtom(GetStringTable(IDS_OWNER_STR));
    idselectorStr = KppAddAtom(GetStringTable(IDS_SELECTOR_STR));
    idBitmapStr = KppAddAtom(GetStringTable(IDS_BITMAPW));
    idRootMenuName = KppAddAtom(GetStringTable(IDS_WIN_MENU));
    idwindowStr = KppAddAtom(GetStringTable(IDS_WINDOW_STR));

    /* Initialize Menu class */
    idRootMenu = NULLID;        /* class id of 'Menu' */
    idRootMenu = Kpp_MakeClass(idRootMenuName, lpIDs->idRootClass);
    MARKSYSTEMCLASS(idRootMenu);

    /* Make Menu slots */
    Init_MenuSlotNames();

    UnwindProtect(cleanup);
    KppDontSaveValues(TRUE);
    
    MakeMenuSlot(idRootMenuName, lpMenuSNs->idXSN);
    KppSetSlotValue(idRootMenuName, lpMenuSNs->idXSN, lpIDs->idNull, EXPATOM);
    MakeMenuSlot(idRootMenuName, lpMenuSNs->idYSN);
    KppSetSlotValue(idRootMenuName, lpMenuSNs->idYSN, lpIDs->idNull, EXPATOM);
    MakeMenuSlot(idRootMenuName, lpMenuSNs->idSelectorsSN);
    SetOptionMultiple(idRootMenuName, lpMenuSNs->idSelectorsSN);
    MakeMenuSlot(idRootMenuName, lpMenuSNs->idSelectorTitlesSN);
    SetOptionMultiple(idRootMenuName, lpMenuSNs->idSelectorTitlesSN);
    MakeMenuSlot(idRootMenuName, lpMenuSNs->idCheckedSelectorsSN);
    SetOptionMultiple(idRootMenuName, lpMenuSNs->idCheckedSelectorsSN);
    MakeMenuSlot(idRootMenuName, lpMenuSNs->idDisabledSelectorsSN);
    SetOptionMultiple(idRootMenuName, lpMenuSNs->idDisabledSelectorsSN);
    MakeMenuSlot(idRootMenuName, lpMenuSNs->idDefaultMessageSN);
    KppSetSlotValue(idRootMenuName, lpMenuSNs->idDefaultMessageSN,
                    idDisplayCall, EXPATOM);

    /* Make Menu Methods */
    /* InitMenu */
    idExp = KppBuildExp(GetStringTable(IDS_MENU_INITMENU));
    idVars = KppMakeList(0);
    KppAppendElem(idVars, idownerStr);
    KppMakeMethod(idRootMenuName, idInitMenu, idVars, idExp);
    KppMarkSystemMethod(idRootMenuName, idInitMenu);

    /* DisplayCall */
    idExp = KppBuildExp(GetStringTable(IDS_MENU_DISPLAYCALL));
    idVars = KppMakeList(0);
    KppAppendElem(idVars, idownerStr);
    KppAppendElem(idVars, idwindowStr);
    KppAppendElem(idVars, idselectorStr);
    KppMakeMethod(idRootMenuName, idDisplayCall, idVars, idExp);
    KppMarkSystemMethod(idRootMenuName, idDisplayCall);

    /* PrepareMenu */
    idExp = KppBuildExp(GetStringTable(IDS_MENU_PREPAREMENU));
    idPrepareMenuMethod = 
        KppMakeMethod(idRootMenuName, idPrepareMenu, NULLID, idExp);
    KppMarkSystemMethod(idRootMenuName, idPrepareMenu);
    
  cleanup:
    KppDontSaveValues(FALSE);
    EndProtect();
}
コード例 #14
0
ファイル: MENUINIT.C プロジェクト: thearttrooper/KappaPC
/*********** Menu related methods for Window ***********/
void PEXPORT KppInitMenuMethods(LISTID idVars,
                                            ITEMID idRootWindowWA)
{
    EXPID idBody;

    idInsertIntoMenu = KppAddAtom(GetStringTable(IDS_INSERTINTOMENU));
    idRemoveFromMenu = KppAddAtom(GetStringTable(IDS_REMOVEFROMMENU));
    idReplaceInMenu = KppAddAtom(GetStringTable(IDS_REPLACEINMENU));
    idSetMenu = KppAddAtom(GetStringTable(IDS_SETMENU));
    idRemoveMenu = KppAddAtom(GetStringTable(IDS_REMOVEMENU));

    /* Method Vars */
    idtargetmenuStr = KppAddAtom(GetStringTable(IDS_TARGETMENU_STR));
    idtargetitemStr = KppAddAtom(GetStringTable(IDS_TARGETITEM_STR));
    idtitleStr = KppAddAtom(GetStringTable(IDS_TITLE_STR));
    idoldselStr = KppAddAtom(GetStringTable(IDS_OLDSEL_STR));
    idnewselStr = KppAddAtom(GetStringTable(IDS_NEWSEL_STR));

    /* InsertIntoMenu */
    {
        char buffer[256];

        LoadString(hInstThisDll, IDS_WINDOW_INSERTINTOMENU, buffer, 255);
        idBody = KppBuildExp(buffer);
    }
    idVars = KppMakeList(0);
    KppAppendElem(idVars, idtargetmenuStr);
    KppAppendElem(idVars, idtargetitemStr);
    KppAppendElem(idVars, idselectorStr);
    KppAppendElem(idVars, idtitleStr);
    KppMakeMethod(idRootWindowWA, idInsertIntoMenu, idVars, idBody);
    KppMarkSystemMethod(idRootWindowWA, idInsertIntoMenu);

    /* RemoveFromMenu */
    idBody = KppBuildExp(GetStringTable(IDS_WINDOW_REMOVEFROMMENU));
    idVars = KppMakeList(0);
    KppAppendElem(idVars, idtargetmenuStr);
    KppAppendElem(idVars, idselectorStr);
    KppMakeMethod(idRootWindowWA, idRemoveFromMenu, idVars, idBody);
    KppMarkSystemMethod(idRootWindowWA, idRemoveFromMenu);

    /* ReplaceInMenu */
    idBody = KppBuildExp(GetStringTable(IDS_WINDOW_REPLACEINMENU));
    idVars = KppMakeList(0);
    KppAppendElem(idVars, idtargetmenuStr);
    KppAppendElem(idVars, idoldselStr);
    KppAppendElem(idVars, idnewselStr);
    KppAppendElem(idVars, idtitleStr);
    KppMakeMethod(idRootWindowWA, idReplaceInMenu, idVars, idBody);
    KppMarkSystemMethod(idRootWindowWA, idReplaceInMenu);

    /* SetMenu */
    idBody = KppBuildExp(GetStringTable(IDS_WINDOW_SETMENU));
    idVars = KppMakeList(0);
    KppAppendElem(idVars, idtargetmenuStr);
    KppMakeMethod(idRootWindowWA, idSetMenu, idVars, idBody);
    KppMarkSystemMethod(idRootWindowWA, idSetMenu);

    /* RemoveMenu */
    idBody = KppBuildExp(GetStringTable(IDS_WINDOW_REMOVEMENU));
    KppMakeMethod(idRootWindowWA, idRemoveMenu, NULLID, idBody);
    KppMarkSystemMethod(idRootWindowWA, idRemoveMenu);
}
コード例 #15
0
ファイル: i18n.cpp プロジェクト: e-h-j/freeorion
const std::string& Language()
{ return GetStringTable().Language(); }
コード例 #16
0
ファイル: BannerObject.cpp プロジェクト: OpenRCT2/OpenRCT2
void BannerObject::Load()
{
    GetStringTable().Sort();
    _legacyType.name = language_allocate_object_string(GetName());
    _legacyType.image = gfx_object_allocate_images(GetImageTable().GetImages(), GetImageTable().GetCount());
}