当前位置: 首页>>代码示例>>C++>>正文


C++ StarSystem类代码示例

本文整理汇总了C++中StarSystem的典型用法代码示例。如果您正苦于以下问题:C++ StarSystem类的具体用法?C++ StarSystem怎么用?C++ StarSystem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了StarSystem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: l_starsystem_export_to_lua

/*
 * Method: ExportToLua
 *
 * Export of generated system for personal interest, customisation, etc
 *
 * Availability:
 *
 *   alpha 33
 *
 * Status:
 *
 *   experimental
 */
static int l_starsystem_export_to_lua(lua_State *l)
{
	PROFILE_SCOPED()
	LUA_DEBUG_START(l);

	StarSystem *s = LuaObject<StarSystem>::CheckFromLua(1);

	static const std::string EXPORTED_SYSTEMS_DIR_NAME("exported_systems");
	if (!FileSystem::userFiles.MakeDirectory(EXPORTED_SYSTEMS_DIR_NAME)) {
		throw CouldNotOpenFileException();
	}

	// construct the filename with folder and extension
	try {
		const std::string filename(EXPORTED_SYSTEMS_DIR_NAME + "/" + FileSystem::SanitiseFileName(s->GetName()) + ".lua");
		const std::string finalPath = FileSystem::NormalisePath(
				FileSystem::JoinPathBelow(FileSystem::GetUserDir(), filename));
		s->ExportToLua(finalPath.c_str());
	} catch (std::invalid_argument &) {
		return luaL_error(l, "could not export system -- name forms an invalid path");
	}

	LUA_DEBUG_END(l, 0);
	return 0;
}
开发者ID:arcadia-xenos,项目名称:pioneer,代码行数:38,代码来源:LuaStarSystem.cpp

示例2: l_starsystem_attr_name

/*
 * Attribute: name
 *
 * The name of the system. This is usually the same as the name of the primary
 * star.
 *
 * Availability:
 *
 *   alpha 10
 *
 * Status:
 *
 *   stable
 */
static int l_starsystem_attr_name(lua_State *l)
{
	PROFILE_SCOPED()
	StarSystem *s = LuaObject<StarSystem>::CheckFromLua(1);
	lua_pushstring(l, s->GetName().c_str());
	return 1;
}
开发者ID:arcadia-xenos,项目名称:pioneer,代码行数:21,代码来源:LuaStarSystem.cpp

示例3: sendHome

//Sends a fleet back to it's home planet
void TaeTurn::sendHome(uint32_t fleet) {
    Game* game = Game::getGame();
    ObjectManager* obm = game->getObjectManager();
    ObjectTypeManager* obtm = game->getObjectTypeManager();
    PlayerManager::Ptr pm = game->getPlayerManager();

    IGObject::Ptr fleetobj = obm->getObject(fleet);
    //Check to make sure it is really a fleet
    if(fleetobj->getType() != obtm->getObjectTypeByName("Fleet")) {
        return;
    }

    //Get all the required objects
    Fleet* f = (Fleet*) fleetobj->getObjectBehaviour();
    Player::Ptr p = pm->getPlayer(f->getOwner());
    IGObject::Ptr sys = obm->getObject(fleetobj->getParent());
    StarSystem* sysData = (StarSystem*) sys->getObjectBehaviour();

    //Remove fleet from system
    sysData->setRegion(0);
    fleetobj->removeFromParent();

    //Find it's home planet
    std::set<uint32_t> objects = obm->getAllIds();
    std::set<uint32_t>::iterator itcurr;
    for(itcurr = objects.begin(); itcurr != objects.end(); ++itcurr) {
        IGObject::Ptr ob = obm->getObject(*itcurr);
        if(ob->getName().compare(string(p->getName() + "'s Home Planet")) == 0) {
            Planet* p = (Planet*) ob->getObjectBehaviour();
            f->setPosition(p->getPosition());
            fleetobj->addToParent(ob->getID());
        }
    }
}
开发者ID:epyon,项目名称:tpserver-cpp,代码行数:35,代码来源:taeturn.cpp

示例4: l_starsystem_attr_path

/*
 * Attribute: path
 *
 * The <SystemPath> to the system
 *
 * Availability:
 *
 *   alpha 10
 *
 * Status:
 *
 *   stable
 */
static int l_starsystem_attr_path(lua_State *l)
{
    StarSystem *s = LuaStarSystem::CheckFromLua(1);
    SystemPath path = s->GetPath();
    LuaSystemPath::PushToLua(&path);
    return 1;
}
开发者ID:adammead,项目名称:pioneer,代码行数:20,代码来源:LuaStarSystem.cpp

示例5: l_starsystem_attr_lawlessness

/*
 * Attribute: lawlessness
 *
 * The lawlessness value for the system, 0 for peaceful, 1 for raging
 * hordes of pirates
 *
 * Availability:
 *
 *   alpha 10
 *
 * Status:
 *
 *   experimental
 */
static int l_starsystem_attr_lawlessness(lua_State *l)
{
	PROFILE_SCOPED()
	StarSystem *s = LuaObject<StarSystem>::CheckFromLua(1);
	lua_pushnumber(l, s->GetSysPolit().lawlessness.ToDouble());
	return 1;
}
开发者ID:arcadia-xenos,项目名称:pioneer,代码行数:21,代码来源:LuaStarSystem.cpp

示例6: l_starsystem_attr_population

/*
 * Attribute: population
 *
 * The population of this system, in billions of people
 *
 * Availability:
 *
 *   alpha 10
 *
 * Status:
 *
 *   experimental
 */
static int l_starsystem_attr_population(lua_State *l)
{
	PROFILE_SCOPED()
	StarSystem *s = LuaObject<StarSystem>::CheckFromLua(1);
	lua_pushnumber(l, s->GetTotalPop().ToDouble());
	return 1;
}
开发者ID:arcadia-xenos,项目名称:pioneer,代码行数:20,代码来源:LuaStarSystem.cpp

示例7: l_starsystem_attr_explored

static int l_starsystem_attr_explored(lua_State *l)
{
	PROFILE_SCOPED()
	StarSystem *s = LuaObject<StarSystem>::CheckFromLua(1);
	lua_pushboolean(l, !s->GetUnexplored());
	return 1;
}
开发者ID:arcadia-xenos,项目名称:pioneer,代码行数:7,代码来源:LuaStarSystem.cpp

示例8: l_starsystem_attr_path

/*
 * Attribute: path
 *
 * The <SystemPath> to the system
 *
 * Availability:
 *
 *   alpha 10
 *
 * Status:
 *
 *   stable
 */
static int l_starsystem_attr_path(lua_State *l)
{
	PROFILE_SCOPED()
	StarSystem *s = LuaObject<StarSystem>::CheckFromLua(1);
	SystemPath path = s->GetPath();
	LuaObject<SystemPath>::PushToLua(&path);
	return 1;
}
开发者ID:arcadia-xenos,项目名称:pioneer,代码行数:21,代码来源:LuaStarSystem.cpp

示例9: l_sbodypath_get_star_system

/*
 * Method: GetStarSystem
 *
 * Get a <StarSystem> object for the system that this path points to
 *
 * > system = path:GetStarSystem()
 *
 * Return:
 *
 *   system - the <StarSystem>
 *
 * Availability:
 *
 *   alpha 10
 *
 * Status:
 *
 *   stable
 */
static int l_sbodypath_get_star_system(lua_State *l)
{
	SystemPath *path = LuaSystemPath::GetFromLua(1);
	StarSystem *s = StarSystem::GetCached(path);
	LuaStarSystem::PushToLua(s);
	s->Release();
	return 1;
}
开发者ID:dewasha,项目名称:pioneer,代码行数:27,代码来源:LuaSystemPath.cpp

示例10: l_sbodypath_get_system_body

/*
 * Method: GetSystemBody
 *
 * Get a <SystemBody> object for the body that this path points to
 *
 * > body = path:GetSystemBody()
 *
 * Return:
 *
 *   body - the <SystemBody>
 *
 * Availability:
 *
 *   alpha 10
 *
 * Status:
 *
 *   stable
 */
static int l_sbodypath_get_system_body(lua_State *l)
{
	SystemPath *path = LuaSystemPath::GetFromLua(1);
	StarSystem *s = StarSystem::GetCached(path);
	SBody *sbody = s->GetBodyByPath(path);
	LuaSBody::PushToLua(sbody);
	s->Release();
	return 1;
}
开发者ID:dewasha,项目名称:pioneer,代码行数:28,代码来源:LuaSystemPath.cpp

示例11: getStarSystem

StarSystem* Universe::getStarSystem( string name )
{
    vector< StarSystem* >::iterator iter;
    for (iter = star_system.begin(); iter != star_system.end(); iter++) {
        StarSystem *ss = *iter;
        if (ss->getName() == name)
            return ss;
    }
    return NULL;
}
开发者ID:vegastrike,项目名称:Vega-Strike-Engine-Source,代码行数:10,代码来源:universe_generic.cpp

示例12: l_starsystem_attr_faction

/*
 * Attribute: faction
 *
 * The faction that controls this system
 *
 * Availability:
 *
 *   alpha 28
 *
 * Status:
 *
 *   experimental
 */
static int l_starsystem_attr_faction(lua_State *l)
{
    StarSystem *s = LuaStarSystem::CheckFromLua(1);
    if (s->GetFaction()->IsValid()) {
        LuaFaction::PushToLua(s->GetFaction());
        return 1;
    } else {
        return 0;
    }
}
开发者ID:adammead,项目名称:pioneer,代码行数:23,代码来源:LuaStarSystem.cpp

示例13: l_starsystem_attr_faction

/*
 * Attribute: faction
 *
 * The <Faction> that controls this system
 *
 * Availability:
 *
 *   alpha 28
 *
 * Status:
 *
 *   experimental
 */
static int l_starsystem_attr_faction(lua_State *l)
{
	PROFILE_SCOPED()
	StarSystem *s = LuaObject<StarSystem>::CheckFromLua(1);
	if (s->GetFaction()->IsValid()) {
		LuaObject<Faction>::PushToLua(s->GetFaction());
		return 1;
	} else {
		return 0;
	}
}
开发者ID:arcadia-xenos,项目名称:pioneer,代码行数:24,代码来源:LuaStarSystem.cpp

示例14: l_starsystem_attr_faction

/*
 * Attribute: faction
 *
 * The <Faction> that controls this system
 *
 * Availability:
 *
 *   alpha 28
 *
 * Status:
 *
 *   experimental
 */
static int l_starsystem_attr_faction(lua_State *l)
{
	PROFILE_SCOPED()
	StarSystem *s = LuaObject<StarSystem>::CheckFromLua(1);
	if (s->GetFaction()->IsValid()) {
		LuaObject<Faction>::PushToLua(const_cast<Faction*>(s->GetFaction())); // XXX const-correctness violation
		return 1;
	} else {
		return 0;
	}
}
开发者ID:BobTheTerrible,项目名称:pioneer,代码行数:24,代码来源:LuaStarSystem.cpp

示例15: l_starsystem_is_commodity_legal

/*
 * Method: IsCommodityLegal
 *
 * Determine if a given cargo item is legal for trade in this system
 *
 * > is_legal = system:IsCommodityLegal(cargo)
 *
 * Parameters:
 *
 *   cargo - the wanted commodity (for instance, Equipment.cargo.hydrogen)
 *
 * Return:
 *
 *   is_legal - true if the commodity is legal, otherwise false
 *
 * Availability:
 *
 *   alpha 10
 *
 * Status:
 *
 *   experimental
 */
static int l_starsystem_is_commodity_legal(lua_State *l)
{
	PROFILE_SCOPED()
	StarSystem *s = LuaObject<StarSystem>::CheckFromLua(1);
	// XXX: Don't use the l10n_key hack, this is just UGLY!!
	luaL_checktype(l, 2, LUA_TTABLE);
	LuaTable(l, 2).PushValueToStack("l10n_key");
	GalacticEconomy::Commodity e = static_cast<GalacticEconomy::Commodity>(
			LuaConstants::GetConstantFromArg(l, "CommodityType", -1));
	lua_pushboolean(l, s->IsCommodityLegal(e));
	return 1;
}
开发者ID:BobTheTerrible,项目名称:pioneer,代码行数:35,代码来源:LuaStarSystem.cpp


注:本文中的StarSystem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。