(svn r10684) -Codechange: some more coding style related changes. Primarily moving { to a new line.
authorrubidium
Wed, 25 Jul 2007 00:16:30 +0000
changeset 7321 f91bdca345e8
parent 7320 96d5862ec06a
child 7322 02592bb40f93
(svn r10684) -Codechange: some more coding style related changes. Primarily moving { to a new line.
src/bmp.cpp
src/endian_check.cpp
src/misc_gui.cpp
src/network/network_gui.cpp
src/saveload.cpp
src/train_gui.cpp
src/vehicle.cpp
src/viewport.cpp
src/win32.cpp
--- a/src/bmp.cpp	Tue Jul 24 21:48:50 2007 +0000
+++ b/src/bmp.cpp	Wed Jul 25 00:16:30 2007 +0000
@@ -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;
--- a/src/endian_check.cpp	Tue Jul 24 21:48:50 2007 +0000
+++ b/src/endian_check.cpp	Wed Jul 25 00:16:30 2007 +0000
@@ -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");
 
--- a/src/misc_gui.cpp	Tue Jul 24 21:48:50 2007 +0000
+++ b/src/misc_gui.cpp	Wed Jul 25 00:16:30 2007 +0000
@@ -786,7 +786,8 @@
 	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()) {
--- a/src/network/network_gui.cpp	Tue Jul 24 21:48:50 2007 +0000
+++ b/src/network/network_gui.cpp	Wed Jul 25 00:16:30 2007 +0000
@@ -87,7 +87,8 @@
 
 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 @@
 
 
 // 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 @@
 }
 
 // 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 @@
 	}
 
 	/* 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 @@
 
 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 {
--- a/src/saveload.cpp	Tue Jul 24 21:48:50 2007 +0000
+++ b/src/saveload.cpp	Wed Jul 25 00:16:30 2007 +0000
@@ -270,7 +270,8 @@
 }
 
 /** 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));
 }
 
--- a/src/train_gui.cpp	Tue Jul 24 21:48:50 2007 +0000
+++ b/src/train_gui.cpp	Wed Jul 25 00:16:30 2007 +0000
@@ -69,7 +69,8 @@
  * @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;
 }
 
--- a/src/vehicle.cpp	Tue Jul 24 21:48:50 2007 +0000
+++ b/src/vehicle.cpp	Wed Jul 25 00:16:30 2007 +0000
@@ -2480,7 +2480,8 @@
 
 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;
--- a/src/viewport.cpp	Tue Jul 24 21:48:50 2007 +0000
+++ b/src/viewport.cpp	Wed Jul 25 00:16:30 2007 +0000
@@ -134,7 +134,8 @@
 	return p;
 }
 
-void InitViewports() {
+void InitViewports()
+{
 	memset(_viewports, 0, sizeof(_viewports));
 	_active_viewports = 0;
 }
--- a/src/win32.cpp	Tue Jul 24 21:48:50 2007 +0000
+++ b/src/win32.cpp	Wed Jul 25 00:16:30 2007 +0000
@@ -110,7 +110,8 @@
 
 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 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];
 	}