Changeset - r13175:ef1f91f8caa1
[Not reviewed]
master
0 12 0
smatz - 15 years ago 2009-10-04 17:10:57
smatz@openttd.org
(svn r17692) -Codechange: minor coding style fixes
12 files changed with 28 insertions and 16 deletions:
0 comments (0 inline, 0 general)
src/ai/ai_info_dummy.cpp
Show inline comments
 
@@ -63,13 +63,13 @@ void AI_CreateAIDummy(HSQUIRRELVM vm)
 
	char error_message[1024];
 
	GetString(error_message, STR_ERROR_AI_NO_AI_FOUND, lastof(error_message));
 

	
 
	/* 2) We construct the AI's code. This is done by merging a header, body and footer */
 
	char dummy_script[4096];
 
	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
 
	 * emit each newline as a separate error printing string. */
 
	char *newline;
 
	char *p = error_message;
 
	do {
src/ai/api/ai_abstractlist.cpp
Show inline comments
 
@@ -175,13 +175,14 @@ public:
 

	
 
		int32 item_current = this->item_next;
 
		FindNext();
 
		return item_current;
 
	}
 

	
 
	void End() {
 
	void End()
 
	{
 
		this->bucket_list = NULL;
 
		this->has_no_more_items = true;
 
		this->item_next = 0;
 
	}
 

	
 
	void FindNext()
 
@@ -283,13 +284,14 @@ public:
 

	
 
		int32 item_current = this->item_next;
 
		FindNext();
 
		return item_current;
 
	}
 

	
 
	void Remove(int item) {
 
	void Remove(int item)
 
	{
 
		if (!this->HasNext()) return;
 

	
 
		/* If we remove the 'next' item, skip to the next */
 
		if (item == this->item_next) {
 
			FindNext();
 
			return;
src/ai/api/ai_abstractlist.hpp
Show inline comments
 
@@ -264,13 +264,14 @@ public:
 
	 * @note You can write your own valuators and use them. Just remember that
 
	 *  the first parameter should be the index-value, and it should return
 
	 *  an integer.
 
	 * @note Example:
 
	 *  list.Valuate(AIBridge.GetPrice, 5);
 
	 *  list.Valuate(AIBridge.GetMaxLength);
 
	 *  function MyVal(bridge_id, myparam) {
 
	 *  function MyVal(bridge_id, myparam)
 
	 *  {
 
	 *    return myparam * bridge_id; // This is silly
 
	 *  }
 
	 *  list.Valuate(MyVal, 12);
 
	 */
 
	void Valuate(void *valuator_function, int params, ...);
 
#endif /* DOXYGEN_SKIP */
src/ai/api/ai_error.cpp
Show inline comments
 
@@ -58,9 +58,10 @@ AIError::AIErrorMapString AIError::error
 

	
 
/* static */ void AIError::RegisterErrorMapString(AIErrorType ai_error_msg, const char *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);
 
}
src/ai/api/ai_list.cpp
Show inline comments
 
@@ -25,13 +25,14 @@ void AIList::ChangeItem(int32 item, int3
 

	
 
void AIList::RemoveItem(int32 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, 3) != OT_INTEGER || sq_gettype(vm, 3) == OT_NULL) {
 
		return sq_throwerror(vm, _SC("you can only assign integers to this list"));
 
	}
 

	
 
	SQInteger idx, val;
src/ai/api/squirrel_export.awk
Show inline comments
 
@@ -10,23 +10,25 @@
 
# to export the AI API to Squirrel.
 
#
 
# Note that arrays are 1 based...
 
#
 

	
 
# 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 (j = i; ARRAY[j - 1] > ARRAY[j]; --j) {
 
			temp = ARRAY[j]
 
			ARRAY[j] = ARRAY[j - 1]
 
			ARRAY[j - 1] = temp
 
	}
 
	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 <> 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; }"
 
	if (name == "AIEvent") {
 
		print "	template <> int Return<" name " *>(HSQUIRRELVM vm, " name " *res) { if (res == NULL) { sq_pushnull(vm); return 1; } Squirrel::CreateClassInstanceVM(vm, \"" name "\", res, NULL, DefSQDestructorCallback<" name ">); return 1; }"
src/autoreplace_gui.cpp
Show inline comments
 
@@ -405,13 +405,14 @@ public:
 
		this->update_left  = true;
 
		this->update_right = true;
 
		this->init_lists   = true;
 
		this->SetDirty();
 
	}
 

	
 
	virtual void OnResize(Point delta) {
 
	virtual void OnResize(Point delta)
 
	{
 
		this->vscroll.UpdateCapacity(delta.y / (int)this->resize.step_height);
 
		this->vscroll2.UpdateCapacity(delta.y / (int)this->resize.step_height);
 

	
 
		Widget *widget = this->widget;
 

	
 
		widget[RVW_WIDGET_LEFT_MATRIX].data = widget[RVW_WIDGET_RIGHT_MATRIX].data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
src/aystar.cpp
Show inline comments
 
@@ -237,13 +237,14 @@ void AyStarMain_Clear(AyStar *aystar)
 
 *   AYSTAR_NO_PATH : indicates that there was no path found.
 
 *   AYSTAR_STILL_BUSY : indicates we have done some checked, that we did not found the path yet, and that we still have items left to try.
 
 * When the algorithm is done (when the return value is not AYSTAR_STILL_BUSY)
 
 * aystar->clear() is called. Note that when you stop the algorithm halfway,
 
 * you should still call clear() yourself!
 
 */
 
int AyStarMain_Main(AyStar *aystar) {
 
int AyStarMain_Main(AyStar *aystar)
 
{
 
	int r, i = 0;
 
	/* Loop through the OpenList
 
	 *  Quit if result is no AYSTAR_STILL_BUSY or is more than loops_per_tick */
 
	while ((r = aystar->loop(aystar)) == AYSTAR_STILL_BUSY && (aystar->loops_per_tick == 0 || ++i < aystar->loops_per_tick)) { }
 
#ifdef AYSTAR_DEBUG
 
	switch (r) {
src/network/core/tcp_content.cpp
Show inline comments
 
@@ -118,13 +118,14 @@ void NetworkContentSocketHandler::Recv_P
 
 * Create stub implementations for all receive commands that only
 
 * show a warning that the given command is not available for the
 
 * socket where the packet came from.
 
 * @param type the packet type to create the stub for
 
 */
 
#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", \
 
			type, this->client_addr.GetAddressAsString()); \
 
	return false; \
 
}
 

	
 
DEFINE_UNAVAILABLE_CONTENT_RECEIVE_COMMAND(PACKET_CONTENT_CLIENT_INFO_LIST);
src/terraform_gui.cpp
Show inline comments
 
@@ -657,13 +657,14 @@ struct ScenarioEditorLandscapeGeneration
 
	ScenarioEditorLandscapeGenerationWindow(const WindowDesc *desc, WindowNumber window_number) : Window()
 
	{
 
		this->InitNested(desc, window_number);
 
		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();
 

	
 
		if (this->IsWidgetLowered(ETTW_LOWER_LAND) || this->IsWidgetLowered(ETTW_RAISE_LAND)) { // change area-size if raise/lower corner is selected
 
			SetTileSelectSize(_terraform_size, _terraform_size);
 
		}
 
	}
src/tgp.cpp
Show inline comments
 
@@ -178,13 +178,14 @@ struct HeightMap
 
	/**
 
	 * Height map accessor
 
	 * @param x X position
 
	 * @param y Y position
 
	 * @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];
 
	}
 
};
 

	
 
/** Global height map instance */
 
static HeightMap _height_map = {NULL, 0, 0, 0, 0};
src/water_cmd.cpp
Show inline comments
 
@@ -551,14 +551,13 @@ struct LocksDrawTileStruct {
 
	SpriteID image;
 
};
 

	
 
#include "table/water_land.h"
 

	
 
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 water_base = GetCanalSprite(CF_WATERSLOPE, ti->tile);
 
	SpriteID locks_base = GetCanalSprite(CF_LOCKS, ti->tile);
 

	
 
	/* If no custom graphics, use defaults */
 
@@ -632,13 +631,14 @@ void DrawShoreTile(Slope tileh)
 

	
 
	assert((tileh != SLOPE_EW) && (tileh != SLOPE_NS)); // No suitable sprites for current flooding behaviour
 

	
 
	DrawGroundSprite(SPR_SHORE_BASE + tileh_to_shoresprite[tileh], PAL_NONE);
 
}
 

	
 
void DrawWaterClassGround(const TileInfo *ti) {
 
void DrawWaterClassGround(const TileInfo *ti)
 
{
 
	switch (GetWaterClass(ti->tile)) {
 
		case WATER_CLASS_SEA:   DrawSeaWater(ti->tile); break;
 
		case WATER_CLASS_CANAL: DrawCanalWater(ti->tile); break;
 
		case WATER_CLASS_RIVER: DrawRiverWater(ti); break;
 
		default: NOT_REACHED();
 
	}
0 comments (0 inline, 0 general)