Jump to content
  • 0

Mirror Map


Question

Posted (edited)

source code:

BUILDIN_FUNC( mirrormap ) {
    const char * ori_Map = script_getstr( st, 2 ) ;
    int mirror_count = script_getnum( st, 3 ) ;
    int ori_m = map_mapname2mapid( ori_Map ) ;
    int mir_m, i ;
    size_t size;

    for ( i = 1 ; i <= mirror_count ; i++ ) {
        mir_m = map_num++ ;

        // Copy the map
        memcpy( &map[mir_m], &map[ori_m], sizeof( struct map_data ) ) ;

        // Alter the name & set map
        snprintf( map[mir_m].name, sizeof( map[mir_m].name ), "%.3d#%s", i, ori_Map ) ;
        map[mir_m].name[MAP_NAME_LENGTH-1] = '\0' ;
        map[mir_m].m = mir_m ;
        map[mir_m].users = 0 ;
        size = map[mir_m].bxs * map[mir_m].bys * sizeof( struct block_list* ) ;
        map[mir_m].block = ( struct block_list ** )aCalloc( 1, size ) ;
        map[mir_m].block_mob = ( struct block_list ** )aCalloc( 1, size ) ;
        map[mir_m].index = mapindex_addmap( -1, map[mir_m].name ) ;
        map[mir_m].channel = NULL ;

        // Add this map to MapDB
        map_addmap2db( &map[mir_m] ) ;

        ShowInfo( "[Mirror map] : %s(%s) had been added.\n", ori_Map, map[mir_m].name ) ;
    }

    return 0 ;
}

But NPC does not copy, how to solve?

Creator : grass0916

Edited by mina

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...