本文整理汇总了C++中Environment::add_neighbor方法的典型用法代码示例。如果您正苦于以下问题:C++ Environment::add_neighbor方法的具体用法?C++ Environment::add_neighbor怎么用?C++ Environment::add_neighbor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Environment
的用法示例。
在下文中一共展示了Environment::add_neighbor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: generate_map
void generate_map(GameStuff & gs)
{
Environment * start = new CornField();
Environment * cf1 = new CornField();
Environment * end = new CornField();
Environment * goal = new Goal();
gs.map.push_back(start);
gs.map.push_back(cf1);
gs.map.push_back(end);
gs.map.push_back(goal);
Object * h = new Honey();
//gs.objects.push_back(h);
Actor * farmer = new Farmer("Pelle"); //TODO: this causes memory leak. WHYYY??
Actor * bee = new Bee();
gs.player = new Player();
gs.actors.push_back(farmer);
gs.actors.push_back(gs.player);
gs.actors.push_back(bee);
//"doors"
start->add_neighbor(cf1, East);
cf1->add_neighbor(start, West);
end->add_neighbor(cf1, South);
cf1->add_neighbor(end, North);
end->add_neighbor(goal, East);
start->pick_up(h);
start->enter(gs.player);
gs.player->environment = start;
cf1->enter(farmer);
farmer->environment = cf1;
cf1->enter(bee);
bee->environment = cf1;
}