Can now clean bullets off the forest.
This commit is contained in:
@@ -224,7 +224,8 @@ void Server::Run() {
|
||||
Timestamp last = 0;
|
||||
std::vector<Chat*> chatlog;
|
||||
std::vector<ChunkMod*> chunkdiffs;
|
||||
std::vector<Bullet*> bullets, outbox_bullets;
|
||||
std::vector<Bullet*> bullets;
|
||||
std::vector<std::vector<Bullet*>::iterator> bullit;
|
||||
std::vector<BulletAdd*> netbull;
|
||||
|
||||
Chat* startchat = new Chat();
|
||||
@@ -334,19 +335,21 @@ void Server::Run() {
|
||||
delete bull;
|
||||
}
|
||||
netbull.clear();
|
||||
|
||||
for (auto& bull : bullets) {
|
||||
|
||||
for (auto bull = bullets.begin(); bull != bullets.end(); ++bull) {
|
||||
ChunkMod* cmod = nullptr;
|
||||
if (bull->Update(m_world, (1. / 60.), 20, m_players, &cmod)) {
|
||||
Bullet* bullet = *bull;
|
||||
if (bullet->Update(m_world, (1. / 60.), 20, m_players, &cmod)) {
|
||||
if (cmod)
|
||||
chunkdiffs.emplace_back(std::move(cmod));
|
||||
outbox_bullets.emplace_back(std::move(bull));
|
||||
chunkdiffs.emplace_back(cmod);
|
||||
bullit.push_back(bull);
|
||||
delete bullet;
|
||||
}
|
||||
}
|
||||
|
||||
for (auto gtfo : outbox_bullets)
|
||||
delete gtfo;
|
||||
outbox_bullets.clear();
|
||||
for (auto& bull: bullit)
|
||||
bullets.erase(bull);
|
||||
bullit.clear();
|
||||
|
||||
for (auto& chat : chatlog) {
|
||||
Log(chat->mess, false, false);
|
||||
@@ -362,10 +365,6 @@ void Server::Run() {
|
||||
delete chmo;
|
||||
}
|
||||
chunkdiffs.clear();
|
||||
|
||||
//for (auto& bull : outbox_bullets)
|
||||
// delete bull;
|
||||
//outbox_bullets.clear();
|
||||
}
|
||||
|
||||
Chat end;
|
||||
|
Reference in New Issue
Block a user