mirror of
https://github.com/luanti-org/luanti.git
synced 2025-12-04 06:35:25 +01:00
Move serialisation code out of sound_spec.h
This commit is contained in:
@@ -433,6 +433,7 @@ set(independent_SRCS
|
||||
profiler.cpp
|
||||
serialization.cpp
|
||||
settings.cpp
|
||||
sound_spec.cpp
|
||||
staticobject.cpp
|
||||
terminal_chat_console.cpp
|
||||
texture_override.cpp
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "imagesource.h"
|
||||
|
||||
#include "exceptions.h"
|
||||
#include <IFileSystem.h>
|
||||
#include "imagefilters.h"
|
||||
#include "renderingengine.h"
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "gettext.h"
|
||||
#include "log.h"
|
||||
#include "log_internal.h"
|
||||
#include "util/serialize.h"
|
||||
#include "util/quicktune.h"
|
||||
#include "httpfetch.h"
|
||||
#include "gameparams.h"
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "scripting_server.h"
|
||||
#include "server.h"
|
||||
#include "serverenvironment.h"
|
||||
#include "util/serialize.h"
|
||||
|
||||
LuaEntitySAO::LuaEntitySAO(ServerEnvironment *env, v3f pos, const std::string &data)
|
||||
: UnitSAO(env, pos)
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "server.h"
|
||||
#include "serverenvironment.h"
|
||||
#include "settings.h"
|
||||
#include "util/serialize.h"
|
||||
|
||||
PlayerSAO::PlayerSAO(ServerEnvironment *env_, RemotePlayer *player_, session_t peer_id_,
|
||||
bool is_singleplayer):
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||
|
||||
#include "rollback.h"
|
||||
#include "exceptions.h"
|
||||
#include <list>
|
||||
#include "log.h"
|
||||
#include "gamedef.h"
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "profiler.h"
|
||||
#include "gamedef.h"
|
||||
#include "util/directiontables.h"
|
||||
#include "util/serialize.h"
|
||||
#include "rollback_interface.h"
|
||||
#include "reflowscan.h"
|
||||
#include "emerge.h"
|
||||
|
||||
23
src/sound_spec.cpp
Normal file
23
src/sound_spec.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
// Luanti
|
||||
// SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
// Copyright (C) 2025 Luanti developers
|
||||
|
||||
#include "sound_spec.h"
|
||||
|
||||
#include "util/serialize.h"
|
||||
|
||||
void SoundSpec::serializeSimple(std::ostream &os, u16 protocol_version) const
|
||||
{
|
||||
os << serializeString16(name);
|
||||
writeF32(os, gain);
|
||||
writeF32(os, pitch);
|
||||
writeF32(os, fade);
|
||||
}
|
||||
|
||||
void SoundSpec::deSerializeSimple(std::istream &is, u16 protocol_version)
|
||||
{
|
||||
name = deSerializeString16(is);
|
||||
gain = readF32(is);
|
||||
pitch = readF32(is);
|
||||
fade = readF32(is);
|
||||
}
|
||||
@@ -5,7 +5,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "util/serialize.h"
|
||||
#include "irrlichttypes_bloated.h"
|
||||
|
||||
/**
|
||||
@@ -27,27 +26,9 @@ struct SoundSpec
|
||||
|
||||
bool exists() const { return !name.empty(); }
|
||||
|
||||
/**
|
||||
* Serialize a `SimpleSoundSpec`.
|
||||
*/
|
||||
void serializeSimple(std::ostream &os, u16 protocol_version) const
|
||||
{
|
||||
os << serializeString16(name);
|
||||
writeF32(os, gain);
|
||||
writeF32(os, pitch);
|
||||
writeF32(os, fade);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserialize a `SimpleSoundSpec`.
|
||||
*/
|
||||
void deSerializeSimple(std::istream &is, u16 protocol_version)
|
||||
{
|
||||
name = deSerializeString16(is);
|
||||
gain = readF32(is);
|
||||
pitch = readF32(is);
|
||||
fade = readF32(is);
|
||||
}
|
||||
// Serialize/Deserialize a `SimpleSoundSpec`.
|
||||
void serializeSimple(std::ostream &os, u16 protocol_version) const;
|
||||
void deSerializeSimple(std::istream &is, u16 protocol_version);
|
||||
|
||||
// Name of the sound-group
|
||||
std::string name;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "serialization.h"
|
||||
#include "noise.h"
|
||||
#include "inventory.h"
|
||||
#include "util/serialize.h"
|
||||
#include "voxel.h"
|
||||
|
||||
class TestMapBlock : public TestBase
|
||||
|
||||
Reference in New Issue
Block a user