Skip to content

Commit

Permalink
FactFlag error fix
Browse files Browse the repository at this point in the history
Check for $ room in NewOwner, formatting.
  • Loading branch information
skittles1 committed Nov 13, 2014
1 parent 2d5bd24 commit ea101a8
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 48 deletions.
64 changes: 35 additions & 29 deletions kod/object/item/passitem/factflag.kod
Expand Up @@ -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
Expand All @@ -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;
Expand All @@ -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;
}
Expand All @@ -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;
Expand All @@ -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;
}

Expand All @@ -132,7 +140,7 @@ messages:
{
return FALSE;
}

DestroyDisposable()
{
return FALSE;
Expand All @@ -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);

Expand All @@ -176,7 +184,7 @@ messages:

if pbCounted
{
send(send(SYS,@GetTerritoryGame),@DecrementFlagItemCount,#flag=self);
Send(Send(SYS,@GetTerritoryGame),@DecrementFlagItemCount,#flag=self);
pbCounted = FALSE;
}

Expand All @@ -187,7 +195,7 @@ messages:
{
if pbCounted
{
send(send(SYS,@GetTerritoryGame),@IncrementFlagItemCount,#flag=self);
Send(Send(SYS,@GetTerritoryGame),@IncrementFlagItemCount,#flag=self);
}

return;
Expand All @@ -198,7 +206,5 @@ messages:
return FALSE;
}


end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

14 changes: 8 additions & 6 deletions kod/object/item/passitem/factflag/dukeflag.kod
Expand Up @@ -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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

15 changes: 9 additions & 6 deletions kod/object/item/passitem/factflag/prncflag.kod
Expand Up @@ -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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

16 changes: 9 additions & 7 deletions kod/object/item/passitem/factflag/reblflag.kod
Expand Up @@ -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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

0 comments on commit ea101a8

Please sign in to comment.