Ignore:
Timestamp:
Jul 31, 2023, 4:06:13 PM (16 months ago)
Author:
alloc
Message:

25_30_44

  • Got rid (mostly) of custom JSON serialization
  • Some code cleanup
File:
1 edited

Legend:

Unmodified
Added
Removed
  • binary-improvements/7dtd-server-fixes/src/PersistentData/Inventory.cs

    r351 r455  
    2424                }
    2525
    26                 private void ProcessInv (List<InvItem> _target, ItemStack[] _sourceFields, int _id) {
     26                private void ProcessInv (ICollection<InvItem> _target, IReadOnlyList<ItemStack> _sourceFields, int _id) {
    2727                        _target.Clear ();
    28                         for (int i = 0; i < _sourceFields.Length; i++) {
     28                        for (int i = 0; i < _sourceFields.Count; i++) {
    2929                                InvItem item = CreateInvItem (_sourceFields [i].itemValue, _sourceFields [i].count, _id);
    3030                                if (item != null && _sourceFields [i].itemValue.Modifications != null) {
     
    4343                }
    4444
    45                 private void ProcessParts (ItemValue[] _parts, InvItem _item, int _playerId) {
    46                         InvItem[] itemParts = new InvItem[_parts.Length];
    47                         for (int i = 0; i < _parts.Length; i++) {
     45                private void ProcessParts (IReadOnlyList<ItemValue> _parts, InvItem _item, int _playerId) {
     46                        InvItem[] itemParts = new InvItem[_parts.Count];
     47                        for (int i = 0; i < _parts.Count; i++) {
    4848                                InvItem partItem = CreateInvItem (_parts [i], 1, _playerId);
    4949                                if (partItem != null && _parts [i].Modifications != null) {
     
    6767
    6868                        if (_count > maxAllowed) {
    69                                 Log.Out ("Player with ID " + _playerId + " has stack for \"" + name + "\" greater than allowed (" +
    70                                          _count + " > " + maxAllowed + ")");
     69                                Log.Out ($"Player with ID {_playerId} has stack for \"{name}\" greater than allowed ({_count} > {maxAllowed})");
    7170                        }
    7271
Note: See TracChangeset for help on using the changeset viewer.