Bazaar developer reference

CvDllGame::GetGreatWorkAudio(int, char *, int)

Defined in
CvDllGame.cpp, line 565
Class
CvDllGame
Hook name
CivHooks::CvDllGame_GetGreatWorkAudio

Hooks

static bool BeforeCvDllGame_GetGreatWorkAudio(CvDllGame* self, int GreatWorkIndex, char* strSound, int length, bool& result);static void AfterCvDllGame_GetGreatWorkAudio(CvDllGame* self, int GreatWorkIndex, char* strSound, int length, bool& result);static bool ReplaceCvDllGame_GetGreatWorkAudio(bool (*original)(CvDllGame*, int, char*, int), CvDllGame* self, int GreatWorkIndex, char* strSound, int length);// CivHooks.h gives this hook point no types, so nothing checks these hooks' parameters.host->RegisterHook(host->pluginIndex, CivHooks::CvDllGame_GetGreatWorkAudio::ID, CIV_HOOK_BEFORE, (void*)&BeforeCvDllGame_GetGreatWorkAudio);host->RegisterHook(host->pluginIndex, CivHooks::CvDllGame_GetGreatWorkAudio::ID, CIV_HOOK_AFTER, (void*)&AfterCvDllGame_GetGreatWorkAudio);host->RegisterHook(host->pluginIndex, CivHooks::CvDllGame_GetGreatWorkAudio::ID, CIV_HOOK_REPLACE, (void*)&ReplaceCvDllGame_GetGreatWorkAudio);

Code

565bool CvDllGame::GetGreatWorkAudio(int GreatWorkIndex, char* strSound, int length)566{567	if (GreatWorkIndex == -1)568	{569		return false;570	}571572	const GreatWorkType eType = m_pGame->GetGameCulture()->GetGreatWorkType(GreatWorkIndex);573	if(eType != NO_GREAT_WORK)574	{575		const CvString audio = CultureHelpers::GetGreatWorkAudio(eType);576577		if(audio.GetLength() <= length)578		{579			if(strcpy_s(strSound, length, audio.c_str()) == 0)580			{581				return true;582			}583		}584	}585586	return false;587}

Calls