diff --git a/src/client/GameSave.cpp b/src/client/GameSave.cpp index 1dfa00c2a..4d4ab13d7 100644 --- a/src/client/GameSave.cpp +++ b/src/client/GameSave.cpp @@ -2052,7 +2052,7 @@ std::pair> GameSave::serialiseOPS() const unsigned int partsDataLen = 0; std::vector partsSaveIndex(NPART); unsigned int partsCount = 0; - std::fill(&partsSaveIndex[0], &partsSaveIndex[NPART], 0); + std::fill(&partsSaveIndex[0], &partsSaveIndex[0] + NPART, 0); for (y=0;yBuildMenus(); luacon_sim->init_can_move(); - std::fill(&luacon_ren->graphicscache[0], &luacon_ren->graphicscache[PT_NUM], gcache_item()); + std::fill(&luacon_ren->graphicscache[0], &luacon_ren->graphicscache[0] + PT_NUM, gcache_item()); return 0; } diff --git a/src/simulation/Gravity.cpp b/src/simulation/Gravity.cpp index 171980a02..f96fff529 100755 --- a/src/simulation/Gravity.cpp +++ b/src/simulation/Gravity.cpp @@ -180,7 +180,7 @@ void Gravity::gravity_update_async() unsigned int size = (XRES / CELL) * (YRES / CELL); membwand(gravy, gravmask, size * sizeof(float), size * sizeof(unsigned)); membwand(gravx, gravmask, size * sizeof(float), size * sizeof(unsigned)); - std::fill(&gravmap[0], &gravmap[size], 0.0f); + std::fill(&gravmap[0], &gravmap[0] + size, 0.0f); } void Gravity::update_grav_async() @@ -188,11 +188,11 @@ void Gravity::update_grav_async() int done = 0; int thread_done = 0; unsigned int size = (XRES / CELL) * (YRES / CELL); - std::fill(&th_ogravmap[0], &th_ogravmap[size], 0.0f); - std::fill(&th_gravmap[0], &th_gravmap[size], 0.0f); - std::fill(&th_gravy[0], &th_gravy[size], 0.0f); - std::fill(&th_gravx[0], &th_gravx[size], 0.0f); - std::fill(&th_gravp[0], &th_gravp[size], 0.0f); + std::fill(&th_ogravmap[0], &th_ogravmap[0] + size, 0.0f); + std::fill(&th_gravmap[0], &th_gravmap[0] + size, 0.0f); + std::fill(&th_gravy[0], &th_gravy[0] + size, 0.0f); + std::fill(&th_gravx[0], &th_gravx[0] + size, 0.0f); + std::fill(&th_gravp[0], &th_gravp[0] + size, 0.0f); #ifdef GRAVFFT if (!grav_fft_status) @@ -231,10 +231,10 @@ void Gravity::start_grav_async() enabled = true; unsigned int size = (XRES / CELL) * (YRES / CELL); - std::fill(&gravy[0], &gravy[size], 0.0f); - std::fill(&gravx[0], &gravx[size], 0.0f); - std::fill(&gravp[0], &gravp[size], 0.0f); - std::fill(&gravmap[0], &gravmap[size], 0.0f); + std::fill(&gravy[0], &gravy[0] + size, 0.0f); + std::fill(&gravx[0], &gravx[0] + size, 0.0f); + std::fill(&gravp[0], &gravp[0] + size, 0.0f); + std::fill(&gravmap[0], &gravmap[0] + size, 0.0f); } void Gravity::stop_grav_async() @@ -251,10 +251,10 @@ void Gravity::stop_grav_async() } // Clear the grav velocities unsigned int size = (XRES / CELL) * (YRES / CELL); - std::fill(&gravy[0], &gravy[size], 0.0f); - std::fill(&gravx[0], &gravx[size], 0.0f); - std::fill(&gravp[0], &gravp[size], 0.0f); - std::fill(&gravmap[0], &gravmap[size], 0.0f); + std::fill(&gravy[0], &gravy[0] + size, 0.0f); + std::fill(&gravx[0], &gravx[0] + size, 0.0f); + std::fill(&gravp[0], &gravp[0] + size, 0.0f); + std::fill(&gravmap[0], &gravmap[0] + size, 0.0f); } #ifdef GRAVFFT @@ -481,7 +481,7 @@ void Gravity::gravity_mask() { t_mask_el = new mask_el[sizeof(mask_el)]; t_mask_el->shape = new char[(XRES / CELL) * (YRES / CELL)]; - std::fill(&t_mask_el->shape[0], &t_mask_el->shape[(XRES / CELL) * (YRES / CELL)], 0); + std::fill(&t_mask_el->shape[0], &t_mask_el->shape[0] + (XRES / CELL) * (YRES / CELL), 0); t_mask_el->shapeout = 0; t_mask_el->next = nullptr; c_mask_el = t_mask_el; @@ -491,7 +491,7 @@ void Gravity::gravity_mask() c_mask_el->next = new mask_el[sizeof(mask_el)]; c_mask_el = c_mask_el->next; c_mask_el->shape = new char[(XRES / CELL) * (YRES / CELL)]; - std::fill(&c_mask_el->shape[0], &c_mask_el->shape[(XRES / CELL) * (YRES / CELL)], 0); + std::fill(&c_mask_el->shape[0], &c_mask_el->shape[0] + (XRES / CELL) * (YRES / CELL), 0); c_mask_el->shapeout = 0; c_mask_el->next = nullptr; } @@ -502,7 +502,7 @@ void Gravity::gravity_mask() } } c_mask_el = t_mask_el; - std::fill(&gravmask[0], &gravmask[(XRES / CELL) * (YRES / CELL)], 0); + std::fill(&gravmask[0], &gravmask[0] + (XRES / CELL) * (YRES / CELL), 0); while (c_mask_el != nullptr) { char *cshape = c_mask_el->shape; diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index ea9a84262..6427be57e 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -560,10 +560,10 @@ std::unique_ptr Simulation::CreateSnapshot() snap->GravVelocityY .insert (snap->GravVelocityY .begin(), &gravy [0] , &gravy [0] + ((XRES / CELL) * (YRES / CELL))); snap->GravValue .insert (snap->GravValue .begin(), &gravp [0] , &gravp [0] + ((XRES / CELL) * (YRES / CELL))); snap->GravMap .insert (snap->GravMap .begin(), &gravmap[0] , &gravmap[0] + ((XRES / CELL) * (YRES / CELL))); - snap->Particles .insert (snap->Particles .begin(), &parts [0] , &parts[parts_lastActiveIndex + 1] ); - snap->PortalParticles.insert (snap->PortalParticles.begin(), &portalp[0][0][0], &portalp [CHANNELS - 1][8 - 1][80 - 1] ); - snap->WirelessData .insert (snap->WirelessData .begin(), &wireless[0][0] , &wireless[CHANNELS - 1][2 - 1] ); - snap->stickmen .insert (snap->stickmen .begin(), &fighters[0] , &fighters[MAX_FIGHTERS] ); + snap->Particles .insert (snap->Particles .begin(), &parts [0] , &parts [0] + parts_lastActiveIndex + 1 ); + snap->PortalParticles.insert (snap->PortalParticles.begin(), &portalp[0][0][0], &portalp[0][0][0] + CHANNELS * 8 * 80 ); + snap->WirelessData .insert (snap->WirelessData .begin(), &wireless[0][0] , &wireless[0][0] + CHANNELS * 2 ); + snap->stickmen .insert (snap->stickmen .begin(), &fighters[0] , &fighters[0] + MAX_FIGHTERS ); snap->stickmen .push_back(player2); snap->stickmen .push_back(player); snap->signs = signs; @@ -893,7 +893,7 @@ bool Simulation::flood_water(int x, int y, int i) // Bitmap for checking where we've already looked auto bitmapPtr = std::unique_ptr(new char[XRES * YRES]); char *bitmap = bitmapPtr.get(); - std::fill(&bitmap[0], &bitmap[XRES * YRES], 0); + std::fill(&bitmap[0], &bitmap[0] + XRES * YRES, 0); try { @@ -1918,7 +1918,7 @@ int Simulation::FloodParts(int x, int y, int fullc, int cm, int flags) // Bitmap for checking where we've already looked auto bitmapPtr = std::unique_ptr(new char[XRES * YRES]); char *bitmap = bitmapPtr.get(); - std::fill(&bitmap[0], &bitmap[XRES * YRES], 0); + std::fill(&bitmap[0], &bitmap[0] + XRES * YRES, 0); if (cm==-1) {