From 1792fa7dcbae6d0678d9672ccb38eba88e87c757 Mon Sep 17 00:00:00 2001 From: FlavioJS Date: Mon, 7 Apr 2008 21:04:28 +0000 Subject: * Made script command 'flagemblem' and guild_emblem_change send an update of the emblem_id to the players in the area. - known bug: ui components that are displaying the emblem at the time (emblem in flag npc and emblem over head in gvg maps) are not updated, but putting the mouse over the target shows the new emblem * Modified script command 'guardian': - returns the id of the guardian - if guardian index isn't supplied, it generates a temporary guardian * Implemented support for temporary guardians (not saved with castle). * Added missing includes from r12520. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12525 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/unit.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/map/unit.c') diff --git a/src/map/unit.c b/src/map/unit.c index b8a5d327a..88bfaab47 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -1950,10 +1950,20 @@ int unit_free(struct block_list *bl, int clrtype) aFree(md->lootitem); md->lootitem=NULL; } - if(md->guardian_data) + if( md->guardian_data ) { - if (md->guardian_data->number < MAX_GUARDIANS) - md->guardian_data->castle->guardian[md->guardian_data->number].id = 0; + struct guild_castle* gc = md->guardian_data->castle; + if( md->guardian_data->number >= 0 && md->guardian_data->number < MAX_GUARDIANS ) + { + gc->guardian[md->guardian_data->number].id = 0; + } + else + { + int i; + ARR_FIND(0, gc->temp_guardians_max, i, gc->temp_guardians[i] == md->bl.id); + if( i < gc->temp_guardians_max ) + gc->temp_guardians[i] = 0; + } aFree(md->guardian_data); md->guardian_data = NULL; } -- cgit v1.2.3-60-g2f50