for(uint32 i=0; i <= max_door_type; i++)
{
Door* door = GetDoorDBID(i);
if(door == NULL)
continue;
if(door->db_id == 0 || strcasecmp(door->zone_name, zone_name))
continue;
if(door->door_id == door_id && strcasecmp(door->zone_name, zone_name) == 0)
return door;
}
My personal preference... I hate using 0 in the place of NULL. it's one of my biggest complaints about the emu sourcecode. Since you all don't use hungarian, sometimes it's not directly obvious if a variable is an id or a pointer. If you see this:
if(door == 0)
door could be either. If you see this:
if(door = NULL)
then it's pretty obvious that it's a pointer.
Another of my pointer issues is testing for null in the same conditional as you use to test for a member's value like the original code was testing door and then the door's database id. I prefer to see them split up like I have them. Again, it's a style thing, but with so many people working on the same code, it's easy to get someone to add a condition to your statement and make a mistake.
|