|
|
/* $Id$ */
|
|
|
|
|
|
/*
|
|
|
* This file is part of OpenTTD.
|
|
|
* OpenTTD 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, version 2.
|
|
|
* OpenTTD 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 OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
|
|
*/
|
|
|
|
|
|
/** @file newgrf_sound.cpp Handling NewGRF provided sounds. */
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
#include "engine_base.h"
|
|
|
#include "newgrf.h"
|
|
|
#include "newgrf_engine.h"
|
|
|
#include "newgrf_sound.h"
|
|
|
#include "vehicle_base.h"
|
|
|
#include "sound_func.h"
|
|
|
#include "fileio_func.h"
|
|
|
#include "debug.h"
|
|
|
#include "settings_type.h"
|
|
|
|
|
|
#include "safeguards.h"
|
|
|
|
|
|
static SmallVector<SoundEntry, 8> _sounds;
|
|
|
static std::vector<SoundEntry> _sounds;
|
|
|
|
|
|
|
|
|
/**
|
|
|
* Allocate sound slots.
|
|
|
* @param num Number of slots to allocate.
|
|
|
* @return First allocated slot.
|
|
|
*/
|
|
|
SoundEntry *AllocateSound(uint num)
|
|
|
{
|
|
|
SoundEntry *sound = grow(_sounds, num);
|
|
|
MemSetT(sound, 0, num);
|
|
|
return sound;
|
|
|
}
|
|
|
|
|
|
|
|
|
void InitializeSoundPool()
|
|
|
{
|
|
|
_sounds.clear();
|
|
|
|
|
|
/* Copy original sound data to the pool */
|
|
|
SndCopyToPool();
|
|
|
}
|
|
|
|
|
|
|