(svn r10684) -Codechange: some more coding style related changes. Primarily moving { to a new line.

pull/155/head
rubidium 17 years ago
parent 542f552f6e
commit 7fe3635cdb

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

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

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

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

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

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

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

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

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

Loading…
Cancel
Save