Applies max at 120..

Login to reply  Page: « < 1 of 1 > »
31 Mar 2010 - 21:032436
Applies max at 120..
Why is it that applies (in oedit) max out at 120?


01 Apr 2010 - 10:232438
Applies are internally represented as a signed byte which means it can have values from -128 to 127. We figured 120 was reasonable as a cutoff.
If you want a larger apply, add it more than once.


__________________
You know who I am.
01 Apr 2010 - 12:112439
what would be the best way of changing this? Why put this kind of limit on things?


01 Apr 2010 - 14:162440
Quote rudeboyrave:
what would be the best way of changing this?


Change it from a byte to a signed integer.

Quote rudeboyrave:
Why put this kind of limit on things?


To limit memory usage.


__________________

Last edited by Fizban (01 Apr 2010 - 14:17)
01 Apr 2010 - 15:202441
would this screw anything up? how much memory could this possibly suck up?


03 Apr 2010 - 13:482446
How will it affect memory usage?
Put short: not at all.

The change:
/** An affect structure. */
struct affected_type
{
  sh_int type;     /**< The type of spell that caused this      */
  sh_int duration; /**< For how long its effects will last      */
-  sbyte modifier;  /**< Added/subtracted to/from apropriate ability     */
+  sh_int modifier;  /**< Added/subtracted to/from apropriate ability     */
  byte location;   /**< Tells which ability to change(APPLY_XXX). */
  long /*bitvector_t*/bitvector; /**< Tells which bits to set (AFF_XXX). */

  struct affected_type *next; /**< The next affect in the list of affects. */
};
Memory usage before = 4 bytes for short ints, 2 bytes for modifier+location (+2 bytes, unused) + 8 bytes for the bitvector + 4/8 bytes for the next pointer.
Memory usage after = 6 bytes for short ints, 1 byte for location (+ 1 byte, unused) + 8 bytes for the bitvector + 4/8 bytes for the next pointer.

Most systems will not start a new allocation in a space that it can't fit into (ie. the long will start on the next address divisable by 4 (or 8, on 64 bit systems) bytes, not on an odd address). This means at least two bytes are unused in the current system. Changing the type to a short int means one of those bytes are used.


__________________
You know who I am.
Login to reply  Page: « < 1 of 1 > »