diff options
author | smatz <smatz@openttd.org> | 2009-10-04 17:10:57 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2009-10-04 17:10:57 +0000 |
commit | 32cbe57178129d371752e29e857fa454a046f7c3 (patch) | |
tree | c1dd06f2f7e052ee5bbbe6e388d6546da67648a3 /src/ai/api | |
parent | 1666f7a1a926eec76a5ae12d54debf4f13bca269 (diff) | |
download | openttd-32cbe57178129d371752e29e857fa454a046f7c3.tar.xz |
(svn r17692) -Codechange: minor coding style fixes
Diffstat (limited to 'src/ai/api')
-rw-r--r-- | src/ai/api/ai_abstractlist.cpp | 6 | ||||
-rw-r--r-- | src/ai/api/ai_abstractlist.hpp | 3 | ||||
-rw-r--r-- | src/ai/api/ai_error.cpp | 3 | ||||
-rw-r--r-- | src/ai/api/ai_list.cpp | 3 | ||||
-rw-r--r-- | src/ai/api/squirrel_export.awk | 6 |
5 files changed, 14 insertions, 7 deletions
diff --git a/src/ai/api/ai_abstractlist.cpp b/src/ai/api/ai_abstractlist.cpp index 0a2b3e224..6647b725e 100644 --- a/src/ai/api/ai_abstractlist.cpp +++ b/src/ai/api/ai_abstractlist.cpp @@ -178,7 +178,8 @@ public: return item_current; } - void End() { + void End() + { this->bucket_list = NULL; this->has_no_more_items = true; this->item_next = 0; @@ -286,7 +287,8 @@ public: 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 */ diff --git a/src/ai/api/ai_abstractlist.hpp b/src/ai/api/ai_abstractlist.hpp index be266b960..86be9dc21 100644 --- a/src/ai/api/ai_abstractlist.hpp +++ b/src/ai/api/ai_abstractlist.hpp @@ -267,7 +267,8 @@ public: * @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); diff --git a/src/ai/api/ai_error.cpp b/src/ai/api/ai_error.cpp index 82b537681..2031d57b2 100644 --- a/src/ai/api/ai_error.cpp +++ b/src/ai/api/ai_error.cpp @@ -61,6 +61,7 @@ AIError::AIErrorMapString AIError::error_map_string = AIError::AIErrorMapString( 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); } diff --git a/src/ai/api/ai_list.cpp b/src/ai/api/ai_list.cpp index 29446aec4..f93e504f1 100644 --- a/src/ai/api/ai_list.cpp +++ b/src/ai/api/ai_list.cpp @@ -28,7 +28,8 @@ 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")); diff --git a/src/ai/api/squirrel_export.awk b/src/ai/api/squirrel_export.awk index d33cfe4a4..b9ea9e519 100644 --- a/src/ai/api/squirrel_export.awk +++ b/src/ai/api/squirrel_export.awk @@ -13,7 +13,8 @@ # # 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] @@ -23,7 +24,8 @@ function array_sort(ARRAY, ELEMENTS, temp, i, j) { 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; }" |