public void run()
        {
            for (int i = 0; i < TransportManager.MAX_LINE_COUNT; ++i)
            {
                /*if (TransportManager.instance.m_lines.m_buffer[i].Info.m_transportType != TransportInfo.TransportType.Tram) {
                 *      continue;
                 * }*/
                //Log.Message("Transport line " + i + ":");
                if ((TransportManager.instance.m_lines.m_buffer[i].m_flags & TransportLine.Flags.Created) == TransportLine.Flags.None)
                {
                    //Log.Message("\tTransport line is not created.");
                }
                //Log.Message("\tFlags: " + TransportManager.instance.m_lines.m_buffer[i].m_flags + ", cat: " + TransportManager.instance.m_lines.m_buffer[i].Info.category + ", type: " + TransportManager.instance.m_lines.m_buffer[i].Info.m_transportType + ", name: " + TransportManager.instance.GetLineName((ushort)i));
                ushort  firstStopNodeId = TransportManager.instance.m_lines.m_buffer[i].m_stops;
                ushort  stopNodeId      = firstStopNodeId;
                Vector3 lastNodePos     = Vector3.zero;
                int     index           = 1;
                while (stopNodeId != 0)
                {
                    Vector3 pos = NetManager.instance.m_nodes.m_buffer[stopNodeId].m_position;
                    if (NetManager.instance.m_nodes.m_buffer[stopNodeId].m_problems != Notification.Problem.None)
                    {
                        Log.Message("\tStop node #" + index + " -- " + stopNodeId + ": Flags: " + NetManager.instance.m_nodes.m_buffer[stopNodeId].m_flags + ", Transport line: " + NetManager.instance.m_nodes.m_buffer[stopNodeId].m_transportLine + ", Problems: " + NetManager.instance.m_nodes.m_buffer[stopNodeId].m_problems + " Pos: " + pos + ", Dist. to lat pos: " + (lastNodePos - pos).magnitude);
                        Log.Message("\tFlags: " + TransportManager.instance.m_lines.m_buffer[i].m_flags + ", cat: " + TransportManager.instance.m_lines.m_buffer[i].Info.category + ", type: " + TransportManager.instance.m_lines.m_buffer[i].Info.m_transportType + ", name: " + TransportManager.instance.GetLineName((ushort)i));
                    }
                    lastNodePos = pos;

                    ushort nextSegment = TransportLine.GetNextSegment(stopNodeId);
                    if (nextSegment != 0)
                    {
                        stopNodeId = NetManager.instance.m_segments.m_buffer[(int)nextSegment].m_endNode;
                    }
                    else
                    {
                        break;
                    }
                    ++index;

                    if (stopNodeId == firstStopNodeId)
                    {
                        break;
                    }

                    if (index > 10000)
                    {
                        Log.Message("Too many iterations!");
                        break;
                    }
                }
            }
        }
示例#2
0
        private static void PrintTransportStats()
        {
            TransportLine[] linesBuffer = TransportManager.instance.m_lines.m_buffer;
            NetNode[]       nodesBuffer = NetManager.instance.m_nodes.m_buffer;

            for (int i = 0; i < TransportManager.MAX_LINE_COUNT; ++i)
            {
                Log.Info("Transport line " + i + ":");

                if ((linesBuffer[i].m_flags &
                     TransportLine.Flags.Created) == TransportLine.Flags.None)
                {
                    Log.Info("\tTransport line is not created.");
                    continue;
                }

                Log.InfoFormat(
                    "\tFlags: {0}, cat: {1}, type: {2}, name: {3}",
                    linesBuffer[i].m_flags,
                    linesBuffer[i].Info.category,
                    linesBuffer[i].Info.m_transportType,
                    TransportManager.instance.GetLineName((ushort)i));

                ushort  firstStopNodeId = linesBuffer[i].m_stops;
                ushort  stopNodeId      = firstStopNodeId;
                Vector3 lastNodePos     = Vector3.zero;
                int     index           = 1;

                while (stopNodeId != 0)
                {
                    Vector3 pos = nodesBuffer[stopNodeId].m_position;

                    Log.InfoFormat(
                        "\tStop node #{0} -- {1}: Flags: {2}, Transport line: {3}, Problems: {4} " +
                        "Pos: {5}, Dist. to lat pos: {6}",
                        index,
                        stopNodeId,
                        nodesBuffer[stopNodeId].m_flags,
                        nodesBuffer[stopNodeId].m_transportLine,
                        nodesBuffer[stopNodeId].m_problems,
                        pos,
                        (lastNodePos - pos).magnitude);

                    if (nodesBuffer[stopNodeId].m_problems != Notification.Problem.None)
                    {
                        Log.Warning("\t*** PROBLEMS DETECTED ***");
                    }

                    lastNodePos = pos;

                    ushort nextSegment = TransportLine.GetNextSegment(stopNodeId);
                    if (nextSegment != 0)
                    {
                        stopNodeId = NetManager.instance.m_segments.m_buffer[nextSegment].m_endNode;
                    }
                    else
                    {
                        break;
                    }

                    ++index;

                    if (stopNodeId == firstStopNodeId)
                    {
                        break;
                    }

                    if (index > 10000)
                    {
                        Log.Error("Too many iterations!");
                        break;
                    }
                }
            }
        }