(svn r17692) -Codechange: minor coding style fixes

This commit is contained in:
smatz 2009-10-04 17:10:57 +00:00
parent 1666f7a1a9
commit 32cbe57178
12 changed files with 28 additions and 16 deletions

View File

@ -66,7 +66,7 @@ void AI_CreateAIDummy(HSQUIRRELVM vm)
/* 2) We construct the AI's code. This is done by merging a header, body and footer */ /* 2) We construct the AI's code. This is done by merging a header, body and footer */
char dummy_script[4096]; char dummy_script[4096];
char *dp = dummy_script; char *dp = dummy_script;
dp = strecpy(dp, "class DummyAI extends AIController {\n function Start() {\n", lastof(dummy_script)); dp = strecpy(dp, "class DummyAI extends AIController {\n function Start()\n {\n", lastof(dummy_script));
/* As special trick we need to split the error message on newlines and /* As special trick we need to split the error message on newlines and
* emit each newline as a separate error printing string. */ * emit each newline as a separate error printing string. */

View File

@ -178,7 +178,8 @@ public:
return item_current; return item_current;
} }
void End() { void End()
{
this->bucket_list = NULL; this->bucket_list = NULL;
this->has_no_more_items = true; this->has_no_more_items = true;
this->item_next = 0; this->item_next = 0;
@ -286,7 +287,8 @@ public:
return item_current; return item_current;
} }
void Remove(int item) { void Remove(int item)
{
if (!this->HasNext()) return; if (!this->HasNext()) return;
/* If we remove the 'next' item, skip to the next */ /* If we remove the 'next' item, skip to the next */

View File

@ -267,7 +267,8 @@ public:
* @note Example: * @note Example:
* list.Valuate(AIBridge.GetPrice, 5); * list.Valuate(AIBridge.GetPrice, 5);
* list.Valuate(AIBridge.GetMaxLength); * list.Valuate(AIBridge.GetMaxLength);
* function MyVal(bridge_id, myparam) { * function MyVal(bridge_id, myparam)
* {
* return myparam * bridge_id; // This is silly * return myparam * bridge_id; // This is silly
* } * }
* list.Valuate(MyVal, 12); * list.Valuate(MyVal, 12);

View File

@ -61,6 +61,7 @@ AIError::AIErrorMapString AIError::error_map_string = AIError::AIErrorMapString(
error_map_string[ai_error_msg] = message; error_map_string[ai_error_msg] = message;
} }
/* static */ AIError::ErrorCategories AIError::GetErrorCategory() { /* static */ AIError::ErrorCategories AIError::GetErrorCategory()
{
return (AIError::ErrorCategories)(GetLastError() >> (uint)ERR_CAT_BIT_SIZE); return (AIError::ErrorCategories)(GetLastError() >> (uint)ERR_CAT_BIT_SIZE);
} }

View File

@ -28,7 +28,8 @@ void AIList::RemoveItem(int32 item)
AIAbstractList::RemoveItem(item); AIAbstractList::RemoveItem(item);
} }
SQInteger AIList::_set(HSQUIRRELVM vm) { SQInteger AIList::_set(HSQUIRRELVM vm)
{
if (sq_gettype(vm, 2) != OT_INTEGER) return SQ_ERROR; if (sq_gettype(vm, 2) != OT_INTEGER) return SQ_ERROR;
if (sq_gettype(vm, 3) != OT_INTEGER || sq_gettype(vm, 3) == OT_NULL) { if (sq_gettype(vm, 3) != OT_INTEGER || sq_gettype(vm, 3) == OT_NULL) {
return sq_throwerror(vm, _SC("you can only assign integers to this list")); return sq_throwerror(vm, _SC("you can only assign integers to this list"));

View File

@ -13,7 +13,8 @@
# #
# Simple insertion sort. # Simple insertion sort.
function array_sort(ARRAY, ELEMENTS, temp, i, j) { function array_sort(ARRAY, ELEMENTS, temp, i, j)
{
for (i = 2; i <= ELEMENTS; i++) for (i = 2; i <= ELEMENTS; i++)
for (j = i; ARRAY[j - 1] > ARRAY[j]; --j) { for (j = i; ARRAY[j - 1] > ARRAY[j]; --j) {
temp = ARRAY[j] temp = ARRAY[j]
@ -23,7 +24,8 @@ function array_sort(ARRAY, ELEMENTS, temp, i, j) {
return return
} }
function dump_class_templates(name) { function dump_class_templates(name)
{
print " template <> " name " *GetParam(ForceType<" name " *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (" name " *)instance; }" print " template <> " name " *GetParam(ForceType<" name " *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (" name " *)instance; }"
print " template <> " name " &GetParam(ForceType<" name " &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(" name " *)instance; }" print " template <> " name " &GetParam(ForceType<" name " &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(" name " *)instance; }"
print " template <> const " name " *GetParam(ForceType<const " name " *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (" name " *)instance; }" print " template <> const " name " *GetParam(ForceType<const " name " *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (" name " *)instance; }"

View File

@ -408,7 +408,8 @@ public:
this->SetDirty(); this->SetDirty();
} }
virtual void OnResize(Point delta) { virtual void OnResize(Point delta)
{
this->vscroll.UpdateCapacity(delta.y / (int)this->resize.step_height); this->vscroll.UpdateCapacity(delta.y / (int)this->resize.step_height);
this->vscroll2.UpdateCapacity(delta.y / (int)this->resize.step_height); this->vscroll2.UpdateCapacity(delta.y / (int)this->resize.step_height);

View File

@ -240,7 +240,8 @@ void AyStarMain_Clear(AyStar *aystar)
* aystar->clear() is called. Note that when you stop the algorithm halfway, * aystar->clear() is called. Note that when you stop the algorithm halfway,
* you should still call clear() yourself! * you should still call clear() yourself!
*/ */
int AyStarMain_Main(AyStar *aystar) { int AyStarMain_Main(AyStar *aystar)
{
int r, i = 0; int r, i = 0;
/* Loop through the OpenList /* Loop through the OpenList
* Quit if result is no AYSTAR_STILL_BUSY or is more than loops_per_tick */ * Quit if result is no AYSTAR_STILL_BUSY or is more than loops_per_tick */

View File

@ -121,7 +121,8 @@ void NetworkContentSocketHandler::Recv_Packets()
* @param type the packet type to create the stub for * @param type the packet type to create the stub for
*/ */
#define DEFINE_UNAVAILABLE_CONTENT_RECEIVE_COMMAND(type) \ #define DEFINE_UNAVAILABLE_CONTENT_RECEIVE_COMMAND(type) \
bool NetworkContentSocketHandler::NetworkPacketReceive_## type ##_command(Packet *p) { \ bool NetworkContentSocketHandler::NetworkPacketReceive_## type ##_command(Packet *p) \
{ \
DEBUG(net, 0, "[tcp/content] received illegal packet type %d from %s", \ DEBUG(net, 0, "[tcp/content] received illegal packet type %d from %s", \
type, this->client_addr.GetAddressAsString()); \ type, this->client_addr.GetAddressAsString()); \
return false; \ return false; \

View File

@ -660,7 +660,8 @@ struct ScenarioEditorLandscapeGenerationWindow : Window {
this->GetWidget<NWidgetCore>(ETTW_PLACE_DESERT_LIGHTHOUSE)->tool_tip = (_settings_game.game_creation.landscape == LT_TROPIC) ? STR_TERRAFORM_TOOLTIP_DEFINE_DESERT_AREA : STR_TERRAFORM_TOOLTIP_PLACE_LIGHTHOUSE; this->GetWidget<NWidgetCore>(ETTW_PLACE_DESERT_LIGHTHOUSE)->tool_tip = (_settings_game.game_creation.landscape == LT_TROPIC) ? STR_TERRAFORM_TOOLTIP_DEFINE_DESERT_AREA : STR_TERRAFORM_TOOLTIP_PLACE_LIGHTHOUSE;
} }
virtual void OnPaint() { virtual void OnPaint()
{
this->DrawWidgets(); this->DrawWidgets();
if (this->IsWidgetLowered(ETTW_LOWER_LAND) || this->IsWidgetLowered(ETTW_RAISE_LAND)) { // change area-size if raise/lower corner is selected if (this->IsWidgetLowered(ETTW_LOWER_LAND) || this->IsWidgetLowered(ETTW_RAISE_LAND)) { // change area-size if raise/lower corner is selected

View File

@ -181,7 +181,8 @@ struct HeightMap
* @param y Y position * @param y Y position
* @return height as fixed point number * @return height as fixed point number
*/ */
inline height_t &height(uint x, uint y) { inline height_t &height(uint x, uint y)
{
return h[x + y * dim_x]; return h[x + y * dim_x];
} }
}; };

View File

@ -554,8 +554,7 @@ struct LocksDrawTileStruct {
#include "table/water_land.h" #include "table/water_land.h"
static void DrawWaterStuff(const TileInfo *ti, const WaterDrawTileStruct *wdts, static void DrawWaterStuff(const TileInfo *ti, const WaterDrawTileStruct *wdts,
SpriteID palette, uint base, bool draw_ground SpriteID palette, uint base, bool draw_ground)
)
{ {
SpriteID image; SpriteID image;
SpriteID water_base = GetCanalSprite(CF_WATERSLOPE, ti->tile); SpriteID water_base = GetCanalSprite(CF_WATERSLOPE, ti->tile);
@ -635,7 +634,8 @@ void DrawShoreTile(Slope tileh)
DrawGroundSprite(SPR_SHORE_BASE + tileh_to_shoresprite[tileh], PAL_NONE); DrawGroundSprite(SPR_SHORE_BASE + tileh_to_shoresprite[tileh], PAL_NONE);
} }
void DrawWaterClassGround(const TileInfo *ti) { void DrawWaterClassGround(const TileInfo *ti)
{
switch (GetWaterClass(ti->tile)) { switch (GetWaterClass(ti->tile)) {
case WATER_CLASS_SEA: DrawSeaWater(ti->tile); break; case WATER_CLASS_SEA: DrawSeaWater(ti->tile); break;
case WATER_CLASS_CANAL: DrawCanalWater(ti->tile); break; case WATER_CLASS_CANAL: DrawCanalWater(ti->tile); break;