This patch removes leftovers of the conversion from arrays to Vectors.
Index: code/gamesnd/gamesnd.cpp
===================================================================
--- code/gamesnd/gamesnd.cpp (Revision 7929)
+++ code/gamesnd/gamesnd.cpp (Arbeitskopie)
@@ -16,17 +16,11 @@
#include "sound/ds.h"
#include <limits.h>
-
SCP_vector<game_snd> Snds;
SCP_vector<game_snd> Snds_iface;
SCP_vector<int> Snds_iface_handle;
-#define GAME_SND 0
-#define IFACE_SND 1
-
-void gamesnd_add_sound_slot(int type, int num);
-
void gamesnd_play_iface(int n)
{
if (Snds_iface_handle[n] >= 0)
@@ -249,15 +243,12 @@
advance_to_eoln(NULL);
}
-// -------------------------------------------------------------------------------------------------
-// gamesnd_parse_soundstbl() will parse the sounds.tbl file, and load the specified sounds.
-//
-//
+/**
+ * parse the sounds.tbl file, and load the specified sounds.
+ */
void gamesnd_parse_soundstbl()
{
int rval;
- int num_game_sounds = 0;
- int num_iface_sounds = 0;
int i;
char cstrtemp[NAME_LENGTH+3];
char *missing_species_names = NULL;
@@ -281,22 +272,20 @@
// Parse the gameplay sounds section
required_string("#Game Sounds Start");
while (required_string_either("#Game Sounds End","$Name:")) {
- Assert( Snds.size() < INT_MAX );
- Assert( num_game_sounds < (int)Snds.size() );
- gamesnd_parse_line( &Snds[num_game_sounds], "$Name:" );
- num_game_sounds++;
- gamesnd_add_sound_slot( GAME_SND, num_game_sounds );
+ game_snd tempSound;
+ gamesnd_parse_line( &tempSound, "$Name:" );
+ Snds.push_back(game_snd(tempSound));
}
required_string("#Game Sounds End");
// Parse the interface sounds section
required_string("#Interface Sounds Start");
while (required_string_either("#Interface Sounds End","$Name:")) {
- Assert( Snds_iface_handle.size() < INT_MAX );
- Assert( num_iface_sounds < (int)Snds_iface.size() );
- gamesnd_parse_line(&Snds_iface[num_iface_sounds], "$Name:");
- num_iface_sounds++;
- gamesnd_add_sound_slot( IFACE_SND, num_iface_sounds );
+ game_snd tempSound;
+ gamesnd_parse_line( &tempSound, "$Name:");
+
+ Snds_iface.push_back(game_snd(tempSound));
+ Snds_iface_handle.push_back(-1);
}
required_string("#Interface Sounds End");
@@ -489,55 +478,16 @@
}
-// -------------------------------------------------------------------------------------------------
-// gamesnd_init_struct()
-//
-void gamesnd_init_struct(game_snd *gs)
-{
- gs->sig = -1;
- gs->filename[0] = 0;
- gs->id = -1;
- gs->id_sig = -1;
-// gs->is_3d = 0;
-// gs->use_ds3d = 0;
- gs->flags = 0;
-}
-
-// -------------------------------------------------------------------------------------------------
-// gamesnd_init_sounds() will initialize the Snds[] and Snds_iface[] arrays
-//
+/**
+ * Currently does nothing
+ */
void gamesnd_init_sounds()
{
- int i = 0;
-
- Snds.clear();
- Snds.resize(MIN_GAME_SOUNDS);
-
- Assert( Snds.size() > 0 );
-
- Assert( Snds.size() <= INT_MAX );
- // init the gameplay sounds
- for (SCP_vector<game_snd>::iterator gs = Snds.begin(); gs != Snds.end(); ++gs) {
- gamesnd_init_struct(&(*gs));
- }
-
- Snds_iface.clear();
- Snds_iface.resize(MIN_INTERFACE_SOUNDS);
- Snds_iface_handle.resize(MIN_INTERFACE_SOUNDS);
-
- Assert( Snds_iface.size() > 0 );
-
- Assert( Snds_iface.size() < INT_MAX );
- // init the interface sounds
-
- for (SCP_vector<game_snd>::iterator si = Snds_iface.begin(); si != Snds_iface.end(); ++si) {
- gamesnd_init_struct(&(*si));
- Snds_iface_handle[i] = -1;
- i++;
- }
}
-// close out gamesnd, ONLY CALL FROM game_shutdown()!!!!
+/**
+ * close out gamesnd, ONLY CALL FROM game_shutdown()!!!!
+ */
void gamesnd_close()
{
Snds.clear();
@@ -545,7 +495,9 @@
Snds_iface_handle.clear();
}
-// callback function for the UI code to call when the mouse first goes over a button.
+/**
+ * callback function for the UI code to call when the mouse first goes over a button.
+ */
void common_play_highlight_sound()
{
gamesnd_play_iface(SND_USER_OVER);
@@ -555,50 +507,3 @@
{
gamesnd_play_iface(SND_GENERAL_FAIL);
}
-
-void gamesnd_add_sound_slot(int type, int num)
-{
- const int increase_by = 5;
- int i;
-
- switch (type) {
- case GAME_SND:
- {
- Assert( Snds.size() <= INT_MAX );
- Assert( num < ((int)Snds.size() + increase_by) );
-
- if (num >= (int)Snds.size()) {
- Snds.resize(Snds.size() + increase_by);
-
- // default all new entries
- for (i = ((int)Snds.size() - increase_by); i < (int)Snds.size(); i++) {
- gamesnd_init_struct(&Snds[i]);
- }
- }
- }
- break;
-
- case IFACE_SND:
- {
- Assert( Snds_iface.size() < INT_MAX );
- Assert( num < ((int)Snds_iface.size() + increase_by) );
-
- if (num >= (int)Snds_iface.size()) {
- Snds_iface.resize(Snds_iface.size() + increase_by);
-
- Snds_iface_handle.resize(Snds_iface.size());
- Assert( Snds_iface.size() < INT_MAX );
-
- // default all new entries
- for (i = ((int)Snds_iface_handle.size() - increase_by); i < (int)Snds_iface_handle.size(); i++) {
- gamesnd_init_struct(&Snds_iface[i]);
- Snds_iface_handle[i] = -1;
- }
- }
- }
- break;
-
- default:
- Int3();
- }
-}