viewing paste Unknown #6519 | Text

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
void mob_reload(void) {
    struct mob_db *mdb_data[MAX_MOB_DB+1];
    int i;
    
    for (i = 0; i < MAX_MOB_DB; i++)
        if (mob_db_data[i] && mob_db_data[i] != mob_dummy) {
            mdb_data[i] = (struct mob_db*)aMalloc(sizeof(struct mob_db));
            memcpy(mdb_data[i], mob_db_data[i], sizeof(struct mob_db));
        }
    
    
    //Mob skills need to be cleared before re-reading them. [Skotlex]
    for (i = 0; i < MAX_MOB_DB; i++)
        if (mob_db_data[i]) {
            memset(&mob_db_data[i]->skill,0,sizeof(mob_db_data[i]->skill));
            mob_db_data[i]->maxskill=0;
        }
 
    // Clear item_drop_ratio_db
    for (i = 0; i < MAX_ITEMDB; i++) {
        if (item_drop_ratio_db[i]) {
            aFree(item_drop_ratio_db[i]);
            item_drop_ratio_db[i] = NULL;
        }
    }
 
    mob_load();
    
    for (i = 0; i < MAX_MOB_DB; i++)
        if (mob_db_data[i] && mob_db_data[i] != mob_dummy) {
            ShowDebug("Comp:%d:%d\n",i,memcmp(mdb_data[i], mob_db_data[i], sizeof(struct mob_db)));
            aFree(mdb_data[i]);
        }
    
    
}
 
Viewed 590 times, submitted by Guest.