summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-06-23 14:38:17 +0000
committerrubidium <rubidium@openttd.org>2010-06-23 14:38:17 +0000
commit52154e097c4f6e0e9d03bad83b933b05b6082d16 (patch)
tree6c439a38376bb38a31b76cd8532f966fbe519f54
parent9683b8746674af9963fb13f00e020edf1dba91f4 (diff)
downloadopenttd-52154e097c4f6e0e9d03bad83b933b05b6082d16.tar.xz
(svn r20013) -Fix [FS#3890]: silence some warnings / take the advice of the warnings into account
-rw-r--r--src/command.cpp2
-rw-r--r--src/newgrf_debug_gui.cpp3
-rw-r--r--src/saveload/afterload.cpp10
-rw-r--r--src/train_gui.cpp4
4 files changed, 14 insertions, 5 deletions
diff --git a/src/command.cpp b/src/command.cpp
index 169c2b6d0..ab5d29764 100644
--- a/src/command.cpp
+++ b/src/command.cpp
@@ -591,7 +591,7 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd,
if (tile != 0 && (tile >= MapSize() || (!IsValidTile(tile) && (cmd_flags & CMD_ALL_TILES) == 0))) return_dcpi(CMD_ERROR, false);
/* Always execute server and spectator commands as spectator */
- bool exec_as_spectator = cmd_flags & (CMD_SPECTATOR | CMD_SERVER);
+ bool exec_as_spectator = (cmd_flags & (CMD_SPECTATOR | CMD_SERVER)) != 0;
/* If the company isn't valid it may only do server command or start a new company!
* The server will ditch any server commands a client sends to it, so effectively
diff --git a/src/newgrf_debug_gui.cpp b/src/newgrf_debug_gui.cpp
index 703edf905..019bd20b9 100644
--- a/src/newgrf_debug_gui.cpp
+++ b/src/newgrf_debug_gui.cpp
@@ -104,6 +104,9 @@ struct NIVariable {
/** Helper class to wrap some functionality/queries in. */
class NIHelper {
public:
+ /** Silence a warning. */
+ virtual ~NIHelper() {}
+
/**
* Is the item with the given index inspectable?
* @param index the index to check.
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index 467e24fa2..dd25705ab 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -431,7 +431,6 @@ bool AfterLoadGame()
SetSignalHandlers();
TileIndex map_size = MapSize();
- Company *c;
if (CheckSavegameVersion(98)) GamelogOldver();
@@ -500,6 +499,7 @@ bool AfterLoadGame()
}
if (CheckSavegameVersion(84)) {
+ Company *c;
FOR_ALL_COMPANIES(c) {
c->name = CopyFromOldName(c->name_1);
if (c->name != NULL) c->name_1 = STR_SV_UNNAMED;
@@ -803,6 +803,7 @@ bool AfterLoadGame()
/* From version 16.0, we included autorenew on engines, which are now saved, but
* of course, we do need to initialize them for older savegames. */
if (CheckSavegameVersion(16)) {
+ Company *c;
FOR_ALL_COMPANIES(c) {
c->engine_renew_list = NULL;
c->settings.engine_renew = false;
@@ -1089,6 +1090,7 @@ bool AfterLoadGame()
* replaced, shall keep their old length. In all prior versions, just default
* to false */
if (CheckSavegameVersionOldStyle(16, 1)) {
+ Company *c;
FOR_ALL_COMPANIES(c) c->settings.renew_keep_length = false;
}
@@ -1147,8 +1149,12 @@ bool AfterLoadGame()
YapfNotifyTrackLayoutChange(INVALID_TILE, INVALID_TRACK);
- if (CheckSavegameVersion(34)) FOR_ALL_COMPANIES(c) ResetCompanyLivery(c);
+ if (CheckSavegameVersion(34)) {
+ Company *c;
+ FOR_ALL_COMPANIES(c) ResetCompanyLivery(c);
+ }
+ Company *c;
FOR_ALL_COMPANIES(c) {
c->avail_railtypes = GetCompanyRailtypes(c->index);
c->avail_roadtypes = GetCompanyRoadtypes(c->index);
diff --git a/src/train_gui.cpp b/src/train_gui.cpp
index 30f079206..35bd1d266 100644
--- a/src/train_gui.cpp
+++ b/src/train_gui.cpp
@@ -55,7 +55,7 @@ void CcBuildWagon(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p
* @param selection Selected vehicle that is dragged.
* @return The width of the highlight mark.
*/
-static uint HighlightDragPosition(int px, int max_width, VehicleID selection)
+static int HighlightDragPosition(int px, int max_width, VehicleID selection)
{
bool rtl = _dynlang.text_dir == TD_RTL;
@@ -108,7 +108,7 @@ void DrawTrainImage(const Train *v, int left, int right, int y, VehicleID select
for (; v != NULL && (rtl ? px > 0 : px < max_width); v = v->Next()) {
if (dragging && !drag_at_end_of_train && drag_dest == v->index) {
/* Highlight the drag-and-drop destination inside the train. */
- uint drag_hlight_width = HighlightDragPosition(px, max_width, selection);
+ int drag_hlight_width = HighlightDragPosition(px, max_width, selection);
px += rtl ? -drag_hlight_width : drag_hlight_width;
}