Show
Ignore:
Timestamp:
11/22/08 00:35:41 (17 years ago)
Author:
yumileroy
Message:

Delete possessed AI only on creature delete.

Original author: gvcoman
Date: 2008-11-16 14:38:02-05:00

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/shared/Database/SQLStorage.h

    r260 r272  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
    1919 */ 
    2020 
     
    2727class SQLStorage 
    2828{ 
    29     template<class T> 
    30     friend struct SQLStorageLoaderBase; 
    31  
    3229    public: 
    3330 
    34         SQLStorage(const char* fmt, const char * _entry_field, const char * sqlname) 
     31        SQLStorage(const char*fmt,const char * _entry_field,const char * sqlname) 
    3532        { 
    36             src_format = fmt; 
    37             dst_format = fmt; 
    38             init(_entry_field, sqlname); 
     33            format=fmt; 
     34            entry_field = _entry_field; 
     35            table=sqlname; 
     36            data=NULL; 
     37            pIndex=NULL; 
     38            iNumFields =strlen(fmt); 
     39            MaxEntry = 0; 
    3940        } 
    40  
    41         SQLStorage(const char* src_fmt, const char* dst_fmt, const char * _entry_field, const char * sqlname) 
    42         { 
    43             src_format = src_fmt; 
    44             dst_format = dst_fmt; 
    45             init(_entry_field, sqlname); 
    46         } 
    47  
    48  
    4941        ~SQLStorage() 
    5042        { 
     
    6557        uint32 MaxEntry; 
    6658        uint32 iNumFields; 
    67  
    6859        void Load(); 
    6960        void Free(); 
    70  
    7161    private: 
    72         void init(const char * _entry_field, const char * sqlname) 
    73         { 
    74             entry_field = _entry_field; 
    75             table=sqlname; 
    76             data=NULL; 
    77             pIndex=NULL; 
    78             iNumFields = strlen(src_format); 
    79             MaxEntry = 0; 
    80         } 
    81  
    8262        char** pIndex; 
    8363 
    8464        char *data; 
    85         const char *src_format; 
    86         const char *dst_format; 
     65        const char *format; 
    8766        const char *table; 
    8867        const char *entry_field; 
    8968        //bool HasString; 
    9069}; 
    91  
    92 template <class T> 
    93 struct SQLStorageLoaderBase 
    94 { 
    95     public: 
    96         void Load(SQLStorage &storage); 
    97  
    98         template<class S, class D> 
    99             void convert(uint32 field_pos, S src, D &dst); 
    100         template<class S> 
    101             void convert_to_str(uint32 field_pos, S src, char * & dst); 
    102         template<class D> 
    103             void convert_from_str(uint32 field_pos, char * src, D& dst); 
    104         void convert_str_to_str(uint32 field_pos, char *src, char *&dst); 
    105  
    106     private: 
    107         template<class V> 
    108             void storeValue(V value, SQLStorage &store, char *p, int x, uint32 &offset); 
    109         void storeValue(char * value, SQLStorage &store, char *p, int x, uint32 &offset); 
    110 }; 
    111  
    112 struct SQLStorageLoader : public SQLStorageLoaderBase<SQLStorageLoader> 
    113 { 
    114 }; 
    115  
    11670#endif