1
0
Fork 0

Codechange: Unify naming of squirrel built-in types in Script API docs

pull/12653/head
frosch 2024-03-24 19:02:16 +01:00 committed by Peter Nelson
parent e436e2ef40
commit dfa2622153
6 changed files with 21 additions and 11 deletions

View File

@ -136,6 +136,16 @@ BEGIN {
next next
} }
# Convert/unify type names
{
gsub(/\<SQInteger\>/, "int")
gsub(/\<SquirrelTable\>/, "table")
gsub(/\<u?int[0-9]*(_t)?\>/, "int")
gsub(/\<HSQOBJECT\>/, "object")
gsub(/std::optional<std::string>/, "string")
gsub(/(const )?std::string *[*&]?/, "string ")
}
# Store comments # Store comments
/\/\*\*.*\*\// { comment_buffer = $0; comment = "false"; next; } /\/\*\*.*\*\// { comment_buffer = $0; comment = "false"; next; }
/\/\*.*\*\// { comment_buffer = ""; comment = "false"; next; } /\/\*.*\*\// { comment_buffer = ""; comment = "false"; next; }

View File

@ -27,13 +27,13 @@ public:
/** /**
* Send information to the AdminPort. The information can be anything * Send information to the AdminPort. The information can be anything
* as long as it isn't a class or instance thereof. * as long as it isn't a class or instance thereof.
* @param table The information to send, in a table. For example: { param = "param" }. * @param data The information to send, in a table. For example: { param = "param" }.
* @return True if and only if the data was successfully converted to JSON * @return True if and only if the data was successfully converted to JSON
* and send to the AdminPort. * and send to the AdminPort.
* @note If the resulting JSON of your table is larger than 1450 bytes, * @note If the resulting JSON of your table is larger than 1450 bytes,
* nothing will be sent (and false will be returned). * nothing will be sent (and false will be returned).
*/ */
static bool Send(void *table); static bool Send(table data);
#endif /* DOXYGEN_API */ #endif /* DOXYGEN_API */
}; };

View File

@ -92,7 +92,7 @@ public:
* *
* @return Data of the script that should be stored in the save game. * @return Data of the script that should be stored in the save game.
*/ */
SquirrelTable Save(); table Save();
/** /**
* Load saved data just before calling #Start. * Load saved data just before calling #Start.
@ -100,7 +100,7 @@ public:
* @param version Version number of the script that created the \a data. * @param version Version number of the script that created the \a data.
* @param data Data that was saved (return value of #Save). * @param data Data that was saved (return value of #Save).
*/ */
void Load(int version, SquirrelTable data); void Load(int version, table data);
#endif /* DOXYGEN_API */ #endif /* DOXYGEN_API */
/** /**

View File

@ -252,5 +252,5 @@ public:
* @note This is a function provided by OpenTTD, you don't have to * @note This is a function provided by OpenTTD, you don't have to
* include it in your Script but should just call it from GetSettings. * include it in your Script but should just call it from GetSettings.
*/ */
void AddLabels(const char *setting_name, table value_names); void AddLabels(string setting_name, table value_names);
}; };

View File

@ -42,21 +42,21 @@ public:
* @param priority The priority to assign the item. * @param priority The priority to assign the item.
* @return True if the item was inserted, false if it was already in the queue. * @return True if the item was inserted, false if it was already in the queue.
*/ */
bool Insert(void *item, SQInteger priority); bool Insert(object item, SQInteger priority);
/** /**
* Remove and return the item with the lowest priority. * Remove and return the item with the lowest priority.
* @return The item with the lowest priority, removed from the queue. Returns null on an empty queue. * @return The item with the lowest priority, removed from the queue. Returns null on an empty queue.
* @pre !IsEmpty() * @pre !IsEmpty()
*/ */
void *Pop(); object Pop();
/** /**
* Get the item with the lowest priority, keeping it in the queue. * Get the item with the lowest priority, keeping it in the queue.
* @return The item with the lowest priority. Returns null on an empty queue. * @return The item with the lowest priority. Returns null on an empty queue.
* @pre !IsEmpty() * @pre !IsEmpty()
*/ */
void *Peek(); object Peek();
/** /**
* Check if an items is already included in the queue. * Check if an items is already included in the queue.
@ -64,7 +64,7 @@ public:
* @return true if the items is already in the queue. * @return true if the items is already in the queue.
* @note Performance is O(n), use only when absolutely required. * @note Performance is O(n), use only when absolutely required.
*/ */
bool Exists(void *item); bool Exists(object item);
/** /**
* Clear the queue, making Count() returning 0 and IsEmpty() returning true. * Clear the queue, making Count() returning 0 and IsEmpty() returning true.

View File

@ -112,14 +112,14 @@ public:
* @param parameter Which parameter to set. * @param parameter Which parameter to set.
* @param value The value of the parameter. Has to be string, integer or an instance of the class ScriptText. * @param value The value of the parameter. Has to be string, integer or an instance of the class ScriptText.
*/ */
void SetParam(int parameter, Object value); void SetParam(int parameter, object value);
/** /**
* Add a value as parameter (appending it). * Add a value as parameter (appending it).
* @param value The value of the parameter. Has to be string, integer or an instance of the class ScriptText. * @param value The value of the parameter. Has to be string, integer or an instance of the class ScriptText.
* @return The same object as on which this is called, so you can chain. * @return The same object as on which this is called, so you can chain.
*/ */
ScriptText *AddParam(Object value); ScriptText *AddParam(object value);
#endif /* DOXYGEN_API */ #endif /* DOXYGEN_API */
/** /**