mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 23:30:04 +00:00
Contour vectors
This commit is contained in:
parent
96cd27adcb
commit
e505edf156
8 changed files with 515 additions and 16 deletions
|
|
@ -0,0 +1,44 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <scwx/wsr88d/rpg/packet.hpp>
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
namespace scwx
|
||||||
|
{
|
||||||
|
namespace wsr88d
|
||||||
|
{
|
||||||
|
namespace rpg
|
||||||
|
{
|
||||||
|
|
||||||
|
class LinkedContourVectorPacketImpl;
|
||||||
|
|
||||||
|
class LinkedContourVectorPacket : public Packet
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit LinkedContourVectorPacket();
|
||||||
|
~LinkedContourVectorPacket();
|
||||||
|
|
||||||
|
LinkedContourVectorPacket(const LinkedContourVectorPacket&) = delete;
|
||||||
|
LinkedContourVectorPacket&
|
||||||
|
operator=(const LinkedContourVectorPacket&) = delete;
|
||||||
|
|
||||||
|
LinkedContourVectorPacket(LinkedContourVectorPacket&&) noexcept;
|
||||||
|
LinkedContourVectorPacket& operator=(LinkedContourVectorPacket&&) noexcept;
|
||||||
|
|
||||||
|
uint16_t packet_code() const;
|
||||||
|
uint16_t initial_point_indicator() const;
|
||||||
|
uint16_t length_of_vectors() const;
|
||||||
|
|
||||||
|
size_t data_size() const override;
|
||||||
|
|
||||||
|
bool Parse(std::istream& is) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::unique_ptr<LinkedContourVectorPacketImpl> p;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace rpg
|
||||||
|
} // namespace wsr88d
|
||||||
|
} // namespace scwx
|
||||||
45
wxdata/include/scwx/wsr88d/rpg/set_color_level_packet.hpp
Normal file
45
wxdata/include/scwx/wsr88d/rpg/set_color_level_packet.hpp
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <scwx/wsr88d/rpg/packet.hpp>
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
namespace scwx
|
||||||
|
{
|
||||||
|
namespace wsr88d
|
||||||
|
{
|
||||||
|
namespace rpg
|
||||||
|
{
|
||||||
|
|
||||||
|
class SetColorLevelPacketImpl;
|
||||||
|
|
||||||
|
class SetColorLevelPacket : public Packet
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit SetColorLevelPacket();
|
||||||
|
~SetColorLevelPacket();
|
||||||
|
|
||||||
|
SetColorLevelPacket(const SetColorLevelPacket&) = delete;
|
||||||
|
SetColorLevelPacket& operator=(const SetColorLevelPacket&) = delete;
|
||||||
|
|
||||||
|
SetColorLevelPacket(SetColorLevelPacket&&) noexcept;
|
||||||
|
SetColorLevelPacket& operator=(SetColorLevelPacket&&) noexcept;
|
||||||
|
|
||||||
|
uint16_t packet_code() const;
|
||||||
|
uint16_t color_value_indicator() const;
|
||||||
|
uint16_t value_of_contour() const;
|
||||||
|
|
||||||
|
size_t data_size() const override;
|
||||||
|
|
||||||
|
bool Parse(std::istream& is) override;
|
||||||
|
|
||||||
|
static constexpr size_t SIZE = 6u;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::unique_ptr<SetColorLevelPacketImpl> p;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace rpg
|
||||||
|
} // namespace wsr88d
|
||||||
|
} // namespace scwx
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <scwx/wsr88d/rpg/packet.hpp>
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
namespace scwx
|
||||||
|
{
|
||||||
|
namespace wsr88d
|
||||||
|
{
|
||||||
|
namespace rpg
|
||||||
|
{
|
||||||
|
|
||||||
|
class UnlinkedContourVectorPacketImpl;
|
||||||
|
|
||||||
|
class UnlinkedContourVectorPacket : public Packet
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit UnlinkedContourVectorPacket();
|
||||||
|
~UnlinkedContourVectorPacket();
|
||||||
|
|
||||||
|
UnlinkedContourVectorPacket(const UnlinkedContourVectorPacket&) = delete;
|
||||||
|
UnlinkedContourVectorPacket&
|
||||||
|
operator=(const UnlinkedContourVectorPacket&) = delete;
|
||||||
|
|
||||||
|
UnlinkedContourVectorPacket(UnlinkedContourVectorPacket&&) noexcept;
|
||||||
|
UnlinkedContourVectorPacket&
|
||||||
|
operator=(UnlinkedContourVectorPacket&&) noexcept;
|
||||||
|
|
||||||
|
uint16_t packet_code() const;
|
||||||
|
uint16_t length_of_vectors() const;
|
||||||
|
|
||||||
|
size_t data_size() const override;
|
||||||
|
|
||||||
|
bool Parse(std::istream& is) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::unique_ptr<UnlinkedContourVectorPacketImpl> p;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace rpg
|
||||||
|
} // namespace wsr88d
|
||||||
|
} // namespace scwx
|
||||||
141
wxdata/source/scwx/wsr88d/rpg/linked_contour_vector_packet.cpp
Normal file
141
wxdata/source/scwx/wsr88d/rpg/linked_contour_vector_packet.cpp
Normal file
|
|
@ -0,0 +1,141 @@
|
||||||
|
#include <scwx/wsr88d/rpg/linked_contour_vector_packet.hpp>
|
||||||
|
|
||||||
|
#include <istream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <boost/log/trivial.hpp>
|
||||||
|
|
||||||
|
namespace scwx
|
||||||
|
{
|
||||||
|
namespace wsr88d
|
||||||
|
{
|
||||||
|
namespace rpg
|
||||||
|
{
|
||||||
|
|
||||||
|
static const std::string logPrefix_ =
|
||||||
|
"[scwx::wsr88d::rpg::linked_contour_vector_packet] ";
|
||||||
|
|
||||||
|
class LinkedContourVectorPacketImpl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit LinkedContourVectorPacketImpl() :
|
||||||
|
packetCode_ {},
|
||||||
|
initialPointIndicator_ {},
|
||||||
|
lengthOfVectors_ {},
|
||||||
|
startI_ {},
|
||||||
|
startJ_ {},
|
||||||
|
endI_ {},
|
||||||
|
endJ_ {} {};
|
||||||
|
~LinkedContourVectorPacketImpl() = default;
|
||||||
|
|
||||||
|
uint16_t packetCode_;
|
||||||
|
uint16_t initialPointIndicator_;
|
||||||
|
uint16_t lengthOfVectors_;
|
||||||
|
|
||||||
|
int16_t startI_;
|
||||||
|
int16_t startJ_;
|
||||||
|
std::vector<int16_t> endI_;
|
||||||
|
std::vector<int16_t> endJ_;
|
||||||
|
};
|
||||||
|
|
||||||
|
LinkedContourVectorPacket::LinkedContourVectorPacket() :
|
||||||
|
p(std::make_unique<LinkedContourVectorPacketImpl>())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
LinkedContourVectorPacket::~LinkedContourVectorPacket() = default;
|
||||||
|
|
||||||
|
LinkedContourVectorPacket::LinkedContourVectorPacket(
|
||||||
|
LinkedContourVectorPacket&&) noexcept = default;
|
||||||
|
LinkedContourVectorPacket& LinkedContourVectorPacket::operator=(
|
||||||
|
LinkedContourVectorPacket&&) noexcept = default;
|
||||||
|
|
||||||
|
uint16_t LinkedContourVectorPacket::packet_code() const
|
||||||
|
{
|
||||||
|
return p->packetCode_;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t LinkedContourVectorPacket::initial_point_indicator() const
|
||||||
|
{
|
||||||
|
return p->initialPointIndicator_;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t LinkedContourVectorPacket::length_of_vectors() const
|
||||||
|
{
|
||||||
|
return p->lengthOfVectors_;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t LinkedContourVectorPacket::data_size() const
|
||||||
|
{
|
||||||
|
return p->lengthOfVectors_ + 10u;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool LinkedContourVectorPacket::Parse(std::istream& is)
|
||||||
|
{
|
||||||
|
bool blockValid = true;
|
||||||
|
|
||||||
|
is.read(reinterpret_cast<char*>(&p->packetCode_), 2);
|
||||||
|
is.read(reinterpret_cast<char*>(&p->initialPointIndicator_), 2);
|
||||||
|
is.read(reinterpret_cast<char*>(&p->startI_), 2);
|
||||||
|
is.read(reinterpret_cast<char*>(&p->startJ_), 2);
|
||||||
|
is.read(reinterpret_cast<char*>(&p->lengthOfVectors_), 2);
|
||||||
|
|
||||||
|
p->packetCode_ = ntohs(p->packetCode_);
|
||||||
|
p->initialPointIndicator_ = ntohs(p->initialPointIndicator_);
|
||||||
|
p->startI_ = ntohs(p->startI_);
|
||||||
|
p->startJ_ = ntohs(p->startJ_);
|
||||||
|
p->lengthOfVectors_ = ntohs(p->lengthOfVectors_);
|
||||||
|
|
||||||
|
int vectorSize = static_cast<int>(p->lengthOfVectors_);
|
||||||
|
|
||||||
|
if (is.eof())
|
||||||
|
{
|
||||||
|
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
|
||||||
|
blockValid = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The number of vectors is equal to the size divided by the number of bytes
|
||||||
|
// in a vector coordinate
|
||||||
|
int vectorCount = vectorSize / 4;
|
||||||
|
int16_t endI;
|
||||||
|
int16_t endJ;
|
||||||
|
|
||||||
|
for (int v = 0; v < vectorCount && !is.eof(); v++)
|
||||||
|
{
|
||||||
|
is.read(reinterpret_cast<char*>(&endI), 2);
|
||||||
|
is.read(reinterpret_cast<char*>(&endJ), 2);
|
||||||
|
|
||||||
|
endI = ntohs(endI);
|
||||||
|
endJ = ntohs(endJ);
|
||||||
|
|
||||||
|
p->endI_.push_back(endI);
|
||||||
|
p->endJ_.push_back(endJ);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is.eof())
|
||||||
|
{
|
||||||
|
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
|
||||||
|
blockValid = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (p->packetCode_ != 0x0E03)
|
||||||
|
{
|
||||||
|
BOOST_LOG_TRIVIAL(warning)
|
||||||
|
<< logPrefix_ << "Invalid packet code: " << p->packetCode_;
|
||||||
|
blockValid = false;
|
||||||
|
}
|
||||||
|
if (p->initialPointIndicator_ != 0x8000)
|
||||||
|
{
|
||||||
|
BOOST_LOG_TRIVIAL(warning)
|
||||||
|
<< logPrefix_
|
||||||
|
<< "Invalid initial point indicator: " << p->initialPointIndicator_;
|
||||||
|
blockValid = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return blockValid;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace rpg
|
||||||
|
} // namespace wsr88d
|
||||||
|
} // namespace scwx
|
||||||
|
|
@ -32,10 +32,10 @@ public:
|
||||||
uint16_t lengthOfBlock_;
|
uint16_t lengthOfBlock_;
|
||||||
uint16_t valueOfVector_;
|
uint16_t valueOfVector_;
|
||||||
|
|
||||||
uint16_t startI_;
|
int16_t startI_;
|
||||||
uint16_t startJ_;
|
int16_t startJ_;
|
||||||
std::vector<uint16_t> endI_;
|
std::vector<int16_t> endI_;
|
||||||
std::vector<uint16_t> endJ_;
|
std::vector<int16_t> endJ_;
|
||||||
};
|
};
|
||||||
|
|
||||||
LinkedVectorPacket::LinkedVectorPacket() :
|
LinkedVectorPacket::LinkedVectorPacket() :
|
||||||
|
|
@ -109,8 +109,8 @@ bool LinkedVectorPacket::Parse(std::istream& is)
|
||||||
// The number of vectors is equal to the size divided by the number of bytes
|
// The number of vectors is equal to the size divided by the number of bytes
|
||||||
// in a vector coordinate
|
// in a vector coordinate
|
||||||
int vectorCount = vectorSize / 4;
|
int vectorCount = vectorSize / 4;
|
||||||
uint16_t endI;
|
int16_t endI;
|
||||||
uint16_t endJ;
|
int16_t endJ;
|
||||||
|
|
||||||
for (int v = 0; v < vectorCount && !is.eof(); v++)
|
for (int v = 0; v < vectorCount && !is.eof(); v++)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
100
wxdata/source/scwx/wsr88d/rpg/set_color_level_packet.cpp
Normal file
100
wxdata/source/scwx/wsr88d/rpg/set_color_level_packet.cpp
Normal file
|
|
@ -0,0 +1,100 @@
|
||||||
|
#include <scwx/wsr88d/rpg/set_color_level_packet.hpp>
|
||||||
|
|
||||||
|
#include <istream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <boost/log/trivial.hpp>
|
||||||
|
|
||||||
|
namespace scwx
|
||||||
|
{
|
||||||
|
namespace wsr88d
|
||||||
|
{
|
||||||
|
namespace rpg
|
||||||
|
{
|
||||||
|
|
||||||
|
static const std::string logPrefix_ =
|
||||||
|
"[scwx::wsr88d::rpg::set_color_level_packet] ";
|
||||||
|
|
||||||
|
class SetColorLevelPacketImpl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit SetColorLevelPacketImpl() :
|
||||||
|
packetCode_ {}, colorValueIndicator_ {}, valueOfContour_ {} {};
|
||||||
|
~SetColorLevelPacketImpl() = default;
|
||||||
|
|
||||||
|
uint16_t packetCode_;
|
||||||
|
uint16_t colorValueIndicator_;
|
||||||
|
uint16_t valueOfContour_;
|
||||||
|
};
|
||||||
|
|
||||||
|
SetColorLevelPacket::SetColorLevelPacket() :
|
||||||
|
p(std::make_unique<SetColorLevelPacketImpl>())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
SetColorLevelPacket::~SetColorLevelPacket() = default;
|
||||||
|
|
||||||
|
SetColorLevelPacket::SetColorLevelPacket(SetColorLevelPacket&&) noexcept =
|
||||||
|
default;
|
||||||
|
SetColorLevelPacket&
|
||||||
|
SetColorLevelPacket::operator=(SetColorLevelPacket&&) noexcept = default;
|
||||||
|
|
||||||
|
uint16_t SetColorLevelPacket::packet_code() const
|
||||||
|
{
|
||||||
|
return p->packetCode_;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t SetColorLevelPacket::color_value_indicator() const
|
||||||
|
{
|
||||||
|
return p->colorValueIndicator_;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t SetColorLevelPacket::value_of_contour() const
|
||||||
|
{
|
||||||
|
return p->valueOfContour_;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t SetColorLevelPacket::data_size() const
|
||||||
|
{
|
||||||
|
return SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SetColorLevelPacket::Parse(std::istream& is)
|
||||||
|
{
|
||||||
|
bool blockValid = true;
|
||||||
|
|
||||||
|
is.read(reinterpret_cast<char*>(&p->packetCode_), 2);
|
||||||
|
is.read(reinterpret_cast<char*>(&p->colorValueIndicator_), 2);
|
||||||
|
is.read(reinterpret_cast<char*>(&p->valueOfContour_), 2);
|
||||||
|
|
||||||
|
p->packetCode_ = ntohs(p->packetCode_);
|
||||||
|
p->colorValueIndicator_ = ntohs(p->colorValueIndicator_);
|
||||||
|
p->valueOfContour_ = ntohs(p->valueOfContour_);
|
||||||
|
|
||||||
|
if (is.eof())
|
||||||
|
{
|
||||||
|
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
|
||||||
|
blockValid = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (p->packetCode_ != 0x0802)
|
||||||
|
{
|
||||||
|
BOOST_LOG_TRIVIAL(warning)
|
||||||
|
<< logPrefix_ << "Invalid packet code: " << p->packetCode_;
|
||||||
|
blockValid = false;
|
||||||
|
}
|
||||||
|
if (p->colorValueIndicator_ != 0x0002)
|
||||||
|
{
|
||||||
|
BOOST_LOG_TRIVIAL(warning)
|
||||||
|
<< logPrefix_
|
||||||
|
<< "Invalid color value indicator: " << p->colorValueIndicator_;
|
||||||
|
blockValid = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return blockValid;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace rpg
|
||||||
|
} // namespace wsr88d
|
||||||
|
} // namespace scwx
|
||||||
125
wxdata/source/scwx/wsr88d/rpg/unlinked_contour_vector_packet.cpp
Normal file
125
wxdata/source/scwx/wsr88d/rpg/unlinked_contour_vector_packet.cpp
Normal file
|
|
@ -0,0 +1,125 @@
|
||||||
|
#include <scwx/wsr88d/rpg/unlinked_contour_vector_packet.hpp>
|
||||||
|
|
||||||
|
#include <istream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <boost/log/trivial.hpp>
|
||||||
|
|
||||||
|
namespace scwx
|
||||||
|
{
|
||||||
|
namespace wsr88d
|
||||||
|
{
|
||||||
|
namespace rpg
|
||||||
|
{
|
||||||
|
|
||||||
|
static const std::string logPrefix_ =
|
||||||
|
"[scwx::wsr88d::rpg::unlinked_contour_vector_packet] ";
|
||||||
|
|
||||||
|
class UnlinkedContourVectorPacketImpl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit UnlinkedContourVectorPacketImpl() :
|
||||||
|
packetCode_ {},
|
||||||
|
lengthOfVectors_ {},
|
||||||
|
beginI_ {},
|
||||||
|
beginJ_ {},
|
||||||
|
endI_ {},
|
||||||
|
endJ_ {} {};
|
||||||
|
~UnlinkedContourVectorPacketImpl() = default;
|
||||||
|
|
||||||
|
uint16_t packetCode_;
|
||||||
|
uint16_t lengthOfVectors_;
|
||||||
|
uint16_t valueOfVector_;
|
||||||
|
|
||||||
|
std::vector<int16_t> beginI_;
|
||||||
|
std::vector<int16_t> beginJ_;
|
||||||
|
std::vector<int16_t> endI_;
|
||||||
|
std::vector<int16_t> endJ_;
|
||||||
|
};
|
||||||
|
|
||||||
|
UnlinkedContourVectorPacket::UnlinkedContourVectorPacket() :
|
||||||
|
p(std::make_unique<UnlinkedContourVectorPacketImpl>())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
UnlinkedContourVectorPacket::~UnlinkedContourVectorPacket() = default;
|
||||||
|
|
||||||
|
UnlinkedContourVectorPacket::UnlinkedContourVectorPacket(
|
||||||
|
UnlinkedContourVectorPacket&&) noexcept = default;
|
||||||
|
UnlinkedContourVectorPacket& UnlinkedContourVectorPacket::operator=(
|
||||||
|
UnlinkedContourVectorPacket&&) noexcept = default;
|
||||||
|
|
||||||
|
uint16_t UnlinkedContourVectorPacket::packet_code() const
|
||||||
|
{
|
||||||
|
return p->packetCode_;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t UnlinkedContourVectorPacket::length_of_vectors() const
|
||||||
|
{
|
||||||
|
return p->lengthOfVectors_ + 4u;
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t UnlinkedContourVectorPacket::data_size() const
|
||||||
|
{
|
||||||
|
return p->lengthOfVectors_ + 4u;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UnlinkedContourVectorPacket::Parse(std::istream& is)
|
||||||
|
{
|
||||||
|
bool blockValid = true;
|
||||||
|
|
||||||
|
is.read(reinterpret_cast<char*>(&p->packetCode_), 2);
|
||||||
|
is.read(reinterpret_cast<char*>(&p->lengthOfVectors_), 2);
|
||||||
|
|
||||||
|
p->packetCode_ = ntohs(p->packetCode_);
|
||||||
|
p->lengthOfVectors_ = ntohs(p->lengthOfVectors_);
|
||||||
|
|
||||||
|
int vectorSize = static_cast<int>(p->lengthOfVectors_);
|
||||||
|
|
||||||
|
// The number of vectors is equal to the size divided by the number of bytes
|
||||||
|
// in a vector
|
||||||
|
int vectorCount = vectorSize / 8;
|
||||||
|
int16_t beginI;
|
||||||
|
int16_t beginJ;
|
||||||
|
int16_t endI;
|
||||||
|
int16_t endJ;
|
||||||
|
|
||||||
|
for (int v = 0; v < vectorCount && !is.eof(); v++)
|
||||||
|
{
|
||||||
|
is.read(reinterpret_cast<char*>(&beginI), 2);
|
||||||
|
is.read(reinterpret_cast<char*>(&beginJ), 2);
|
||||||
|
is.read(reinterpret_cast<char*>(&endI), 2);
|
||||||
|
is.read(reinterpret_cast<char*>(&endJ), 2);
|
||||||
|
|
||||||
|
beginI = ntohs(beginI);
|
||||||
|
beginJ = ntohs(beginJ);
|
||||||
|
endI = ntohs(endI);
|
||||||
|
endJ = ntohs(endJ);
|
||||||
|
|
||||||
|
p->beginI_.push_back(beginI);
|
||||||
|
p->beginJ_.push_back(beginJ);
|
||||||
|
p->endI_.push_back(endI);
|
||||||
|
p->endJ_.push_back(endJ);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is.eof())
|
||||||
|
{
|
||||||
|
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
|
||||||
|
blockValid = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (p->packetCode_ != 0x3501)
|
||||||
|
{
|
||||||
|
BOOST_LOG_TRIVIAL(warning)
|
||||||
|
<< logPrefix_ << "Invalid packet code: " << p->packetCode_;
|
||||||
|
blockValid = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return blockValid;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace rpg
|
||||||
|
} // namespace wsr88d
|
||||||
|
} // namespace scwx
|
||||||
|
|
@ -32,10 +32,10 @@ public:
|
||||||
uint16_t lengthOfBlock_;
|
uint16_t lengthOfBlock_;
|
||||||
uint16_t valueOfVector_;
|
uint16_t valueOfVector_;
|
||||||
|
|
||||||
std::vector<uint16_t> beginI_;
|
std::vector<int16_t> beginI_;
|
||||||
std::vector<uint16_t> beginJ_;
|
std::vector<int16_t> beginJ_;
|
||||||
std::vector<uint16_t> endI_;
|
std::vector<int16_t> endI_;
|
||||||
std::vector<uint16_t> endJ_;
|
std::vector<int16_t> endJ_;
|
||||||
};
|
};
|
||||||
|
|
||||||
UnlinkedVectorPacket::UnlinkedVectorPacket() :
|
UnlinkedVectorPacket::UnlinkedVectorPacket() :
|
||||||
|
|
@ -104,10 +104,10 @@ bool UnlinkedVectorPacket::Parse(std::istream& is)
|
||||||
// The number of vectors is equal to the size divided by the number of bytes
|
// The number of vectors is equal to the size divided by the number of bytes
|
||||||
// in a vector
|
// in a vector
|
||||||
int vectorCount = vectorSize / 8;
|
int vectorCount = vectorSize / 8;
|
||||||
uint16_t beginI;
|
int16_t beginI;
|
||||||
uint16_t beginJ;
|
int16_t beginJ;
|
||||||
uint16_t endI;
|
int16_t endI;
|
||||||
uint16_t endJ;
|
int16_t endJ;
|
||||||
|
|
||||||
for (int v = 0; v < vectorCount && !is.eof(); v++)
|
for (int v = 0; v < vectorCount && !is.eof(); v++)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue