FloooD / custom_cs2dsrv

Jermuk's custom Counter Strike 2D Server written in C and modified by FloooD and leegao.
173.192.35.85:36000
3 stars 0 forks source link

Rewrite the existing code to use streams. #12

Closed leegao closed 13 years ago

leegao commented 13 years ago

As per uprate6's suggestion, I'll probably be able to do this fairly quickly as the migration from the existing codebase shouldn't be much of a problem. Current stream implementation should run about as quickly as if not more efficient than the old implementation since packets are (theoretically) sent in little endian, a cast to the respective datatypes would suffice (except for readline). IE:

i = "xfexf3"; // 0xf3fe in LE
short c = *(short*)i; (Returns 0xf3fe, which is correct)

I'll be working on this in the experimental branch, as soon as I finish rerouting everything into the scheduler.

leegao commented 13 years ago

Committed auxiliary functions into master

FloooD commented 13 years ago

eh.. ok i'll look at it tomorrow ;p

leegao commented 13 years ago

I'm already working on it, the way that the sends and the packets are written seems as if they weren't even remotely planned out. Each huge blocks of code can be concisely written in less than 5 lines. Fucking dammit, the way that it was written just makes me want to rage <_<

leegao commented 13 years ago

Alright, I've gone through about 70% of the packets and have made the code nearly 100% smaller. This is getting onto my nerves so I'm going to drop this until tomorrow.

leegao commented 13 years ago

wow, got the packets part down to only 800 or so lines of code from over 2000... reading through that shit was a pain in the ass.

FloooD commented 13 years ago

rofl nice

leegao commented 13 years ago

alright, the code's somewhat stable enough to be merged into the upstream so I'm gonna go for it and see if the build breaks (shouldn't). Don't make any commits for the next hour.

leegao commented 13 years ago

btw why are x/y pointers now? Do they point to the memory of the XY buffer?

leegao commented 13 years ago

nvm, didn't look at the commit log