Bazaar developer reference

CvLuaGameInfo::pRegisterActions(lua_State *)

Defined in
Lua/CvLuaGameInfo.cpp, line 33
Class
CvLuaGameInfo
Hook name
CivHooks::CvLuaGameInfo_pRegisterActions

Hooks

static bool BeforeCvLuaGameInfo_pRegisterActions(lua_State* L, int& result);static void AfterCvLuaGameInfo_pRegisterActions(lua_State* L, int& result);static int ReplaceCvLuaGameInfo_pRegisterActions(int (*original)(lua_State*), lua_State* L);CivRegisterBefore<CivHooks::CvLuaGameInfo_pRegisterActions>(host, &BeforeCvLuaGameInfo_pRegisterActions);CivRegisterAfter<CivHooks::CvLuaGameInfo_pRegisterActions>(host, &AfterCvLuaGameInfo_pRegisterActions);CivRegisterReplace<CivHooks::CvLuaGameInfo_pRegisterActions>(host, &ReplaceCvLuaGameInfo_pRegisterActions);

Code

33int CvLuaGameInfo::pRegisterActions(lua_State* L)34{35	lua_newtable(L);36	lua_pushvalue(L, -1);37	lua_setglobal(L, "GameInfoActions");3839	const int t = lua_gettop(L);40	int idx = 0;4142	typedef std::vector<CvActionInfo*> ActionInfos;43	ActionInfos& infos = GC.getActionInfo();44	for(ActionInfos::const_iterator it = infos.begin();45	        it != infos.end(); ++it)46	{47		CvActionInfo* pEntry = (*it);48		lua_createtable(L, 0, 0);4950		Table kEntry(L, -1);5152		kEntry["MissionData"]		= pEntry->getMissionData();53		kEntry["CommandData"]		= pEntry->getCommandData();5455		kEntry["AutomateType"]		= pEntry->getAutomateType();56		kEntry["InterfaceModeType"]	= pEntry->getInterfaceModeType();57		kEntry["MissionType"]		= pEntry->getMissionType();58		kEntry["CommandType"]		= pEntry->getCommandType();59		kEntry["ControlType"]		= pEntry->getControlType();60		kEntry["OriginalIndex"]		= pEntry->getOriginalIndex();6162		kEntry["ConfirmCommand"]	= pEntry->isConfirmCommand();63		kEntry["Visible"]			= pEntry->isVisible();64		kEntry["SubType"]			= (int)pEntry->getSubType();6566		kEntry["Type"]				= pEntry->GetType();67		kEntry["TextKey"]			= pEntry->GetTextKey();6869		kEntry["ActionInfoIndex"]	= pEntry->getActionInfoIndex();70		kEntry["HotKeyVal"]			= pEntry->getHotKeyVal();71		kEntry["HotKeyPriority"]	= pEntry->getHotKeyPriority();72		kEntry["HotKeyValAlt"]		= pEntry->getHotKeyValAlt();73		kEntry["HotKeyPriorityAlt"]	= pEntry->getHotKeyPriorityAlt();74		kEntry["OrderPriority"]		= pEntry->getOrderPriority();7576		kEntry["AltDown"]			= pEntry->isAltDown();77		kEntry["ShiftDown"]			= pEntry->isShiftDown();78		kEntry["CtrlDown"]			= pEntry->isCtrlDown();79		kEntry["AltDownAlt"]		= pEntry->isAltDownAlt();80		kEntry["ShiftDownAlt"]		= pEntry->isShiftDownAlt();81		kEntry["CtrlDownAlt"]		= pEntry->isCtrlDownAlt();8283		kEntry["HotKey"]			= pEntry->getHotKeyString();84		kEntry["Help"]				= pEntry->GetHelp();85		kEntry["DisabledHelp"]		= pEntry->GetDisabledHelp();8687		lua_rawseti(L, t, idx);8889		++idx;90	}9192	return 0;93}

Calls

Called by