(svn r17228) -Codechange: some coding style fixes

replace/41b28d7194a279bdc17475d4fbe2ea6ec885a466
rubidium 15 years ago
parent 0188ebad56
commit 7fb95e2c2b

@ -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;

@ -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:

@ -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 */

@ -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)

@ -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;
}

@ -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;
}

@ -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--;
}

@ -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;
}
}
}

@ -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

@ -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;

@ -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 */

@ -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

@ -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;

Loading…
Cancel
Save