summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCharles Pigott <charlespigott@googlemail.com>2018-10-14 18:17:09 +0100
committerfrosch <github@elsenhans.name>2018-10-31 12:41:49 +0100
commite0c0394e373d2f3326383e79d7fcb9f4e288ae02 (patch)
tree0242bbb30aea2abf39ead7af8f0cf7d5fe8f0542 /src
parentf5b1115039e41d7f75f91e7355003f10dd01b352 (diff)
downloadopenttd-e0c0394e373d2f3326383e79d7fcb9f4e288ae02.tar.xz
Fix: Remove various dead or unnecessary assignments
Diffstat (limited to 'src')
-rw-r--r--src/gfx_layout.cpp9
-rw-r--r--src/industry_gui.cpp1
-rw-r--r--src/newgrf.cpp4
-rw-r--r--src/saveload/oldloader.cpp2
-rw-r--r--src/script/script_info_dummy.cpp2
-rw-r--r--src/string.cpp2
-rw-r--r--src/strings.cpp3
7 files changed, 8 insertions, 15 deletions
diff --git a/src/gfx_layout.cpp b/src/gfx_layout.cpp
index 6cef84e13..c493e69c3 100644
--- a/src/gfx_layout.cpp
+++ b/src/gfx_layout.cpp
@@ -498,11 +498,6 @@ const ParagraphLayouter::Line *FallbackParagraphLayout::NextLine(int max_width)
return l;
}
- const WChar *begin = this->buffer;
- const WChar *last_space = NULL;
- const WChar *last_char = begin;
- int width = 0;
-
int offset = this->buffer - this->buffer_begin;
FontMap::iterator iter = this->runs.Begin();
while (iter->first <= offset) {
@@ -513,6 +508,10 @@ const ParagraphLayouter::Line *FallbackParagraphLayout::NextLine(int max_width)
const FontCache *fc = iter->second->fc;
const WChar *next_run = this->buffer_begin + iter->first;
+ const WChar *begin = this->buffer;
+ const WChar *last_space = NULL;
+ const WChar *last_char;
+ int width = 0;
for (;;) {
WChar c = *this->buffer;
last_char = this->buffer;
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index dd1f765a7..9108c4e7a 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -508,7 +508,6 @@ public:
y += FONT_HEIGHT_NORMAL;
/* Get the additional purchase info text, if it has not already been queried. */
- str = STR_NULL;
if (HasBit(indsp->callback_mask, CBM_IND_FUND_MORE_TEXT)) {
uint16 callback_res = GetIndustryCallback(CBID_INDUSTRY_FUND_MORE_TEXT, 0, 0, NULL, this->selected_type, INVALID_TILE);
if (callback_res != CALLBACK_FAILED && callback_res != 0x400) {
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 9c5a406ca..93b28a1bc 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -3472,8 +3472,6 @@ static ChangeInfoResult IndustriesChangeInfo(uint indid, int numinfo, int prop,
} else {
/* Declared as been valid, can be used */
itt[k].gfx = tempid;
- size = k + 1;
- copy_from = itt;
}
} else if (itt[k].gfx == 0xFF) {
itt[k].ti.x = (int8)GB(itt[k].ti.x, 0, 8);
@@ -3787,8 +3785,6 @@ static ChangeInfoResult AirportChangeInfo(uint airport, int numinfo, int prop, B
} else {
/* Declared as been valid, can be used */
att[k].gfx = tempid;
- size = k + 1;
- copy_from = att;
}
} else if (att[k].gfx == 0xFF) {
att[k].ti.x = (int8)GB(att[k].ti.x, 0, 8);
diff --git a/src/saveload/oldloader.cpp b/src/saveload/oldloader.cpp
index 13ee0e5b0..e0ad0e732 100644
--- a/src/saveload/oldloader.cpp
+++ b/src/saveload/oldloader.cpp
@@ -265,7 +265,7 @@ static SavegameType DetermineOldSavegameType(FILE *f, char *title, const char *l
case SGT_TTD: title = strecpy(title, "(TTD) ", last); break;
default: title = strecpy(title, "(broken) ", last); break;
}
- title = strecpy(title, temp, last);
+ strecpy(title, temp, last);
}
return type;
diff --git a/src/script/script_info_dummy.cpp b/src/script/script_info_dummy.cpp
index e11c63151..53860386c 100644
--- a/src/script/script_info_dummy.cpp
+++ b/src/script/script_info_dummy.cpp
@@ -92,7 +92,7 @@ void Script_CreateDummy(HSQUIRRELVM vm, StringID string, const char *type)
p = newline + 1;
} while (newline != NULL);
- dp = strecpy(dp, " }\n}\n", lastof(dummy_script));
+ strecpy(dp, " }\n}\n", lastof(dummy_script));
/* 3) We translate the error message in the character format that Squirrel wants.
* We can use the fact that the wchar string printing also uses %s to print
diff --git a/src/string.cpp b/src/string.cpp
index 4c714a2e0..521d96c4a 100644
--- a/src/string.cpp
+++ b/src/string.cpp
@@ -170,7 +170,7 @@ void str_fix_scc_encoded(char *str, const char *last)
if ((len == 0 && str + 4 > last) || str + len > last) break;
WChar c;
- len = Utf8Decode(&c, str);
+ Utf8Decode(&c, str);
if (c == '\0') break;
if (c == 0xE028 || c == 0xE02A) {
diff --git a/src/strings.cpp b/src/strings.cpp
index 1ff7e2aea..8ec9844b6 100644
--- a/src/strings.cpp
+++ b/src/strings.cpp
@@ -818,7 +818,6 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg
sub_args.ClearTypeInformation();
memset(sub_args_need_free, 0, sizeof(sub_args_need_free));
- const char *s = str;
char *p;
uint32 stringid = strtoul(str, &p, 16);
if (*p != ':' && *p != '\0') {
@@ -837,7 +836,7 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg
int i = 0;
while (*p != '\0' && i < 20) {
uint64 param;
- s = ++p;
+ const char *s = ++p;
/* Find the next value */
bool instring = false;