1 /* 2 * PROPRIETARY INFORMATION. This software is proprietary to POWDER 3 * Development, and is not to be reproduced, transmitted, or disclosed 4 * in any way without written permission. 5 * 6 * Produced by: Jeff Lait 7 * 8 * POWDER Development 9 * 10 * NAME: name.h ( POWDER Library, C++ ) 11 * 12 * COMMENTS: 13 * This class handles the global namespace which allows 14 * users to name specific creatures or items. We don't 15 * want to waste 32 bits on a pointer, when there can 16 * only be a few names. This also simplifies the marshalling, 17 * etc, of names. 18 */ 19 20 #ifndef __name__ 21 #define __name__ 22 23 #include "buf.h" 24 25 // Required one time initialization. 26 void name_init(int numnames = 0); 27 28 // Required load/save functions. These save the 29 // actual data of the names. 30 void name_load(SRAMSTREAM &is); 31 void name_save(SRAMSTREAM &os); 32 33 class NAME 34 { 35 public: 36 NAME(); 37 ~NAME(); 38 39 // Copy constructor & assignment operators. 40 NAME(const NAME &name); 41 NAME &operator=(const NAME &name); 42 43 const char *getName() const; 44 45 // Because you can't change an existing name, setName will 46 // actually allocate a new myIdx. 47 void setName(const char *name); setName(BUF buf)48 void setName(BUF buf) 49 { setName(buf.buffer()); } 50 51 void save(SRAMSTREAM &os) const; 52 void load(SRAMSTREAM &is); 53 54 protected: 55 u16 myIdx; 56 }; 57 58 #endif 59 60