From d763e294f44eb38b94bf7e2055b77a982b72b7c0 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 16 Aug 2009 17:34:00 +0000 Subject: more constness --- src/client/chat.cc | 8 ++++---- src/client/hud.cc | 18 +++++++++--------- src/client/infowidget.cc | 6 +++--- src/client/map.cc | 42 +++++++++++++++++++++--------------------- src/client/notifications.cc | 6 +++--- src/client/soundext.cc | 2 +- 6 files changed, 41 insertions(+), 41 deletions(-) (limited to 'src/client') diff --git a/src/client/chat.cc b/src/client/chat.cc index 93ba4b0..137e6b1 100644 --- a/src/client/chat.cc +++ b/src/client/chat.cc @@ -183,14 +183,14 @@ void Chat::resize() const float margin = 8.0f; math::Vector2f s(size()); - s.x -= margin*2; - s.y -= margin*2; + s[0] -= margin*2; + s[1] -= margin*2; chat_scrollpane->set_location(margin, margin); - chat_scrollpane->set_size(s.x, s.y - font()->height() *1.5f); + chat_scrollpane->set_size(s.width(), s.height() - font()->height() *1.5f); chat_input->set_location(margin, height() - font()->height() - margin); - chat_input->set_size(s.x, font()->height()); + chat_input->set_size(s.width(), font()->height()); } diff --git a/src/client/hud.cc b/src/client/hud.cc index 102c445..662bbe8 100644 --- a/src/client/hud.cc +++ b/src/client/hud.cc @@ -50,19 +50,19 @@ void HUD::draw_offscreen_target(core::Entity *entity, bool is_active_target) float cx = 0; float cy = 0; - if ( target.y*target.y + target.z*target.z < 0.0001 ) { + if ( target.y() * target.y() + target.z() * target.z() < 0.0001 ) { // X - bound, behind (front is visible) cx = 0.0f; cy = -0.5f; - } else if (fabs(target.y) > fabs(target.z)) { + } else if (fabs(target.y()) > fabs(target.z())) { // Y-bound - cx = math::sgnf(target.y) * 0.5f; - cy = 0.5f * target.z / fabs(target.y); + cx = math::sgnf(target.y()) * 0.5f; + cy = 0.5f * target.z() / fabs(target.y()); } else { // Z-bound - cx = 0.5f * target.y / fabs(target.z); - cy = math::sgnf(target.z) * 0.5f; + cx = 0.5f * target.y() / fabs(target.z()); + cy = math::sgnf(target.z()) * 0.5f; } const float r = 16; @@ -117,11 +117,11 @@ void HUD::draw_target(core::Entity *entity, bool is_active_target) target = render::Camera::axis().transpose() * target; // calculate the intersection between the line (0,0,0)-target and the frustum front - float t = (render::FRUSTUMFRONT + 0.001f) / target.x; + float t = (render::FRUSTUMFRONT + 0.001f) / target.x(); Vector3f center(target *t); - float cx = render::State::width() * (0.5 - center.y); - float cy = render::State::height() * (0.5 - center.z * render::State::aspect()); + float cx = render::State::width() * (0.5 - center.y()); + float cy = render::State::height() * (0.5 - center.z() * render::State::aspect()); if ((cx < 0 ) || (cy < 0) || (cx > render::State::width()) || (cy > render::State::height())) { draw_offscreen_target(entity, is_active_target); diff --git a/src/client/infowidget.cc b/src/client/infowidget.cc index fd3de11..b30dfd7 100644 --- a/src/client/infowidget.cc +++ b/src/client/infowidget.cc @@ -58,9 +58,9 @@ void DevInfoWidget::draw() if (core::localcontrol()) { textstream << std::fixed << std::setprecision(2) - << "^Nx ^B" << core::localcontrol()->location().x << " " - << "^Ny ^B" << core::localcontrol()->location().y << " " - << "^Nz ^B" << core::localcontrol()->location().z << '\n'; + << "^Nx ^B" << core::localcontrol()->location().x() << " " + << "^Ny ^B" << core::localcontrol()->location().y() << " " + << "^Nz ^B" << core::localcontrol()->location().z() << '\n'; textstream << "^Nthurst ^B" << core::localcontrol()->thrust() << " " << "^Nspeed ^B" << core::localcontrol()->speed() << '\n'; diff --git a/src/client/map.cc b/src/client/map.cc index a2a353a..46ac583 100644 --- a/src/client/map.cc +++ b/src/client/map.cc @@ -83,19 +83,19 @@ void Map::draw() math::Vector2f v(global_location()); math::Vector2f l; - v.x += margin; - v.y += (height() - s - 2.0f * margin) * 0.5f; + v[0] += margin; + v[1] += (height() - s - 2.0f * margin) * 0.5f; map_hover = 0; gl::color(0,0,blue); gl::begin(gl::Lines); for (int i=0; i <= gridsize; i++) { - gl::vertex(v.x, v.y + s / gridsize * i); - gl::vertex(v.x + s, v.y + s / gridsize * i); + gl::vertex(v.x(), v.y() + s / gridsize * i); + gl::vertex(v.x() + s, v.y() + s / gridsize * i); - gl::vertex(v.x + s / gridsize * i, v.y); - gl::vertex(v.x + s / gridsize * i, v.y+s); + gl::vertex(v.x() + s / gridsize * i, v.y()); + gl::vertex(v.x() + s / gridsize * i, v.y() + s); } gl::end(); @@ -105,8 +105,8 @@ void Map::draw() size_t texture_current = render::Textures::bind(texture_entity); - v.x += s * 0.5f; - v.y += s * 0.5f; + v[0] += s * 0.5f; + v[0] += s * 0.5f; core::Zone *zone = core::localplayer()->zone(); @@ -128,8 +128,8 @@ void Map::draw() if (targets::is_valid_map_target(entity)) { draw_icon = true; - l.x -= s / scale * entity->location().y; - l.y -= s / scale * entity->location().x; + l[0] -= s / scale * entity->location().y(); + l[1] -= s / scale * entity->location().x(); if (math::distancesquared(cursor, l) < (r*r)) { map_hover = entity->id(); @@ -175,16 +175,16 @@ void Map::draw() gl::color(color); glTexCoord2f(0.0f, 0.0f); - gl::vertex(l.x-r, l.y-r); + gl::vertex(l.x() - r, l.y() - r); glTexCoord2f(1.0f, 0.0f); - gl::vertex(l.x+r, l.y-r); + gl::vertex(l.x() + r, l.y() - r); glTexCoord2f(1.0f, 1.0f); - gl::vertex(l.x+r, l.y+r); + gl::vertex(l.x() + r, l.y() + r); glTexCoord2f(0.0f, 1.0f); - gl::vertex(l.x-r, l.y+r); + gl::vertex(l.x() - r, l.y() + r); } } @@ -194,8 +194,8 @@ void Map::draw() //if (core::localcontrol()->state() != core::Entity::Docked) { l.assign(v); - l.x -= s / scale * entity->location().y; - l.y -= s / scale * entity->location().x; + l[0] -= s / scale * entity->location().y(); + l[1] -= s / scale * entity->location().x(); if (core::application()->time() - floorf(core::application()->time()) < 0.5f) { if (texture_current != texture_entity) { gl::end(); @@ -207,16 +207,16 @@ void Map::draw() color.a = 1.0f; gl::color(color); glTexCoord2f(0.0f, 0.0f); - gl::vertex(l.x-r, l.y-r); - + gl::vertex(l.x() - r, l.y() - r); + glTexCoord2f(1.0f, 0.0f); - gl::vertex(l.x+r, l.y-r); + gl::vertex(l.x() + r, l.y() - r); glTexCoord2f(1.0f, 1.0f); - gl::vertex(l.x+r, l.y+r); + gl::vertex(l.x() + r, l.y() + r); glTexCoord2f(0.0f, 1.0f); - gl::vertex(l.x-r, l.y+r); + gl::vertex(l.x() - r, l.y() + r); } //} diff --git a/src/client/notifications.cc b/src/client/notifications.cc index 25cbe0b..062aacb 100644 --- a/src/client/notifications.cc +++ b/src/client/notifications.cc @@ -58,11 +58,11 @@ void Notifications::draw() const float margin = ui::UI::elementmargin; math::Vector2f s(size()); - s.x -= margin*2; - s.y -= margin*2; + s[0] -= margin*2; + s[1] -= margin*2; notify_scrollpane->set_location(margin, margin); - notify_scrollpane->set_size(s.x, s.y ); + notify_scrollpane->set_size(s.x(), s.y() ); } diff --git a/src/client/soundext.cc b/src/client/soundext.cc index dda3a98..40b9417 100644 --- a/src/client/soundext.cc +++ b/src/client/soundext.cc @@ -98,7 +98,7 @@ void SoundExt::frame(float elapsed) float speed = entity->speed(); float pitch = 1.0f; float gain = 0.0; - float r = ( entity->model() ? entity->model()->maxbbox().x : entity->radius()); + float r = ( entity->model() ? entity->model()->maxbbox().x() : entity->radius()); if (entity->state() == core::Entity::Impulse) { pitch = 1.0f; -- cgit v1.2.3