本文整理汇总了C++中AList::set_int方法的典型用法代码示例。如果您正苦于以下问题:C++ AList::set_int方法的具体用法?C++ AList::set_int怎么用?C++ AList::set_int使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AList
的用法示例。
在下文中一共展示了AList::set_int方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
int
building_create(int type, int x, int y)
{
Building* building;
if (type == 1)
{
building = 0;
}
else
{
AList props;
props.set_int("x-pos", x);
props.set_int("y-pos", y);
building = BuildingTypeManager::current()->create_building(type, props);
}
if (building)
{
BuildingManager::current()->add_building(building, x, y);
return building->get_id();
}
else
{
std::cout << "BuildingCommands: Unhandled building type: " << type << std::endl;
return 0;
}
}
示例2: if
int
building_create_type(const char* name, SCM lst)
{
AList alist;
while(!gh_null_p(lst))
{
SCM key = gh_car(lst);
if (gh_null_p(gh_cdr(lst)))
{
std::cout << "Missing argument to keyword!" << std::endl;
}
SCM value = gh_cadr(lst);
if (gh_boolean_p(value))
{
alist.set_bool(Guile::keyword2string(key), gh_scm2bool(value));
}
else if (gh_number_p(value))
{
alist.set_int(Guile::keyword2string(key), gh_scm2int(value));
}
else if (gh_string_p(value))
{
alist.set_string(Guile::keyword2string(key), Guile::scm2string(value));
}
else
{
std::cout << "BuildingCommands: unknown argumnent type" << std::endl;
}
lst = gh_cddr(lst);
}
return BuildingTypeManager::current()->register_factory(new CustomBuildingFactory(name, alist));
}