summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-07-25 00:16:30 +0000
committerrubidium <rubidium@openttd.org>2007-07-25 00:16:30 +0000
commitb29026864567b6a3842bd5b518ac989e5cd29d97 (patch)
treebc80f8b8cc5d138e78c7794df9fa66f425b589f3 /src
parente640900e8ac5e35dad2242bda391903a04906852 (diff)
downloadopenttd-b29026864567b6a3842bd5b518ac989e5cd29d97.tar.xz
(svn r10684) -Codechange: some more coding style related changes. Primarily moving { to a new line.
Diffstat (limited to 'src')
-rw-r--r--src/bmp.cpp3
-rw-r--r--src/endian_check.cpp54
-rw-r--r--src/misc_gui.cpp3
-rw-r--r--src/network/network_gui.cpp13
-rw-r--r--src/saveload.cpp3
-rw-r--r--src/train_gui.cpp3
-rw-r--r--src/vehicle.cpp3
-rw-r--r--src/viewport.cpp3
-rw-r--r--src/win32.cpp6
9 files changed, 49 insertions, 42 deletions
diff --git a/src/bmp.cpp b/src/bmp.cpp
index 4ee43c4cf..a96c3680c 100644
--- a/src/bmp.cpp
+++ b/src/bmp.cpp
@@ -9,7 +9,8 @@
#include "macros.h"
#include "helpers.hpp"
-void BmpInitializeBuffer(BmpBuffer *buffer, FILE *file) {
+void BmpInitializeBuffer(BmpBuffer *buffer, FILE *file)
+{
buffer->pos = -1;
buffer->file = file;
buffer->read = 0;
diff --git a/src/endian_check.cpp b/src/endian_check.cpp
index 9c6fe7125..27769aa54 100644
--- a/src/endian_check.cpp
+++ b/src/endian_check.cpp
@@ -12,45 +12,41 @@
#include <stdio.h>
#include <string.h>
-/** Main call of the endian_check program
+/**
+ * Main call of the endian_check program
* @param argc argument count
* @param argv arguments themselves
- * @return exit code */
-int main (int argc, char *argv[]) {
- unsigned char EndianTest[2] = { 1, 0 };
+ * @return exit code
+ */
+int main (int argc, char *argv[])
+{
+ unsigned char endian_test[2] = { 1, 0 };
int force_BE = 0, force_LE = 0, force_PREPROCESSOR = 0;
- if (argc > 1 && strcmp(argv[1], "BE") == 0)
- force_BE = 1;
- if (argc > 1 && strcmp(argv[1], "LE") == 0)
- force_LE = 1;
- if (argc > 1 && strcmp(argv[1], "PREPROCESSOR") == 0)
- force_PREPROCESSOR = 1;
+ if (argc > 1 && strcmp(argv[1], "BE") == 0) force_BE = 1;
+ if (argc > 1 && strcmp(argv[1], "LE") == 0) force_LE = 1;
+ if (argc > 1 && strcmp(argv[1], "PREPROCESSOR") == 0) force_PREPROCESSOR = 1;
printf("#ifndef ENDIAN_H\n#define ENDIAN_H\n");
if (force_LE == 1) {
printf("#define TTD_LITTLE_ENDIAN\n");
+ } else if (force_BE == 1) {
+ printf("#define TTD_BIG_ENDIAN\n");
+ } else if (force_PREPROCESSOR == 1) {
+ /* Support for universal binaries on OSX
+ * Universal binaries supports both PPC and x86
+ * If a compiler for OSX gets this setting, it will always pick the correct endian and no test is needed
+ */
+ printf("#ifdef __BIG_ENDIAN__\n");
+ printf("#define TTD_BIG_ENDIAN\n");
+ printf("#else\n");
+ printf("#define TTD_LITTLE_ENDIAN\n");
+ printf("#endif\n");
+ } else if (*(short*)endian_test == 1 ) {
+ printf("#define TTD_LITTLE_ENDIAN\n");
} else {
- if (force_BE == 1) {
- printf("#define TTD_BIG_ENDIAN\n");
- } else {
- if (force_PREPROCESSOR == 1) {
- /** adding support for universal binaries on OSX
- * Universal binaries supports both PPC and x86
- * If a compiler for OSX gets this setting, it will always pick the correct endian and no test is needed */
- printf("#ifdef __BIG_ENDIAN__\n");
- printf("#define TTD_BIG_ENDIAN\n");
- printf("#else\n");
- printf("#define TTD_LITTLE_ENDIAN\n");
- printf("#endif\n");
- } else {
- if ( *(short *) EndianTest == 1 )
- printf("#define TTD_LITTLE_ENDIAN\n");
- else
- printf("#define TTD_BIG_ENDIAN\n");
- }
- }
+ printf("#define TTD_BIG_ENDIAN\n");
}
printf("#endif\n");
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp
index 5d842a43a..2925821c2 100644
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -786,7 +786,8 @@ static void DrawStationCoverageText(const AcceptedCargo accepts,
DrawStringMultiLine(str_x, str_y, STR_SPEC_USERSTRING, 144);
}
-void DrawStationCoverageAreaText(int sx, int sy, StationCoverageType sct, int rad) {
+void DrawStationCoverageAreaText(int sx, int sy, StationCoverageType sct, int rad)
+{
TileIndex tile = TileVirtXY(_thd.pos.x, _thd.pos.y);
AcceptedCargo accepts;
if (tile < MapSize()) {
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index 687e36337..113d50c9b 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -87,7 +87,8 @@ static const StringID _players_dropdown[] = {
static StringID _language_dropdown[NETLANG_COUNT + 1] = {STR_NULL};
-void SortNetworkLanguages() {
+void SortNetworkLanguages()
+{
/* Init the strings */
if (_language_dropdown[0] == STR_NULL) {
for (int i = 0; i < NETLANG_COUNT; i++) _language_dropdown[i] = STR_NETWORK_LANG_ANY + i;
@@ -1133,7 +1134,8 @@ static void ClientList_None(byte client_no)
// Help, a action is clicked! What do we do?
-static void HandleClientListPopupClick(byte index, byte clientno) {
+static void HandleClientListPopupClick(byte index, byte clientno)
+{
// A click on the Popup of the ClientList.. handle the command
if (index < MAX_CLIENTLIST_ACTION && _clientlist_proc[index] != NULL) {
_clientlist_proc[index](clientno);
@@ -1166,7 +1168,8 @@ static bool CheckClientListHeight(Window *w)
}
// Finds the amount of actions in the popup and set the height correct
-static uint ClientListPopupHeigth() {
+static uint ClientListPopupHeight()
+{
int i, num = 0;
// Find the amount of actions
@@ -1236,7 +1239,7 @@ static Window *PopupClientList(Window *w, int client_no, int x, int y)
}
/* Calculate the height */
- h = ClientListPopupHeigth();
+ h = ClientListPopupHeight();
// Allocate the popup
w = AllocateWindow(x, y, 150, h + 1, ClientListPopupWndProc, WC_TOOLBAR_MENU, _client_list_popup_widgets);
@@ -1486,7 +1489,7 @@ void ShowJoinStatusWindow()
static void SendChat(const char *buf, DestType type, int dest)
{
- if (buf[0] == '\0') return;
+ if (StrEmpty(buf)) return;
if (!_network_server) {
SEND_COMMAND(PACKET_CLIENT_CHAT)((NetworkAction)(NETWORK_ACTION_CHAT + type), type, dest, buf);
} else {
diff --git a/src/saveload.cpp b/src/saveload.cpp
index 01518f061..ffce4e69d 100644
--- a/src/saveload.cpp
+++ b/src/saveload.cpp
@@ -270,7 +270,8 @@ static void SlWriteSimpleGamma(uint i)
}
/** Return how many bytes used to encode a gamma value */
-static inline uint SlGetGammaLength(uint i) {
+static inline uint SlGetGammaLength(uint i)
+{
return 1 + (i >= (1 << 7)) + (i >= (1 << 14)) + (i >= (1 << 21));
}
diff --git a/src/train_gui.cpp b/src/train_gui.cpp
index f4236d84c..efdbcb186 100644
--- a/src/train_gui.cpp
+++ b/src/train_gui.cpp
@@ -69,7 +69,8 @@ void CcCloneTrain(bool success, TileIndex tile, uint32 p1, uint32 p2)
* @param len Length measured in 1/8ths of a standard wagon.
* @return Number of pixels across.
*/
-int WagonLengthToPixels(int len) {
+int WagonLengthToPixels(int len)
+{
return (len * _traininfo_vehicle_width) / 8;
}
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index bcbeca3c7..ee210f3ac 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -2480,7 +2480,8 @@ CommandCost CmdChangeServiceInt(TileIndex tile, uint32 flags, uint32 p1, uint32
static Rect _old_vehicle_coords;
-void BeginVehicleMove(Vehicle *v) {
+void BeginVehicleMove(Vehicle *v)
+{
_old_vehicle_coords.left = v->left_coord;
_old_vehicle_coords.top = v->top_coord;
_old_vehicle_coords.right = v->right_coord;
diff --git a/src/viewport.cpp b/src/viewport.cpp
index 2f40dead4..289e12900 100644
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -134,7 +134,8 @@ static Point MapXYZToViewport(const ViewPort *vp, uint x, uint y, uint z)
return p;
}
-void InitViewports() {
+void InitViewports()
+{
memset(_viewports, 0, sizeof(_viewports));
_active_viewports = 0;
}
diff --git a/src/win32.cpp b/src/win32.cpp
index 36b26c2e5..a734acf59 100644
--- a/src/win32.cpp
+++ b/src/win32.cpp
@@ -110,7 +110,8 @@ struct DebugFileInfo {
static uint32 *_crc_table;
-static void MakeCRCTable(uint32 *table) {
+static void MakeCRCTable(uint32 *table)
+{
uint32 crc, poly = 0xEDB88320L;
int i;
int j;
@@ -126,7 +127,8 @@ static void MakeCRCTable(uint32 *table) {
}
}
-static uint32 CalcCRC(byte *data, uint size, uint32 crc) {
+static uint32 CalcCRC(byte *data, uint size, uint32 crc)
+{
for (; size > 0; size--) {
crc = ((crc >> 8) & 0x00FFFFFF) ^ _crc_table[(crc ^ *data++) & 0xFF];
}