forked from Kolyah35/minecraft-pe-0.6.1
FIX: Crash when server is disaibling
This commit is contained in:
@@ -258,9 +258,10 @@ void Minecraft::selectLevel( const std::string& levelId, const std::string& leve
|
||||
|
||||
void Minecraft::setLevel(Level* level, const std::string& message /* ="" */, LocalPlayer* forceInsertPlayer /* = NULL */) {
|
||||
cameraTargetPlayer = NULL;
|
||||
LOGI("Seed is %ld\n", level->getSeed());
|
||||
|
||||
if (level != NULL) {
|
||||
LOGI("Seed is %ld\n", level->getSeed());
|
||||
|
||||
level->raknetInstance = raknetInstance;
|
||||
gameMode->initLevel(level);
|
||||
|
||||
|
||||
@@ -1077,13 +1077,13 @@ void LevelRenderer::playSound(const std::string& name, float x, float y, float z
|
||||
float dd = 16;
|
||||
|
||||
if (volume > 1) dd *= volume;
|
||||
if (mc->cameraTargetPlayer->distanceToSqr(x, y, z) < dd * dd) {
|
||||
if (mc->cameraTargetPlayer != NULL && mc->cameraTargetPlayer->distanceToSqr(x, y, z) < dd * dd) {
|
||||
mc->soundEngine->play(name, x, y, z, volume, pitch);
|
||||
}
|
||||
}
|
||||
|
||||
void LevelRenderer::addParticle(const std::string& name, float x, float y, float z, float xa, float ya, float za, int data) {
|
||||
|
||||
if (mc->cameraTargetPlayer != NULL) {
|
||||
float xd = mc->cameraTargetPlayer->x - x;
|
||||
float yd = mc->cameraTargetPlayer->y - y;
|
||||
float zd = mc->cameraTargetPlayer->z - z;
|
||||
@@ -1125,6 +1125,7 @@ void LevelRenderer::addParticle(const std::string& name, float x, float y, float
|
||||
//sw.stop();
|
||||
//sw.printEvery(50, "add-particle-string");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void LevelRenderer::addParticle(ParticleType::Id name, float x, float y, float z, float xa, float ya, float za, int data) {
|
||||
|
||||
@@ -124,6 +124,8 @@ void ClientSideNetworkHandler::onDisconnect(const RakNet::RakNetGUID& guid)
|
||||
minecraft->setLevel(NULL);
|
||||
#ifndef STANDALONE_SERVER
|
||||
minecraft->gui.addMessage("Disconnected from server");
|
||||
// TODO: screen with error
|
||||
minecraft->screenChooser.setScreen(SCREEN_STARTMENU);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -697,12 +697,9 @@ void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, WantCrea
|
||||
}
|
||||
}
|
||||
|
||||
// for (int i = 0; i < items.size(); i++) {
|
||||
// RemoveItemPacket removePacket(packet->playerId, items.at(i).count, items.at(i).getAuxValue(), items.at(i).id);
|
||||
// raknetInstance->send(source, removePacket);
|
||||
|
||||
// p->inventory->removeResource(ItemInstance(items.at(i).id, items.at(i).count, items.at(i).getAuxValue()));
|
||||
// }
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
p->inventory->removeResource(ItemInstance(items.at(i).id, items.at(i).count, items.at(i).getAuxValue()));
|
||||
}
|
||||
// TakeItemPacket itemAdd(p->entityId, wantCreate.count, wantCreate.getAuxValue(), wantCreate.id);
|
||||
// raknetInstance->send(source, itemAdd);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user