coord front_creature = gs->creatures.front()->get_coord(); //get location of creature closest to base
coord end = gs->map->get_end(); //get location of base
if (front_creature == end) { //if creature location == base location, then game over
exit_run_mode();
}
get_coord 和 get_end 函数返回一个 const coord & 并且上面的代码没有任何错误。但是当我用下面的代码替换它时,Visual Studio 说“没有运算符 '==' 匹配这些操作数”。我尝试在各个函数周围放置括号,但没有运气。
if (gs->creatures.front()->get_coord() == gs->map->get_end()) {
exit_run_mode();
}