Here is about 40 lines less and can go near the end of Map::Attack in map.cpp:
int distance = util::path_length(target_x, target_y, closeby->x, closeby->y);
if (distance <=2 && closeby->alive)
{
*Effect/Damage functions go here
}
*NPC "closeby" should be defined in a loop (this->npcs, NPC, closeby). Also, weapons should have an unused flag that could be used to declare what effect if any is to be cast in an area.
C:\Documents and Settings\HP_Administrator\Desktop\Trunk\src\map.cpp||In member function 'bool Map::AttackPK(Character*, Direction)':|
C:\Documents and Settings\HP_Administrator\Desktop\Trunk\src\map.cpp|1748|error: 'closeby' was not declared in this scope|
C:\Documents and Settings\HP_Administrator\Desktop\Trunk\src\map.cpp||In member function 'bool Map::AttackPKSpell(Character*, int, int)':|
C:\Documents and Settings\HP_Administrator\Desktop\Trunk\src\map.cpp|1794|warning: comparison between signed and unsigned integer expressions|
||=== Build finished: 1 errors, 1 warnings ===|