Fix crash in normal race (RaceEventManager NULL).

This commit is contained in:
hiker 2016-12-16 23:26:34 +11:00
parent 77c14152c2
commit 5cde8f785f
3 changed files with 5 additions and 5 deletions

View File

@ -324,7 +324,7 @@ void ItemManager::checkItemHit(AbstractKart* kart)
if((*i)->hitKart(kart->getXYZ(), kart))
{
// if we're not playing online, pick the item.
if (!RaceEventManager::getInstance()->isRunning())
if (!NetworkConfig::get()->isNetworking())
collectedItem(*i, kart);
else if (NetworkConfig::get()->isServer())
{

View File

@ -67,7 +67,6 @@
#include "modes/soccer_world.hpp"
#include "modes/world.hpp"
#include "network/network_config.hpp"
#include "network/race_event_manager.hpp"
#include "network/rewind_manager.hpp"
#include "physics/btKart.hpp"
#include "physics/btKartRaycast.hpp"
@ -1477,8 +1476,8 @@ void Kart::update(float dt)
// Check if any item was hit.
// check it if we're not in a network world, or if we're on the server
// (when network mode is on)
if (!RaceEventManager::getInstance()->isRunning() ||
NetworkConfig::get()->isServer())
if(!NetworkConfig::get()->isNetworking() ||
NetworkConfig::get()->isServer() )
ItemManager::get()->checkItemHit(this);
static video::SColor pink(255, 255, 133, 253);

View File

@ -141,7 +141,8 @@ float MainLoop::getLimitedDt()
void MainLoop::updateRace(float dt)
{
// The race event manager will update world in case of an online race
if (RaceEventManager::getInstance()->isRunning())
if ( RaceEventManager::getInstance() &&
RaceEventManager::getInstance()->isRunning() )
RaceEventManager::getInstance()->update(dt);
else
World::getWorld()->updateWorld(dt);