»Maverick Posted December 28, 2004 Report Posted December 28, 2004 Hiya For my little plugin I need to know where doors are on the map. I have seen that Mervbot has some kind of 'Map' list, like the flaglist. However I don't know how to use it. I was thinking someting like this _listnode <Map> *parse = map->head; Â Â while (parse) { Tile *t = parse->item; sendPublic("Tile at "+ String(t->x) + "," + String(t->y) + ":" + String(t->type)); parse = parse->next; } Only problem is that there is no class 'Map' in Mervbot. Same for 'bricklist'. Does someone know how to do this?
»SOS Posted December 28, 2004 Report Posted December 28, 2004 I'm sure there was a map somewhere there... yea, there it is.BYTE map[TILE_MAX_LINEAR]; _linkedlist <Brick> brickList; in class Host. Although it probably isn't accessible from plugins (that shouldn't be too hard to change). Bricklist should be in plugins already.
50% Packetloss Posted December 30, 2004 Report Posted December 30, 2004 Uint32 getLinear(Uint32 x, Uint32 y){ return ((y & 1023) << 10) | (x & 1023);} Check out Map.h and Map.cpp The BYTE *map in the plugin code is passed the address of the huge map array. When you use the formula above you will get the linear index value for the array. Example: bool botInfo::CheckTile(Uint32 x,Uint32 y)//takes tile coords { bool Found=false; BYTE tile=map[((y & 1023) << 10) | (x & 1023)]; if((tile > 0 && tile < 170) || (tile >= 219 && tile <=220)) {Found=true;} return Found; } Read through some of the core's code, i believe that the map is updated when bricks are laid down. The brick list also contains the bricks in the arena, its parsed in the same way the player list is.
»Maverick Posted December 30, 2004 Author Report Posted December 30, 2004 Thanks for your replies guys. However I am not going to use it anymore because I am leaving SS for good. Thanks alot anyway
50% Packetloss Posted December 31, 2004 Report Posted December 31, 2004 Later maverick, good choice. Find yourself some hot babe and retire.
Recommended Posts