- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在为一项任务编写“韦诺之战”代码。今天在编译的时候出现了如下错误(我之前编译项目的时候没有收到这些错误):
代码是(它是一个 .hpp 文件):
/* $Id: pathfind.hpp 54806 2012-07-20 22:17:33Z jamit $ */
/*
Copyright (C) 2003 - 2012 by David White <dave@whitevine.net>
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY.
See the COPYING file for more details.
*/
/**
* @file
* This module contains various pathfinding functions and utilities.
*/
#ifndef PATHFIND_H_INCLUDED
#define PATHFIND_H_INCLUDED
class gamemap;
class team;
class unit;
class unit_map;
class unit_movement_type;
#include "map_location.hpp"
#include <map>
#include <list>
#include <functional>
namespace pathfind {
class teleport_map;
enum VACANT_TILE_TYPE { VACANT_CASTLE, VACANT_ANY };
enum PATH_TYPE { MOVE, VISION, JAMMING };
/// Function that will find a location on the board that is as near
/// to @a loc as possible, but which is unoccupied by any units.
map_location find_vacant_tile(const map_location& loc,
VACANT_TILE_TYPE vacancy=VACANT_ANY,
const unit* pass_check=NULL,
const team* shroud_check=NULL);
/// Wrapper for find_vacant_tile() when looking for a vacant castle tile
/// near a leader.
map_location find_vacant_castle(const unit & leader);
/** Determines if a given location is in an enemy zone of control. */
bool enemy_zoc(team const ¤t_team, map_location const &loc,
team const &viewing_team, bool see_all=false);
struct cost_calculator
{
cost_calculator() {}
virtual double cost(const map_location& loc, const double so_far) const = 0;
virtual ~cost_calculator() {}
static double getNoPathValue() { return (42424242.0); }
};
/**
* Object which contains all the possible locations a unit can move to,
* with associated best routes to those locations.
*/
struct paths
{
paths()
: destinations()
{
}
/// Construct a list of paths for the specified unit.
paths(gamemap const &map,
unit_map const &/*units*/, // Not used
const unit& u, std::vector<team> const &teams,
bool force_ignore_zocs, bool allow_teleport,
const team &viewing_team, int additional_turns = 0,
bool see_all = false, bool ignore_units = false);
/// Virtual destructor (default processing).
virtual ~paths();
struct step
{
map_location curr, prev;
int move_left;
};
/** Ordered vector of possible destinations. */
struct dest_vect : std::vector<step>
{
const_iterator find(const map_location &) const;
bool contains(const map_location &) const;
void insert(const map_location &);
std::vector<map_location> get_path(const const_iterator &) const;
};
dest_vect destinations;
};
/**
* A refinement of paths for use when calculating vision.
*/
struct vision_path : public paths
{
/// Construct a list of seen hexes for a unit.
vision_path(gamemap const &map, const unit& viewer,
map_location const &loc, const std::map<map_location, int>& jamming_map);
virtual ~vision_path();
/// The edges are the non-destination hexes bordering the destinations.
std::set<map_location> edges;
};
/**
* A refinement of paths for use when calculating jamming.
*/
struct jamming_path : public paths
{
/// Construct a list of jammed hexes for a unit.
jamming_path(gamemap const &map, const unit& jammer,
map_location const &loc);
virtual ~jamming_path();
/// The edges are the non-destination hexes bordering the destinations.
//std::set<map_location> edges;
};
/** Structure which holds a single route between one location and another. */
struct plain_route
{
plain_route() : steps(), move_cost(0) {}
std::vector<map_location> steps;
/** Movement cost for reaching the end of the route. */
int move_cost;
};
/** Structure which holds a single route and marks for special events. */
struct marked_route
{
marked_route()
: route()
, steps(route.steps)
, move_cost(route.move_cost)
, marks()
{
}
marked_route(const marked_route& rhs)
: route(rhs.route)
, steps(route.steps)
, move_cost(route.move_cost)
, marks(rhs.marks)
{
}
marked_route& operator=(const marked_route& rhs)
{
this->route = rhs.route;
this->steps = this->route.steps;
this->move_cost = this->route.move_cost;
this->marks = rhs.marks;
return *this;
}
struct mark
{
mark(int turns_number = 0, bool in_zoc = false,
bool do_capture = false, bool is_invisible = false)
: turns(turns_number), zoc(in_zoc),
capture(do_capture), invisible(is_invisible) {}
int turns;
bool zoc;
bool capture;
bool invisible;
bool operator==(const mark& m) const {
return turns == m.turns && zoc == m.zoc && capture == m.capture && invisible == m.invisible;
}
};
typedef std::map<map_location, mark> mark_map;
plain_route route;
//make steps and move_cost of the underlying plain_route directly accessible
std::vector<map_location>& steps;
int& move_cost;
mark_map marks;
};
plain_route a_star_search(map_location const &src, map_location const &dst,
double stop_at, const cost_calculator* costCalculator,
const size_t parWidth, const size_t parHeight,
const teleport_map* teleports = NULL);
/**
* Add marks on a route @a rt assuming that the unit located at the first hex of
* rt travels along it.
*/
marked_route mark_route(const plain_route &rt);
struct shortest_path_calculator : cost_calculator
{
shortest_path_calculator(const unit& u, const team& t, const unit_map& units,
const std::vector<team> &teams, const gamemap &map,
bool ignore_unit = false, bool ignore_defense_ = false,
bool see_all = false);
virtual double cost(const map_location& loc, const double so_far) const;
private:
unit const &unit_;
team const &viewing_team_;
unit_map const &units_;
std::vector<team> const &teams_;
gamemap const &map_;
int const movement_left_;
int const total_movement_;
bool const ignore_unit_;
bool const ignore_defense_;
bool see_all_;
};
struct move_type_path_calculator : cost_calculator
{
move_type_path_calculator(const unit_movement_type& mt, int movement_left, int total_movement, const team& t, const gamemap& map);
virtual double cost(const map_location& loc, const double so_far) const;
private:
const unit_movement_type &movement_type_;
const int movement_left_;
const int total_movement_;
team const &viewing_team_;
gamemap const &map_;
};
/**
* Function which only uses terrain, ignoring shroud, enemies, etc.
* Required by move_unit_fake if the normal path fails.
*/
struct emergency_path_calculator : cost_calculator
{
emergency_path_calculator(const unit& u, const gamemap& map);
virtual double cost(const map_location& loc, const double so_far) const;
private:
unit const &unit_;
gamemap const &map_;
};
/**
* Function which doesn't take anything into account. Used by
* move_unit_fake for the last-chance case.
*/
struct dummy_path_calculator : cost_calculator
{
dummy_path_calculator(const unit& u, const gamemap& map);
virtual double cost(const map_location& loc, const double so_far) const;
};
}
#endif
错误:
c:\users...\trunk\wesnoth-1.11.0\src\pathfind\pathfind.hpp(24): error C2144: syntax error : 'gamemap' should be preceded by ';' 1>c:\users...s\trunk\wesnoth-1.11.0\src\pathfind\pathfind.hpp(24): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
最佳答案
在包含此文件的所有位置检查在此文件之前包含的 header 。
其中一个将以缺少最后一个分号的类/结构结束:
class Foo
{
} // <-- missing semicolon here is not picked up until
// the next declaration in another file
添加分号,收工:-)
关于c++ - 错误 C2144 和错误 C4430 在同一行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13638912/
我想要以下代码的 Python 单行解决方案,但是怎么做呢? total = 0 for ob in self.oblist: total += sum(v.amount for v in o
今天和大家一起学习一种可视化技术:构建树状热力图treemap。树形图易于可视化,且易于被人理解。树状图通过展示不同大小的矩形,以传达不同大小的数据量,一般认为,较大的矩形意味着占总体的一大部分,而较
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引起辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the he
我有一个声明 $set eq "Y" ? $set = "N" : $set = "Y"; 但不管它总是设置为 "N" # Toggle setting if ($set eq "Y") { $
当我尝试在我的服务器上上传一个 php 文件时,我收到一条消息:"Parse error: ..." 我知道这是什么意思,但问题是别的。 如果我在本地服务器上编辑文件(我的计算机上安装了 XAMPP)
我是 python oneliner 循环的新手。 我希望用户将数据输入到二维列表中,同时提醒他他们将输入的数据索引。我的代码是: flag=0 x=[[int(input("enter the "+
尝试在变量之前和之后打印字符串。C 是否有能力使用一条语句来显示此输出? 这有效: float value = 5; printf("\nThe value of %f", value); print
我正在验证我创建的 MySQL 数据库的结果,为此,我需要一些屏幕截图。 例如,以下查询: select distinct run_ID from ngsRunStats_FK.failedRuns
有人可以解释一下这个 JS LINE 吗?数据是一个对象。 var list = data == null ? [] : (data.wine instanceof Array ? data.wine
如何在一行中添加三个下拉菜单。我想把我的日、月和年放在一行中,但不能这样做。任何帮助将不胜感激。我附上我的 jsfiddle . .... 最佳
我正在尝试使用 html 将 iframe 的高度设置为 100%(我已成功完成),但我还在顶部添加了一行额外的文本,所以它太高了 ~16px(这需要一个滚动条)。有没有办法更改 iframe 以显示
这是一个示例,我从文件中读取行作为字符串,以使整个文件作为字符串数组: String[] ArrayOfStrings = (new Scanner( new File("log.txt") ).us
我有一个包含大量定义的配置文件,用于在编译期间包含模块。此外,这意味着我必须经常检查代码内部的定义。每张支票需要 3 行,是否可以在一行中执行此操作。 #if FUNC_ENABLED functio
我正在尝试制作一个水平列表,其中每个 列表中的 s 的高度为 385px,宽度为 400px。 我尝试使用 inline-block 使列表水平排列,但这似乎不起作用。也就是说,我的意思是列表仍然是垂
这很烦人,我有一个带有 css 文件的 wordpress 主题,所有内容都在一长行中。我想知道为什么有人会那样做。现在我已经升级了,我需要将旧文件与新文件进行比较,以便我可以接受更改。 Meld、d
我有一个对象数组,其中每个对象都有一个 search_order 属性。我要检查数组并将所有对象的属性增加 1这是简单的方法: res = [] for r in array: r.searc
我在某些服务器上遇到许多具有相同内容和相同名称的文件。我需要隔离这些文件进行分析,所以我不能只删除重复项。操作系统为Linux(centos和ubuntu)。 我枚举文件名和位置并将它们放入文本文件中
你能在不抛出错误的情况下解决这个问题吗?答案是单线。这是来自一个死的职位发布,在回复中要求回答。我认为这是剔除受访者的聪明方法,但我似乎无法在不出错的情况下回答它。 显而易见的解决方案: f.moo(
这个问题在这里已经有了答案: Is it ok if I omit curly braces in Java? [closed] (16 个答案) 关闭 9 年前。 我在 java 中使用没有大括号
我在这里试图用 python 制作一个简单的计算器,我想知道是否可以在命令运行时将前 3 行合并为一行。我的意思是;我不必按 Enter 键来键入下一个数字/运算符,而是按空格键(在输入部分)。 wh
我是一名优秀的程序员,十分优秀!