static int create_random_girl(lua_State *L)
{
	

	int age		= 17;
	bool global	= false;	// set to true to add her to the pool
	bool undead	= false;	// unused by CreateRandomGirl
	bool slave	= false;	// set to true to create her as a slave
	bool inhuman	= false;	// set to true for a non-human girl
					// really should allow "both"
	bool kidnapped	= false;	// set to true to create an abductee
/*
 *	now - let's have an arg table
 */
 	int argtab = lua_gettop(L);
/*
 *	make sure it exists and is in fact a table
 */
	if(argtab == 0) {
		g_LogFile.ss() << "Warning: missing parameter for wm.add_cust_to_brothel";
		g_LogFile.ssend();
		return 1;
	}
	luaL_checktype(L, argtab, LUA_TTABLE);
/*
 *	OK - let's pull some parameters out of that table
 *	defaults are retained if a parameter is omitted
 */
	get_from_table(L, argtab, "age", age);
	get_from_table(L, argtab, "global", global);
	get_from_table(L, argtab, "undead", undead);
	get_from_table(L, argtab, "slave",  slave);
	get_from_table(L, argtab, "inhuman",  inhuman);
	get_from_table(L, argtab, "kidnapped",  kidnapped);
/*
 *	now create the girl
 */
	Girl *girl = g_Girls.CreateRandomGirl(
		age,		// age
		global,		// add to global girl list flag
		slave,		// create as slave flag
		undead,		// undead flag
		inhuman,	// true if non-humans are possible
		kidnapped	// true if kidnapped
	);
/*
 *	now create a lua table with the girl data
 */
	make_lua_girl(L, girl);
	return 1;
}
/*
 * this sets the wm.girl field to the girl passed
 */
void cLuaScript::set_wm_girl(Girl *girl)
{
/*
 *	get the "wm" symbol on the stack to start with
 */
 	lua_getglobal(l, "wm");
	//assert(lua_isnil(l, -1) == 0);
	int wm = lua_gettop(l);
	g_LogFile.ss() << "cLuaScript::set_wm_girl: wm index at " << wm;
	g_LogFile.ssend();
/*
 *	now push the key "girl" on after it
 */
 	lua_pushstring(l, "girl");
/*
 *	now format the Girl data as a Lua table
 */
	make_lua_girl(l, girl);
/*
 *	last store the girl data in wm
 */
 	lua_settable(l, wm);
}
예제 #3
0
파일: cLuaScript.cpp 프로젝트: Jenocke/test
static int create_random_girl(lua_State *L)
{
	CLog log;

	int age			= 17;		// if age is less than 18, virgin is set to true and age gets reset to 18	// `J` Legal Note: 18 is the Legal Age of Majority for the USA where I live 
	bool global		= false;	// set to true to add her to the pool
	bool slave		= false;	// set to true to create her as a slave
	bool undead		= false;	// unused by CreateRandomGirl
	bool inhuman	= false;	// set to true for a non-human girl
	bool kidnapped	= false;	// set to true to create an abductee
	bool arena		= false;	// set to true for an arena girl
	bool daughter	= false;	// set to true if she will be player's daughter
	bool isdaughter	= false;	// set to true if is she a Canonical_Daughter of another girl?
	string name		= "";		// specific name search
	/*
 *	now - let's have an arg table
 */
 	int argtab = lua_gettop(L);
/*
 *	make sure it exists and is in fact a table
 */
	if(argtab == 0) {
		log.ss() << "Warning: missing parameter for wm.add_cust_to_brothel";
		log.ssend();
		return 1;
	}
	luaL_checktype(L, argtab, LUA_TTABLE);
/*
 *	OK - let's pull some parameters out of that table
 *	defaults are retained if a parameter is omitted
 */
	get_from_table(L, argtab, "age", age);
	get_from_table(L, argtab, "global", global);
	get_from_table(L, argtab, "slave",  slave);
	get_from_table(L, argtab, "undead", undead);
	get_from_table(L, argtab, "inhuman", inhuman);
	get_from_table(L, argtab, "kidnapped",  kidnapped);
	get_from_table(L, argtab, "arena", arena);
	get_from_table(L, argtab, "daughter", daughter);
	get_from_table(L, argtab, "isdaughter", isdaughter);

/*
 *	now create the girl
 */
	sGirl *girl = g_Girls.CreateRandomGirl(
		age,		// age
		global,		// add to global girl list flag
		slave,		// create as slave flag
		undead,		// undead flag
		inhuman,	// true if non-humans are possible
		kidnapped,	// true if kidnapped
		arena,		// is the girl from the arena
		daughter,	// is she going to be the player's daughter?
		isdaughter,	// is she a Canonical_Daughter of another girl?
		""			// used to find a specific rgirl by name
	);
/*
 *	now create a lua table with the girl data
 */
	make_lua_girl(L, girl);
	return 1;
}