# HG changeset patch # User unc0rr # Date 1386958442 -14400 # Node ID 0b4b9fda5bd4ff2c08e61fc63bbf135e4fe51c4f # Parent 4b7df6e96b780199c000e2211880f6176d164cdd - /owner command to specify team owner - Move team-related handlers to uTeams diff -r 4b7df6e96b78 -r 0b4b9fda5bd4 QTfrontend/team.cpp --- a/QTfrontend/team.cpp Fri Dec 13 21:55:19 2013 +0400 +++ b/QTfrontend/team.cpp Fri Dec 13 22:14:02 2013 +0400 @@ -276,6 +276,9 @@ sl.push_back(QString("evoicepack " + m_voicepack)); sl.push_back(QString("eflag " + m_flag)); + if(!m_owner.isEmpty()) + sl.push_back(QString("eowner " + m_owner)); + for (int t = 0; t < m_numHedgehogs; t++) { sl.push_back(QString("eaddhh %1 %2 %3") diff -r 4b7df6e96b78 -r 0b4b9fda5bd4 hedgewars/uAIAmmoTests.pas --- a/hedgewars/uAIAmmoTests.pas Fri Dec 13 21:55:19 2013 +0400 +++ b/hedgewars/uAIAmmoTests.pas Fri Dec 13 22:14:02 2013 +0400 @@ -1229,6 +1229,8 @@ x, y, dx, dy: real; EX, EY, t: LongInt; begin +Targ:= Targ; // avoid compiler hint + x:= hwFloat2Float(Me^.X) + hwSign(Me^.dX) * 7; y:= hwFloat2Float(Me^.Y); dx:= hwSign(Me^.dX) * 0.03; diff -r 4b7df6e96b78 -r 0b4b9fda5bd4 hedgewars/uCommandHandlers.pas --- a/hedgewars/uCommandHandlers.pas Fri Dec 13 21:55:19 2013 +0400 +++ b/hedgewars/uCommandHandlers.pas Fri Dec 13 22:14:02 2013 +0400 @@ -109,39 +109,6 @@ CurrentTeam^.ExtDriven:= true end; -procedure chGrave(var s: shortstring); -begin -if CurrentTeam = nil then - OutError(errmsgIncorrectUse + ' "/grave"', true); -if s[1]='"' then - Delete(s, 1, 1); -if s[byte(s[0])]='"' then - Delete(s, byte(s[0]), 1); -CurrentTeam^.GraveName:= s -end; - -procedure chFort(var s: shortstring); -begin -if CurrentTeam = nil then - OutError(errmsgIncorrectUse + ' "/fort"', true); -if s[1]='"' then - Delete(s, 1, 1); -if s[byte(s[0])]='"' then - Delete(s, byte(s[0]), 1); -CurrentTeam^.FortName:= s -end; - -procedure chFlag(var s: shortstring); -begin -if CurrentTeam = nil then - OutError(errmsgIncorrectUse + ' "/flag"', true); -if s[1]='"' then - Delete(s, 1, 1); -if s[byte(s[0])]='"' then - Delete(s, byte(s[0]), 1); -CurrentTeam^.flag:= s -end; - procedure chScript(var s: shortstring); begin if s[1]='"' then @@ -152,21 +119,6 @@ ScriptLoad(s) end; -procedure chSetHat(var s: shortstring); -begin -if (not isDeveloperMode) or (CurrentTeam = nil) then exit; -with CurrentTeam^ do - begin - if not CurrentHedgehog^.King then - if (s = '') - or (((GameFlags and gfKing) <> 0) and (s = 'crown')) - or ((Length(s) > 39) and (Copy(s,1,8) = 'Reserved') and (Copy(s,9,32) <> PlayerHash)) then - CurrentHedgehog^.Hat:= 'NoHat' - else - CurrentHedgehog^.Hat:= s - end; -end; - procedure chCurU_p(var s: shortstring); begin s:= s; // avoid compiler hint @@ -843,7 +795,6 @@ RegisterVariable('setweap' , @chSetWeapon , false, true); //////// End top by freq analysis RegisterVariable('gencmd' , @chGenCmd , false); - RegisterVariable('flag' , @chFlag , false); RegisterVariable('script' , @chScript , false); RegisterVariable('proto' , @chCheckProto , true ); RegisterVariable('spectate', @chFastUntilLag , false); @@ -873,9 +824,6 @@ RegisterVariable('gmflags' , @chGameFlags , false); RegisterVariable('turntime', @chHedgehogTurnTime, false); RegisterVariable('minestime',@chMinesTime , false); - RegisterVariable('fort' , @chFort , false); - RegisterVariable('grave' , @chGrave , false); - RegisterVariable('hat' , @chSetHat , false); RegisterVariable('quit' , @chQuit , true ); RegisterVariable('forcequit', @chForceQuit , true ); RegisterVariable('confirm' , @chConfirm , true ); diff -r 4b7df6e96b78 -r 0b4b9fda5bd4 hedgewars/uTeams.pas --- a/hedgewars/uTeams.pas Fri Dec 13 21:55:19 2013 +0400 +++ b/hedgewars/uTeams.pas Fri Dec 13 22:14:02 2013 +0400 @@ -679,6 +679,62 @@ end; +procedure chSetHat(var s: shortstring); +begin +if (not isDeveloperMode) or (CurrentTeam = nil) then exit; +with CurrentTeam^ do + begin + if not CurrentHedgehog^.King then + if (s = '') + or (((GameFlags and gfKing) <> 0) and (s = 'crown')) + or ((Length(s) > 39) and (Copy(s,1,8) = 'Reserved') and (Copy(s,9,32) <> PlayerHash)) then + CurrentHedgehog^.Hat:= 'NoHat' + else + CurrentHedgehog^.Hat:= s + end; +end; + +procedure chGrave(var s: shortstring); +begin + if CurrentTeam = nil then + OutError(errmsgIncorrectUse + ' "/grave"', true); + if s[1]='"' then + Delete(s, 1, 1); + if s[byte(s[0])]='"' then + Delete(s, byte(s[0]), 1); + CurrentTeam^.GraveName:= s +end; + +procedure chFort(var s: shortstring); +begin + if CurrentTeam = nil then + OutError(errmsgIncorrectUse + ' "/fort"', true); + if s[1]='"' then + Delete(s, 1, 1); + if s[byte(s[0])]='"' then + Delete(s, byte(s[0]), 1); + CurrentTeam^.FortName:= s +end; + +procedure chFlag(var s: shortstring); +begin + if CurrentTeam = nil then + OutError(errmsgIncorrectUse + ' "/flag"', true); + if s[1]='"' then + Delete(s, 1, 1); + if s[byte(s[0])]='"' then + Delete(s, byte(s[0]), 1); + CurrentTeam^.flag:= s +end; + +procedure chOwner(var s: shortstring); +begin + if CurrentTeam = nil then + OutError(errmsgIncorrectUse + ' "/owner"', true); + + CurrentTeam^.Owner:= s +end; + procedure initModule; begin RegisterVariable('addhh', @chAddHH, false); @@ -687,6 +743,11 @@ RegisterVariable('bind', @chBind, true ); RegisterVariable('teamgone', @chTeamGone, true ); RegisterVariable('finish', @chFinish, true ); // all teams gone +RegisterVariable('fort' , @chFort , false); +RegisterVariable('grave' , @chGrave , false); +RegisterVariable('hat' , @chSetHat , false); +RegisterVariable('flag' , @chFlag , false); +RegisterVariable('owner' , @chOwner , false); CurrentTeam:= nil; PreviousTeam:= nil; diff -r 4b7df6e96b78 -r 0b4b9fda5bd4 hedgewars/uTypes.pas --- a/hedgewars/uTypes.pas Fri Dec 13 21:55:19 2013 +0400 +++ b/hedgewars/uTypes.pas Fri Dec 13 22:14:02 2013 +0400 @@ -380,13 +380,15 @@ Binds: TBinds; Hedgehogs: array[0..cMaxHHIndex] of THedgehog; CurrHedgehog: LongWord; - NameTagTex: PTexture; + NameTagTex, + OwnerTex: PTexture; GraveTex, AIKillsTex, FlagTex: PTexture; Flag: shortstring; GraveName: shortstring; FortName: shortstring; + Owner: shortstring; TeamHealth: LongInt; TeamHealthBarHealth: LongInt; DrawHealthY: LongInt;