Skip to content

Commit

Permalink
Merge pull request #1619 from heinezen/fix/clang_format_comments
Browse files Browse the repository at this point in the history
Fix tabs in multi-line comments
  • Loading branch information
TheJJ committed Feb 13, 2024
2 parents 460ea98 + 2402b6d commit 35e2b0a
Show file tree
Hide file tree
Showing 208 changed files with 3,290 additions and 3,176 deletions.
4 changes: 2 additions & 2 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ AlignConsecutiveDeclarations: false
AlignConsecutiveMacros: false
AlignEscapedNewlines: DontAlign
AlignOperands: Align
AlignTrailingComments: false
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Never
Expand Down Expand Up @@ -100,7 +100,7 @@ PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Right
ReflowComments: false
ReflowComments: true
SortIncludes: CaseInsensitive
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
Expand Down
132 changes: 66 additions & 66 deletions libopenage/assets/mod_manager.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023-2023 the openage authors. See copying.md for legal info.
// Copyright 2023-2024 the openage authors. See copying.md for legal info.

#pragma once

Expand All @@ -22,67 +22,67 @@ class ModManager {
~ModManager() = default;

/**
* Adds a modpack to the list of available modpacks.
*
* @param info_file Path to the modpack definition file.
*/
* Adds a modpack to the list of available modpacks.
*
* @param info_file Path to the modpack definition file.
*/
void register_modpack(const util::Path &info_file);

/**
* Adds a modpack to the list of available modpacks.
*
* @param info Modpack definition.
*/
* Adds a modpack to the list of available modpacks.
*
* @param info Modpack definition.
*/
void register_modpack(const ModpackInfo &info);

/**
* Ready a set of modpacks with the given IDs.
*
* This prepares the modpacks for loading by valiating the integrity of
* the contained data, checking if the load order and mounting the
* assets into the virtual filesystem.
*
* TODO:
* - Mount modpacks into virtual filesystem.
* - Validate manifest.toml
* - Verify signature of manifest.toml (if signed)
*
* Note that data inside the modpack is not loaded yet. Data
* loading is done inside the simulation before the game starts or
* in case of media files, when they are requested during the game.
*
* Modpacks must have been registered with \p register_modpack() before
* activating.
*
* @param load_order Load order of modpacks.
*/
* Ready a set of modpacks with the given IDs.
*
* This prepares the modpacks for loading by valiating the integrity of
* the contained data, checking if the load order and mounting the
* assets into the virtual filesystem.
*
* TODO:
* - Mount modpacks into virtual filesystem.
* - Validate manifest.toml
* - Verify signature of manifest.toml (if signed)
*
* Note that data inside the modpack is not loaded yet. Data
* loading is done inside the simulation before the game starts or
* in case of media files, when they are requested during the game.
*
* Modpacks must have been registered with \p register_modpack() before
* activating.
*
* @param load_order Load order of modpacks.
*/
void activate_modpacks(const std::vector<std::string> &load_order);

/**
* Get a loaded modpack by its ID.
*
* @param modpack_id ID of the modpack to get.
*
* @return Modpack with the given ID.
*/
* Get a loaded modpack by its ID.
*
* @param modpack_id ID of the modpack to get.
*
* @return Modpack with the given ID.
*/
std::shared_ptr<Modpack> get_modpack(const std::string &modpack_id) const;

/**
* Get the load order of modpacks.
*
* @return Modpack IDs in the order that they should be loaded.
*/
* Get the load order of modpacks.
*
* @return Modpack IDs in the order that they should be loaded.
*/
const std::vector<std::string> &get_load_order() const;

/**
* Enumerates all modpack ids in a given directory.
*
* This also loads available modpack definition files.
*
* @param directory Path to the directory to enumerate.
*
* @return Infos of the identified modpacks.
*/
* Enumerates all modpack ids in a given directory.
*
* This also loads available modpack definition files.
*
* @param directory Path to the directory to enumerate.
*
* @return Infos of the identified modpacks.
*/
static std::vector<ModpackInfo> enumerate_modpacks(const util::Path &directory) {
std::vector<ModpackInfo> result;

Expand All @@ -106,37 +106,37 @@ class ModManager {

private:
/**
* Set the order in which modpack data should be loaded.
*
* This also checks whether the given load order is valid, i.e.
* by checking if all dependencies/conflicts are resolved.
*
* TODO: Dynamically resolve load order?
*
* @param load_order Load order of modpacks.
*/
* Set the order in which modpack data should be loaded.
*
* This also checks whether the given load order is valid, i.e.
* by checking if all dependencies/conflicts are resolved.
*
* TODO: Dynamically resolve load order?
*
* @param load_order Load order of modpacks.
*/
void set_load_order(const std::vector<std::string> &load_order);

/**
* TODO: Mount point for modpacks.
*/
* TODO: Mount point for modpacks.
*/
util::Path asset_base_dir;

/**
* Active modpacks. Maps their ID ('name' in the modpack definition file)
* to the modpack.
*/
* Active modpacks. Maps their ID ('name' in the modpack definition file)
* to the modpack.
*/
std::unordered_map<std::string, std::shared_ptr<Modpack>> active;

/**
* Available modpacks that can be activated. Maps their ID ('name' in the modpack
* definition file) to the modpack info.
*/
* Available modpacks that can be activated. Maps their ID ('name' in the modpack
* definition file) to the modpack info.
*/
std::unordered_map<std::string, ModpackInfo> available;

/**
* Load order of modpacks.
*/
* Load order of modpacks.
*/
std::vector<std::string> load_order;
};

Expand Down
50 changes: 25 additions & 25 deletions libopenage/assets/modpack.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023-2023 the openage authors. See copying.md for legal info.
// Copyright 2023-2024 the openage authors. See copying.md for legal info.

#pragma once

Expand Down Expand Up @@ -79,50 +79,50 @@ ModpackInfo parse_modepack_def(const util::Path &info_file);
class Modpack {
public:
/**
* Create a new modpack.
*
* Loads the modpack using the information in the definition file.
*
* @param info_file Path to the modpack definition file.
*/
* Create a new modpack.
*
* Loads the modpack using the information in the definition file.
*
* @param info_file Path to the modpack definition file.
*/
Modpack(const util::Path &info_file);

/**
* Create a new modpack from an existing modpack info.
*
* @param info Modpack metadata information.
*/
* Create a new modpack from an existing modpack info.
*
* @param info Modpack metadata information.
*/
Modpack(const ModpackInfo &info);

/**
* Create a new modpack from an existing modpack info.
*
* @param info Modpack metadata information.
*/
* Create a new modpack from an existing modpack info.
*
* @param info Modpack metadata information.
*/
Modpack(const ModpackInfo &&info);

Modpack(const Modpack &) = delete;
Modpack(Modpack &&) = default;
~Modpack() = default;

/**
* Get the metadata information of the modpack.
*
* @return Modpack metadata information.
*/
* Get the metadata information of the modpack.
*
* @return Modpack metadata information.
*/
const ModpackInfo &get_info() const;

/**
* Check if the modpack is valid.
*
* @return true if the modpack is valid, false otherwise.
*/
* Check if the modpack is valid.
*
* @return true if the modpack is valid, false otherwise.
*/
bool check_integrity() const;

private:
/**
* Modpack metadata information.
*/
* Modpack metadata information.
*/
ModpackInfo info;
};

Expand Down
10 changes: 4 additions & 6 deletions libopenage/audio/category.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
// Copyright 2014-2017 the openage authors. See copying.md for legal info.
// Copyright 2014-2024 the openage authors. See copying.md for legal info.

#pragma once

#include <iostream>

namespace openage {
namespace audio {

namespace openage::audio {

enum class category_t {
GAME,
Expand All @@ -17,7 +15,7 @@ enum class category_t {


const char *category_t_to_str(category_t val);
std::ostream &operator <<(std::ostream &os, category_t val);
std::ostream &operator<<(std::ostream &os, category_t val);


}} // openage::audio
} // namespace openage::audio
10 changes: 6 additions & 4 deletions libopenage/audio/dynamic_loader.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Copyright 2014-2017 the openage authors. See copying.md for legal info.
// Copyright 2014-2024 the openage authors. See copying.md for legal info.

#pragma once

#include <memory>
#include <string>

#include "../util/path.h"
#include "format.h"
#include "types.h"
#include "../util/path.h"


namespace openage {
Expand Down Expand Up @@ -43,7 +43,8 @@ class DynamicLoader {
* @param offset the offset from the resource's beginning
* @param chunk_size the number of int16_t values that fit in one chunk
*/
virtual size_t load_chunk(int16_t *chunk_buffer, size_t offset,
virtual size_t load_chunk(int16_t *chunk_buffer,
size_t offset,
size_t chunk_size) = 0;

/**
Expand All @@ -55,4 +56,5 @@ class DynamicLoader {
format_t format);
};

}} // openage::audio
} // namespace audio
} // namespace openage
26 changes: 13 additions & 13 deletions libopenage/audio/dynamic_resource.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2015-2019 the openage authors. See copying.md for legal info.
// Copyright 2015-2024 the openage authors. See copying.md for legal info.

#pragma once

Expand All @@ -8,15 +8,15 @@
#include <unordered_map>
#include <vector>

#include "../datastructure/concurrent_queue.h"
#include "../job/job.h"
#include "../job/job_group.h"
#include "../util/path.h"
#include "category.h"
#include "dynamic_loader.h"
#include "format.h"
#include "resource.h"
#include "types.h"
#include "../datastructure/concurrent_queue.h"
#include "../job/job.h"
#include "../job/job_group.h"
#include "../util/path.h"

namespace openage {
namespace audio {
Expand Down Expand Up @@ -59,10 +59,10 @@ class DynamicResource : public Resource {
category_t category,
int id,
const util::Path &path,
format_t format=format_t::OPUS,
int preload_amount=DEFAULT_PRELOAD_AMOUNT,
size_t chunk_size=DEFAULT_CHUNK_SIZE,
size_t max_chunks=DEFAULT_MAX_CHUNKS);
format_t format = format_t::OPUS,
int preload_amount = DEFAULT_PRELOAD_AMOUNT,
size_t chunk_size = DEFAULT_CHUNK_SIZE,
size_t max_chunks = DEFAULT_MAX_CHUNKS);

virtual ~DynamicResource() = default;

Expand Down Expand Up @@ -95,7 +95,7 @@ class DynamicResource : public Resource {
static constexpr int DEFAULT_PRELOAD_AMOUNT = 10;

/** The default used chunk size in bytes (100ms for 48kHz stereo audio). */
static constexpr size_t DEFAULT_CHUNK_SIZE = 9600*2;
static constexpr size_t DEFAULT_CHUNK_SIZE = 9600 * 2;

/** The default number of chunks, that can be loaded at the same time. */
static constexpr size_t DEFAULT_MAX_CHUNKS = 100;
Expand Down Expand Up @@ -138,11 +138,11 @@ class DynamicResource : public Resource {
* Resource chunk index to chunk mapping.
* Loading and usage state is reached through this.
*/
std::unordered_map<size_t,std::shared_ptr<chunk_info_t>> chunks;
std::unordered_map<size_t, std::shared_ptr<chunk_info_t>> chunks;

/** The background loading job group. */
job::JobGroup loading_job_group;
};

}
}
} // namespace audio
} // namespace openage
Loading

0 comments on commit 35e2b0a

Please sign in to comment.