Codechange: improve documentation by removing unneeded constructors/operators

This commit is contained in:
Rubidium
2026-07-01 19:26:40 +02:00
committed by rubidium42
parent 01919af55b
commit d2a3f52257
4 changed files with 13 additions and 26 deletions
+2 -2
View File
@@ -257,7 +257,7 @@ static void ParamSet(ByteReader &buf)
/* Reserve space at the current sprite ID */
GrfMsg(4, "ParamSet: GRM: Allocated {} sprites at {}", count, _cur_gps.spriteid);
_grm_sprites[GRFLocation(_cur_gps.grffile->grfid, _cur_gps.nfo_line)] = std::make_pair(_cur_gps.spriteid, count);
_grm_sprites[GRFLocation{_cur_gps.grffile->grfid, _cur_gps.nfo_line}] = std::make_pair(_cur_gps.spriteid, count);
_cur_gps.spriteid += count;
}
}
@@ -291,7 +291,7 @@ static void ParamSet(ByteReader &buf)
switch (op) {
case 0:
/* Return space reserved during reservation stage */
src1 = _grm_sprites[GRFLocation(_cur_gps.grffile->grfid, _cur_gps.nfo_line)].first;
src1 = _grm_sprites[GRFLocation{_cur_gps.grffile->grfid, _cur_gps.nfo_line}].first;
GrfMsg(4, "ParamSet: GRM: Using pre-allocated sprites at {}", src1);
break;
+9 -13
View File
@@ -197,21 +197,17 @@ public:
extern GrfProcessingState _cur_gps;
/** A location within a NewGRF, like file:line but in the context of NewGRFs. */
struct GRFLocation {
uint32_t grfid;
uint32_t nfoline;
uint32_t grfid; ///< Identifier of the NewGRF this refers to.
uint32_t nfoline; ///< The line of NFO this refers to.
GRFLocation(uint32_t grfid, uint32_t nfoline) : grfid(grfid), nfoline(nfoline) { }
bool operator <(const GRFLocation &other) const
{
return this->grfid < other.grfid || (this->grfid == other.grfid && this->nfoline < other.nfoline);
}
bool operator ==(const GRFLocation &other) const
{
return this->grfid == other.grfid && this->nfoline == other.nfoline;
}
/**
* Compare with another location.
* @param other The other location to compare to.
* @return The std::strong_ordering of the comparison.
*/
constexpr auto operator<=>(const GRFLocation &other) const = default;
};
using GRFLineToSpriteOverride = std::map<GRFLocation, std::vector<uint8_t>>;
-2
View File
@@ -27,8 +27,6 @@ struct StringIDMapping {
uint32_t grfid; ///< Source NewGRF.
GRFStringID source; ///< Source grf-local GRFStringID.
std::function<void(StringID)> func; ///< Function for mapping result.
StringIDMapping(uint32_t grfid, GRFStringID source, std::function<void(StringID)> &&func) : grfid(grfid), source(source), func(std::move(func)) { }
};
/** Strings to be mapped during load. */
+2 -9
View File
@@ -85,15 +85,8 @@ enum GRFPalette : uint8_t {
/** Basic data to distinguish a GRF. Used in the server list window */
struct GRFIdentifier {
uint32_t grfid; ///< GRF ID (defined by Action 0x08)
MD5Hash md5sum; ///< MD5 checksum of file to distinguish files with the same GRF ID (eg. newer version of GRF)
GRFIdentifier() = default;
GRFIdentifier(const GRFIdentifier &other) = default;
GRFIdentifier(GRFIdentifier &&other) = default;
GRFIdentifier(uint32_t grfid, const MD5Hash &md5sum) : grfid(grfid), md5sum(md5sum) {}
GRFIdentifier& operator =(const GRFIdentifier &other) = default;
uint32_t grfid; ///< GRF ID (defined by Action 0x08)
MD5Hash md5sum; ///< MD5 checksum of file to distinguish files with the same GRF ID (eg. newer version of GRF)
/**
* Does the identification match the provided values?