void BuildingObject::changeTeleportDestination(Vector & position, float & yaw) const { if (!isAuthoritative()) { WARNING(true, ("BuildingObject::changeTeleportDestination called on " "non-authoritative building %s", getNetworkId().getValueString().c_str())); return; } // call a script trigger that will give us the index of the cloning facility // tube to respawn in, if any int index = -1; ScriptParams params; params.addParam(index); IGNORE_RETURN(const_cast<GameScriptObject *>(getScriptObject())->trigAllScripts( Scripting::TRIG_GET_RESPAWN_LOC, params)); index = params.getIntParam(0); if (index >= 0) { DataTable * respawnTable = DataTableManager::getTable(CLONE_RESPAWN_TABLE, true); if (respawnTable != NULL) { int row = respawnTable->searchColumnString(0, getTemplateName()); if (row >= 0) { char buffer[32]; sprintf(buffer, "TUBE%d_X", index+1); int column = respawnTable->findColumnNumber(buffer); if (column >= 0) { position.x = respawnTable->getFloatValue(column, row); position.z = respawnTable->getFloatValue(column+1, row); yaw = convertDegreesToRadians(respawnTable->getFloatValue(column+2, row)); } } } } }
float CombatTimingTable::getWeaponReloadTimeSeconds(std::string const & weaponType) { float result = 0; DataTable * combatTimingTable = DataTableManager::getTable(cs_combatTimingTableName, true); if (combatTimingTable) { int rowNum = combatTimingTable->searchColumnString(0, weaponType); result = combatTimingTable->getFloatValue("WeaponReloadTimeSeconds", rowNum); } return result; }
void ShipTurretManager::install() // static { InstallTimer const installTimer("ShipTurretManager::install"); Iff iff; if (iff.open("datatables/space/ship_turret.iff", true)) { DataTable dataTable; dataTable.load(iff); int numberOfRows = dataTable.getNumRows(); for (int row = 0; row < numberOfRows; ++row) { std::string const chassisName(dataTable.getStringValue("chassis", row)); ShipChassis const * const chassis = ShipChassis::findShipChassisByName(TemporaryCrcString(chassisName.c_str(), false)); FATAL(!chassis, ("ShipTurretManager::install: no such chassis '%s'", chassisName.c_str())); int const weaponIndex = dataTable.getIntValue("weaponIndex", row); ShipTurretData &shipTurretData = s_shipTurretData[chassis->getCrc()][weaponIndex]; shipTurretData.minYaw = dataTable.getFloatValue("minYaw", row) * PI_OVER_180; shipTurretData.maxYaw = dataTable.getFloatValue("maxYaw", row) * PI_OVER_180; shipTurretData.minPitch = dataTable.getFloatValue("minPitch", row) * PI_OVER_180; shipTurretData.maxPitch = dataTable.getFloatValue("maxPitch", row) * PI_OVER_180; } } }