mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-13 09:35:23 -04:00
Fix not being able to place water/lava/bedrock after loading new map in singleplayer (Thanks Guri)
This commit is contained in:
parent
31ea08eead
commit
4875746bf6
28
src/Server.c
28
src/Server.c
@ -118,15 +118,8 @@ int Ping_AveragePingMS(void) {
|
|||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
*-------------------------------------------------Singleplayer connection-------------------------------------------------*
|
*-------------------------------------------------Singleplayer connection-------------------------------------------------*
|
||||||
*#########################################################################################################################*/
|
*#########################################################################################################################*/
|
||||||
#define SP_HasDir(path) (String_IndexOf(&path, '/') >= 0 || String_IndexOf(&path, '\\') >= 0)
|
static void SPConnection_ResetBlockPerms(void) {
|
||||||
static void SPConnection_BeginConnect(void) {
|
|
||||||
static const String logName = String_FromConst("Singleplayer");
|
|
||||||
String path;
|
|
||||||
RNGState rnd;
|
|
||||||
int i, count;
|
int i, count;
|
||||||
|
|
||||||
Chat_SetLogName(&logName);
|
|
||||||
Game_UseCPEBlocks = Game_UseCPE;
|
|
||||||
count = Game_UseCPEBlocks ? BLOCK_CPE_COUNT : BLOCK_ORIGINAL_COUNT;
|
count = Game_UseCPEBlocks ? BLOCK_CPE_COUNT : BLOCK_ORIGINAL_COUNT;
|
||||||
|
|
||||||
for (i = 1; i < count; i++) {
|
for (i = 1; i < count; i++) {
|
||||||
@ -134,12 +127,21 @@ static void SPConnection_BeginConnect(void) {
|
|||||||
Blocks.CanDelete[i] = true;
|
Blocks.CanDelete[i] = true;
|
||||||
}
|
}
|
||||||
Event_RaiseVoid(&BlockEvents.PermissionsChanged);
|
Event_RaiseVoid(&BlockEvents.PermissionsChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define SP_HasDir(path) (String_IndexOf(&path, '/') >= 0 || String_IndexOf(&path, '\\') >= 0)
|
||||||
|
static void SPConnection_BeginConnect(void) {
|
||||||
|
static const String logName = String_FromConst("Singleplayer");
|
||||||
|
String path;
|
||||||
|
RNGState rnd;
|
||||||
|
Chat_SetLogName(&logName);
|
||||||
|
Game_UseCPEBlocks = Game_UseCPE;
|
||||||
|
SPConnection_ResetBlockPerms();
|
||||||
|
|
||||||
/* For when user drops a map file onto ClassiCube.exe */
|
/* For when user drops a map file onto ClassiCube.exe */
|
||||||
path = Game_Username;
|
path = Game_Username;
|
||||||
if (SP_HasDir(path) && File_Exists(&path)) {
|
if (SP_HasDir(path) && File_Exists(&path)) {
|
||||||
Map_LoadFrom(&path);
|
Map_LoadFrom(&path); return;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Random_SeedFromCurrentTime(&rnd);
|
Random_SeedFromCurrentTime(&rnd);
|
||||||
@ -491,10 +493,12 @@ static void OnNewMap(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void OnReset(void) {
|
static void OnReset(void) {
|
||||||
if (Server.IsSinglePlayer) return;
|
if (Server.IsSinglePlayer) {
|
||||||
|
SPConnection_ResetBlockPerms();
|
||||||
|
} else {
|
||||||
net_writeFailed = false;
|
net_writeFailed = false;
|
||||||
OnFree();
|
OnFree();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void OnInit(void) {
|
static void OnInit(void) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user