Fix MSVC project not compiling due to missing GameStructs.h, don't expose some private functions in .h files

This commit is contained in:
UnknownShadow200 2020-06-19 22:22:41 +10:00
parent e95f7767d4
commit ada9caef3e
8 changed files with 10 additions and 18 deletions

View File

@ -215,7 +215,7 @@ void Audio_Open(AudioHandle* handle, int buffers) {
Logger_Abort("No free audio contexts");
}
cc_result Audio_Close(AudioHandle handle) {
static cc_result Audio_DoClose(AudioHandle handle) {
struct AudioFormat fmt = { 0 };
struct AudioContext* ctx = &audioContexts[handle];
@ -349,7 +349,7 @@ void Audio_Open(AudioHandle* handle, int buffers) {
Logger_Abort("No free audio contexts");
}
cc_result Audio_Close(AudioHandle handle) {
static cc_result Audio_DoClose(AudioHandle handle) {
struct AudioFormat fmt = { 0 };
struct AudioContext* ctx;
cc_result res;
@ -447,11 +447,11 @@ struct AudioFormat* Audio_GetFormat(AudioHandle handle) {
return &audioContexts[handle].format;
}
cc_result Audio_StopAndClose(AudioHandle handle) {
cc_result Audio_Close(AudioHandle handle) {
cc_bool finished;
Audio_Stop(handle);
Audio_IsFinished(handle, &finished); /* unqueue buffers */
return Audio_Close(handle);
return Audio_DoClose(handle);
}
@ -722,7 +722,7 @@ static void Sounds_FreeOutputs(struct SoundOutput* outputs) {
for (i = 0; i < AUDIO_MAX_HANDLES; i++) {
if (outputs[i].handle == HANDLE_INV) continue;
Audio_StopAndClose(outputs[i].handle);
Audio_Close(outputs[i].handle);
outputs[i].handle = HANDLE_INV;
Mem_Free(outputs[i].buffer);
@ -900,7 +900,7 @@ static void Music_RunLoop(void) {
Chat_AddRaw("&cDisabling music");
Audio_MusicVolume = 0;
}
Audio_StopAndClose(music_out);
Audio_Close(music_out);
if (music_joining) return;
Thread_Detach(music_thread);

View File

@ -27,11 +27,8 @@ typedef int AudioHandle;
/* Acquires an audio context. */
void Audio_Open(AudioHandle* handle, int buffers);
/* Frees an allocated audio context. */
/* NOTE: Audio_StopAndClose should be used, because this method can fail if audio is playing. */
cc_result Audio_Close(AudioHandle handle);
/* Stops playing audio, unqueues buffers, then frees the audio context. */
cc_result Audio_StopAndClose(AudioHandle handle);
cc_result Audio_Close(AudioHandle handle);
/* Returns the format audio is played in. */
struct AudioFormat* Audio_GetFormat(AudioHandle handle);
/* Sets the format audio to play is in. */

View File

@ -688,7 +688,7 @@ static void Blocks_Reset(void) {
static void OnAtlasChanged(void* obj) { Block_RecalculateAllSpriteBB(); }
static void Blocks_Init(void) {
int block;
for (block = BLOCK_AIR; block <= BLOCK_MAX_DEFINED; block++) {
for (block = BLOCK_AIR; block < BLOCK_COUNT; block++) {
Blocks.CanPlace[block] = true;
Blocks.CanDelete[block] = true;
}

View File

@ -233,7 +233,6 @@
<ClInclude Include="SelectionBox.h" />
<ClInclude Include="Server.h" />
<ClInclude Include="Stream.h" />
<ClInclude Include="GameStructs.h" />
<ClInclude Include="TexturePack.h" />
<ClInclude Include="Utils.h" />
<ClInclude Include="PackedCol.h" />

View File

@ -165,9 +165,6 @@
<ClInclude Include="Game.h">
<Filter>Header Files\Game</Filter>
</ClInclude>
<ClInclude Include="GameStructs.h">
<Filter>Header Files\Game</Filter>
</ClInclude>
<ClInclude Include="Camera.h">
<Filter>Header Files\Utils</Filter>
</ClInclude>

View File

@ -50,7 +50,7 @@ struct ChunkInfo* MapRenderer_GetChunk(int cx, int cy, int cz) {
return &mapChunks[MapRenderer_Pack(cx, cy, cz)];
}
void ChunkInfo_Reset(struct ChunkInfo* chunk, int x, int y, int z) {
static void ChunkInfo_Reset(struct ChunkInfo* chunk, int x, int y, int z) {
chunk->CentreX = x + HALF_CHUNK_SIZE; chunk->CentreY = y + HALF_CHUNK_SIZE;
chunk->CentreZ = z + HALF_CHUNK_SIZE;
#ifndef CC_BUILD_GL11

View File

@ -64,7 +64,6 @@ struct ChunkInfo {
struct ChunkPartInfo* TranslucentParts;
};
void ChunkInfo_Reset(struct ChunkInfo* chunk, int x, int y, int z);
/* Gets the chunk at the given chunk coordinates in the world. */
/* NOTE: Does NOT check coordinates are within bounds. */
struct ChunkInfo* MapRenderer_GetChunk(int cx, int cy, int cz);

View File

@ -1464,7 +1464,7 @@ static void CPE_DefineModel(cc_uint8* data) {
/* read # CustomModelParts */
numParts = *data++;
if (numParts >= MAX_CUSTOM_MODEL_PARTS) {
if (numParts > MAX_CUSTOM_MODEL_PARTS) {
String msg; char msgBuffer[256];
String_InitArray(msg, msgBuffer);