summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ai/ai_info.cpp2
-rw-r--r--src/ai/api/ai_abstractlist.cpp14
-rw-r--r--src/blitter/32bpp_anim.cpp14
-rw-r--r--src/debug.cpp3
-rw-r--r--src/depot_gui.cpp2
-rw-r--r--src/fios.cpp7
-rw-r--r--src/misc/binaryheap.hpp3
-rw-r--r--src/misc/blob.hpp7
-rw-r--r--src/newgrf.cpp8
-rw-r--r--src/news_gui.cpp3
-rw-r--r--src/npf.h5
-rw-r--r--src/saveload/oldloader_sl.cpp10
-rw-r--r--src/video/dedicated_v.cpp3
13 files changed, 47 insertions, 34 deletions
diff --git a/src/ai/ai_info.cpp b/src/ai/ai_info.cpp
index 22e2dcded..7ec0de826 100644
--- a/src/ai/ai_info.cpp
+++ b/src/ai/ai_info.cpp
@@ -198,7 +198,7 @@ SQInteger AIInfo::AddSetting(HSQUIRRELVM vm)
if (SQ_FAILED(sq_getinteger(vm, -1, &res))) return SQ_ERROR;
config.hard_value = res;
items |= 0x040;
- } else if (strcmp(key, "random_deviation") == 0) {
+ } else if (strcmp(key, "random_deviation") == 0) {
SQInteger res;
if (SQ_FAILED(sq_getinteger(vm, -1, &res))) return SQ_ERROR;
config.random_deviation = res;
diff --git a/src/ai/api/ai_abstractlist.cpp b/src/ai/api/ai_abstractlist.cpp
index b1b9d098d..6cff54dc9 100644
--- a/src/ai/api/ai_abstractlist.cpp
+++ b/src/ai/api/ai_abstractlist.cpp
@@ -489,13 +489,19 @@ void AIAbstractList::Sort(SorterType sorter, bool ascending)
delete this->sorter;
switch (sorter) {
case SORT_BY_ITEM:
- if (ascending) this->sorter = new AIAbstractListSorterItemAscending(this);
- else this->sorter = new AIAbstractListSorterItemDescending(this);
+ if (ascending) {
+ this->sorter = new AIAbstractListSorterItemAscending(this);
+ } else {
+ this->sorter = new AIAbstractListSorterItemDescending(this);
+ }
break;
case SORT_BY_VALUE:
- if (ascending) this->sorter = new AIAbstractListSorterValueAscending(this);
- else this->sorter = new AIAbstractListSorterValueDescending(this);
+ if (ascending) {
+ this->sorter = new AIAbstractListSorterValueAscending(this);
+ } else {
+ this->sorter = new AIAbstractListSorterValueDescending(this);
+ }
break;
default:
diff --git a/src/blitter/32bpp_anim.cpp b/src/blitter/32bpp_anim.cpp
index 1c72a1382..2ff9b536a 100644
--- a/src/blitter/32bpp_anim.cpp
+++ b/src/blitter/32bpp_anim.cpp
@@ -363,8 +363,11 @@ void Blitter_32bppAnim::ScrollBuffer(void *video, int &left, int &top, int &widt
src = dst - scroll_y * this->anim_buf_width;
/* Adjust left & width */
- if (scroll_x >= 0) dst += scroll_x;
- else src -= scroll_x;
+ if (scroll_x >= 0) {
+ dst += scroll_x;
+ } else {
+ src -= scroll_x;
+ }
uint tw = width + (scroll_x >= 0 ? -scroll_x : scroll_x);
uint th = height - scroll_y;
@@ -379,8 +382,11 @@ void Blitter_32bppAnim::ScrollBuffer(void *video, int &left, int &top, int &widt
src = dst - scroll_y * this->anim_buf_width;
/* Adjust left & width */
- if (scroll_x >= 0) dst += scroll_x;
- else src -= scroll_x;
+ if (scroll_x >= 0) {
+ dst += scroll_x;
+ } else {
+ src -= scroll_x;
+ }
/* the y-displacement may be 0 therefore we have to use memmove,
* because source and destination may overlap */
diff --git a/src/debug.cpp b/src/debug.cpp
index 5cb4572c4..b1d7e6677 100644
--- a/src/debug.cpp
+++ b/src/debug.cpp
@@ -69,7 +69,8 @@ static void debug_print(const char *dbg, const char *buf)
snprintf(buf2, lengthof(buf2), "dbg: [%s] %s\n", dbg, buf);
send(_debug_socket, buf2, (int)strlen(buf2), 0);
- } else
+ return;
+ }
#endif /* ENABLE_NETWORK */
if (strcmp(dbg, "desync") != 0) {
#if defined(WINCE)
diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp
index e3cb1dafa..6eb4fe25c 100644
--- a/src/depot_gui.cpp
+++ b/src/depot_gui.cpp
@@ -152,7 +152,7 @@ static void TrainDepotMoveVehicle(const Vehicle *wagon, VehicleID sel, const Veh
if (wagon == NULL) {
if (head != NULL) wagon = head->Last();
- } else {
+ } else {
wagon = wagon->Previous();
if (wagon == NULL) return;
}
diff --git a/src/fios.cpp b/src/fios.cpp
index 56048197f..bee76a1d6 100644
--- a/src/fios.cpp
+++ b/src/fios.cpp
@@ -102,11 +102,14 @@ const char *FiosBrowseTo(const FiosItem *item)
s[0] = '\0'; // Remove last path separator character, so we can go up one level.
}
s = strrchr(path, PATHSEPCHAR);
- if (s != NULL) s[1] = '\0'; // go up a directory
+ if (s != NULL) {
+ s[1] = '\0'; // go up a directory
#if defined(__MORPHOS__) || defined(__AMIGAOS__)
/* On MorphOS or AmigaOS paths look like: "Volume:directory/subdirectory" */
- else if ((s = strrchr(path, ':')) != NULL) s[1] = '\0';
+ } else if ((s = strrchr(path, ':')) != NULL) {
+ s[1] = '\0';
#endif
+ }
break;
}
diff --git a/src/misc/binaryheap.hpp b/src/misc/binaryheap.hpp
index 7fce75356..d80a0ce26 100644
--- a/src/misc/binaryheap.hpp
+++ b/src/misc/binaryheap.hpp
@@ -185,8 +185,7 @@ inline void CBinaryHeapT<Titem_>::RemoveByIdx(int idx)
}
/* move parent to the proper place */
if (m_size > 0) m_items[gap] = &last;
- }
- else {
+ } else {
assert(idx == m_size);
m_size--;
}
diff --git a/src/misc/blob.hpp b/src/misc/blob.hpp
index 5403adcce..9c68d9db9 100644
--- a/src/misc/blob.hpp
+++ b/src/misc/blob.hpp
@@ -240,8 +240,11 @@ public:
{
if (MaxRawSize() > 0 && num_bytes > 0) {
assert(num_bytes <= RawSize());
- if (num_bytes < RawSize()) RawSizeRef() -= num_bytes;
- else RawSizeRef() = 0;
+ if (num_bytes < RawSize()) {
+ RawSizeRef() -= num_bytes;
+ } else {
+ RawSizeRef() = 0;
+ }
}
}
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 4d1f16031..76e2b689f 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -3397,10 +3397,10 @@ static void FeatureNewName(byte *buf, size_t len)
* B veh-type see action 0 (as 00..07, + 0A
* But IF veh-type = 48, then generic text
* B language-id If bit 6 is set, This is the extended language scheme,
- with up to 64 language.
- Otherwise, it is a mapping where set bits have meaning
- 0 = american, 1 = english, 2 = german, 3 = french, 4 = spanish
- Bit 7 set means this is a generic text, not a vehicle one (or else)
+ * with up to 64 language.
+ * Otherwise, it is a mapping where set bits have meaning
+ * 0 = american, 1 = english, 2 = german, 3 = french, 4 = spanish
+ * Bit 7 set means this is a generic text, not a vehicle one (or else)
* B num-veh number of vehicles which are getting a new name
* B/W offset number of the first vehicle that gets a new name
* Byte : ID of vehicle to change
diff --git a/src/news_gui.cpp b/src/news_gui.cpp
index 25dc6af8f..051db7eac 100644
--- a/src/news_gui.cpp
+++ b/src/news_gui.cpp
@@ -1028,8 +1028,7 @@ struct MessageOptionsWindow : Window {
Dimension d = {0, 0};
for (const StringID *str = message_opt; *str != INVALID_STRING_ID; str++) d = maxdim(d, GetStringBoundingBox(*str));
size->width = d.width + padding.width + MOS_BUTTON_SPACE; // A bit extra for better looks.
- }
- else if (widget == WIDGET_NEWSOPT_SOUNDTICKER) {
+ } else if (widget == WIDGET_NEWSOPT_SOUNDTICKER) {
size->width += MOS_BUTTON_SPACE; // A bit extra for better looks.
}
return;
diff --git a/src/npf.h b/src/npf.h
index 92268a6d8..5425b5afe 100644
--- a/src/npf.h
+++ b/src/npf.h
@@ -138,10 +138,7 @@ static inline bool NPFGetFlag(const AyStarNode *node, NPFNodeFlag flag)
*/
static inline void NPFSetFlag(AyStarNode *node, NPFNodeFlag flag, bool value)
{
- if (value)
- SetBit(node->user_data[NPF_NODE_FLAGS], flag);
- else
- ClrBit(node->user_data[NPF_NODE_FLAGS], flag);
+ SB(node->user_data[NPF_NODE_FLAGS], flag, 1, value);
}
#endif /* NPF_H */
diff --git a/src/saveload/oldloader_sl.cpp b/src/saveload/oldloader_sl.cpp
index 8a45d587b..001e65d43 100644
--- a/src/saveload/oldloader_sl.cpp
+++ b/src/saveload/oldloader_sl.cpp
@@ -491,16 +491,16 @@ static void ReadTTDPatchFlags()
/* TTDPatch misuses _old_map3 for flags.. read them! */
_old_vehicle_multiplier = _old_map3[0];
/* Somehow.... there was an error in some savegames, so 0 becomes 1
- and 1 becomes 2. The rest of the values are okay */
+ * and 1 becomes 2. The rest of the values are okay */
if (_old_vehicle_multiplier < 2) _old_vehicle_multiplier++;
_old_vehicle_names = MallocT<StringID>(_old_vehicle_multiplier * 850);
/* TTDPatch increases the Vehicle-part in the middle of the game,
- so if the multipler is anything else but 1, the assert fails..
- bump the assert value so it doesn't!
- (1 multipler == 850 vehicles
- 1 vehicle == 128 bytes */
+ * so if the multipler is anything else but 1, the assert fails..
+ * bump the assert value so it doesn't!
+ * (1 multipler == 850 vehicles
+ * 1 vehicle == 128 bytes */
_bump_assert_value = (_old_vehicle_multiplier - 1) * 850 * 128;
for (uint i = 0; i < 17; i++) { // check tile 0, too
diff --git a/src/video/dedicated_v.cpp b/src/video/dedicated_v.cpp
index cce1d2925..5069f8d0a 100644
--- a/src/video/dedicated_v.cpp
+++ b/src/video/dedicated_v.cpp
@@ -134,8 +134,7 @@ static FVideoDriver_Dedicated iFVideoDriver_Dedicated;
const char *VideoDriver_Dedicated::Start(const char * const *parm)
{
int bpp = BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth();
- if (bpp == 0) _dedicated_video_mem = NULL;
- else _dedicated_video_mem = MallocT<byte>(_cur_resolution.width * _cur_resolution.height * (bpp / 8));
+ _dedicated_video_mem = (bpp == 0) ? NULL : MallocT<byte>(_cur_resolution.width * _cur_resolution.height * (bpp / 8));
_screen.width = _screen.pitch = _cur_resolution.width;
_screen.height = _cur_resolution.height;