OpenTTD
music.cpp File Reference

The songs that OpenTTD knows. More...

#include "stdafx.h"
#include "base_media_func.h"
#include "safeguards.h"
#include "fios.h"

Go to the source code of this file.

Macros

#define SET_TYPE   "music"
 The type of set we're replacing.
 

Functions

char * GetMusicCatEntryName (const char *filename, size_t entrynum)
 Read the name of a music CAT file entry. More...
 
byte * GetMusicCatEntryData (const char *filename, size_t entrynum, size_t &entrylen)
 Read the full data of a music CAT file entry. More...
 
 assert_compile (lengthof(_music_file_names)==NUM_SONGS_AVAILABLE)
 Make sure we aren't messing things up. More...
 

Variables

static const char *const _music_file_names []
 Names corresponding to the music set's files. More...
 

Detailed Description

The songs that OpenTTD knows.

Definition in file music.cpp.

Function Documentation

◆ assert_compile()

Make sure we aren't messing things up.

◆ GetMusicCatEntryData()

byte* GetMusicCatEntryData ( const char *  filename,
size_t  entrynum,
size_t &  entrylen 
)

Read the full data of a music CAT file entry.

Parameters
filenameName of CAT file to read from.
entrynumIndex of entry to read
[out]entrylenReceives length of data read
Returns
Pointer to buffer with data read, caller is responsible for freeind memory, NULL if entrynum does not exist.

Definition at line 57 of file music.cpp.

References BASESET_DIR, CONFIG_SLOT, FioCheckFileExists(), FioOpenFile(), FioReadBlock(), FioReadByte(), FioReadDword(), FioSeekTo(), FioSkipBytes(), and INSTANTIATE_BASE_MEDIA_METHODS.

◆ GetMusicCatEntryName()

char* GetMusicCatEntryName ( const char *  filename,
size_t  entrynum 
)

Read the name of a music CAT file entry.

Parameters
filenameName of CAT file to read from
entrynumIndex of entry whose name to read
Returns
Pointer to string, caller is responsible for freeing memory, NULL if entrynum does not exist.

Definition at line 30 of file music.cpp.

References BASESET_DIR, CONFIG_SLOT, FioCheckFileExists(), FioOpenFile(), FioReadBlock(), FioReadByte(), FioReadDword(), and FioSeekTo().

Variable Documentation

◆ _music_file_names

const char* const _music_file_names[]
static
Initial value:
= {
"theme",
"old_0", "old_1", "old_2", "old_3", "old_4", "old_5", "old_6", "old_7", "old_8", "old_9",
"new_0", "new_1", "new_2", "new_3", "new_4", "new_5", "new_6", "new_7", "new_8", "new_9",
"ezy_0", "ezy_1", "ezy_2", "ezy_3", "ezy_4", "ezy_5", "ezy_6", "ezy_7", "ezy_8", "ezy_9",
}

Names corresponding to the music set's files.

Definition at line 81 of file music.cpp.