void SurveyMapManager::UpdateVehicles(Actor** vehicles, int num_vehicles) { for (int t = 0; t < num_vehicles; t++) { if (!vehicles[t]) continue; SurveyMapEntity* e = getMapEntityByName("Truck" + TOSTRING(vehicles[t]->ar_instance_id)); if (e) { e->setState(static_cast<int>(Actor::SimState::LOCAL_SIMULATED)); e->setVisibility(true); e->setPosition(vehicles[t]->getPosition().x, vehicles[t]->getPosition().z); e->setRotation(Radian(vehicles[t]->getHeadingDirectionAngle())); } } }
void TerrainObjectManager::loadPreloadedTrucks() { // in netmode, don't load other trucks! if (gEnv->network != nullptr) { return; } for (unsigned int i=0; i<truck_preload.size(); i++) { Vector3 pos = Vector3(truck_preload[i].px, truck_preload[i].py, truck_preload[i].pz); Beam *b = BeamFactory::getSingleton().CreateLocalRigInstance( pos, truck_preload[i].rotation, truck_preload[i].name, -1, nullptr, /* spawnbox */ truck_preload[i].ismachine, nullptr, /* truckconfig */ nullptr, /* skin */ truck_preload[i].freePosition, true /* preloaded_with_terrain */ ); #ifdef USE_MYGUI if (b && gEnv->surveyMap) { SurveyMapEntity *e = gEnv->surveyMap->createNamedMapEntity("Truck"+TOSTRING(b->trucknum), SurveyMapManager::getTypeByDriveable(b->driveable)); if (e) { e->setState(DESACTIVATED); e->setVisibility(true); e->setPosition(truck_preload[i].px, truck_preload[i].pz); e->setRotation(-Radian(b->getHeadingDirectionAngle())); } } #endif //USE_MYGUI } }