X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fsupertux%2Fsector.cpp;h=519a2f4c8f2c56d505d97009ff66e7d4e44954f9;hb=04270f0886aa08cb8fee7dba58d41975ddb1cb72;hp=cffda6b0e1f079a49e0d12568a2fb1e78f02e6dc;hpb=dda6e795fbeada433c96f4f4b947848e15c86a39;p=supertux.git diff --git a/src/supertux/sector.cpp b/src/supertux/sector.cpp index cffda6b0e..519a2f4c8 100644 --- a/src/supertux/sector.cpp +++ b/src/supertux/sector.cpp @@ -45,7 +45,8 @@ #include "object/snow_particle_system.hpp" #include "object/text_object.hpp" #include "object/tilemap.hpp" -#include "physfs/ifile_stream.hpp" +#include "physfs/ifile_streambuf.hpp" +#include "scripting/scripting.hpp" #include "scripting/squirrel_util.hpp" #include "supertux/collision.hpp" #include "supertux/constants.hpp" @@ -54,23 +55,19 @@ #include "supertux/level.hpp" #include "supertux/object_factory.hpp" #include "supertux/player_status.hpp" +#include "supertux/savegame.hpp" #include "supertux/spawn_point.hpp" #include "supertux/tile.hpp" #include "trigger/sequence_trigger.hpp" #include "util/file_system.hpp" -#define DEFORM_BOTTOM AATriangle::DEFORM1 -#define DEFORM_TOP AATriangle::DEFORM2 -#define DEFORM_LEFT AATriangle::DEFORM3 -#define DEFORM_RIGHT AATriangle::DEFORM4 - Sector* Sector::_current = 0; bool Sector::show_collrects = false; bool Sector::draw_solids_only = false; Sector::Sector(Level* parent) : - level(parent), + level(parent), name(), bullets(), init_script(), @@ -78,23 +75,23 @@ Sector::Sector(Level* parent) : currentmusic(LEVEL_MUSIC), sector_table(), scripts(), - ambient_light( 1.0f, 1.0f, 1.0f, 1.0f ), + ambient_light( 1.0f, 1.0f, 1.0f, 1.0f ), gameobjects(), moving_objects(), spawnpoints(), portables(), music(), - gravity(10.0), - player(0), + gravity(10.0), + player(0), solid_tilemaps(), - camera(0), + camera(0), effect(0) { - add_object(new Player(GameSession::current()->get_player_status(), "Tux")); + add_object(new Player(GameSession::current()->get_savegame().get_player_status(), "Tux")); add_object(new DisplayEffect("Effect")); add_object(new TextObject("Text")); - sound_manager->preload("sounds/shoot.wav"); + SoundManager::current()->preload("sounds/shoot.wav"); // create a new squirrel table for the sector using namespace scripting; @@ -149,37 +146,37 @@ Sector::get_level() } GameObject* -Sector::parse_object(const std::string& name, const Reader& reader) +Sector::parse_object(const std::string& name_, const Reader& reader) { - if(name == "camera") { - Camera* camera = new Camera(this, "Camera"); - camera->parse(reader); - return camera; - } else if(name == "particles-snow") { + if(name_ == "camera") { + Camera* camera_ = new Camera(this, "Camera"); + camera_->parse(reader); + return camera_; + } else if(name_ == "particles-snow") { SnowParticleSystem* partsys = new SnowParticleSystem(); partsys->parse(reader); return partsys; - } else if(name == "particles-rain") { + } else if(name_ == "particles-rain") { RainParticleSystem* partsys = new RainParticleSystem(); partsys->parse(reader); return partsys; - } else if(name == "particles-comets") { + } else if(name_ == "particles-comets") { CometParticleSystem* partsys = new CometParticleSystem(); partsys->parse(reader); return partsys; - } else if(name == "particles-ghosts") { + } else if(name_ == "particles-ghosts") { GhostParticleSystem* partsys = new GhostParticleSystem(); partsys->parse(reader); return partsys; - } else if(name == "particles-clouds") { + } else if(name_ == "particles-clouds") { CloudParticleSystem* partsys = new CloudParticleSystem(); partsys->parse(reader); return partsys; - } else if(name == "money") { // for compatibility with old maps + } else if(name_ == "money") { // for compatibility with old maps return new Jumpy(reader); } else { try { - return ObjectFactory::instance().create(name, reader); + return ObjectFactory::instance().create(name_, reader); } catch(std::exception& e) { log_warning << e.what() << "" << std::endl; return 0; @@ -234,7 +231,7 @@ Sector::parse(const Reader& sector) update_game_objects(); - if(solid_tilemaps.size() < 1) log_warning << "sector '" << name << "' does not contain a solid tile layer." << std::endl; + if(solid_tilemaps.size() < 1) { log_warning << "sector '" << name << "' does not contain a solid tile layer." << std::endl; } fix_old_tiles(); if(!camera) { @@ -394,12 +391,12 @@ Sector::parse_old_format(const Reader& reader) } // add a camera - Camera* camera = new Camera(this, "Camera"); - add_object(camera); + Camera* camera_ = new Camera(this, "Camera"); + add_object(camera_); update_game_objects(); - if(solid_tilemaps.size() < 1) log_warning << "sector '" << name << "' does not contain a solid tile layer." << std::endl; + if(solid_tilemaps.size() < 1) { log_warning << "sector '" << name << "' does not contain a solid tile layer." << std::endl; } fix_old_tiles(); update_game_objects(); @@ -420,13 +417,20 @@ Sector::fix_old_tiles() add_object(new InvisibleBlock(pos)); solids->change(x, y, 0); } else if(tile->getAttributes() & Tile::COIN) { - add_object(new Coin(pos)); + add_object(new Coin(pos, solids)); solids->change(x, y, 0); } else if(tile->getAttributes() & Tile::FULLBOX) { add_object(new BonusBlock(pos, tile->getData())); solids->change(x, y, 0); } else if(tile->getAttributes() & Tile::BRICK) { - add_object(new Brick(pos, tile->getData())); + if( ( id == 78 ) || ( id == 105 ) ){ + add_object( new Brick(pos, tile->getData(), "images/objects/bonus_block/brickIce.sprite") ); + } else if( ( id == 77 ) || ( id == 104 ) ){ + add_object( new Brick(pos, tile->getData(), "images/objects/bonus_block/brick.sprite") ); + } else { + log_warning << "attribute 'brick #t' is not supported for tile-id " << id << std::endl; + add_object( new Brick(pos, tile->getData(), "images/objects/bonus_block/brick.sprite") ); + } solids->change(x, y, 0); } else if(tile->getAttributes() & Tile::GOAL) { std::string sequence = tile->getData() == 0 ? "endsequence" : "stoptux"; @@ -599,7 +603,13 @@ Sector::activate(const Vector& player_pos) } } + //FIXME: This is a really dirty workaround for this strange camera jump + player->move(player->get_pos()+Vector(-32, 0)); camera->reset(player->get_pos()); + camera->update(1); + player->move(player->get_pos()+(Vector(32, 0))); + camera->update(1); + update_game_objects(); //Run default.nut just before init script @@ -607,7 +617,8 @@ Sector::activate(const Vector& player_pos) std::string basedir = FileSystem::dirname(get_level()->filename); if(PHYSFS_exists((basedir + "/info").c_str())) { try { - IFileStream in(basedir + "/default.nut"); + IFileStreambuf ins(basedir + "/default.nut"); + std::istream in(&ins); run_script(in, "default.nut"); } catch(std::exception& ) { // doesn't exist or erroneous; do nothing @@ -741,31 +752,31 @@ Sector::before_object_add(GameObject* object) solid_tilemaps.push_back(tilemap); } - Camera* camera = dynamic_cast (object); - if(camera != NULL) { + Camera* camera_ = dynamic_cast (object); + if(camera_ != NULL) { if(this->camera != 0) { log_warning << "Multiple cameras added. Ignoring" << std::endl; return false; } - this->camera = camera; + this->camera = camera_; } - Player* player = dynamic_cast (object); - if(player != NULL) { + Player* player_ = dynamic_cast (object); + if(player_ != NULL) { if(this->player != 0) { log_warning << "Multiple players added. Ignoring" << std::endl; return false; } - this->player = player; + this->player = player_; } - DisplayEffect* effect = dynamic_cast (object); - if(effect != NULL) { + DisplayEffect* effect_ = dynamic_cast (object); + if(effect_ != NULL) { if(this->effect != 0) { log_warning << "Multiple DisplayEffects added. Ignoring" << std::endl; return false; } - this->effect = effect; + this->effect = effect_; } if(_current == this) { @@ -962,293 +973,6 @@ void check_collisions(collision::Constraints* constraints, } } -/* Returns zero if a unisolid tile is non-solid due to the movement direction, - * non-zero if the tile is solid due to direction. */ -int check_movement_unisolid (Vector movement, const Tile* tile) -{ - int slope_info; - double mv_x; - double mv_y; - double mv_tan; - double slope_tan; - -#define MV_NON_SOLID 0 -#define MV_SOLID 1 - - /* If the tile is not a slope, this is very easy. */ - if ((tile->getAttributes() & Tile::SLOPE) == 0) - { - if (movement.y >= 0) /* moving down */ - return MV_SOLID; - else /* moving up */ - return MV_NON_SOLID; - } - - /* Initialize mv_x and mv_y. Depending on the slope the axis are inverted so - * that we can always use the "SOUTHEAST" case of the slope. The southeast - * case is the following: - * . - * /! - * / ! - * +--+ - */ - mv_x = (double) movement.x; - mv_y = (double) movement.y; - - slope_info = tile->getData(); - switch (slope_info & AATriangle::DIRECTION_MASK) - { - case AATriangle::SOUTHEAST: /* . */ - /* do nothing */ /* /! */ - break; /* / ! */ - /* +--+ */ - case AATriangle::SOUTHWEST: /* . */ - mv_x *= (-1.0); /* !\ */ - break; /* ! \ */ - /* +--+ */ - case AATriangle::NORTHEAST: /* +--+ */ - mv_y *= (-1.0); /* \ ! */ - break; /* \! */ - /* ' */ - case AATriangle::NORTHWEST: /* +--+ */ - mv_x *= (-1.0); /* ! / */ - mv_y *= (-1.0); /* !/ */ - break; /* ' */ - } /* switch (slope_info & DIRECTION_MASK) */ - - /* Handle the easy cases first */ - /* If we're moving to the right and down, then the slope is solid. */ - if ((mv_x >= 0.0) && (mv_y >= 0.0)) /* 4th quadrant */ - return MV_SOLID; - /* If we're moving to the left and up, then the slope is not solid. */ - else if ((mv_x <= 0.0) && (mv_y <= 0.0)) /* 2nd quadrant */ - return MV_NON_SOLID; - - /* The pure up-down and left-right movements have already been handled. */ - assert (mv_x != 0.0); - assert (mv_y != 0.0); - - /* calculate tangent of movement */ - mv_tan = (-1.0) * mv_y / mv_x; - - /* determine tangent of the slope */ - slope_tan = 1.0; - if (((slope_info & AATriangle::DEFORM_MASK) == DEFORM_BOTTOM) - || ((slope_info & AATriangle::DEFORM_MASK) == DEFORM_TOP)) - slope_tan = 0.5; /* ~= 26.6 deg */ - else if (((slope_info & AATriangle::DEFORM_MASK) == DEFORM_LEFT) - || ((slope_info & AATriangle::DEFORM_MASK) == DEFORM_RIGHT)) - slope_tan = 2.0; /* ~= 63.4 deg */ - - /* up and right */ - if (mv_x > 0.0) /* 1st quadrant */ - { - assert (mv_y < 0.0); - if (mv_tan <= slope_tan) - return MV_SOLID; - else - return MV_NON_SOLID; - } - /* down and left */ - else if (mv_x < 0.0) /* 3rd quadrant */ - { - assert (mv_y > 0.0); - if (mv_tan >= slope_tan) - return MV_SOLID; - else - return MV_NON_SOLID; - } - - assert (1 != 1); - return (-1); - -#undef MV_NON_SOLID -#undef MV_SOLID -} /* int check_movement_unisolid */ - -int is_above_line (float l_x, float l_y, float m, - float p_x, float p_y) -{ - float interp_y = (l_y + (m * (p_x - l_x))); - if (interp_y == p_y) - return (1); - else if (interp_y > p_y) - return (1); - else - return (0); -} - -int is_below_line (float l_x, float l_y, float m, - float p_x, float p_y) -{ - if (is_above_line (l_x, l_y, m, p_x, p_y)) - return (0); - else - return (1); -} - -int check_position_unisolid (const Rectf& obj_bbox, - const Rectf& tile_bbox, - const Tile* tile) -{ - int slope_info; - float tile_x; - float tile_y; - float gradient; - float delta_x; - float delta_y; - float obj_x; - float obj_y; - -#define POS_NON_SOLID 0 -#define POS_SOLID 1 - - /* If this is not a slope, this is - again - easy */ - if ((tile->getAttributes() & Tile::SLOPE) == 0) - { - if ((obj_bbox.get_bottom () - SHIFT_DELTA) <= tile_bbox.get_top ()) - return POS_SOLID; - else - return POS_NON_SOLID; - } - - /* There are 20 different cases. For each case, calculate a line that - * describes the slope's surface. The line is defined by x, y, and m, the - * gradient. */ - slope_info = tile->getData(); - switch (slope_info - & (AATriangle::DIRECTION_MASK | AATriangle::DEFORM_MASK)) - { - case AATriangle::SOUTHWEST: - case AATriangle::SOUTHWEST | DEFORM_TOP: - case AATriangle::SOUTHWEST | DEFORM_LEFT: - case AATriangle::NORTHEAST: - case AATriangle::NORTHEAST | DEFORM_TOP: - case AATriangle::NORTHEAST | DEFORM_LEFT: - tile_x = tile_bbox.get_left (); - tile_y = tile_bbox.get_top (); - gradient = 1.0; - break; - - case AATriangle::SOUTHEAST: - case AATriangle::SOUTHEAST | DEFORM_TOP: - case AATriangle::SOUTHEAST | DEFORM_RIGHT: - case AATriangle::NORTHWEST: - case AATriangle::NORTHWEST | DEFORM_TOP: - case AATriangle::NORTHWEST | DEFORM_RIGHT: - tile_x = tile_bbox.get_right (); - tile_y = tile_bbox.get_top (); - gradient = -1.0; - break; - - case AATriangle::SOUTHEAST | DEFORM_BOTTOM: - case AATriangle::SOUTHEAST | DEFORM_LEFT: - case AATriangle::NORTHWEST | DEFORM_BOTTOM: - case AATriangle::NORTHWEST | DEFORM_LEFT: - tile_x = tile_bbox.get_left (); - tile_y = tile_bbox.get_bottom (); - gradient = -1.0; - break; - - case AATriangle::SOUTHWEST | DEFORM_BOTTOM: - case AATriangle::SOUTHWEST | DEFORM_RIGHT: - case AATriangle::NORTHEAST | DEFORM_BOTTOM: - case AATriangle::NORTHEAST | DEFORM_RIGHT: - tile_x = tile_bbox.get_right (); - tile_y = tile_bbox.get_bottom (); - gradient = 1.0; - break; - - default: - assert (23 == 42); - return POS_NON_SOLID; - } - - /* delta_x, delta_y: Gradient aware version of SHIFT_DELTA. Here, we set the - * sign of the values only. Also, we determine here which corner of the - * object's bounding box is the interesting one for us. */ - delta_x = 1.0 * SHIFT_DELTA; - delta_y = 1.0 * SHIFT_DELTA; - switch (slope_info & AATriangle::DIRECTION_MASK) - { - case AATriangle::SOUTHWEST: - delta_x *= 1.0; - delta_y *= -1.0; - obj_x = obj_bbox.get_left (); - obj_y = obj_bbox.get_bottom (); - break; - - case AATriangle::SOUTHEAST: - delta_x *= -1.0; - delta_y *= -1.0; - obj_x = obj_bbox.get_right (); - obj_y = obj_bbox.get_bottom (); - break; - - case AATriangle::NORTHWEST: - delta_x *= 1.0; - delta_y *= 1.0; - obj_x = obj_bbox.get_left (); - obj_y = obj_bbox.get_top (); - break; - - case AATriangle::NORTHEAST: - delta_x *= -1.0; - delta_y *= 1.0; - obj_x = obj_bbox.get_right (); - obj_y = obj_bbox.get_top (); - break; - } - - /* Adapt the delta_x, delta_y and the gradient for the 26.6 deg and 63.4 deg - * cases. */ - switch (slope_info & AATriangle::DEFORM_MASK) - { - case 0: - delta_x *= .70710678118654752440; /* 1/sqrt(2) */ - delta_y *= .70710678118654752440; /* 1/sqrt(2) */ - break; - - case DEFORM_BOTTOM: - case DEFORM_TOP: - delta_x *= .44721359549995793928; /* 1/sqrt(5) */ - delta_y *= .89442719099991587856; /* 2/sqrt(5) */ - gradient *= 0.5; - break; - - case DEFORM_LEFT: - case DEFORM_RIGHT: - delta_x *= .89442719099991587856; /* 2/sqrt(5) */ - delta_y *= .44721359549995793928; /* 1/sqrt(5) */ - gradient *= 2.0; - break; - } - - /* With a south slope, check if all points are above the line. If one point - * isn't, the slope is not solid. => You can pass through a south-slope from - * below but not from above. */ - if (((slope_info & AATriangle::DIRECTION_MASK) == AATriangle::SOUTHWEST) - || ((slope_info & AATriangle::DIRECTION_MASK) == AATriangle::SOUTHEAST)) - { - if (is_below_line (tile_x, tile_y, gradient, obj_x + delta_x, obj_y + delta_y)) - return (POS_NON_SOLID); - else - return (POS_SOLID); - } - /* northwest or northeast. Same as above, but inverted. You can pass from top - * to bottom but not vice versa. */ - else - { - if (is_above_line (tile_x, tile_y, gradient, obj_x + delta_x, obj_y + delta_y)) - return (POS_NON_SOLID); - else - return (POS_SOLID); - } - -#undef POS_NON_SOLID -#undef POS_SOLID -} /* int check_position_unisolid */ - void Sector::collision_tilemap(collision::Constraints* constraints, const Vector& movement, const Rectf& dest, @@ -1272,40 +996,26 @@ Sector::collision_tilemap(collision::Constraints* constraints, if(!tile) continue; // skip non-solid tiles - if((tile->getAttributes() & Tile::SOLID) == 0) + if(!tile->is_solid ()) continue; Rectf tile_bbox = solids->get_tile_bbox(x, y); - // only handle unisolid when the player is falling down and when he was - // above the tile before - if(tile->getAttributes() & Tile::UNISOLID) { - int status; + /* If the tile is a unisolid tile, the "is_solid()" function above + * didn't do a thorough check. Calculate the position and (relative) + * movement of the object and determine whether or not the tile is + * solid with regard to those parameters. */ + if(tile->is_unisolid ()) { Vector relative_movement = movement - solids->get_movement(/* actual = */ true); - /* Check if the tile is solid given the current movement. This works - * for south-slopes (which are solid when moving "down") and - * north-slopes (which are solid when moving "up". "up" and "down" is - * in quotation marks because because the slope's gradient is taken. - * Also, this uses the movement relative to the tilemaps own movement - * (if any). --octo */ - status = check_movement_unisolid (relative_movement, tile); - /* If zero is returned, the unisolid tile is non-solid. */ - if (status == 0) + if (!tile->is_solid (tile_bbox, object.get_bbox(), relative_movement)) continue; + } /* if (tile->is_unisolid ()) */ - /* Check whether the object is already *in* the tile. If so, the tile - * is non-solid. Otherwise, if the object is "above" (south slopes) - * or "below" (north slopes), the tile will be solid. */ - status = check_position_unisolid (object.get_bbox(), tile_bbox, tile); - if (status == 0) - continue; - } - - if(tile->getAttributes() & Tile::SLOPE) { // slope tile + if(tile->is_slope ()) { // slope tile AATriangle triangle; int slope_data = tile->getData(); - if (solids->get_drawing_effect() == VERTICAL_FLIP) + if (solids->get_drawing_effect() & VERTICAL_FLIP) slope_data = AATriangle::vertical_flip(slope_data); triangle = AATriangle(tile_bbox, slope_data); @@ -1459,8 +1169,6 @@ Sector::collision_static_constrains(MovingObject& object) Constraints constraints; Vector movement = object.get_movement(); Rectf& dest = object.dest; - float owidth = object.get_bbox().get_width(); - float oheight = object.get_bbox().get_height(); for(int i = 0; i < 2; ++i) { collision_static(&constraints, Vector(0, movement.y), dest, object); @@ -1470,16 +1178,16 @@ Sector::collision_static_constrains(MovingObject& object) // apply calculated horizontal constraints if(constraints.get_position_bottom() < infinity) { float height = constraints.get_height (); - if(height < oheight) { + if(height < object.get_bbox().get_height()) { // we're crushed, but ignore this for now, we'll get this again // later if we're really crushed or things will solve itself when // looking at the vertical constraints } dest.p2.y = constraints.get_position_bottom() - DELTA; - dest.p1.y = dest.p2.y - oheight; + dest.p1.y = dest.p2.y - object.get_bbox().get_height(); } else if(constraints.get_position_top() > -infinity) { dest.p1.y = constraints.get_position_top() + DELTA; - dest.p2.y = dest.p1.y + oheight; + dest.p2.y = dest.p1.y + object.get_bbox().get_height(); } } if(constraints.has_constraints()) { @@ -1502,7 +1210,7 @@ Sector::collision_static_constrains(MovingObject& object) // apply calculated vertical constraints float width = constraints.get_width (); if(width < infinity) { - if(width + SHIFT_DELTA < owidth) { + if(width + SHIFT_DELTA < object.get_bbox().get_width()) { #if 0 printf("Object %p crushed horizontally... L:%f R:%f\n", &object, constraints.get_position_left(), constraints.get_position_right()); @@ -1514,15 +1222,15 @@ Sector::collision_static_constrains(MovingObject& object) object.collision_solid(h); } else { float xmid = constraints.get_x_midpoint (); - dest.p1.x = xmid - owidth/2; - dest.p2.x = xmid + owidth/2; + dest.p1.x = xmid - object.get_bbox().get_width()/2; + dest.p2.x = xmid + object.get_bbox().get_width()/2; } } else if(constraints.get_position_right() < infinity) { dest.p2.x = constraints.get_position_right() - DELTA; - dest.p1.x = dest.p2.x - owidth; + dest.p1.x = dest.p2.x - object.get_bbox().get_width(); } else if(constraints.get_position_left() > -infinity) { dest.p1.x = constraints.get_position_left() + DELTA; - dest.p2.x = dest.p1.x + owidth; + dest.p2.x = dest.p1.x + object.get_bbox().get_width(); } } @@ -1538,7 +1246,7 @@ Sector::collision_static_constrains(MovingObject& object) collision_static(&constraints, movement, dest, object); if(constraints.get_position_bottom() < infinity) { float height = constraints.get_height (); - if(height + SHIFT_DELTA < oheight) { + if(height + SHIFT_DELTA < object.get_bbox().get_height()) { #if 0 printf("Object %p crushed vertically...\n", &object); #endif @@ -1686,9 +1394,9 @@ Sector::is_free_of_tiles(const Rectf& rect, const bool ignoreUnisolid) const if(!tile) continue; if(!(tile->getAttributes() & Tile::SOLID)) continue; - if((tile->getAttributes() & Tile::UNISOLID) && ignoreUnisolid) + if(tile->is_unisolid () && ignoreUnisolid) continue; - if(tile->getAttributes() & Tile::SLOPE) { + if(tile->is_slope ()) { AATriangle triangle; Rectf tbbox = solids->get_tile_bbox(x, y); triangle = AATriangle(tbbox, tile->getData()); @@ -1761,7 +1469,7 @@ Sector::add_bullet(const Vector& pos, const PlayerStatus* player_status, float x new_bullet = new Bullet(pos, xm, dir, player_status->bonus); add_object(new_bullet); - sound_manager->play("sounds/shoot.wav"); + SoundManager::current()->play("sounds/shoot.wav"); return true; } @@ -1779,16 +1487,16 @@ Sector::play_music(MusicType type) currentmusic = type; switch(currentmusic) { case LEVEL_MUSIC: - sound_manager->play_music(music); + SoundManager::current()->play_music(music); break; case HERRING_MUSIC: - sound_manager->play_music("music/invincible.ogg"); + SoundManager::current()->play_music("music/invincible.ogg"); break; case HERRING_WARNING_MUSIC: - sound_manager->stop_music(TUX_INVINCIBLE_TIME_WARNING); + SoundManager::current()->stop_music(TUX_INVINCIBLE_TIME_WARNING); break; default: - sound_manager->play_music(""); + SoundManager::current()->play_music(""); break; } } @@ -1890,10 +1598,10 @@ Sector::get_ambient_blue() } void -Sector::set_gravity(float gravity) +Sector::set_gravity(float gravity_) { log_warning << "Changing a Sector's gravitational constant might have unforeseen side-effects" << std::endl; - this->gravity = gravity; + this->gravity = gravity_; } float