Junior Spellweaver
- Joined
- Apr 6, 2008
- Messages
- 181
- Reaction score
- 0
Just replace your original Maps::changeMap function with the following. That's it, nothing more or less. Changes are in bold.
Maps.cpp
I got sad watching everyone reinvent the wheel, so I am releasing this simplicity. Cheers. =]
Maps.cpp
Code:
void Maps::changeMap(Player* player, int mapid, int pos){
[b]if(mapid == 999999999 || mapid < 0){
mapid = player->getMap();
pos = 0;
}[/b]
removePlayer(player);
player->setMap(mapid);
player->setMappos(pos);
player->setType(0);
Pos cpos;
if((unsigned int)pos<info[mapid].Portals.size()){
cpos.x = info[mapid].Portals[pos].x;
cpos.y = info[mapid].Portals[pos].y;
}
else if(info[mapid].Portals.size() > 0){
cpos.x = info[mapid].Portals[0].x;
cpos.y = info[mapid].Portals[0].y;
}
else{
cpos.x = 0;
cpos.y = 0;
}
player->setPos(cpos);
MapPacket::changeMap(player);
newMap(player);
}
I got sad watching everyone reinvent the wheel, so I am releasing this simplicity. Cheers. =]