diff --git a/source/src/bot/botmanager.cpp b/source/src/bot/botmanager.cpp index 5d324d43..b56082e8 100644 --- a/source/src/bot/botmanager.cpp +++ b/source/src/bot/botmanager.cpp @@ -28,9 +28,7 @@ CBotManager BotManager; CBotManager::~CBotManager(void) { EndMap(); - - while(m_StoredBots.Empty() == false) - delete m_StoredBots.Pop(); + ClearStoredBots(); } void CBotManager::Init() diff --git a/source/src/client.cpp b/source/src/client.cpp index 762b5290..6128c17d 100644 --- a/source/src/client.cpp +++ b/source/src/client.cpp @@ -151,9 +151,10 @@ void disconnect(int onlyclean, int async) player1->clientnum = -1; player1->lifesequence = 0; player1->clientrole = CR_DEFAULT; - if(m_botmode) BotManager.EndMap(); + kickallbots(); loopv(players) zapplayer(players[i]); clearvote(); + clearsounds(); localdisconnect(); } if(!connpeer && clienthost) diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index ef034069..f80edf43 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -195,6 +195,7 @@ void freebotent(botent *d) loopv(players) if(players[i]==d) { DELETEP(players[i]); + players.remove(i); } } diff --git a/source/src/entity.h b/source/src/entity.h index 40bc13a7..ad794547 100644 --- a/source/src/entity.h +++ b/source/src/entity.h @@ -419,6 +419,7 @@ struct botent : playerent float targetyaw; // monster wants to look in this direction botent() : pBot(NULL), enemy(NULL) { type = ENT_BOT; } + ~botent() { } int deaths() { return lifesequence; } }; diff --git a/source/src/main.cpp b/source/src/main.cpp index 3fb1c9c6..9be60657 100644 --- a/source/src/main.cpp +++ b/source/src/main.cpp @@ -9,7 +9,7 @@ void cleanup(char *msg) // single program exit point; { abortconnect(); disconnect(1); - cleansound(); + soundcleanup(); cleanupserver(); } SDL_ShowCursor(1); diff --git a/source/src/protos.h b/source/src/protos.h index 62f09130..2cafa369 100644 --- a/source/src/protos.h +++ b/source/src/protos.h @@ -434,11 +434,11 @@ extern void playsound(int n, entity *e, int priority = SP_NORMAL); extern void playsound(int n, const vec *v, int priority = SP_NORMAL); extern void playsoundc(int n); extern void initsound(); -extern void cleansound(); +extern void soundcleanup(); extern void checkmapsounds(); extern void checkplayerloopsounds(); extern void music(char *name, char *cmd); -extern void clearmapsounds(); +extern void clearsounds(); // rendermodel extern void rendermodel(const char *mdl, int anim, int tex, float rad, const vec &o, float yaw, float pitch, float speed = 0, int basetime = 0, playerent *d = NULL, modelattach *a = NULL, float scale = 1.0f); diff --git a/source/src/sound.cpp b/source/src/sound.cpp index 9b3edec1..1465514e 100644 --- a/source/src/sound.cpp +++ b/source/src/sound.cpp @@ -537,7 +537,7 @@ COMMAND(registersound, ARG_4STR); void mapsound(char *name, char *vol, char *maxuses, char *loop) { addsound(name, atoi(vol), atoi(maxuses), atoi(loop) != 0, mapsounds); } COMMAND(mapsound, ARG_4STR); -void cleansound() +void soundcleanup() { if(nosound) return; stopsound(); @@ -549,13 +549,10 @@ void cleansound() alutExit(); } -void clearmapsounds() +void clearsounds() { - loopv(locations) if(locations[i].e && locations[i].inuse) - { - locations[i].reset(); - } mapsounds.setsizenodelete(0); + locations.setsizenodelete(0); } void checkmapsounds() diff --git a/source/src/world.cpp b/source/src/world.cpp index 420e8700..9a257c84 100644 --- a/source/src/world.cpp +++ b/source/src/world.cpp @@ -271,7 +271,7 @@ void empty_world(int factor, bool force) // main empty world creation routine if(!force && noteditmode()) return; cleardlights(); pruneundos(); - clearmapsounds(); + clearsounds(); sqr *oldworld = world; bool copy = false; if(oldworld && factor<0) { factor = sfactor+1; copy = true; } diff --git a/source/src/worldio.cpp b/source/src/worldio.cpp index 2b32ccf7..6193b6f1 100644 --- a/source/src/worldio.cpp +++ b/source/src/worldio.cpp @@ -233,7 +233,7 @@ bool load_world(char *mname) // still supports all map formats that have preparectf(true); cleardlights(); pruneundos(); - clearmapsounds(); + clearsounds(); setnames(mname); gzFile f = opengzfile(cgzname, "rb9"); if(!f) { conoutf("\f3could not read map %s", cgzname); return false; }