mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 11:35:08 -04:00
Game shouldn't crash when you set a sound id above snow sound id
This commit is contained in:
parent
21d96f1de1
commit
740c6010c2
@ -55,7 +55,7 @@ namespace ClassicalSharp.Audio {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Sound PickRandomSound(byte type) {
|
public Sound PickRandomSound(byte type) {
|
||||||
if (type == SoundType.None) return null;
|
if (type == SoundType.None || type >= SoundType.Count) return null;
|
||||||
if (type == SoundType.Metal) type = SoundType.Stone;
|
if (type == SoundType.Metal) type = SoundType.Stone;
|
||||||
string name = SoundType.Names[type];
|
string name = SoundType.Names[type];
|
||||||
|
|
||||||
|
@ -14,7 +14,8 @@ namespace ClassicalSharp {
|
|||||||
public const byte Glass = 6; public const byte Cloth = 7;
|
public const byte Glass = 6; public const byte Cloth = 7;
|
||||||
public const byte Sand = 8; public const byte Snow = 9;
|
public const byte Sand = 8; public const byte Snow = 9;
|
||||||
|
|
||||||
public static string[] Names = new string[10] {
|
public const byte Count = 10;
|
||||||
|
public static string[] Names = new string[Count] {
|
||||||
"none", "wood", "gravel", "grass", "stone",
|
"none", "wood", "gravel", "grass", "stone",
|
||||||
"metal", "glass", "cloth", "sand", "snow",
|
"metal", "glass", "cloth", "sand", "snow",
|
||||||
};
|
};
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
enum SOUND {
|
enum SOUND {
|
||||||
SOUND_NONE, SOUND_WOOD, SOUND_GRAVEL, SOUND_GRASS,
|
SOUND_NONE, SOUND_WOOD, SOUND_GRAVEL, SOUND_GRASS,
|
||||||
SOUND_STONE, SOUND_METAL, SOUND_GLASS, SOUND_CLOTH,
|
SOUND_STONE, SOUND_METAL, SOUND_GLASS, SOUND_CLOTH,
|
||||||
SOUND_SAND, SOUND_SNOW,
|
SOUND_SAND, SOUND_SNOW, SOUND_COUNT,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Describes how a block is rendered in the world. */
|
/* Describes how a block is rendered in the world. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user