Commit Graph
36 Commits
Author SHA1 Message Date
Taylor Richards 80d68ccc27 address issues raised during code review 2020-12-24 09:45:17 -05:00
Taylor Richards 9b97821616 optimize sexp_packet()
- chnage op count data type to short
   (can't have more space than that anyway)
 - get rid of some loops in favor of plain memcpy()
 - fewer magic numbers
 - use SEXP_MAX_PACKET_SIZE to fix packet size discrepancy
2020-12-24 09:38:23 -05:00
Taylor Richards c943600ee3 adjust *_STRING() macros to save space
- ADD/GET_STRING() will use 1-byte lengths (up to 255 chars)
 - ADD/GET_STRING_16() will use 2-byte lengths (up to 65,535 chars)
 - ADD/GET_STRING_32() added for compatiblity (game_active packet only!)
2020-12-24 09:38:22 -05:00
Goober5000 39858fdfe0 giant refactor of sexps to use caching for ships and wings 2020-06-26 12:59:31 -04:00
Goober5000 80f0663cfa shut up, clang 2020-06-01 23:11:29 -04:00
Goober5000 ed5360899e add back the send_ship(shipnum) funcion, and also add the sim-hull fix 2020-06-01 21:29:18 -04:00
Goober5000 6354e5d2ce add non-sexp.cpp (and minimal sexp.cpp changes) from overhaul wip 2020-06-01 21:14:10 -04:00
asarium 0d9fbd4725 Use SCP_strings and SCP_vectors in SEXP code
I split this from #1331 to make reviewing these two changesets easier.

These changes convert all usages of const char* to SCP_string in the
static SEXP arrays so that the dynamic SEXP system can use SCP_strings
instead of having to allocate the strings and then somehow figure out
which strings must be freed at the end of the program.

This also converts the SEXP arrays to vectors so that new SEXP operators
can be added at runtime later.
2017-09-14 11:11:52 +02:00
Fabian Woltermann 8248ac2516 Encapsulates the multi_sexp infrastructure in its own class (#833)
While working on #824, I found out that cleaning up that particular piece of code would not be doable cleanly without a refactor of the multi_sexp infrastructure. This is that refactor; it encapsulates the code of multi_sexp inside a class, an instance of which is then used to manage all the network stuff that sexps need to do.
2016-08-15 23:39:40 -07:00
Fabian Woltermann 770fce8de5 Bitset flags -- take 2 (#775)
This introduces a new mechanism for handling bit flags. Instead of using an int (or two, or three) to write bits into, this uses the std::bitset in a wrapper class that accepts an enum class as input. This means that certain classes of errors we've had a few of in the engine, where a coder used the wrong set of flags or checked them against the wrong variable (SF_STEALTH vs SIF_STEALTH, for example) can now be detected at a compiler level rather than not at all.
2016-08-12 16:13:50 -07:00
asarium a685642554 And another batch of 64-bit fixes 2016-08-12 09:42:55 +02:00
Echelon9 930f386064 Generalise warning string if we can't provide callback operator information. 2015-08-08 18:10:26 +10:00
Echelon9 cffdbe932f Fix: warning: format ‘%d’ expects a matching ‘int’ argument [-Wformat=] 2015-08-05 20:12:41 +10:00
karajorma 5dc4bfea97 Fix a bug with the multiplayer SEXP code. The callback functions write to the packet and thus can also make it go out of bounds.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10466 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-23 13:41:01 +10:00
Goober5000 9b589d3005 MSVC6 compatibility 2013-01-08 01:44:48 +00:00
Goober5000 b30e2ee226 inspired by recent change to multi_sexp.cpp... in most cases, SCP_string should not be passed by value 2012-11-05 08:31:39 +00:00
chief1983 4e5d3e2e57 Fix all the 'no newline at end of file' warnings I saw thrown by gcc on FreeBSD. 2012-11-02 17:30:17 +00:00
The_E 4d57e2eaba Make change-team-color multi. Also adds SCP_string overloads for multi_send_string/multi_get_string 2012-10-27 09:24:11 +00:00
Echelon9 dc4371680a Clear a whole set of LLVM warnings - some of these would have caused memory fubars, so should marginally improve stability 2012-01-15 08:08:15 +00:00
Zacam 6c702a11e6 svn:eol-type set to LF. 2012-01-13 18:37:09 +00:00
karajorma 28db28427b Not that it matters much since it's that's what it's ending up as anyway but since the variable that uses it was switched to unsigned we might as well change this. 2012-01-11 01:44:24 +00:00
karajorma 7df5137ac4 Fix a mismatch. 2011-08-31 14:06:19 +00:00
karajorma 7ca92457b4 PVS-Studio fix: V512 A call of the 'memset' function will lead to underflow of the buffer 'type'.
Never really would matter but it's a waste of memory declaring an int buffer and then only using 1/4 of it
2011-08-30 11:50:23 +00:00
karajorma caff640862 Documentation for the Multiplayer SEXP system. 2011-08-30 00:18:32 +00:00
karajorma 56f758967a Fix several SEXPs for multiplayer use. This should fix Mantis issues 2401, 2483 and 2382.
In addition, fix a bug caused by SEXPs that do a callback but don't send any data.
2011-08-24 08:37:11 +00:00
karajorma 4dfa577114 Add options to send objects, shorts and ushorts via the multiplayer SEXP system. 2011-08-19 08:09:50 +00:00
karajorma 1a577f6473 Fixes and clean up for the multiplayer SEXP packet system.
- Make the system more robust against accidental attempts to write data to the packet without proper initialisation. 
- Improve the error messages and function names to make clear the difference between the packet the game actually sends and the abstracted packets the coder seems to create and send in sexp.cpp
- Add a convenience methods to deal with SEXPs that don't need to write any data.
2011-08-18 07:48:59 +00:00
karajorma df0722f929 Fixes for the multiplayer SEXP packet to prevent errors caused by the coder taking too little data out of the packet before reporting that they are done. 2011-08-18 05:24:27 +00:00
karajorma 284fd79740 Not 100% a bug fix but this will have the effect of making it harder to hit the bug and will warn when it hits it. See http://www.hard-light.net/forums/index.php?topic=72160.0 for more details 2010-10-24 05:28:30 +00:00
karajorma 64d3a85dfa Fix an issue with the multi_sexp system if you ever had to send two full packets in a single frame. 2010-03-03 14:11:59 +00:00
portej05 719825f80d The big CVS comment removal. This chops approx. 3.5mb off a full checkout.
I've tested this through compiling and through hand checking. 
Normalises line endings in ALL files to \n.
2009-06-20 08:08:20 +00:00
karajorma 5e3ca2f514 A few minor fixes. 2009-06-13 18:08:54 +00:00
karajorma 96852832cc Fix compilation of Assertion on MSVC 6 and compilation of multi_sexp stuff on Mac OS X 2009-05-28 13:00:26 +00:00
chief1983 3c64b07134 Convert these to UNIX again, hope they compile this time... 2009-05-19 22:02:48 +00:00
karajorma 7c70f212ba More minor fixes. 2009-05-16 16:20:45 +00:00
karajorma b67289e52a Commit the SEXP packet code.
Add the set-respawns SEXP.
2009-05-15 18:32:46 +00:00