Bazaar developer reference

CvDllNetMessageHandler::ResponseSellBuilding(PlayerTypes, int, BuildingTypes)

Defined in
CvDllNetMessageHandler.cpp, line 912
Class
CvDllNetMessageHandler
Hook name
CivHooks::CvDllNetMessageHandler_ResponseSellBuilding
Lua events
GameEvents.CitySoldBuilding

Hooks

static bool BeforeCvDllNetMessageHandler_ResponseSellBuilding(CvDllNetMessageHandler* self, PlayerTypes ePlayer, int iCityID, BuildingTypes eBuilding);static void AfterCvDllNetMessageHandler_ResponseSellBuilding(CvDllNetMessageHandler* self, PlayerTypes ePlayer, int iCityID, BuildingTypes eBuilding);static void ReplaceCvDllNetMessageHandler_ResponseSellBuilding(void (*original)(CvDllNetMessageHandler*, PlayerTypes, int, BuildingTypes), CvDllNetMessageHandler* self, PlayerTypes ePlayer, int iCityID, BuildingTypes eBuilding);// CivHooks.h gives this hook point no types, so nothing checks these hooks' parameters.host->RegisterHook(host->pluginIndex, CivHooks::CvDllNetMessageHandler_ResponseSellBuilding::ID, CIV_HOOK_BEFORE, (void*)&BeforeCvDllNetMessageHandler_ResponseSellBuilding);host->RegisterHook(host->pluginIndex, CivHooks::CvDllNetMessageHandler_ResponseSellBuilding::ID, CIV_HOOK_AFTER, (void*)&AfterCvDllNetMessageHandler_ResponseSellBuilding);host->RegisterHook(host->pluginIndex, CivHooks::CvDllNetMessageHandler_ResponseSellBuilding::ID, CIV_HOOK_REPLACE, (void*)&ReplaceCvDllNetMessageHandler_ResponseSellBuilding);

Code

912void CvDllNetMessageHandler::ResponseSellBuilding(PlayerTypes ePlayer, int iCityID, BuildingTypes eBuilding)913{914	CvCity* pCity = GET_PLAYER(ePlayer).getCity(iCityID);915	if(pCity)916	{917		pCity->GetCityBuildings()->DoSellBuilding(eBuilding);918919#if defined(MOD_EVENTS_CITY)920		if (MOD_EVENTS_CITY) {921			GAMEEVENTINVOKE_HOOK(GAMEEVENT_CitySoldBuilding, ePlayer, iCityID, eBuilding);922		} else {923#endif924		ICvEngineScriptSystem1* pkScriptSystem = gDLL->GetScriptSystem();925		if (pkScriptSystem) 926		{927			CvLuaArgsHandle args;928			args->Push(ePlayer);929			args->Push(iCityID);930			args->Push(eBuilding);931932			bool bResult;933			LuaSupport::CallHook(pkScriptSystem, "CitySoldBuilding", args.get(), bResult);934		}935#if defined(MOD_EVENTS_CITY)936		}937#endif938	}939}

Calls