Bazaar developer reference

stringToBools(const char *, int *, bool **)

Defined in
CvGameCoreUtils.cpp, line 1014
Hook name
CivHooks::stringToBools

Hooks

static bool BeforestringToBools(const char* szString, int* iNumBools, bool** ppBools);static void AfterstringToBools(const char* szString, int* iNumBools, bool** ppBools);static void ReplacestringToBools(void (*original)(const char*, int*, bool**), const char* szString, int* iNumBools, bool** ppBools);CivRegisterBefore<CivHooks::stringToBools>(host, &BeforestringToBools);CivRegisterAfter<CivHooks::stringToBools>(host, &AfterstringToBools);CivRegisterReplace<CivHooks::stringToBools>(host, &ReplacestringToBools);

Code

1011//1012// caller must call SAFE_DELETE_ARRAY on ppBools - caller should not be outside the DLL either1013//1014void stringToBools(const char* szString, int* iNumBools, bool** ppBools)1015{1016	CvAssertMsg(szString, "null string");1017	if(szString)1018	{1019		*iNumBools = strlen(szString);1020		*ppBools = FNEW(bool[*iNumBools], c_eCiv5GameplayDLL, 0);1021		int i;1022		for(i=0; i<*iNumBools; i++)1023		{1024			(*ppBools)[i] = (szString[i]=='1');1025		}1026	}1027}

Calls