Make entity vtable and Updater_XYZ const

This commit is contained in:
UnknownShadow200 2020-03-20 21:51:34 +11:00
parent 5621c5c119
commit 0553c950fd
5 changed files with 21 additions and 21 deletions

View File

@ -870,7 +870,7 @@ static void LocalPlayer_CheckJumpVelocity(void* obj) {
} }
} }
static struct EntityVTABLE localPlayer_VTABLE = { const static struct EntityVTABLE localPlayer_VTABLE = {
LocalPlayer_Tick, Player_Despawn, LocalPlayer_SetLocation, Entity_GetCol, LocalPlayer_Tick, Player_Despawn, LocalPlayer_SetLocation, Entity_GetCol,
LocalPlayer_RenderModel, LocalPlayer_RenderName LocalPlayer_RenderModel, LocalPlayer_RenderName
}; };
@ -1098,7 +1098,7 @@ static void NetPlayer_RenderName(struct Entity* e) {
if (distance <= (float)threshold) DrawName(e); if (distance <= (float)threshold) DrawName(e);
} }
struct EntityVTABLE netPlayer_VTABLE = { const struct EntityVTABLE netPlayer_VTABLE = {
NetPlayer_Tick, Player_Despawn, NetPlayer_SetLocation, Entity_GetCol, NetPlayer_Tick, Player_Despawn, NetPlayer_SetLocation, Entity_GetCol,
NetPlayer_RenderModel, NetPlayer_RenderName NetPlayer_RenderModel, NetPlayer_RenderName
}; };

View File

@ -69,7 +69,7 @@ struct EntityVTABLE {
/* Contains a model, along with position, velocity, and rotation. May also contain other fields and properties. */ /* Contains a model, along with position, velocity, and rotation. May also contain other fields and properties. */
struct Entity { struct Entity {
struct EntityVTABLE* VTABLE; const struct EntityVTABLE* VTABLE;
Vec3 Position; Vec3 Position;
float Pitch, Yaw, RotX, RotY, RotZ; float Pitch, Yaw, RotX, RotY, RotZ;
Vec3 Velocity; Vec3 Velocity;

View File

@ -229,7 +229,7 @@ void HeldBlockRenderer_Render(double delta) {
Gfx_LoadMatrix(MATRIX_PROJECTION, &Gfx.Projection); Gfx_LoadMatrix(MATRIX_PROJECTION, &Gfx.Projection);
} }
static struct EntityVTABLE heldEntity_VTABLE = { const static struct EntityVTABLE heldEntity_VTABLE = {
NULL, NULL, NULL, HeldBlockRenderer_GetCol, NULL, NULL, NULL, HeldBlockRenderer_GetCol,
NULL, NULL NULL, NULL
}; };

View File

@ -1232,11 +1232,11 @@ static cc_result Process_RawGetExePath(char* path, int* len) {
#define UPDATE_SRC TEXT(UPDATE_FILE) #define UPDATE_SRC TEXT(UPDATE_FILE)
#if _WIN64 #if _WIN64
const char* Updater_D3D9 = "ClassiCube.64.exe"; const char* const Updater_D3D9 = "ClassiCube.64.exe";
const char* Updater_OGL = "ClassiCube.64-opengl.exe"; const char* const Updater_OGL = "ClassiCube.64-opengl.exe";
#else #else
const char* Updater_D3D9 = "ClassiCube.exe"; const char* const Updater_D3D9 = "ClassiCube.exe";
const char* Updater_OGL = "ClassiCube.opengl.exe"; const char* const Updater_OGL = "ClassiCube.opengl.exe";
#endif #endif
cc_bool Updater_Clean(void) { cc_bool Updater_Clean(void) {
@ -1286,8 +1286,8 @@ cc_result Updater_GetBuildTime(TimeMS* ms) {
/* Don't need special execute permission on windows */ /* Don't need special execute permission on windows */
cc_result Updater_MarkExecutable(void) { return 0; } cc_result Updater_MarkExecutable(void) { return 0; }
#elif defined CC_BUILD_WEB || defined CC_BUILD_ANDROID #elif defined CC_BUILD_WEB || defined CC_BUILD_ANDROID
const char* Updater_D3D9 = NULL; const char* const Updater_D3D9 = NULL;
const char* Updater_OGL = NULL; const char* const Updater_OGL = NULL;
cc_bool Updater_Clean(void) { return true; } cc_bool Updater_Clean(void) { return true; }
cc_result Updater_Start(void) { return ERR_NOT_SUPPORTED; } cc_result Updater_Start(void) { return ERR_NOT_SUPPORTED; }
@ -1296,27 +1296,27 @@ cc_result Updater_MarkExecutable(void) { return 0; }
#elif defined CC_BUILD_POSIX #elif defined CC_BUILD_POSIX
cc_bool Updater_Clean(void) { return true; } cc_bool Updater_Clean(void) { return true; }
const char* Updater_D3D9 = NULL; const char* const Updater_D3D9 = NULL;
#if defined CC_BUILD_LINUX #if defined CC_BUILD_LINUX
#if __x86_64__ #if __x86_64__
const char* Updater_OGL = "ClassiCube"; const char* const Updater_OGL = "ClassiCube";
#elif __i386__ #elif __i386__
const char* Updater_OGL = "ClassiCube.32"; const char* const Updater_OGL = "ClassiCube.32";
#elif CC_BUILD_RPI #elif CC_BUILD_RPI
const char* Updater_OGL = "ClassiCube.rpi"; const char* const Updater_OGL = "ClassiCube.rpi";
#else #else
const char* Updater_OGL = NULL; const char* const Updater_OGL = NULL;
#endif #endif
#elif defined CC_BUILD_OSX #elif defined CC_BUILD_OSX
#if __x86_64__ #if __x86_64__
const char* Updater_OGL = "ClassiCube.64.osx"; const char* const Updater_OGL = "ClassiCube.64.osx";
#elif __i386__ #elif __i386__
const char* Updater_OGL = "ClassiCube.osx"; const char* const Updater_OGL = "ClassiCube.osx";
#else #else
const char* Updater_OGL = NULL; const char* const Updater_OGL = NULL;
#endif #endif
#else #else
const char* Updater_OGL = NULL; const char* const Updater_OGL = NULL;
#endif #endif
cc_result Updater_Start(void) { cc_result Updater_Start(void) {

View File

@ -63,8 +63,8 @@ CC_API void Process_Exit(cc_result code);
/* For example, provide a http:// url to open a website in the user's web browser. */ /* For example, provide a http:// url to open a website in the user's web browser. */
CC_API void Process_StartOpen(const String* args); CC_API void Process_StartOpen(const String* args);
extern const char* Updater_D3D9; extern const char* const Updater_D3D9;
extern const char* Updater_OGL; extern const char* const Updater_OGL;
/* Attempts to clean up any leftover files from an update */ /* Attempts to clean up any leftover files from an update */
cc_bool Updater_Clean(void); cc_bool Updater_Clean(void);
/* Starts the platform-specific method to update then start the game using the UPDATE_FILE file. */ /* Starts the platform-specific method to update then start the game using the UPDATE_FILE file. */