Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 24, 2012, 8:49:19 PM (12 years ago)
Author:
decapitb
Message:

tower defense update

Location:
code/branches/presentation2012
Files:
4 edited
2 copied

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2012

  • code/branches/presentation2012/src

    • Property svn:mergeinfo set to (toggle deleted branches)
      /code/branches/dockingsystem2/srcmergedeligible
      /code/branches/environment3/srcmergedeligible
      /code/branches/formation/srcmergedeligible
      /code/branches/gamecontent/srcmergedeligible
      /code/branches/hud/srcmergedeligible
      /code/branches/masterserverfix/srcmergedeligible
      /code/branches/menue/srcmergedeligible
      /code/branches/newlevel2012/srcmergedeligible
      /code/branches/output/srcmergedeligible
      /code/branches/pickup2012/srcmergedeligible
      /code/branches/presentation/srcmergedeligible
      /code/branches/presentation2011/srcmergedeligible
      /code/branches/shipSelection/srcmergedeligible
      /code/branches/sound2012/srcmergedeligible
      /code/branches/spacegate/srcmergedeligible
      /code/branches/spaceraceTwo/srcmergedeligible
      /code/branches/surfaceRace/srcmergedeligible
      /code/branches/usability/srcmergedeligible
      /code/trunk/srcmergedeligible
      /code/branches/ai/src6592-7033
      /code/branches/ai2/src8721-8880
      /code/branches/bigships/src8137-8588
      /code/branches/buildsystem/src1874-2276,​2278-2400
      /code/branches/buildsystem2/src2506-2658
      /code/branches/buildsystem3/src2662-2708
      /code/branches/ceguilua/src1802-1808
      /code/branches/chat/src6527-6797
      /code/branches/chat2/src6836-6910
      /code/branches/console/src5941-6104
      /code/branches/consolecommands2/src6451-7178
      /code/branches/consolecommands3/src7178-7283
      /code/branches/core3/src1572-1739
      /code/branches/core4/src3221-3224,​3227,​3234-3238,​3242,​3244-3250,​3252-3254,​3256,​3259-3261,​3264-3265,​3268-3275,​3277-3278,​3280,​3284-3285,​3287,​3289-3294,​3305,​3309-3310
      /code/branches/core5/src5768-5928,​6009
      /code/branches/data_cleanup/src7537-7686
      /code/branches/doc/src7290-7400
      /code/branches/dockingsystem/src8101-8192
      /code/branches/dynamicmatch/src6584-7030
      /code/branches/fps/src6591-7072
      /code/branches/gameimmersion/src8102-8577
      /code/branches/gamestate/src6430-6572,​6621-6661
      /code/branches/gamestates2/src6594-6745
      /code/branches/gametypes/src2826-3031
      /code/branches/gcc43/src1580
      /code/branches/gui/src1635-1723,​2795-2894
      /code/branches/hudelements/src6584-6941
      /code/branches/hudimprovements/src7920-8672
      /code/branches/ingamemenu/src6000-6023
      /code/branches/input/src1629-1636
      /code/branches/ipv6/src7293-7458
      /code/branches/kicklib/src7940-8096,​8098-8277
      /code/branches/kicklib2/src8282-8350
      /code/branches/lastmanstanding/src7479-7644
      /code/branches/lastmanstanding3/src7903-8175
      /code/branches/libraries/src5612-5692
      /code/branches/libraries2/src5703-5737
      /code/branches/lod/src6586-6911
      /code/branches/lodfinal/src2372-2411
      /code/branches/mac_osx/src7789-8128,​8135
      /code/branches/map/src2801-3086,​3089
      /code/branches/masterserver/src7502-7738
      /code/branches/menu/src5941-6146,​6148,​7536-7687
      /code/branches/miniprojects/src2754-2824
      /code/branches/netp2/src2835-2988
      /code/branches/netp3/src2988-3082
      /code/branches/netp6/src3214-3302
      /code/branches/network/src2356
      /code/branches/network2/src6434-6465
      /code/branches/network3/src7196-7344
      /code/branches/network4/src7497-7755
      /code/branches/network5/src7757-7781
      /code/branches/network6/src7823-8315
      /code/branches/network64/src2210-2355
      /code/branches/notifications/src7314-7401
      /code/branches/objecthierarchy/src1911-2085,​2100,​2110-2169
      /code/branches/objecthierarchy2/src2171-2479
      /code/branches/ois_update/src7506-7788
      /code/branches/overlay/src2117-2385
      /code/branches/particles/src2829-3085
      /code/branches/particles2/src6050-6106,​6109
      /code/branches/pch/src3113-3194
      /code/branches/physics/src1912-2055,​2107-2439
      /code/branches/physics_merge/src2436-2457
      /code/branches/pickup/src8145-8555
      /code/branches/pickup2/src5942-6405
      /code/branches/pickup3/src6418-6523
      /code/branches/pickup4/src6594-6710
      /code/branches/pickups/src1926-2086,​2127,​2827-2915
      /code/branches/pickups2/src2107-2497,​2915-3071
      /code/branches/png2/src7262-7263
      /code/branches/portals/src8087-8455
      /code/branches/portals2/src8460-8602
      /code/branches/ppspickups1/src6552-6708
      /code/branches/ppspickups2/src6527-6532,​6554-6709
      /code/branches/ppspickups3/src6757-6997
      /code/branches/ppspickups4/src7003-7089
      /code/branches/presentation2/src6106-6416,​7787-7800
      /code/branches/presentation3/src6913-7162
      /code/branches/questsystem/src1894-2088
      /code/branches/questsystem2/src2107-2259
      /code/branches/questsystem5/src2776-2905
      /code/branches/releasetodo/src7614-7647
      /code/branches/resource/src3327-3366
      /code/branches/resource2/src3372-5694
      /code/branches/rocket/src6523-6950
      /code/branches/rocket2/src6953-6970
      /code/branches/script_trigger/src1295-1953,​1955
      /code/branches/skybox2/src6559-6989
      /code/branches/sound/src2829-3010
      /code/branches/sound3/src5941-6102
      /code/branches/spaceboundaries/src8085-8457
      /code/branches/spaceboundaries2/src8460-8613
      /code/branches/spacerace/src8182-8630
      /code/branches/steering/src5949-6091,​8140-8595
      /code/branches/tetris/src8100-8563
      /code/branches/tutoriallevel/src7827-8370
      /code/branches/tutoriallevel2/src8370-8452
      /code/branches/tutoriallevel3/src8453-8636
      /code/branches/unity_build/src8440-8716
      /code/branches/weapon/src1925-2094
      /code/branches/weapon2/src2107-2488
      /code/branches/weapons/src2897-3051,​8143-8591
      /code/branches/weaponsystem/src2742-2890
  • code/branches/presentation2012/src/modules

    • Property svn:mergeinfo set to (toggle deleted branches)
      /code/branches/dockingsystem2/src/modulesmergedeligible
      /code/branches/environment3/src/modulesmergedeligible
      /code/branches/formation/src/modulesmergedeligible
      /code/branches/gamecontent/src/modulesmergedeligible
      /code/branches/hud/src/modulesmergedeligible
      /code/branches/masterserverfix/src/modulesmergedeligible
      /code/branches/menue/src/modulesmergedeligible
      /code/branches/newlevel2012/src/modulesmergedeligible
      /code/branches/output/src/modulesmergedeligible
      /code/branches/pickup2012/src/modulesmergedeligible
      /code/branches/presentation/src/modulesmergedeligible
      /code/branches/presentation2011/src/modulesmergedeligible
      /code/branches/shipSelection/src/modulesmergedeligible
      /code/branches/sound2012/src/modulesmergednon-inheritableeligible
      /code/branches/spacegate/src/modulesmergedeligible
      /code/branches/spaceraceTwo/src/modulesmergedeligible
      /code/branches/surfaceRace/src/modulesmergedeligible
      /code/branches/usability/src/modulesmergedeligible
      /code/trunk/src/modulesmergedeligible
      /code/branches/ai/src/modules6592-7033
      /code/branches/ai2/src/modules8721-8880
      /code/branches/bigships/src/modules8137-8588
      /code/branches/buildsystem/src/modules1874-2276,​2278-2400
      /code/branches/buildsystem2/src/modules2506-2658
      /code/branches/buildsystem3/src/modules2662-2708
      /code/branches/ceguilua/src/modules1802-1808
      /code/branches/chat/src/modules6527-6797
      /code/branches/chat2/src/modules6836-6910
      /code/branches/console/src/modules5941-6104
      /code/branches/consolecommands2/src/modules6451-7178
      /code/branches/consolecommands3/src/modules7178-7283
      /code/branches/core3/src/modules1572-1739
      /code/branches/core4/src/modules3221-3224,​3227,​3234-3238,​3242,​3244-3250,​3252-3254,​3256,​3259-3261,​3264-3265,​3268-3275,​3277-3278,​3280,​3284-3285,​3287,​3289-3294,​3305,​3309-3310
      /code/branches/core5/src/modules5768-5928,​6009
      /code/branches/data_cleanup/src/modules7537-7686
      /code/branches/doc/src/modules7290-7400
      /code/branches/dockingsystem/src/modules8101-8192
      /code/branches/dynamicmatch/src/modules6584-7030
      /code/branches/fps/src/modules6591-7072
      /code/branches/gameimmersion/src/modules8102-8577
      /code/branches/gamestate/src/modules6430-6572,​6621-6661
      /code/branches/gamestates2/src/modules6594-6745
      /code/branches/gametypes/src/modules2826-3031
      /code/branches/gcc43/src/modules1580
      /code/branches/gui/src/modules1635-1723,​2795-2894
      /code/branches/hudelements/src/modules6584-6941
      /code/branches/hudimprovements/src/modules7920-8672
      /code/branches/ingamemenu/src/modules6000-6023
      /code/branches/input/src/modules1629-1636
      /code/branches/ipv6/src/modules7293-7458
      /code/branches/kicklib/src/modules7940-8096,​8098-8277
      /code/branches/kicklib2/src/modules8282-8350
      /code/branches/lastmanstanding/src/modules7479-7644
      /code/branches/lastmanstanding3/src/modules7903-8175
      /code/branches/libraries/src/modules5612-5692
      /code/branches/libraries2/src/modules5703-5737
      /code/branches/lod/src/modules6586-6911
      /code/branches/lodfinal/src/modules2372-2411
      /code/branches/mac_osx/src/modules7789-8128,​8135
      /code/branches/map/src/modules2801-3086,​3089
      /code/branches/masterserver/src/modules7502-7738
      /code/branches/menu/src/modules5941-6146,​6148,​7536-7687
      /code/branches/miniprojects/src/modules2754-2824
      /code/branches/netp2/src/modules2835-2988
      /code/branches/netp3/src/modules2988-3082
      /code/branches/netp6/src/modules3214-3302
      /code/branches/network/src/modules2356
      /code/branches/network2/src/modules6434-6465
      /code/branches/network3/src/modules7196-7344
      /code/branches/network4/src/modules7497-7755
      /code/branches/network5/src/modules7757-7781
      /code/branches/network6/src/modules7823-8315
      /code/branches/network64/src/modules2210-2355
      /code/branches/notifications/src/modules7314-7401
      /code/branches/objecthierarchy/src/modules1911-2085,​2100,​2110-2169
      /code/branches/objecthierarchy2/src/modules2171-2479
      /code/branches/ois_update/src/modules7506-7788
      /code/branches/overlay/src/modules2117-2385
      /code/branches/particles/src/modules2829-3085
      /code/branches/particles2/src/modules6050-6106,​6109
      /code/branches/pch/src/modules3113-3194
      /code/branches/physics/src/modules1912-2055,​2107-2439
      /code/branches/physics_merge/src/modules2436-2457
      /code/branches/pickup/src/modules8145-8555
      /code/branches/pickup2/src/modules5942-6405
      /code/branches/pickup3/src/modules6418-6523
      /code/branches/pickup4/src/modules6594-6710
      /code/branches/pickups/src/modules1926-2086,​2127,​2827-2915
      /code/branches/pickups2/src/modules2107-2497,​2915-3071
      /code/branches/png2/src/modules7262-7263
      /code/branches/portals/src/modules8087-8455
      /code/branches/portals2/src/modules8460-8602
      /code/branches/ppspickups1/src/modules6552-6708
      /code/branches/ppspickups2/src/modules6527-6532,​6554-6709
      /code/branches/ppspickups3/src/modules6757-6997
      /code/branches/ppspickups4/src/modules7003-7089
      /code/branches/presentation2/src/modules6106-6416,​7787-7800
      /code/branches/presentation3/src/modules6913-7162
      /code/branches/questsystem/src/modules1894-2088
      /code/branches/questsystem2/src/modules2107-2259
      /code/branches/questsystem5/src/modules2776-2905
      /code/branches/releasetodo/src/modules7614-7647
      /code/branches/resource/src/modules3327-3366
      /code/branches/resource2/src/modules3372-5694
      /code/branches/rocket/src/modules6523-6950
      /code/branches/rocket2/src/modules6953-6970
      /code/branches/script_trigger/src/modules1295-1953,​1955
      /code/branches/skybox2/src/modules6559-6989
      /code/branches/sound/src/modules2829-3010
      /code/branches/sound3/src/modules5941-6102
      /code/branches/spaceboundaries/src/modules8085-8457
      /code/branches/spaceboundaries2/src/modules8460-8613
      /code/branches/spacerace/src/modules8182-8630
      /code/branches/steering/src/modules5949-6091,​8140-8595
      /code/branches/tetris/src/modules8100-8563
      /code/branches/tutoriallevel/src/modules7827-8370
      /code/branches/tutoriallevel2/src/modules8370-8452
      /code/branches/tutoriallevel3/src/modules8453-8636
      /code/branches/unity_build/src/modules8440-8716
      /code/branches/weapon/src/modules1925-2094
      /code/branches/weapon2/src/modules2107-2488
      /code/branches/weapons/src/modules2897-3051,​8143-8591
      /code/branches/weaponsystem/src/modules2742-2890
  • code/branches/presentation2012/src/modules/gametypes

    • Property svn:mergeinfo set to (toggle deleted branches)
      /code/branches/environment3/src/modules/gametypesmergedeligible
      /code/branches/formation/src/modules/gametypesmergedeligible
      /code/branches/gamecontent/src/modules/gametypesmergedeligible
      /code/branches/hud/src/modules/gametypesmergedeligible
      /code/branches/masterserverfix/src/modules/gametypesmergedeligible
      /code/branches/menue/src/modules/gametypesmergedeligible
      /code/branches/newlevel2012/src/modules/gametypesmergedeligible
      /code/branches/output/src/modules/gametypesmergedeligible
      /code/branches/pickup2012/src/modules/gametypesmergedeligible
      /code/branches/presentation/src/modules/gametypesmergedeligible
      /code/branches/presentation2011/src/modules/gametypesmergedeligible
      /code/branches/shipSelection/src/modules/gametypesmergedeligible
      /code/branches/sound2012/src/modules/gametypesmergedeligible
      /code/branches/spacegate/src/modules/gametypesmergedeligible
      /code/branches/spaceraceTwo/src/modules/gametypesmergedeligible
      /code/branches/surfaceRace/src/modules/gametypesmergedeligible
      /code/trunk/src/modules/gametypesmergedeligible
      /code/branches/ai/src/modules/gametypes6592-7033
      /code/branches/ai2/src/modules/gametypes8721-8880
      /code/branches/bigships/src/modules/gametypes8137-8588
      /code/branches/buildsystem/src/modules/gametypes1874-2276,​2278-2400
      /code/branches/buildsystem2/src/modules/gametypes2506-2658
      /code/branches/buildsystem3/src/modules/gametypes2662-2708
      /code/branches/ceguilua/src/modules/gametypes1802-1808
      /code/branches/chat/src/modules/gametypes6527-6797
      /code/branches/chat2/src/modules/gametypes6836-6910
      /code/branches/console/src/modules/gametypes5941-6104
      /code/branches/consolecommands2/src/modules/gametypes6451-7178
      /code/branches/consolecommands3/src/modules/gametypes7178-7283
      /code/branches/core3/src/modules/gametypes1572-1739
      /code/branches/core4/src/modules/gametypes3221-3224,​3227,​3234-3238,​3242,​3244-3250,​3252-3254,​3256,​3259-3261,​3264-3265,​3268-3275,​3277-3278,​3280,​3284-3285,​3287,​3289-3294,​3305,​3309-3310
      /code/branches/core5/src/modules/gametypes5768-5928,​6009
      /code/branches/data_cleanup/src/modules/gametypes7537-7686
      /code/branches/doc/src/modules/gametypes7290-7400
      /code/branches/dockingsystem/src/modules/gametypes8101-8192
      /code/branches/dockingsystem2/src/modules/gametypes8196-8560
      /code/branches/dynamicmatch/src/modules/gametypes6584-7030
      /code/branches/fps/src/modules/gametypes6591-7072
      /code/branches/gameimmersion/src/modules/gametypes8102-8577
      /code/branches/gamestate/src/modules/gametypes6430-6572,​6621-6661
      /code/branches/gamestates2/src/modules/gametypes6594-6745
      /code/branches/gametypes/src/modules/gametypes2826-3031
      /code/branches/gcc43/src/modules/gametypes1580
      /code/branches/gui/src/modules/gametypes1635-1723,​2795-2894
      /code/branches/hudelements/src/modules/gametypes6584-6941
      /code/branches/hudimprovements/src/modules/gametypes7920-8672
      /code/branches/ingamemenu/src/modules/gametypes6000-6023
      /code/branches/input/src/modules/gametypes1629-1636
      /code/branches/ipv6/src/modules/gametypes7293-7458
      /code/branches/kicklib/src/modules/gametypes7940-8096,​8098-8277
      /code/branches/kicklib2/src/modules/gametypes8282-8350
      /code/branches/lastmanstanding/src/modules/gametypes7479-7644
      /code/branches/lastmanstanding3/src/modules/gametypes7903-8175
      /code/branches/libraries/src/modules/gametypes5612-5692
      /code/branches/libraries2/src/modules/gametypes5703-5737
      /code/branches/lod/src/modules/gametypes6586-6911
      /code/branches/lodfinal/src/modules/gametypes2372-2411
      /code/branches/mac_osx/src/modules/gametypes7789-8128,​8135
      /code/branches/map/src/modules/gametypes2801-3086,​3089
      /code/branches/masterserver/src/modules/gametypes7502-7738
      /code/branches/menu/src/modules/gametypes5941-6146,​6148,​7536-7687
      /code/branches/miniprojects/src/modules/gametypes2754-2824
      /code/branches/netp2/src/modules/gametypes2835-2988
      /code/branches/netp3/src/modules/gametypes2988-3082
      /code/branches/netp6/src/modules/gametypes3214-3302
      /code/branches/network/src/modules/gametypes2356
      /code/branches/network2/src/modules/gametypes6434-6465
      /code/branches/network3/src/modules/gametypes7196-7344
      /code/branches/network4/src/modules/gametypes7497-7755
      /code/branches/network5/src/modules/gametypes7757-7781
      /code/branches/network6/src/modules/gametypes7823-8315
      /code/branches/network64/src/modules/gametypes2210-2355
      /code/branches/notifications/src/modules/gametypes7314-7401
      /code/branches/objecthierarchy/src/modules/gametypes1911-2085,​2100,​2110-2169
      /code/branches/objecthierarchy2/src/modules/gametypes2171-2479
      /code/branches/ois_update/src/modules/gametypes7506-7788
      /code/branches/overlay/src/modules/gametypes2117-2385
      /code/branches/particles/src/modules/gametypes2829-3085
      /code/branches/particles2/src/modules/gametypes6050-6106,​6109
      /code/branches/pch/src/modules/gametypes3113-3194
      /code/branches/physics/src/modules/gametypes1912-2055,​2107-2439
      /code/branches/physics_merge/src/modules/gametypes2436-2457
      /code/branches/pickup/src/modules/gametypes8145-8555
      /code/branches/pickup2/src/modules/gametypes5942-6405
      /code/branches/pickup3/src/modules/gametypes6418-6523
      /code/branches/pickup4/src/modules/gametypes6594-6710
      /code/branches/pickups/src/modules/gametypes1926-2086,​2127,​2827-2915
      /code/branches/pickups2/src/modules/gametypes2107-2497,​2915-3071
      /code/branches/png2/src/modules/gametypes7262-7263
      /code/branches/portals/src/modules/gametypes8087-8455
      /code/branches/portals2/src/modules/gametypes8460-8602
      /code/branches/ppspickups1/src/modules/gametypes6552-6708
      /code/branches/ppspickups2/src/modules/gametypes6527-6532,​6554-6709
      /code/branches/ppspickups3/src/modules/gametypes6757-6997
      /code/branches/ppspickups4/src/modules/gametypes7003-7089
      /code/branches/presentation2/src/modules/gametypes6106-6416,​7787-7800
      /code/branches/presentation3/src/modules/gametypes6913-7162
      /code/branches/questsystem/src/modules/gametypes1894-2088
      /code/branches/questsystem2/src/modules/gametypes2107-2259
      /code/branches/questsystem5/src/modules/gametypes2776-2905
      /code/branches/releasetodo/src/modules/gametypes7614-7647
      /code/branches/resource/src/modules/gametypes3327-3366
      /code/branches/resource2/src/modules/gametypes3372-5694
      /code/branches/rocket/src/modules/gametypes6523-6950
      /code/branches/rocket2/src/modules/gametypes6953-6970
      /code/branches/script_trigger/src/modules/gametypes1295-1953,​1955
      /code/branches/skybox2/src/modules/gametypes6559-6989
      /code/branches/sound/src/modules/gametypes2829-3010
      /code/branches/sound3/src/modules/gametypes5941-6102
      /code/branches/spaceboundaries/src/modules/gametypes8085-8457
      /code/branches/spaceboundaries2/src/modules/gametypes8460-8613
      /code/branches/spacerace/src/modules/gametypes8182-8630
      /code/branches/steering/src/modules/gametypes5949-6091,​8140-8595
      /code/branches/tetris/src/modules/gametypes8100-8563
      /code/branches/tutoriallevel/src/modules/gametypes7827-8370
      /code/branches/tutoriallevel2/src/modules/gametypes8370-8452
      /code/branches/tutoriallevel3/src/modules/gametypes8453-8636
      /code/branches/unity_build/src/modules/gametypes8440-8716
      /code/branches/usability/src/modules/gametypes7915-8078
      /code/branches/weapon/src/modules/gametypes1925-2094
      /code/branches/weapon2/src/modules/gametypes2107-2488
      /code/branches/weapons/src/modules/gametypes2897-3051,​8143-8591
      /code/branches/weaponsystem/src/modules/gametypes2742-2890
  • code/branches/presentation2012/src/modules/gametypes/CaptureTheFlag.cc

    r9240 r9241  
    2828#include "CaptureTheFlag.h"
    2929
    30 #include "core/CoreIncludes.h"
    3130#include "core/ConfigValueIncludes.h"
    3231#include "interfaces/TeamColourable.h"
     
    3938{
    4039    CreateUnloadableFactory(CaptureTheFlag);
    41 
     40   
    4241    CaptureTheFlag::CaptureTheFlag(BaseObject* creator) : TeamBaseMatch(creator)
    4342    {
     
    4746        this->pointsTeam1_ = 0;
    4847        this->pointsTeam2_ = 0;
    49        
    50         //this->flagTeamBlue = new FlagPickup(this);
    51         //this->flagTeamRed = new FlagPickup(this);
    52 
     48               
     49//      this->flagTeamBlue = new FlagPickup(this);
     50//      this->flagTeamRed = new FlagPickup(this);
     51       
    5352        this->setConfigValues();
    5453    }
    55 
     54   
    5655    void CaptureTheFlag::tick(float dt){
     56       
     57        SUPER(CaptureTheFlag, tick, dt);
     58       
    5759        if(this->flagTeamBlue->isPickedUp()){
    58                 if(getTeam(this->flagTeamBlue->pickedUpBy()->getPlayer()) == 1){
     60            teamnr = getTeam(this->flagTeamBlue->pickedUpBy()->getPlayer());
     61                if(teamnr == 1){
    5962                    this->flagTeamBlue->ignorePickedUp();
    6063                   
    6164                        if(this->flagTeamBlue->pickedUpBy()->hasFlag()){
    62                                 pointsTeam1_ += 1000;
     65                    this->addTeamPoints(teamnr, 1000);
    6366                                this->flagTeamBlue->pickedUpBy()->setHasFlag(false);
    6467                        }
     
    7073        }
    7174        if(this->flagTeamRed->isPickedUp()){
    72                 if(getTeam(this->flagTeamRed->pickedUpBy()->getPlayer()) == 0){
     75            teamnr = getTeam(this->flagTeamBlue->pickedUpBy()->getPlayer());
     76                if(teamnr == 0){
    7377                    this->flagTeamRed->ignorePickedUp();
    7478                   
    7579                        if(this->flagTeamRed->pickedUpBy()->hasFlag()){
    76                                 pointsTeam1_ += 1000;
     80                    this->addTeamPoints(teamnr, 1000);
    7781                                this->flagTeamRed->pickedUpBy()->setHasFlag(false);
    7882                        }
     
    8387                }
    8488        }
     89       
    8590    }
    8691    void CaptureTheFlag::setConfigValues()
    8792    {
    8893        SetConfigValue(teams_, 2);
    89 
     94       
    9095        static ColourValue colours[] =
    9196        {
     
    96101        };
    97102        static std::vector<ColourValue> defaultcolours(colours, colours + sizeof(colours) / sizeof(ColourValue));
    98 
     103       
    99104        SetConfigValue(teamcolours_, defaultcolours);
    100105    }
    101 
     106   
    102107    void CaptureTheFlag::playerEntered(PlayerInfo* player)
    103108    {
    104         Deathmatch::playerEntered(player);
    105 
     109        TeamBaseMatch::playerEntered(player);
     110       
    106111        std::vector<unsigned int> playersperteam(this->teams_, 0);
    107 
     112       
    108113        for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)
    109114            if (it->second < static_cast<int>(this->teams_) && it->second >= 0)
    110115                playersperteam[it->second]++;
    111 
     116       
    112117        unsigned int minplayers = static_cast<unsigned int>(-1);
    113118        size_t minplayersteam = 0;
     
    120125            }
    121126        }
    122 
     127       
    123128        this->teamnumbers_[player] = minplayersteam;
    124129    }
    125 
     130   
    126131    bool CaptureTheFlag::playerLeft(PlayerInfo* player)
    127132    {
    128133        bool valid_player = Deathmatch::playerLeft(player);
    129 
     134       
    130135        if (valid_player)
    131136            this->teamnumbers_.erase(player);
    132 
     137       
    133138        return valid_player;
    134139    }
    135 
     140   
    136141    bool CaptureTheFlag::allowPawnHit(Pawn* victim, Pawn* originator)
    137142    {
    138143        return (!this->pawnsAreInTheSameTeam(victim, originator) || !originator);
    139144    }
    140 
     145   
    141146    bool CaptureTheFlag::allowPawnDamage(Pawn* victim, Pawn* originator)
    142147    {
    143148        return (!this->pawnsAreInTheSameTeam(victim, originator) || !originator);
    144149    }
    145 
     150   
    146151    bool CaptureTheFlag::allowPawnDeath(Pawn* victim, Pawn* originator)
    147152    {
    148153        return (!this->pawnsAreInTheSameTeam(victim, originator) || !originator);
    149154    }
    150 
     155   
    151156    // collect Points for killing oppenents
    152         void CaptureTheFlag::playerScored(PlayerInfo* player)
    153         {
    154             int teamnr = this->getTeam(player);
    155             this->addTeamPoints(teamnr, 5);
    156         }
    157        
    158        
    159         // show points or each interval of time
    160         void CaptureTheFlag::showPoints()
    161         {
    162             if (!this->hasStarted() || this->hasEnded())
    163                 return;
    164 
    165             orxout(message) << "Points standing:" << '\n' << "Team Blue: "<< pointsTeam1_ << '\n' << "Team Red: " << pointsTeam2_ << endl;
    166             if(pointsTeam1_ >=1700 && pointsTeam1_ < 2000) orxout(message) << "Team Blue is near victory!" << endl;
    167             if(pointsTeam2_ >=1700 && pointsTeam2_ < 2000) orxout(message) << "Team Red is near victory!" << endl;
    168         }
    169        
    170         // end game if one team reaches 2000 points
    171         void CaptureTheFlag::endGame()
    172         {
    173             if (this->pointsTeam1_ >= 2000 || this->pointsTeam2_ >= 2000)
    174             {
    175                 int winningteam = -1;
    176 
    177                 if (this->pointsTeam1_ > this->pointsTeam2_)
    178                 {
    179                     orxout(message) << "Team Blue has won the match" << endl;
    180                     winningteam = 0;
    181                 }
     157    void CaptureTheFlag::playerScored(PlayerInfo* player)
     158    {
     159        int teamnr = this->getTeam(player);
     160        this->addTeamPoints(teamnr, 5);
     161    }
     162   
     163   
     164    // show points or each interval of time
     165    void CaptureTheFlag::showPoints()
     166    {
     167        if (!this->hasStarted() || this->hasEnded())
     168            return;
     169       
     170        orxout(message) << "Points standing:" << '\n' << "Team Blue: "<< pointsTeam1_ << '\n' << "Team Red: " << pointsTeam2_ << endl;
     171        if(pointsTeam1_ >=1700 && pointsTeam1_ < 2000) orxout(message) << "Team Blue is near victory!" << endl;
     172        if(pointsTeam2_ >=1700 && pointsTeam2_ < 2000) orxout(message) << "Team Red is near victory!" << endl;
     173    }
     174   
     175    // end game if one team reaches 2000 points
     176    void CaptureTheFlag::endGame()
     177    {
     178        if (this->pointsTeam1_ >= 2000 || this->pointsTeam2_ >= 2000)
     179        {
     180            int winningteam = -1;
     181           
     182            if (this->pointsTeam1_ > this->pointsTeam2_)
     183            {
     184                orxout(message) << "Team Blue has won the match" << endl;
     185                winningteam = 0;
     186            }
     187            else
     188            {
     189                orxout(message) << "Team Red has won the match" << endl;
     190                winningteam = 1;
     191            }
     192           
     193            for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)
     194            {
     195                if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     196                    continue;
     197               
     198                if (it->second == winningteam)
     199                    this->gtinfo_->sendAnnounceMessage("You have won the match!", it->first->getClientID());
    182200                else
    183                 {
    184                     orxout(message) << "Team Red has won the match" << endl;
    185                     winningteam = 1;
    186                 }
    187 
    188                 for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)
    189                 {
    190                     if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    191                         continue;
    192 
    193                     if (it->second == winningteam)
    194                         this->gtinfo_->sendAnnounceMessage("You have won the match!", it->first->getClientID());
    195                     else
    196                         this->gtinfo_->sendAnnounceMessage("You have lost the match!", it->first->getClientID());
    197                 }
    198 
    199                 this->end();
    200                 this->scoreTimer_.stopTimer();
    201                 this->outputTimer_.stopTimer();
    202             }
    203         }
    204        
    205         // this function is called by the function winPoints() which adds points to the teams for every base and killed openents at a certain time
    206         void CaptureTheFlag::addTeamPoints(int team, int points)
    207         {
    208             if(team == 0)
    209             {
    210                 this->pointsTeam1_ += points;
    211             }
    212             if(team == 1)
    213             {
    214                 this->pointsTeam2_ += points;
    215             }
    216 
    217             this->endGame();
    218         }
    219 
    220         int TeamBaseMatch::getTeamPoints(int team)
    221         {
    222             if(team == 0)
    223             {
    224                 return this->pointsTeam1_;
    225             }
    226             if(team == 1)
    227             {
    228                 return this->pointsTeam2_;
    229             }
    230 
    231             return 0;
    232         }
    233        
     201                    this->gtinfo_->sendAnnounceMessage("You have lost the match!", it->first->getClientID());
     202            }
     203           
     204            this->end();
     205            this->scoreTimer_.stopTimer();
     206            this->outputTimer_.stopTimer();
     207        }
     208    }
     209   
     210    // this function is called by the function winPoints() which adds points to the teams for every base and killed openents at a certain time
     211    void CaptureTheFlag::addTeamPoints(int team, int points)
     212    {
     213        if(team == 0)
     214        {
     215            this->pointsTeam1_ += points;
     216        }
     217        if(team == 1)
     218        {
     219            this->pointsTeam2_ += points;
     220        }
     221       
     222        this->endGame();
     223    }
     224   
     225    int TeamBaseMatch::getTeamPoints(int team)
     226    {
     227        if(team == 0)
     228        {
     229            return this->pointsTeam1_;
     230        }
     231        if(team == 1)
     232        {
     233            return this->pointsTeam2_;
     234        }
     235       
     236        return 0;
     237    }
     238   
    234239    SpawnPoint* CaptureTheFlag::getBestSpawnPoint(PlayerInfo* player) const
    235240    {
     
    238243        if (it_player != this->teamnumbers_.end())
    239244            desiredTeamNr = it_player->second;
    240 
     245       
    241246        // Only use spawnpoints of the own team (or non-team-spawnpoints)
    242247        std::set<SpawnPoint*> teamSpawnPoints = this->spawnpoints_;
     
    252257                }
    253258            }
    254 
     259           
    255260            ++it;
    256261        }
    257 
     262       
    258263        SpawnPoint* fallbackSpawnPoint = NULL;
    259264        if (teamSpawnPoints.size() > 0)
     
    269274                    break;
    270275                }
    271 
     276               
    272277                ++index;
    273278            }
    274 
     279           
    275280            // Remove all inactive SpawnPoints from the list.
    276281            for (std::set<SpawnPoint*>::iterator it = teamSpawnPoints.begin(); it != teamSpawnPoints.end(); )
     
    281286                    continue;
    282287                }
    283 
     288               
    284289                ++it;
    285290            }
    286 
     291           
    287292            randomspawn = static_cast<unsigned int>(rnd(static_cast<float>(teamSpawnPoints.size())));
    288293            index = 0;
     
    291296                if (index == randomspawn)
    292297                    return (*it);
    293 
     298               
    294299                ++index;
    295300            }
    296 
     301           
    297302            return fallbackSpawnPoint;
    298303        }
    299 
     304       
    300305        return 0;
    301306    }
    302 
     307   
    303308    void CaptureTheFlag::playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn)
    304309    {
    305310        if (!player)
    306311            return;
    307 
     312       
    308313        // Set the team colour
    309314        std::map<PlayerInfo*, int>::const_iterator it_player = this->teamnumbers_.find(player);
     
    313318            {
    314319                pawn->setRadarObjectColour(this->teamcolours_[it_player->second]);
    315 
     320               
    316321                std::set<WorldEntity*> pawnAttachments = pawn->getAttachedObjects();
    317322                for (std::set<WorldEntity*>::iterator it = pawnAttachments.begin(); it != pawnAttachments.end(); ++it)
     
    326331        }
    327332    }
    328 
     333   
    329334    bool CaptureTheFlag::pawnsAreInTheSameTeam(Pawn* pawn1, Pawn* pawn2)
    330335    {
     
    333338            std::map<PlayerInfo*, int>::const_iterator it1 = this->teamnumbers_.find(pawn1->getPlayer());
    334339            std::map<PlayerInfo*, int>::const_iterator it2 = this->teamnumbers_.find(pawn2->getPlayer());
    335 
     340           
    336341            if (it1 != this->teamnumbers_.end() && it2 != this->teamnumbers_.end())
    337342                return (it1->second == it2->second);
     
    339344        return false;
    340345    }
    341 
     346   
    342347    int CaptureTheFlag::getTeam(PlayerInfo* player)
    343348    {
  • code/branches/presentation2012/src/modules/gametypes/CaptureTheFlag.h

    r9240 r9241  
    3232#include "OrxonoxPrereqs.h"
    3333#include <set>
     34#include "core/CoreIncludes.h"
     35
    3436#include "tools/Timer.h"
    3537#include "gametypes/TeamBaseMatch.h"
    3638#include "infos/PlayerInfo.h"
    3739#include "pickup/items/FlagPickup.h"
     40#include "pickup/PickupPrereqs.h"
    3841
    3942namespace orxonox
     
    4245    {
    4346    public:
    44                         CaptureTheFlag(BaseObject* creator);
    45                 virtual ~CaptureTheFlag() {}
    46 
    47                 void tick(float dt);
    48 
    49                 void setConfigValues();
    50 
    51                 virtual void playerEntered(PlayerInfo* player);
    52                 virtual bool playerLeft(PlayerInfo* player);
    53 
    54                 virtual bool allowPawnHit(Pawn* victim, Pawn* originator = 0);
    55                 virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = 0);
    56                 virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0);
    57 
    58                 virtual void playerScored(PlayerInfo* player);
    59                 virtual void showPoints();
    60                 virtual void endGame();
    61 
    62                 void addTeamPoints(int team, int points);
    63                 int getTeamPoints(int team);
    64 
    65                 virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn);
    66 
    67                 int getTeam(PlayerInfo* player);
    68                 inline const ColourValue& getTeamColour(int teamnr) const
    69                     { return this->teamcolours_[teamnr]; }
    70 
    71             protected:
    72                 virtual SpawnPoint* getBestSpawnPoint(PlayerInfo* player) const;
    73                 bool pawnsAreInTheSameTeam(Pawn* pawn1, Pawn* pawn2);
    74 
    75                 std::map<PlayerInfo*, int> teamnumbers_;
    76                 std::vector<ColourValue> teamcolours_;
    77                 unsigned int teams_;
    78 
    79                 FlagPickup* flagTeamBlue;
    80                 FlagPickup* flagTeamRed;
    81                 //points for each team
    82                 int pointsTeam1_;
    83                 int pointsTeam2_;
    84 
     47        CaptureTheFlag(BaseObject* creator);
     48        virtual ~CaptureTheFlag() {}
     49       
     50        void tick(float dt);
     51       
     52        void setConfigValues();
     53       
     54        virtual void playerEntered(PlayerInfo* player);
     55        virtual bool playerLeft(PlayerInfo* player);
     56       
     57        virtual bool allowPawnHit(Pawn* victim, Pawn* originator = 0);
     58        virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = 0);
     59        virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0);
     60       
     61        virtual void playerScored(PlayerInfo* player);
     62        virtual void showPoints();
     63        virtual void endGame();
     64       
     65        void addTeamPoints(int team, int points);
     66        int getTeamPoints(int team);
     67       
     68        virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn);
     69       
     70        int getTeam(PlayerInfo* player);
     71        inline const ColourValue& getTeamColour(int teamnr) const
     72        { return this->teamcolours_[teamnr]; }
     73       
     74    protected:
     75        virtual SpawnPoint* getBestSpawnPoint(PlayerInfo* player) const;
     76        bool pawnsAreInTheSameTeam(Pawn* pawn1, Pawn* pawn2);
     77       
     78        std::map<PlayerInfo*, int> teamnumbers_;
     79        std::vector<ColourValue> teamcolours_;
     80        unsigned int teams_;
     81       
     82        FlagPickup* flagTeamBlue;
     83        FlagPickup* flagTeamRed;
     84       
     85        //points for each team
     86        int pointsTeam1_;
     87        int pointsTeam2_;
     88        int teamnr;
     89       
    8590    };
    8691}
Note: See TracChangeset for help on using the changeset viewer.