Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/zone.cc')
-rw-r--r--src/core/zone.cc20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/core/zone.cc b/src/core/zone.cc
index 8c74457..f33fc60 100644
--- a/src/core/zone.cc
+++ b/src/core/zone.cc
@@ -116,7 +116,9 @@ void Zone ::clear()
}
/* ---- class Zone ------------------------------------------------- */
-Zone::Zone(std::string const & label) : Label(label)
+Zone::Zone(std::string const & label) :
+ Label(label),
+ zone_ambient_color(1.0f, 1.0f, 1.0f)
{
zone_id = 0;
zone_defaultview = 0;
@@ -134,7 +136,9 @@ Zone::Zone(std::string const & label) : Label(label)
}
-Zone::Zone(std::istream & is) : Label()
+Zone::Zone(std::istream & is) :
+ Label(),
+ zone_ambient_color(1.0f, 1.0f, 1.0f)
{
zone_id = 0;
zone_defaultview = 0;
@@ -262,6 +266,9 @@ void Zone::serialize_server_update(std::ostream & os) const
os << label() << " ";
os << "\"" << name() << "\" ";
os << "\"" << zone_sky << "\" ";
+ os << zone_ambient_color.r << " ";
+ os << zone_ambient_color.g << " ";
+ os << zone_ambient_color.b << " ";
os << (zone_defaultview ? zone_defaultview->id() : 0);
}
@@ -269,25 +276,34 @@ void Zone::serialize_server_update(std::ostream & os) const
void Zone::receive_server_update(std::istream &is)
{
unsigned int id = 0;
+ float r = 1.0f, g = 1.0f, b = 1.0f;
std::string n;
char c;
+ // zone label
is >> n;
set_label(n);
n.clear();
+ // zone name
while ((is.get(c)) && (c != '"'));
while ((is.get(c)) && (c != '"'))
n += c;
set_name(n);
n.clear();
+ // sky name
while ((is.get(c)) && (c != '"'));
while ((is.get(c)) && (c != '"'))
n += c;
zone_sky.assign(n);
n.clear();
+ // ambient light color
+ is >> r >> g >> b;
+ zone_ambient_color.assign(r, g, b);
+
+ // default view
is >> id;
zone_defaultview = Entity::find(id);
}