wyozi / wmc-plus

Media center addon for Garry's Mod
MIT License
1 stars 1 forks source link

Stop nettable from sending unneeded changes #12

Closed yupi2 closed 8 years ago

yupi2 commented 8 years ago

If a line is deleted the server uses table.remove(t, id) to remove the line from the table. If id is less than #t though, this will cause every value from id to #t to be moved down an index which nettable will interpret as modifications for lines id through #t.

These changes replace the to-be-deleted line with the last line and then removes the last line. Now it's 1-2 modifications sent opposed to #t - id + 1 modifications.

Also when a line is deleted all lines are deselected because

-- Unselecting lines because it would be confusing to
--  see the line you just deleted to still be selected.
yupi2 commented 8 years ago

@wyozi I'm thinking of adding in the date media was added like in WMC. With that as the sorting method the line ID column could possibly be removed. That would solve the media order changes from this.

wyozi commented 8 years ago

Yeah, that sounds like a good idea.

yupi2 commented 8 years ago

I'm going to leave this PR on hold for a bit. I'm testing to see if using the URL as the media-table key would be better than using number IDs.

yupi2 commented 8 years ago

These changes are obsolete now that I've got URLs instead of numeric IDs all fine. I'll open up another PR with all of that stuff.