From ea101a8b74886e381941c3a6ab4f0f1f3e54493f Mon Sep 17 00:00:00 2001 From: skittles1 Date: Thu, 13 Nov 2014 13:35:49 +0800 Subject: [PATCH] FactFlag error fix Check for $ room in NewOwner, formatting. --- kod/object/item/passitem/factflag.kod | 64 ++++++++++--------- .../item/passitem/factflag/dukeflag.kod | 14 ++-- .../item/passitem/factflag/prncflag.kod | 15 +++-- .../item/passitem/factflag/reblflag.kod | 16 +++-- 4 files changed, 61 insertions(+), 48 deletions(-) diff --git a/kod/object/item/passitem/factflag.kod b/kod/object/item/passitem/factflag.kod index 9b10481e9f..171bdf4ecd 100644 --- a/kod/object/item/passitem/factflag.kod +++ b/kod/object/item/passitem/factflag.kod @@ -22,10 +22,12 @@ resources: FactionFlag_name_rsc = "flag" FactionFlag_desc_rsc = "This is the flag of neutrality." FactionFlag_drops = "%s%s slips from your grasp and falls to the ground!" - FactionFlag_not_soldier = "The flag can only be used by an officially recognized soldier of this faction!" + FactionFlag_not_soldier = \ + "The flag can only be used by an officially recognized " + "soldier of this faction!" classvars: - + vrName = FactionFlag_name_rsc vrDesc = FactionFlag_desc_rsc vrIcon = FactionFlag_icon_rsc @@ -40,16 +42,16 @@ classvars: viFaction = FACTION_NEUTRAL -properties: +properties: ptTeleportIdle = $ pbCounted = FALSE -messages: +messages: Constructor() { - send(send(SYS,@GetTerritoryGame),@IncrementFlagItemCount,#flag=self); + Send(Send(SYS,@GetTerritoryGame),@IncrementFlagItemCount,#flag=self); pbCounted = TRUE; propagate; @@ -66,10 +68,10 @@ messages: if IsClass(what,&Player) { - oSoldierShield = send(what,@FindUsing,#class=&SoldierShield); + oSoldierShield = Send(what,@FindUsing,#class=&SoldierShield); if oSoldierShield = $ - OR send(oSoldierShield,@GetFaction) <> viFaction + OR Send(oSoldierShield,@GetFaction) <> viFaction { return FALSE; } @@ -87,22 +89,28 @@ messages: DeleteTimer(ptTeleportIdle); ptTeleportIdle = $; } - + if what = $ { propagate; } - - if not isClass(what,&User) + + if NOT IsClass(what,&User) { ptTeleportIdle = CreateTimer(self,@TeleportIdle,IDLE_TIME); } - oRoom = send(SYS,@UtilGetRoomRecurse,#what=what); - oFlagpole = send(oRoom,@FindHoldingActive,#class=&Flagpole); + oRoom = Send(SYS,@UtilGetRoomRecurse,#what=what); + + % Check for a valid room, perhaps we were sold to an NPC. + if oRoom <> $ + { + oFlagpole = Send(oRoom,@FindHoldingActive,#class=&Flagpole); + } + if oFlagpole <> $ { - post(oFlagpole,@CheckClaimerFlag); + Post(oFlagpole,@CheckClaimerFlag); } propagate; @@ -111,14 +119,14 @@ messages: TeleportIdle() { ptTeleportIdle = $; - send(self,@TeleportHome); + Send(self,@TeleportHome); return; } TeleportHome() { - % override this for each flag + % Override this for each flag. return; } @@ -132,7 +140,7 @@ messages: { return FALSE; } - + DestroyDisposable() { return FALSE; @@ -141,25 +149,25 @@ messages: DropSelf(what=$) { local oRoom, iRow, iCol; - - oRoom = send(what,@GetOwner); - iRow = send(what,@GetRow); - iCol = send(what,@GetCol); - send(oRoom,@Newhold,#what=self,#new_col=iCol,#New_row=iRow); + oRoom = Send(what,@GetOwner); + iRow = Send(what,@GetRow); + iCol = Send(what,@GetCol); + + Send(oRoom,@NewHold,#what=self,#new_col=iCol,#New_row=iRow); return; } UserLogoff() { - if isclass(poOwner,&Admin) + if IsClass(poOwner,&Admin) { propagate; } - - send(poOwner,@MsgSendUser,#message_rsc=FactionFlag_drops, - #parm1=send(self,@GetCapDef),#parm2=vrName); + + Send(poOwner,@MsgSendUser,#message_rsc=FactionFlag_drops, + #parm1=Send(self,@GetCapDef),#parm2=vrName); Send(self,@DropSelf,#what=poOwner); @@ -176,7 +184,7 @@ messages: if pbCounted { - send(send(SYS,@GetTerritoryGame),@DecrementFlagItemCount,#flag=self); + Send(Send(SYS,@GetTerritoryGame),@DecrementFlagItemCount,#flag=self); pbCounted = FALSE; } @@ -187,7 +195,7 @@ messages: { if pbCounted { - send(send(SYS,@GetTerritoryGame),@IncrementFlagItemCount,#flag=self); + Send(Send(SYS,@GetTerritoryGame),@IncrementFlagItemCount,#flag=self); } return; @@ -198,7 +206,5 @@ messages: return FALSE; } - end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - diff --git a/kod/object/item/passitem/factflag/dukeflag.kod b/kod/object/item/passitem/factflag/dukeflag.kod index 3c0e1655bc..bf7059aae6 100644 --- a/kod/object/item/passitem/factflag/dukeflag.kod +++ b/kod/object/item/passitem/factflag/dukeflag.kod @@ -18,26 +18,28 @@ resources: DukeFlag_icon_rsc = flagdinv.bgf DukeFlag_name_rsc = "flag of the Duke" - DukeFlag_desc_rsc = "This flag bears the royal colors of the Duke, protector of Tos." + DukeFlag_desc_rsc = \ + "This flag bears the royal colors of the Duke, protector of Tos." classvars: - + vrName = DukeFlag_name_rsc vrDesc = DukeFlag_desc_rsc vrIcon = DukeFlag_icon_rsc viFaction = FACTION_DUKE -properties: +properties: -messages: +messages: TeleportHome() { - send(send(SYS,@FindRoomByNum,#num=RID_DUKE3),@Newhold,#what=self,#new_row=12,#new_col=20,#fine_row=0,#fine_col=32); + Send(Send(SYS,@FindRoomByNum,#num=RID_DUKE3),@NewHold, + #what=self,#new_row=12,#new_col=20,#fine_row=0,#fine_col=32); + return; } end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - diff --git a/kod/object/item/passitem/factflag/prncflag.kod b/kod/object/item/passitem/factflag/prncflag.kod index 15361cf0a7..01adf6c8ff 100644 --- a/kod/object/item/passitem/factflag/prncflag.kod +++ b/kod/object/item/passitem/factflag/prncflag.kod @@ -18,26 +18,29 @@ resources: PrincessFlag_icon_rsc = flagpinv.bgf PrincessFlag_name_rsc = "flag of the Princess" - PrincessFlag_desc_rsc = "This flag bears the royal colors of the Princess, sovereign of Barloque." + PrincessFlag_desc_rsc = \ + "This flag bears the royal colors of the Princess, " + "sovereign of Barloque." classvars: - + vrName = PrincessFlag_name_rsc vrDesc = PrincessFlag_desc_rsc vrIcon = PrincessFlag_icon_rsc viFaction = FACTION_PRINCESS -properties: +properties: -messages: +messages: TeleportHome() { - send(send(SYS,@FindRoomByNum,#num=RID_CASTLE2C),@Newhold,#what=self,#new_row=30,#new_col=23,#fine_row=48,#fine_col=16); + Send(Send(SYS,@FindRoomByNum,#num=RID_CASTLE2C),@NewHold, + #what=self,#new_row=30,#new_col=23,#fine_row=48,#fine_col=16); + return; } end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - diff --git a/kod/object/item/passitem/factflag/reblflag.kod b/kod/object/item/passitem/factflag/reblflag.kod index 5635500dac..7451488ae3 100644 --- a/kod/object/item/passitem/factflag/reblflag.kod +++ b/kod/object/item/passitem/factflag/reblflag.kod @@ -18,27 +18,29 @@ resources: RebelFlag_icon_rsc = flagjinv.bgf RebelFlag_name_rsc = "rebel flag" - RebelFlag_desc_rsc = "This flag bears the colors of the rebel forces of Jasper." + RebelFlag_desc_rsc = \ + "This flag bears the colors of the rebel forces of Jasper." classvars: - + vrName = RebelFlag_name_rsc vrDesc = RebelFlag_desc_rsc vrIcon = RebelFlag_icon_rsc viFaction = FACTION_REBEL -properties: +properties: -messages: +messages: TeleportHome() { - % right in front of the arsenal - send(send(SYS,@FindRoomByNum,#num=RID_JAS_BAR),@Newhold,#what=self,#new_row=6,#new_col=5); + % Right in front of the arsenal. + Send(Send(SYS,@FindRoomByNum,#num=RID_JAS_BAR), + @NewHold,#what=self,#new_row=6,#new_col=5); + return; } end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -