mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-29 09:44:52 +01:00
Updated Coding Style (markdown)
@@ -32,7 +32,7 @@ int32_t gNumGuests = 0;
|
||||
static int32_t _nextGuestIndex;
|
||||
|
||||
/// Local function declarations
|
||||
static rct_peep* GetLastGuest();
|
||||
static Peep* GetLastGuest();
|
||||
|
||||
/// All functions should be prefixed with the name of the source file followed
|
||||
/// by '_'. In this case 'example_'. The name of the function should be lower
|
||||
@@ -40,17 +40,17 @@ static rct_peep* GetLastGuest();
|
||||
/// Only local functions need documentation (javadoc style)
|
||||
/// Global functions should have their documentation in the header file.
|
||||
|
||||
static rct_peep* CreateGuest(const int32_t spawnIndex);
|
||||
static Peep* CreateGuest(const int32_t spawnIndex);
|
||||
{
|
||||
/// Arguments and local variables use camelCase
|
||||
rct_sprite* peepSprite = create_sprite(spawnIndex);
|
||||
Entity* peepSprite = CreateEntity(spawnIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the last guest in the linked list of guests.
|
||||
* @return A reference to the last peep.
|
||||
*/
|
||||
static rct_peep* GetLastGuest()
|
||||
static Peep* GetLastGuest()
|
||||
{
|
||||
/// all braces must be on their own lines.
|
||||
if (gNumGuests == 0)
|
||||
@@ -77,7 +77,7 @@ static rct_peep* GetLastGuest()
|
||||
// until the last peep is found.
|
||||
/// Pointer asterisks are placed next to the variable name.
|
||||
/// E.g. int32_t a, *ptrA, *ptrB
|
||||
rct_peep* peep = gSprites[_nextGuestIndex];
|
||||
Peep* peep = gSprites[_nextGuestIndex];
|
||||
/// Always be explicit with NULL checks
|
||||
while (peep->next != nullptr)
|
||||
{
|
||||
@@ -93,7 +93,7 @@ static rct_peep* GetLastGuest()
|
||||
/// Use regions to allow text editors to collapse large blocks of code
|
||||
#pragma region Animation Tables
|
||||
|
||||
/// Structure members are title case.
|
||||
/// Public structure members are title case.
|
||||
/**
|
||||
* Represents a currently running animation.
|
||||
*/
|
||||
@@ -103,6 +103,13 @@ struct PeepAnimation
|
||||
int32_t AnimationLength;
|
||||
};
|
||||
|
||||
class PeepAction
|
||||
{
|
||||
private:
|
||||
/// Private or Protected variables start with an underscore
|
||||
int32_t _actionType;
|
||||
}
|
||||
|
||||
/// Local constants do not require underscore prefix. They are title case.
|
||||
static const int32_t WalkingAnimation[] =
|
||||
{
|
||||
@@ -171,7 +178,7 @@ extern int32_t gNumGuests;
|
||||
* @param spawnIndex The index of the spawn spot to create the guest at.
|
||||
* @return A new peep.
|
||||
*/
|
||||
rct_peep* CreateGuest(int32_t spawnIndex);
|
||||
Peep* CreateGuest(int32_t spawnIndex);
|
||||
|
||||
#endif
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user