1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-23 06:44:38 +01:00

clang-format object

This commit is contained in:
clang-format
2018-06-22 23:03:20 +02:00
committed by Hielke Morsink
parent e32189fd98
commit a6a12af1ec
42 changed files with 1452 additions and 1283 deletions

View File

@@ -9,15 +9,17 @@
#pragma warning(disable : 4706) // assignment within conditional expression
#include <memory>
#include "WaterObject.h"
#include "../OpenRCT2.h"
#include "../core/IStream.hpp"
#include "../localisation/Language.h"
#include "../localisation/StringIds.h"
#include "../OpenRCT2.h"
#include "ObjectJsonHelpers.h"
#include "WaterObject.h"
void WaterObject::ReadLegacy(IReadObjectContext * context, IStream * stream)
#include <memory>
void WaterObject::ReadLegacy(IReadObjectContext* context, IStream* stream)
{
stream->Seek(14, STREAM_SEEK_CURRENT);
_legacyType.flags = stream->ReadValue<uint16_t>();
@@ -45,7 +47,7 @@ void WaterObject::Unload()
_legacyType.string_idx = 0;
}
void WaterObject::DrawPreview(rct_drawpixelinfo * dpi, int32_t width, int32_t height) const
void WaterObject::DrawPreview(rct_drawpixelinfo* dpi, int32_t width, int32_t height) const
{
// Write (no image)
int32_t x = width / 2;
@@ -56,22 +58,13 @@ void WaterObject::DrawPreview(rct_drawpixelinfo * dpi, int32_t width, int32_t he
void WaterObject::ReadJson([[maybe_unused]] IReadObjectContext* context, const json_t* root)
{
auto properties = json_object_get(root, "properties");
_legacyType.flags = ObjectJsonHelpers::GetFlags<uint16_t>(properties, {
{ "allowDucks", WATER_FLAGS_ALLOW_DUCKS }});
_legacyType.flags = ObjectJsonHelpers::GetFlags<uint16_t>(properties, { { "allowDucks", WATER_FLAGS_ALLOW_DUCKS } });
ObjectJsonHelpers::LoadStrings(root, GetStringTable());
// Images which are actually palette data
static const char * paletteNames[] =
{
"general",
"waves-0",
"waves-1",
"waves-2",
"sparkles-0",
"sparkles-1",
"sparkles-2"
};
static const char* paletteNames[]
= { "general", "waves-0", "waves-1", "waves-2", "sparkles-0", "sparkles-1", "sparkles-2" };
for (auto paletteName : paletteNames)
{
auto jPalettes = json_object_get(properties, "palettes");
@@ -86,7 +79,7 @@ void WaterObject::ReadJson([[maybe_unused]] IReadObjectContext* context, const j
}
}
void WaterObject::ReadJsonPalette(const json_t * jPalette)
void WaterObject::ReadJsonPalette(const json_t* jPalette)
{
auto paletteStartIndex = json_integer_value(json_object_get(jPalette, "index"));
auto jColours = json_object_get(jPalette, "colours");
@@ -96,7 +89,7 @@ void WaterObject::ReadJsonPalette(const json_t * jPalette)
size_t dataIndex = 0;
size_t index;
const json_t * jColour;
const json_t* jColour;
json_array_foreach(jColours, index, jColour)
{
auto szColour = json_string_value(jColour);
@@ -116,11 +109,11 @@ void WaterObject::ReadJsonPalette(const json_t * jPalette)
g1.x_offset = (int16_t)paletteStartIndex;
g1.flags = G1_FLAG_PALETTE;
auto &imageTable = GetImageTable();
auto& imageTable = GetImageTable();
imageTable.AddImage(&g1);
}
uint32_t WaterObject::ParseColour(const std::string &s) const
uint32_t WaterObject::ParseColour(const std::string& s) const
{
uint8_t r = 0;
uint8_t g = 0;