deactivate();
- for(ScriptList::iterator i = scripts.begin();
- i != scripts.end(); ++i) {
+ for(auto i = scripts.begin(); i != scripts.end(); ++i) {
HSQOBJECT& object = *i;
sq_release(global_vm, &object);
}
update_game_objects();
assert(gameobjects_new.size() == 0);
- for(GameObjects::iterator i = gameobjects.begin();
- i != gameobjects.end(); ++i) {
+ for(auto i = gameobjects.begin(); i != gameobjects.end(); ++i) {
GameObjectPtr object = *i;
before_object_remove(object);
}
void
Sector::fix_old_tiles()
{
- for(std::list<TileMap*>::iterator i = solid_tilemaps.begin(); i != solid_tilemaps.end(); i++) {
+ for(auto i = solid_tilemaps.begin(); i != solid_tilemaps.end(); i++) {
TileMap* solids = *i;
for(size_t x=0; x < solids->get_width(); ++x) {
for(size_t y=0; y < solids->get_height(); ++y) {
}
// add lights for special tiles
- for(GameObjects::iterator i = gameobjects.begin(); i != gameobjects.end(); i++) {
+ for(auto i = gameobjects.begin(); i != gameobjects.end(); i++) {
TileMap* tm = dynamic_cast<TileMap*>(i->get());
if (!tm) continue;
for(size_t x=0; x < tm->get_width(); ++x) {
using namespace scripting;
// garbage collect thread list
- for(ScriptList::iterator i = scripts.begin();
- i != scripts.end(); ) {
+ for(auto i = scripts.begin(); i != scripts.end(); ) {
HSQOBJECT& object = *i;
HSQUIRRELVM vm = object_to_vm(object);
{
// make sure the object isn't already in the list
#ifndef NDEBUG
- for(GameObjects::iterator i = gameobjects.begin(); i != gameobjects.end();
- ++i) {
+ for(auto i = gameobjects.begin(); i != gameobjects.end(); ++i) {
assert(*i != object);
}
- for(GameObjects::iterator i = gameobjects_new.begin();
- i != gameobjects_new.end(); ++i) {
+ for(auto i = gameobjects_new.begin(); i != gameobjects_new.end(); ++i) {
assert(*i != object);
}
#endif
Sector::activate(const std::string& spawnpoint)
{
std::shared_ptr<SpawnPoint> sp;
- for(SpawnPoints::iterator i = spawnpoints.begin(); i != spawnpoints.end();
- ++i) {
+ for(auto i = spawnpoints.begin(); i != spawnpoints.end(); ++i) {
if((*i)->name == spawnpoint) {
sp = *i;
break;
if(show_collrects) {
Color color(1.0f, 0.0f, 0.0f, 0.75f);
- for(MovingObjects::iterator i = moving_objects.begin();
- i != moving_objects.end(); ++i) {
+ for(auto i = moving_objects.begin(); i != moving_objects.end(); ++i) {
MovingObject* object = *i;
const Rectf& rect = object->get_bbox();
float y1 = dest.get_top();
float y2 = dest.get_bottom();
- for(std::list<TileMap*>::const_iterator i = solid_tilemaps.begin(); i != solid_tilemaps.end(); i++) {
+ for(auto i = solid_tilemaps.begin(); i != solid_tilemaps.end(); i++) {
TileMap* solids = *i;
// test with all tiles in this rectangle
float y2 = dest.p2.y;
uint32_t result = 0;
- for(std::list<TileMap*>::const_iterator i = solid_tilemaps.begin(); i != solid_tilemaps.end(); i++) {
+ for(auto i = solid_tilemaps.begin(); i != solid_tilemaps.end(); i++) {
TileMap* solids = *i;
// test with all tiles in this rectangle
collision_tilemap(constraints, movement, dest, object);
// collision with other (static) objects
- for(MovingObjects::iterator i = moving_objects.begin();
- i != moving_objects.end(); ++i) {
+ for(auto i = moving_objects.begin(); i != moving_objects.end(); ++i) {
MovingObject* moving_object = *i;
if(moving_object->get_group() != COLGROUP_STATIC
&& moving_object->get_group() != COLGROUP_MOVING_STATIC)
using namespace collision;
// calculate destination positions of the objects
- for(MovingObjects::iterator i = moving_objects.begin();
- i != moving_objects.end(); ++i) {
+ for(auto i = moving_objects.begin(); i != moving_objects.end(); ++i) {
MovingObject* moving_object = *i;
Vector mov = moving_object->get_movement();
}
// part1: COLGROUP_MOVING vs COLGROUP_STATIC and tilemap
- for(MovingObjects::iterator i = moving_objects.begin();
- i != moving_objects.end(); ++i) {
+ for(auto i = moving_objects.begin(); i != moving_objects.end(); ++i) {
MovingObject* moving_object = *i;
if((moving_object->get_group() != COLGROUP_MOVING
&& moving_object->get_group() != COLGROUP_MOVING_STATIC
}
// part2: COLGROUP_MOVING vs tile attributes
- for(MovingObjects::iterator i = moving_objects.begin();
- i != moving_objects.end(); ++i) {
+ for(auto i = moving_objects.begin(); i != moving_objects.end(); ++i) {
MovingObject* moving_object = *i;
if((moving_object->get_group() != COLGROUP_MOVING
&& moving_object->get_group() != COLGROUP_MOVING_STATIC
}
// part2.5: COLGROUP_MOVING vs COLGROUP_TOUCHABLE
- for(MovingObjects::iterator i = moving_objects.begin();
- i != moving_objects.end(); ++i) {
+ for(auto i = moving_objects.begin(); i != moving_objects.end(); ++i) {
MovingObject* moving_object = *i;
if((moving_object->get_group() != COLGROUP_MOVING
&& moving_object->get_group() != COLGROUP_MOVING_STATIC)
|| !moving_object->is_valid())
continue;
- for(MovingObjects::iterator i2 = moving_objects.begin();
- i2 != moving_objects.end(); ++i2) {
+ for(auto i2 = moving_objects.begin(); i2 != moving_objects.end(); ++i2) {
MovingObject* moving_object_2 = *i2;
if(moving_object_2->get_group() != COLGROUP_TOUCHABLE
|| !moving_object_2->is_valid())
}
// part3: COLGROUP_MOVING vs COLGROUP_MOVING
- for(MovingObjects::iterator i = moving_objects.begin();
- i != moving_objects.end(); ++i) {
+ for(auto i = moving_objects.begin(); i != moving_objects.end(); ++i) {
MovingObject* moving_object = *i;
if((moving_object->get_group() != COLGROUP_MOVING
|| !moving_object->is_valid())
continue;
- for(MovingObjects::iterator i2 = i+1;
- i2 != moving_objects.end(); ++i2) {
+ for(auto i2 = i+1; i2 != moving_objects.end(); ++i2) {
MovingObject* moving_object_2 = *i2;
if((moving_object_2->get_group() != COLGROUP_MOVING
&& moving_object_2->get_group() != COLGROUP_MOVING_STATIC)
}
// apply object movement
- for(MovingObjects::iterator i = moving_objects.begin();
- i != moving_objects.end(); ++i) {
+ for(auto i = moving_objects.begin(); i != moving_objects.end(); ++i) {
MovingObject* moving_object = *i;
moving_object->bbox = moving_object->dest;
{
using namespace collision;
- for(std::list<TileMap*>::const_iterator i = solid_tilemaps.begin(); i != solid_tilemaps.end(); i++) {
+ for(auto i = solid_tilemaps.begin(); i != solid_tilemaps.end(); i++) {
TileMap* solids = *i;
// test with all tiles in this rectangle
if (!is_free_of_tiles(rect, ignoreUnisolid)) return false;
- for(MovingObjects::const_iterator i = moving_objects.begin();
- i != moving_objects.end(); ++i) {
+ for(auto i = moving_objects.begin(); i != moving_objects.end(); ++i) {
const MovingObject* moving_object = *i;
if (moving_object == ignore_object) continue;
if (!moving_object->is_valid()) continue;
if (!is_free_of_tiles(rect)) return false;
- for(MovingObjects::const_iterator i = moving_objects.begin();
- i != moving_objects.end(); ++i) {
+ for(auto i = moving_objects.begin(); i != moving_objects.end(); ++i) {
const MovingObject* moving_object = *i;
if (moving_object == ignore_object) continue;
if (!moving_object->is_valid()) continue;
bool
Sector::inside(const Rectf& rect) const
{
- for(std::list<TileMap*>::const_iterator i = solid_tilemaps.begin(); i != solid_tilemaps.end(); i++) {
+ for(auto i = solid_tilemaps.begin(); i != solid_tilemaps.end(); i++) {
TileMap* solids = *i;
Rectf bbox = solids->get_bbox();
Sector::get_width() const
{
float width = 0;
- for(std::list<TileMap*>::const_iterator i = solid_tilemaps.begin();
- i != solid_tilemaps.end(); i++) {
+ for(auto i = solid_tilemaps.begin(); i != solid_tilemaps.end(); i++) {
TileMap* solids = *i;
width = std::max(width, solids->get_bbox().get_right());
}
Sector::get_height() const
{
float height = 0;
- for(std::list<TileMap*>::const_iterator i = solid_tilemaps.begin();
+ for(auto i = solid_tilemaps.begin();
i != solid_tilemaps.end(); i++) {
TileMap* solids = *i;
height = std::max(height, solids->get_bbox().get_bottom());
void
Sector::change_solid_tiles(uint32_t old_tile_id, uint32_t new_tile_id)
{
- for(std::list<TileMap*>::const_iterator i = solid_tilemaps.begin(); i != solid_tilemaps.end(); i++) {
+ for(auto i = solid_tilemaps.begin(); i != solid_tilemaps.end(); i++) {
TileMap* solids = *i;
solids->change_all(old_tile_id, new_tile_id);
}
float nearest_dist = std::numeric_limits<float>::max();
std::vector<Player*> players = Sector::current()->get_players();
- for (std::vector<Player*>::iterator playerIter = players.begin();
- playerIter != players.end();
- ++playerIter)
+ for (auto playerIter = players.begin(); playerIter != players.end(); ++playerIter)
{
Player *this_player = *playerIter;
if (this_player->is_dying() || this_player->is_dead())