Bazaar developer reference

CvCity::canCreate(ProjectTypes, bool, bool) const

Defined in
CvCity.cpp, line 3005
Class
CvCity
Hook name
CivHooks::CvCity_canCreate
Lua events
GameEvents.CityCanCreate

Hooks

static bool BeforeCvCity_canCreate(const CvCity* self, ProjectTypes eProject, bool bContinue, bool bTestVisible, bool& result);static void AfterCvCity_canCreate(const CvCity* self, ProjectTypes eProject, bool bContinue, bool bTestVisible, bool& result);static bool ReplaceCvCity_canCreate(bool (*original)(const CvCity*, ProjectTypes, bool, bool), const CvCity* self, ProjectTypes eProject, bool bContinue, bool bTestVisible);CivRegisterBefore<CivHooks::CvCity_canCreate>(host, &BeforeCvCity_canCreate);CivRegisterAfter<CivHooks::CvCity_canCreate>(host, &AfterCvCity_canCreate);CivRegisterReplace<CivHooks::CvCity_canCreate>(host, &ReplaceCvCity_canCreate);

Code

3005bool CvCity::canCreate(ProjectTypes eProject, bool bContinue, bool bTestVisible) const3006{3007	VALIDATE_OBJECT30083009	if(!(GET_PLAYER(getOwner()).canCreate(eProject, bContinue, bTestVisible)))3010	{3011		return false;3012	}30133014	ICvEngineScriptSystem1* pkScriptSystem = gDLL->GetScriptSystem();3015	if(pkScriptSystem)3016	{3017		CvLuaArgsHandle args;3018		args->Push(getOwner());3019		args->Push(GetID());3020		args->Push(eProject);30213022		// Attempt to execute the game events.3023		// Will return false if there are no registered listeners.3024		bool bResult = false;3025		if(LuaSupport::CallTestAll(pkScriptSystem, "CityCanCreate", args.get(), bResult))3026		{3027			// Check the result.3028			if(bResult == false)3029			{3030				return false;3031			}3032		}3033	}30343035	return true;3036}

Calls

Called by