server icon indicating copy to clipboard operation
server copied to clipboard

🔨 Death to raw operator `new`

Open zach2good opened this issue 1 year ago • 1 comments

I affirm:

  • [x] I understand that if I do not agree to the following points by completing the checkboxes my issue will be ignored.
  • [x] I have read and understood the Contributing Guide and the Code of Conduct.
  • [x] I have searched existing issues to see if the issue has already been opened, and I have checked the commit log to see if the issue has been resolved since my server was last updated.

Describe the feature

I was looking at Teo's PR: https://github.com/LandSandBoat/server/pull/5163 and it struck me how we still have a lot of use of new. We have the capacity to use unique_ptr, but that's very verbose. I propose we template the pushPacket call and forward the args.

A la:

PChar->pushPacket<CMessageBasicPacket>(PChar, PChar, 0, 0, MSGBASIC_CANNOT_USE_IN_AREA);

zach2good avatar Feb 20 '24 09:02 zach2good

propose we template the pushPacket call and forward the args.

oh yes please

TeoTwawki avatar Feb 21 '24 13:02 TeoTwawki