ModernUO/Projects/Server
Kamron Batman a4cabe2fa4
fix: Optimizes FindItemsByType by removing allocations. (#1515)
### Summary
Container enumeration is in dire need of optimization. Thanks to @stefanomerotta for initiating this work with PR #1443. This PR handles a small part of what Stefan started. Also included are some bug fixes.

### Method Signatures

```cs
// Use with foreach without moving/deleting items
FindItemsByTypeEnumerator<T> FindItemsByType<T>(bool recurse = true, Predicate<T> predicate = null)

// Use with foreach when moving/deleting items
QueuedItemsEnumerator<T> EnumerateItemsByType<T>(bool recurse = true, Predicate<T> predicate = null)

// Use when iterating multiple times or queuing
PooledRefQueue<T> QueueItemsByType<T>(bool recurse = true, Predicate<T> predicate = null)

// Use when iterating multiples times or manipulating elements without traversing
PooledRefList<T> ListItemsByType<T>(bool recurse = true, Predicate<T> predicate = null)
```

* `FindItemsByType<T>` has changed from returning `List<T>` to `FindItemsByTypeEnumerator<T>` - This method is not safe to use in situations where an item may get consumed, deleted, or moved.

* `EnumerateItemsByType<T>` was added as a safe way to iterate and manipulate items.
  * **Note**: EnumerateItemsByType will _completely traverse the container_ before iteration starts because it uses `QueueItemsByType` under the hood.

* `QueueItemsByType<T>`  and `ListItemsByType<T>` was added to return a queue or list of items to iterate multiple times and manipulate the items. This isn't the most efficient since it uses a predicate and can result in 2 or 3 total iterations unnecessarily.

### Bug Fixes
- [X] Fishing had an error in the random check that may have caused slight bias.
2023-09-28 19:36:45 -07:00
..
Buffers chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
Client feat: Adds KR/EC client versions (No actual support yet). (#1506) 2023-09-18 23:53:18 -07:00
Collections chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
Comparers chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
Configuration chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
ContextMenus fix: Cleans up core code (#1187) 2022-10-10 21:47:08 -07:00
Diagnostics fix: Cleans up core code (#1187) 2022-10-10 21:47:08 -07:00
Events feat: Adds a movement throttle system. Removes Fastwalk system. (#1511) 2023-09-27 20:53:22 -07:00
Exceptions chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
GarbageCollection fix: Adds Gen2 callback for each STArrayPool (#971) 2022-03-26 13:57:42 -07:00
Geometry chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
Gumps chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
Items fix: Optimizes FindItemsByType by removing allocations. (#1515) 2023-09-28 19:36:45 -07:00
Json fix: Fixes JSON TypeConverter so that it can deserialize full name types (#1466) 2023-08-21 21:25:09 -07:00
Localization chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
Logging chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
Maps chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
Menus fix: Cleans up core code (#1187) 2022-10-10 21:47:08 -07:00
Migrations fix: Adds name support for all mods (#1128) 2022-10-15 10:46:31 -07:00
Mobiles fix: Optimizes FindItemsByType by removing allocations. (#1515) 2023-09-28 19:36:45 -07:00
Network feat: Adds a movement throttle system. Removes Fastwalk system. (#1511) 2023-09-27 20:53:22 -07:00
PropertyList chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
Random chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
Regions fix: Fixes region child level (#1508) 2023-09-19 10:35:50 -07:00
Serialization chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
Targeting Adds hue support to StaticTile (#1321) 2023-01-21 11:19:11 -08:00
Text chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
TileMatrix chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
Timer chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
TimeZones chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
Utilities fix: Fixes PlayerVendor customizations not working due to constructor issues (#1451) 2023-08-10 19:24:45 -07:00
World chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
AssemblyHandler.cs chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
Attributes.cs chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
CityInfo.cs chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
Commands.cs fix: Fixes crafter deserialize, cleans up bandages, and codegens misc items (#1350) 2023-02-25 00:54:12 -08:00
Effects.cs fix: Fixes more packet initializations (#1507) 2023-09-19 00:02:17 -07:00
EventLoopTasks.cs chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
ExpansionInfo.cs feat: Adds KR/EC client versions (No actual support yet). (#1506) 2023-09-18 23:53:18 -07:00
Guild.cs chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
HuePicker.cs fix: Cleans up core code (#1187) 2022-10-10 21:47:08 -07:00
IAccount.cs fix: Cleans up core code (#1187) 2022-10-10 21:47:08 -07:00
IEntity.cs chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
Interfaces.cs fix: Fixes casting by sending ParalyzeFlag to client while animating (#1397) 2023-04-27 23:12:07 -07:00
KeywordList.cs fix: Cleans up core code (#1187) 2022-10-10 21:47:08 -07:00
Main.cs feat: Adds ping listener on port 12000 for server list (#1485) 2023-09-03 09:29:27 -07:00
MessageType.cs fix: Moves the rest of the Incoming packets (#1338) 2023-02-10 22:59:36 -08:00
MultiData.cs fix: Fixes loading map and static files (#1177) 2022-09-29 16:02:41 -07:00
MUO.ico Adds MUO Logo (#52) 2019-09-12 13:13:13 -07:00
Party.cs fix: Cleans up core code (#1187) 2022-10-10 21:47:08 -07:00
Poison.cs fix: Adds ISpanParsable and fixes command conditionals (#1241) 2022-11-12 00:26:02 -08:00
Prompt.cs fix: Cleans up core code (#1187) 2022-10-10 21:47:08 -07:00
Race.cs fix: Fixes TryParse for Race (#1244) 2022-11-12 00:31:25 -08:00
Sector.cs fix: Fixes region child level (#1508) 2023-09-19 10:35:50 -07:00
SecureTrade.cs fix: Update LabelTo, SendMessage, etc to Interpolated Strings (#1283) 2022-11-28 19:58:12 -08:00
Serial.cs chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
Server.csproj fix: Updates PollGroup to use the refactored/fixed changes by stefanomerotta (#1499) 2023-09-13 23:58:28 -07:00
Skills.cs feat: Customize expansion and set maps on first boot (#1425) 2023-07-31 20:46:49 -07:00
TileData.cs chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
TileList.cs Adds hue support to StaticTile (#1321) 2023-01-21 11:19:11 -08:00