mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-13 01:26:50 -04:00
Android: Fix singleplayer reusing texture pack from last server (thanks fizzwhiz)
This commit is contained in:
parent
f54360d169
commit
a3f32279f6
@ -176,11 +176,6 @@ void Game_Reset(void) {
|
|||||||
struct IGameComponent* comp;
|
struct IGameComponent* comp;
|
||||||
World_NewMap();
|
World_NewMap();
|
||||||
|
|
||||||
if (TexturePack_Url.length) {
|
|
||||||
TexturePack_Url.length = 0;
|
|
||||||
TexturePack_ExtractCurrent(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (comp = comps_head; comp; comp = comp->next) {
|
for (comp = comps_head; comp; comp = comp->next) {
|
||||||
if (comp->Reset) comp->Reset();
|
if (comp->Reset) comp->Reset();
|
||||||
}
|
}
|
||||||
@ -378,6 +373,7 @@ static void Game_Load(void) {
|
|||||||
Event_Register_(&WindowEvents.Resized, NULL, Game_OnResize);
|
Event_Register_(&WindowEvents.Resized, NULL, Game_OnResize);
|
||||||
Event_Register_(&WindowEvents.Closing, NULL, Game_Free);
|
Event_Register_(&WindowEvents.Closing, NULL, Game_Free);
|
||||||
|
|
||||||
|
Game_AddComponent(&Textures_Component);
|
||||||
Game_AddComponent(&Input_Component);
|
Game_AddComponent(&Input_Component);
|
||||||
Game_AddComponent(&Camera_Component);
|
Game_AddComponent(&Camera_Component);
|
||||||
Game_AddComponent(&Gfx_Component);
|
Game_AddComponent(&Gfx_Component);
|
||||||
@ -395,7 +391,6 @@ static void Game_Load(void) {
|
|||||||
|
|
||||||
Game_AddComponent(&Animations_Component);
|
Game_AddComponent(&Animations_Component);
|
||||||
Game_AddComponent(&Inventory_Component);
|
Game_AddComponent(&Inventory_Component);
|
||||||
Game_AddComponent(&Textures_Component);
|
|
||||||
World_Reset();
|
World_Reset();
|
||||||
|
|
||||||
Game_AddComponent(&Builder_Component);
|
Game_AddComponent(&Builder_Component);
|
||||||
|
12
src/Server.c
12
src/Server.c
@ -502,12 +502,6 @@ static void OnNewMap(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void OnReset(void) {
|
|
||||||
if (Server.IsSinglePlayer) return;
|
|
||||||
net_writeFailed = false;
|
|
||||||
OnClose();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void OnInit(void) {
|
static void OnInit(void) {
|
||||||
String_InitArray(Server.Name, nameBuffer);
|
String_InitArray(Server.Name, nameBuffer);
|
||||||
String_InitArray(Server.MOTD, motdBuffer);
|
String_InitArray(Server.MOTD, motdBuffer);
|
||||||
@ -523,6 +517,12 @@ static void OnInit(void) {
|
|||||||
String_AppendConst(&Server.AppName, GAME_APP_NAME);
|
String_AppendConst(&Server.AppName, GAME_APP_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void OnReset(void) {
|
||||||
|
if (Server.IsSinglePlayer) return;
|
||||||
|
net_writeFailed = false;
|
||||||
|
OnClose();
|
||||||
|
}
|
||||||
|
|
||||||
static void OnFree(void) {
|
static void OnFree(void) {
|
||||||
Server.IP.length = 0;
|
Server.IP.length = 0;
|
||||||
OnClose();
|
OnClose();
|
||||||
|
@ -466,12 +466,20 @@ static void OnInit(void) {
|
|||||||
TextureCache_Init();
|
TextureCache_Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void OnReset(void) {
|
||||||
|
if (!TexturePack_Url.length) return;
|
||||||
|
TexturePack_Url.length = 0;
|
||||||
|
TexturePack_ExtractCurrent(false);
|
||||||
|
}
|
||||||
|
|
||||||
static void OnFree(void) {
|
static void OnFree(void) {
|
||||||
OnContextLost(NULL);
|
OnContextLost(NULL);
|
||||||
Atlas2D_Free();
|
Atlas2D_Free();
|
||||||
|
TexturePack_Url.length = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct IGameComponent Textures_Component = {
|
struct IGameComponent Textures_Component = {
|
||||||
OnInit, /* Init */
|
OnInit, /* Init */
|
||||||
OnFree /* Free */
|
OnFree, /* Free */
|
||||||
|
OnReset /* Reset */
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user