RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Help with a loop, please?

Vhaldir

Sorceror
I've gone blind and dumb, apparently.. this loop keeps running and causes a client disconnect (too much data pending).. it is not seeming to find any tiles >= -5 Z coordinate (even though they exist). I receive a continual stream of "Next Location ({0}) is at correct Z level"

Would anyone be so kind as to stuff my nose in the direction of what I've done wrong? :D
-Thanks in advance.

Code:
                    Point3D location = ((LandTarget)targ).Location;
                    Point3D nextlocToCheck = new Point3D( location.X, location.Y, location.Z );
 
                    if ( location.Z <= -5 )
                    {
                        do
                        {
                            LandTile landTile = map.Tiles.GetLandTile( nextlocToCheck.X, nextlocToCheck.Y );
                            int landID = landTile.ID & TileData.MaxLandValue;
 
                            switch (landID)
                            {
                                case 117: // Dirt
                                case 118: // Dirt
                                case 119: // Dirt
                                case 120: // Dirt
                                {
                                    int newTile = Utility.Random(168,171);
 
                                    if (newTile > 171)
                                        newTile = 171;
 
                                    if (newTile < 168)
                                        newTile = 168;
 
                                    new SetLandID(nextlocToCheck.X, nextlocToCheck.Y, map.MapID, newTile).DoOperation(); //Random Water
 
                                    if (this != null && this.Quantity > 0)
                                        this.Quantity -= 1;
                                } break;
                                case 142:
                                case 155:
                                {
                                      newStaticID = Utility.Random(6051, 6052);
                                      //Facing E Grass->Dirt Border
                                } break;
                                case 143:
                                case 150:
                                {
                                      newStaticID = Utility.Random(6045, 6046);
                                      //Facing W Grass->Dirt Border
                                } break;
                                case 146:
                                case 153:
                                {
                                      newStaticID = Utility.Random(6049, 6050);
                                      //Facing N Grass->Dirt Border
                                } break;
                                case 147:
                                case 154:
                                {
                                      newStaticID = Utility.Random(6047, 6048);
                                      //Facing S Grass->Dirt Border
                                } break;
                                case 149: //Facing SE/NW Dirt->Dirt Border
                                case 161:
                                {
                                      newStaticID = 6054; //TODO: Check adjacent tile to see if it's north or south
                                      //Facing SE Corner Grass->Dirt Border '<'
                                } break;
                                case 151:
                                case 160:
                                {
                                      newStaticID = 6054;
                                      //Facing SE Corner Grass->Dirt Border 'V'
                                } break;
                                case 152:
                                case 163:
                                {
                                      newStaticID = 6055;
                                      //Facing NW Corner Grass->Dirt Border '^'
                                } break;
                                case 162:
                                {
                                      newStaticID = 6053;
                                      //Facing SW Corner Grass->Dirt Border '>'
                                } break;
                            }
                            player.SendMessage("Next Location ({0}) is at correct Z level", nextlocToCheck );
                            nextlocToCheck.X -= 1;
                        }
                        while ( nextlocToCheck.Z <= -5 );
                    }
 
Top