[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/sound sound_res_mgr.cxx,1.2,1.3 sound
From: |
torangan |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/sound sound_res_mgr.cxx,1.2,1.3 sound_res_mgr.hxx,1.2,1.3 |
Date: |
4 Jun 2003 17:22:35 -0000 |
Update of /var/lib/cvs/Games/Pingus/src/sound
In directory dark:/tmp/cvs-serv16368/src/sound
Modified Files:
sound_res_mgr.cxx sound_res_mgr.hxx
Log Message:
cleanup / memory leak fixes by Henri Manson
Index: sound_res_mgr.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/sound/sound_res_mgr.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- sound_res_mgr.cxx 19 Apr 2003 10:23:19 -0000 1.2
+++ sound_res_mgr.cxx 4 Jun 2003 17:22:33 -0000 1.3
@@ -1,50 +1,57 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <ClanLib/sound.h>
-#include "../path_manager.hxx"
-#include "../globals.hxx"
-#include "../debug.hxx"
-#include "sound_res_mgr.hxx"
-
-SoundResMgr::SoundMap SoundResMgr::sound_map;
-
-SoundHandle
-SoundResMgr::load(const std::string& name)
-{
- SoundMap::iterator i = sound_map.find(name);
-
- if (i == sound_map.end())
- {
- std::string filename = path_manager.complete("sounds/" + name + ".wav");
- CL_SoundBuffer* buffer = new CL_SoundBuffer (new CL_Sample(filename,
NULL), true);
- pout(PINGUS_DEBUG_LOADING) << "SoundResMgr: Loading sound from disk: "
- << name << " -> " << filename << std::endl;
-
- sound_map[name] = buffer;
- return buffer;
- }
- else
- {
- pout(PINGUS_DEBUG_LOADING) << "SoundResMgr: Loading sound from cache: "
<< name << std::endl;
- return i->second;
- }
-}
-
-/* EOF */
+// $Id$
+//
+// Pingus - A free Lemmings clone
+// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+#include <ClanLib/sound.h>
+#include "../path_manager.hxx"
+#include "../globals.hxx"
+#include "../debug.hxx"
+#include "sound_res_mgr.hxx"
+
+SoundResMgr::SoundMap SoundResMgr::sound_map;
+
+SoundHandle
+SoundResMgr::load(const std::string& name)
+{
+ SoundMap::iterator i = sound_map.find(name);
+
+ if (i == sound_map.end())
+ {
+ std::string filename = path_manager.complete("sounds/" + name + ".wav");
+ CL_SoundBuffer* buffer = new CL_SoundBuffer (new CL_Sample(filename,
NULL), true);
+ pout(PINGUS_DEBUG_LOADING) << "SoundResMgr: Loading sound from disk: "
+ << name << " -> " << filename << std::endl;
+
+ sound_map[name] = buffer;
+ return buffer;
+ }
+ else
+ {
+ pout(PINGUS_DEBUG_LOADING) << "SoundResMgr: Loading sound from cache: "
<< name << std::endl;
+ return i->second;
+ }
+}
+
+void SoundResMgr::free_sound_map()
+{
+ for (SoundMap::iterator i = sound_map.begin(); i != sound_map.end(); ++i)
+ {
+ delete i->second;
+ }
+}
+/* EOF */
Index: sound_res_mgr.hxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/sound/sound_res_mgr.hxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- sound_res_mgr.hxx 19 Apr 2003 10:23:19 -0000 1.2
+++ sound_res_mgr.hxx 4 Jun 2003 17:22:33 -0000 1.3
@@ -1,46 +1,46 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_SOUND_RES_MGR_HXX
-#define HEADER_PINGUS_SOUND_RES_MGR_HXX
-
-#include <map>
-
-class CL_SoundBuffer;
-
-typedef CL_SoundBuffer* SoundHandle;
-
-/** */
-class SoundResMgr
-{
-private:
- typedef std::map<std::string, CL_SoundBuffer*> SoundMap;
- static SoundMap sound_map;
-
-public:
- static SoundHandle load(const std::string& name);
-
-private:
- SoundResMgr (const SoundResMgr&);
- SoundResMgr& operator= (const SoundResMgr&);
-};
-
-#endif
-
-/* EOF */
+// $Id$
+//
+// Pingus - A free Lemmings clone
+// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+#ifndef HEADER_PINGUS_SOUND_RES_MGR_HXX
+#define HEADER_PINGUS_SOUND_RES_MGR_HXX
+
+#include <map>
+
+class CL_SoundBuffer;
+
+typedef CL_SoundBuffer* SoundHandle;
+
+/** */
+class SoundResMgr
+{
+private:
+ typedef std::map<std::string, CL_SoundBuffer*> SoundMap;
+ static SoundMap sound_map;
+
+public:
+ static SoundHandle load(const std::string& name);
+ static void free_sound_map();
+private:
+ SoundResMgr (const SoundResMgr&);
+ SoundResMgr& operator= (const SoundResMgr&);
+};
+
+#endif
+
+/* EOF */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/sound sound_res_mgr.cxx,1.2,1.3 sound_res_mgr.hxx,1.2,1.3,
torangan <=
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src/worldmap manager.cxx,1.38,1.39 manager.hxx,1.21,1.22 path_graph.cxx,1.21,1.22 path_graph.hxx,1.10,1.11 worldmap.cxx,1.47,1.48
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src/worldmap manager.cxx,1.38,1.39 manager.hxx,1.21,1.22 path_graph.cxx,1.21,1.22 path_graph.hxx,1.10,1.11 worldmap.cxx,1.47,1.48
- Index(es):