mirror of
https://github.com/edubart/otclient.git
synced 2025-04-29 17:19:20 +02:00
Fix std::istream::streampos deprecation warning (#1154)
This commit is contained in:
parent
e0d5b7d7fd
commit
1d614e294c
@ -126,23 +126,21 @@ private:
|
|||||||
|
|
||||||
inline std::ostream& operator<<(std::ostream& out, const Color& color)
|
inline std::ostream& operator<<(std::ostream& out, const Color& color)
|
||||||
{
|
{
|
||||||
using namespace std;
|
return out << '#'
|
||||||
out << "#" << hex << setfill('0')
|
<< std::hex << std::setfill('0')
|
||||||
<< setw(2) << (int)color.r()
|
<< std::setw(2) << (int)color.r()
|
||||||
<< setw(2) << (int)color.g()
|
<< std::setw(2) << (int)color.g()
|
||||||
<< setw(2) << (int)color.b()
|
<< std::setw(2) << (int)color.b()
|
||||||
<< setw(2) << (int)color.a();
|
<< std::setw(2) << (int)color.a()
|
||||||
out << dec << setfill(' ');
|
<< std::dec << std::setfill(' ');
|
||||||
return out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::istream& operator>>(std::istream& in, Color& color)
|
inline std::istream& operator>>(std::istream& in, Color& color)
|
||||||
{
|
{
|
||||||
using namespace std;
|
|
||||||
std::string tmp;
|
std::string tmp;
|
||||||
|
|
||||||
if(in.get() == '#') {
|
if(in.peek() == '#') {
|
||||||
in >> tmp;
|
in.ignore() >> tmp;
|
||||||
|
|
||||||
if(tmp.length() == 6 || tmp.length() == 8) {
|
if(tmp.length() == 6 || tmp.length() == 8) {
|
||||||
color.setRed((uint8)stdext::hex_to_dec(tmp.substr(0, 2)));
|
color.setRed((uint8)stdext::hex_to_dec(tmp.substr(0, 2)));
|
||||||
@ -152,10 +150,10 @@ inline std::istream& operator>>(std::istream& in, Color& color)
|
|||||||
color.setAlpha((uint8)stdext::hex_to_dec(tmp.substr(6, 2)));
|
color.setAlpha((uint8)stdext::hex_to_dec(tmp.substr(6, 2)));
|
||||||
else
|
else
|
||||||
color.setAlpha(255);
|
color.setAlpha(255);
|
||||||
} else
|
} else {
|
||||||
in.seekg(-(std::istream::streampos)tmp.length()-1, ios_base::cur);
|
in.seekg(-tmp.length()-1, std::ios_base::cur);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
in.unget();
|
|
||||||
in >> tmp;
|
in >> tmp;
|
||||||
|
|
||||||
if(tmp == "alpha") {
|
if(tmp == "alpha") {
|
||||||
@ -197,7 +195,7 @@ inline std::istream& operator>>(std::istream& in, Color& color)
|
|||||||
} else if(tmp == "orange") {
|
} else if(tmp == "orange") {
|
||||||
color = Color::orange;
|
color = Color::orange;
|
||||||
} else {
|
} else {
|
||||||
in.seekg(-tmp.length(), ios_base::cur);
|
in.seekg(-tmp.length(), std::ios_base::cur);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return in;
|
return in;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user