mina Posted January 24, 2018 Group: Members Topic Count: 11 Topics Per Day: 0.00 Content Count: 27 Reputation: 2 Joined: 10/25/13 Last Seen: November 16, 2024 Share Posted January 24, 2018 (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 January 24, 2018 by mina Quote Link to comment Share on other sites More sharing options...
Question
mina
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 minaLink to comment
Share on other sites
0 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.