From a8665d204255b4b0ad9ae6982f77ecd5e053c1b6 Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Mon, 11 Jun 2012 17:28:27 +0200 Subject: Changed #defined constants to consts; typedef struct -> struct --- src/object/auto/autobase.cpp | 16 +++++------ src/object/auto/autobase.h | 19 ++++++------- src/object/auto/autoderrick.cpp | 4 +-- src/object/auto/autoenergy.cpp | 4 +-- src/object/auto/autohuston.h | 7 +++-- src/object/auto/autolabo.cpp | 2 +- src/object/auto/autonuclear.cpp | 2 +- src/object/auto/autoportico.cpp | 28 +++++++++---------- src/object/auto/autosafe.cpp | 2 +- src/object/auto/autotower.cpp | 4 +-- src/object/brain.cpp | 2 +- src/object/brain.h | 7 +++-- src/object/motion/motionant.cpp | 2 +- src/object/motion/motionant.h | 29 +++++++++++--------- src/object/motion/motionbee.cpp | 2 +- src/object/motion/motionbee.h | 16 +++++++---- src/object/motion/motionhuman.cpp | 4 +-- src/object/motion/motionhuman.h | 54 ++++++++++++++++++++----------------- src/object/motion/motionmother.cpp | 2 +- src/object/motion/motionspider.cpp | 2 +- src/object/motion/motionspider.h | 24 ++++++++++------- src/object/motion/motiontoto.cpp | 2 +- src/object/motion/motiontoto.h | 11 +++++--- src/object/motion/motionvehicle.cpp | 4 --- src/object/motion/motionworm.cpp | 8 +++--- src/object/object.cpp | 10 +++---- src/object/object.h | 25 ++++++++--------- src/object/robotmain.cpp | 2 +- src/object/robotmain.h | 37 ++++++++++++------------- src/object/task/task.h | 23 ++++++++-------- src/object/task/taskbuild.h | 4 +-- src/object/task/taskfire.cpp | 6 ++--- src/object/task/taskgoto.cpp | 6 ++--- src/object/task/taskgoto.h | 2 +- src/object/task/taskmanip.cpp | 16 +++++------ src/object/task/taskrecover.cpp | 4 +-- src/object/task/taskshield.cpp | 2 +- src/object/task/taskshield.h | 4 +-- src/object/task/taskterraform.cpp | 4 +-- 39 files changed, 209 insertions(+), 193 deletions(-) (limited to 'src/object') diff --git a/src/object/auto/autobase.cpp b/src/object/auto/autobase.cpp index 5c1bb2d..54bf96f 100644 --- a/src/object/auto/autobase.cpp +++ b/src/object/auto/autobase.cpp @@ -48,14 +48,14 @@ -#define BASE_LAND_TIME 7.5f // hard landing -#define BASE_TAKO_TIME 10.0f // hard landing -#define BASE_DOOR_TIME 6.0f // time opening / closing -#define BASE_DOOR_TIME2 2.0f // time opening / closing suppl. -#define BASE_PORTICO_TIME_MOVE 16.0f // gate advance time -#define BASE_PORTICO_TIME_DOWN 4.0f // gate length down -#define BASE_PORTICO_TIME_OPEN 4.0f // gate opening duration -#define BASE_TRANSIT_TIME 15.0f // transit duration +const float BASE_LAND_TIME = 7.5f; // hard landing +const float BASE_TAKO_TIME = 10.0f; // hard landing +const float BASE_DOOR_TIME = 6.0f; // time opening / closing +const float BASE_DOOR_TIME2 = 2.0f; // time opening / closing suppl. +const float BASE_PORTICO_TIME_MOVE = 16.0f; // gate advance time +const float BASE_PORTICO_TIME_DOWN = 4.0f; // gate length down +const float BASE_PORTICO_TIME_OPEN = 4.0f; // gate opening duration +const float BASE_TRANSIT_TIME = 15.0f; // transit duration diff --git a/src/object/auto/autobase.h b/src/object/auto/autobase.h index 1a3623d..513f16e 100644 --- a/src/object/auto/autobase.h +++ b/src/object/auto/autobase.h @@ -31,15 +31,16 @@ class CCamera; class CObject; - -#define PARAM_STOP 0 // run=0 -> stops and open -#define PARAM_LANDING 1 // run=1 -> landing -#define PARAM_PORTICO 2 // run=2 -> gate on the ground -#define PARAM_FIXSCENE 3 // run=3 -> open and stops to win / lost -#define PARAM_TRANSIT1 11 // run=11 -> transit in space -#define PARAM_TRANSIT2 12 // run=12 -> transit in space -#define PARAM_TRANSIT3 13 // run=13 -> transit in space - +enum AutoBaseParam +{ + PARAM_STOP = 0, // run=0 -> stops and open + PARAM_LANDING = 1, // run=1 -> landing + PARAM_PORTICO = 2, // run=2 -> gate on the ground + PARAM_FIXSCENE = 3, // run=3 -> open and stops to win / lost + PARAM_TRANSIT1 = 11, // run=11 -> transit in space + PARAM_TRANSIT2 = 12, // run=12 -> transit in space + PARAM_TRANSIT3 = 13 // run=13 -> transit in space +}; enum AutoBasePhase { diff --git a/src/object/auto/autoderrick.cpp b/src/object/auto/autoderrick.cpp index 8350da8..a7d0b5e 100644 --- a/src/object/auto/autoderrick.cpp +++ b/src/object/auto/autoderrick.cpp @@ -43,8 +43,8 @@ -#define DERRICK_DELAY 10.0f // duration of the extraction -#define DERRICK_DELAYu 30.0f // same, but for uranium +const float DERRICK_DELAY = 10.0f; // duration of the extraction +const float DERRICK_DELAYu = 30.0f; // same, but for uranium diff --git a/src/object/auto/autoenergy.cpp b/src/object/auto/autoenergy.cpp index ba265e8..75ab92a 100644 --- a/src/object/auto/autoenergy.cpp +++ b/src/object/auto/autoenergy.cpp @@ -46,8 +46,8 @@ -#define ENERGY_POWER 0.4f // Necessary energy for a battery -#define ENERGY_DELAY 12.0f // processing time +const float ENERGY_POWER = 0.4f; // Necessary energy for a battery +const float ENERGY_DELAY = 12.0f; // processing time diff --git a/src/object/auto/autohuston.h b/src/object/auto/autohuston.h index 32954f7..e17d04e 100644 --- a/src/object/auto/autohuston.h +++ b/src/object/auto/autohuston.h @@ -32,7 +32,7 @@ class CObject; -typedef struct +struct HustonLens { int parti; ParticuleType type; @@ -40,11 +40,10 @@ typedef struct float dim; float total; float off; -} -HustonLens; +}; -#define HUSTONMAXLENS 20 +const int HUSTONMAXLENS = 20; class CAutoHuston : public CAuto diff --git a/src/object/auto/autolabo.cpp b/src/object/auto/autolabo.cpp index 41b6299..7d5c576 100644 --- a/src/object/auto/autolabo.cpp +++ b/src/object/auto/autolabo.cpp @@ -47,7 +47,7 @@ -#define LABO_DELAY 20.0f // duration of the analysis +const float LABO_DELAY = 20.0f; // duration of the analysis diff --git a/src/object/auto/autonuclear.cpp b/src/object/auto/autonuclear.cpp index a6a9904..5139b9b 100644 --- a/src/object/auto/autonuclear.cpp +++ b/src/object/auto/autonuclear.cpp @@ -45,7 +45,7 @@ -#define NUCLEAR_DELAY 30.0f // duration of the generation +const float NUCLEAR_DELAY = 30.0f; // duration of the generation diff --git a/src/object/auto/autoportico.cpp b/src/object/auto/autoportico.cpp index 97f11c5..5c4a09c 100644 --- a/src/object/auto/autoportico.cpp +++ b/src/object/auto/autoportico.cpp @@ -44,20 +44,20 @@ -#define PARAM_DEPOSE 2 // run=2 -> deposits the spaceship - -#define PORTICO_POSa 75.0f -#define PORTICO_POSb 65.0f -#define PORTICO_ANGLE1a ( 25.0f*PI/180.0f) -#define PORTICO_ANGLE1b ( 70.0f*PI/180.0f) -#define PORTICO_ANGLE2a (-37.5f*PI/180.0f) -#define PORTICO_ANGLE2b (-62.5f*PI/180.0f) -#define PORTICO_ANGLE3a (-77.5f*PI/180.0f) -#define PORTICO_ANGLE3b (-30.0f*PI/180.0f) - -#define PORTICO_TIME_MOVE 16.0f -#define PORTICO_TIME_DOWN 4.0f -#define PORTICO_TIME_OPEN 12.0f +const int PARAM_DEPOSE = 2; // run=2 -> deposits the spaceship + +const float PORTICO_POSa = 75.0f; +const float PORTICO_POSb = 65.0f; +const float PORTICO_ANGLE1a = ( 25.0f*PI/180.0f); +const float PORTICO_ANGLE1b = ( 70.0f*PI/180.0f); +const float PORTICO_ANGLE2a = (-37.5f*PI/180.0f); +const float PORTICO_ANGLE2b = (-62.5f*PI/180.0f); +const float PORTICO_ANGLE3a = (-77.5f*PI/180.0f); +const float PORTICO_ANGLE3b = (-30.0f*PI/180.0f); + +const float PORTICO_TIME_MOVE = 16.0f; +const float PORTICO_TIME_DOWN = 4.0f; +const float PORTICO_TIME_OPEN = 12.0f; diff --git a/src/object/auto/autosafe.cpp b/src/object/auto/autosafe.cpp index 8104c5e..6565202 100644 --- a/src/object/auto/autosafe.cpp +++ b/src/object/auto/autosafe.cpp @@ -46,7 +46,7 @@ -#define OPEN_DELAY 8.0f // duration of opening +const float OPEN_DELAY = 8.0f; // duration of opening diff --git a/src/object/auto/autotower.cpp b/src/object/auto/autotower.cpp index 63222b8..74cc984 100644 --- a/src/object/auto/autotower.cpp +++ b/src/object/auto/autotower.cpp @@ -47,8 +47,8 @@ -#define TOWER_SCOPE 200.0f // range of beam -#define ENERGY_FIRE 0.125f // energy consumed by fire +const float TOWER_SCOPE = 200.0f; // range of beam +const float ENERGY_FIRE = 0.125f; // energy consumed by fire // Object's constructor. diff --git a/src/object/brain.cpp b/src/object/brain.cpp index 1bbebe4..2984eab 100644 --- a/src/object/brain.cpp +++ b/src/object/brain.cpp @@ -69,7 +69,7 @@ -#define MAXTRACERECORD 1000 +const int MAXTRACERECORD = 1000; diff --git a/src/object/brain.h b/src/object/brain.h index 11fd379..c54f0f7 100644 --- a/src/object/brain.h +++ b/src/object/brain.h @@ -46,7 +46,7 @@ class CSound; class CParticule; -#define BRAINMAXSCRIPT 10 +const int BRAINMAXSCRIPT = 10; @@ -59,12 +59,11 @@ enum TraceOper TO_PEN = 4, // color change }; -typedef struct +struct TraceRecord { TraceOper oper; float param; -} -TraceRecord; +}; diff --git a/src/object/motion/motionant.cpp b/src/object/motion/motionant.cpp index 0f6543a..3caf79a 100644 --- a/src/object/motion/motionant.cpp +++ b/src/object/motion/motionant.cpp @@ -44,7 +44,7 @@ #define ADJUST_ANGLE false // true -> adjusts the angles of the members -#define START_TIME 1000.0f // beginning of the relative time +const float START_TIME = 1000.0f; // beginning of the relative time diff --git a/src/object/motion/motionant.h b/src/object/motion/motionant.h index 084a9a9..dc969fe 100644 --- a/src/object/motion/motionant.h +++ b/src/object/motion/motionant.h @@ -32,19 +32,24 @@ class CBrain; class CPhysics; class CObject; +enum MotionAntAction +{ + MA_MARCH = 0, + MA_STOP = 1, + MA_SPEC = 2 +}; -#define MA_MARCH 0 -#define MA_STOP 1 -#define MA_SPEC 2 - -#define MAS_PREPARE 0 -#define MAS_FIRE 1 -#define MAS_TERMINATE 2 -#define MAS_BURN 3 -#define MAS_RUIN 4 -#define MAS_BACK1 5 -#define MAS_BACK2 6 -#define MAS_BACK3 7 +enum MotionAntSpecialAction +{ + MAS_PREPARE = 0, + MAS_FIRE = 1, + MAS_TERMINATE = 2, + MAS_BURN = 3, + MAS_RUIN = 4, + MAS_BACK1 = 5, + MAS_BACK2 = 6, + MAS_BACK3 = 7 +}; class CMotionAnt : public CMotion diff --git a/src/object/motion/motionbee.cpp b/src/object/motion/motionbee.cpp index 7f3da7a..9167bbc 100644 --- a/src/object/motion/motionbee.cpp +++ b/src/object/motion/motionbee.cpp @@ -44,7 +44,7 @@ #define ADJUST_ANGLE false // true -> adjusts the angles of the members -#define START_TIME 1000.0f // beginning of the relative time +const float START_TIME = 1000.0f; // beginning of the relative time diff --git a/src/object/motion/motionbee.h b/src/object/motion/motionbee.h index a62f2ba..5c69bff 100644 --- a/src/object/motion/motionbee.h +++ b/src/object/motion/motionbee.h @@ -33,12 +33,18 @@ class CPhysics; class CObject; -#define MB_MARCH 0 -#define MB_SPEC 1 +enum MotionBeeAction +{ + MB_MARCH = 0, + MB_SPEC = 1 +}; -#define MBS_HOLD 0 -#define MBS_BURN 1 -#define MBS_RUIN 2 +enum MotionBeeSpecialAction +{ + MBS_HOLD = 0, + MBS_BURN = 1, + MBS_RUIN = 2 +}; class CMotionBee : public CMotion diff --git a/src/object/motion/motionhuman.cpp b/src/object/motion/motionhuman.cpp index 02e4dd3..6667a39 100644 --- a/src/object/motion/motionhuman.cpp +++ b/src/object/motion/motionhuman.cpp @@ -46,9 +46,9 @@ #define ADJUST_ANGLE false // true -> adjusts the angles of the members -#define ADJUST_ACTION (3*3*3*3*MH_SPEC+3*3*3*MHS_SATCOM) +const int ADJUST_ACTION = (3*3*3*3*MH_SPEC+3*3*3*MHS_SATCOM); -#define START_TIME 1000.0f // beginning of the relative time +const float START_TIME = 1000.0f; // beginning of the relative time diff --git a/src/object/motion/motionhuman.h b/src/object/motion/motionhuman.h index e563a81..1fc8d57 100644 --- a/src/object/motion/motionhuman.h +++ b/src/object/motion/motionhuman.h @@ -34,30 +34,36 @@ class CPhysics; class CObject; -#define MH_MARCH 0 -#define MH_MARCHTAKE 1 -#define MH_TURN 2 -#define MH_STOP 3 -#define MH_FLY 4 -#define MH_SWIM 5 -#define MH_SPEC 6 - -#define MHS_FIRE 0 -#define MHS_GUN 1 -#define MHS_TAKE 2 -#define MHS_TAKEOTHER 3 -#define MHS_TAKEHIGH 4 -#define MHS_UPRIGHT 5 -#define MHS_WIN 6 -#define MHS_LOST 7 -#define MHS_DEADg 8 -#define MHS_DEADg1 9 -#define MHS_DEADg2 10 -#define MHS_DEADg3 11 -#define MHS_DEADg4 12 -#define MHS_DEADw 13 -#define MHS_FLAG 14 -#define MHS_SATCOM 15 +enum MotionHumanAction +{ + MH_MARCH = 0, + MH_MARCHTAKE = 1, + MH_TURN = 2, + MH_STOP = 3, + MH_FLY = 4, + MH_SWIM = 5, + MH_SPEC = 6 +}; + +enum MotionHumanSpecialAction +{ + MHS_FIRE = 0, + MHS_GUN = 1, + MHS_TAKE = 2, + MHS_TAKEOTHER = 3, + MHS_TAKEHIGH = 4, + MHS_UPRIGHT = 5, + MHS_WIN = 6, + MHS_LOST = 7, + MHS_DEADg = 8, + MHS_DEADg1 = 9, + MHS_DEADg2 = 10, + MHS_DEADg3 = 11, + MHS_DEADg4 = 12, + MHS_DEADw = 13, + MHS_FLAG = 14, + MHS_SATCOM = 15 +}; class CMotionHuman : public CMotion diff --git a/src/object/motion/motionmother.cpp b/src/object/motion/motionmother.cpp index 6db0a8b..cd5fb7c 100644 --- a/src/object/motion/motionmother.cpp +++ b/src/object/motion/motionmother.cpp @@ -44,7 +44,7 @@ #define ADJUST_ANGLE false // true -> adjusts the angles of the members -#define START_TIME 1000.0f // beginning of the relative time +const float START_TIME = 1000.0f; // beginning of the relative time diff --git a/src/object/motion/motionspider.cpp b/src/object/motion/motionspider.cpp index 2671933..08eb546 100644 --- a/src/object/motion/motionspider.cpp +++ b/src/object/motion/motionspider.cpp @@ -44,7 +44,7 @@ #define ADJUST_ANGLE false // true -> adjusts the angles of the members -#define START_TIME 1000.0f // beginning of the relative time +const float START_TIME = 1000.0f; // beginning of the relative time diff --git a/src/object/motion/motionspider.h b/src/object/motion/motionspider.h index bda769d..6f18e07 100644 --- a/src/object/motion/motionspider.h +++ b/src/object/motion/motionspider.h @@ -33,16 +33,22 @@ class CPhysics; class CObject; -#define MS_MARCH 0 -#define MS_STOP 1 -#define MS_SPEC 2 +enum MotionSpiderAction +{ + MS_MARCH = 0, + MS_STOP = 1, + MS_SPEC = 2 +}; -#define MSS_BURN 0 -#define MSS_RUIN 1 -#define MSS_EXPLO 2 -#define MSS_BACK1 3 -#define MSS_BACK2 4 -#define MSS_BACK3 5 +enum MotionSpiderSpecialAction +{ + MSS_BURN = 0, + MSS_RUIN = 1, + MSS_EXPLO = 2, + MSS_BACK1 = 3, + MSS_BACK2 = 4, + MSS_BACK3 = 5 +}; class CMotionSpider : public CMotion diff --git a/src/object/motion/motiontoto.cpp b/src/object/motion/motiontoto.cpp index 64ff021..317d2ab 100644 --- a/src/object/motion/motiontoto.cpp +++ b/src/object/motion/motiontoto.cpp @@ -44,7 +44,7 @@ -#define START_TIME 1000.0f // beginning of the relative time +const float START_TIME = 1000.0f; // beginning of the relative time diff --git a/src/object/motion/motiontoto.h b/src/object/motion/motiontoto.h index 1c7f871..935e4a5 100644 --- a/src/object/motion/motiontoto.h +++ b/src/object/motion/motiontoto.h @@ -34,10 +34,13 @@ class CBrain; class CPhysics; -#define MT_ERROR 0 -#define MT_WARNING 1 -#define MT_INFO 2 -#define MT_MESSAGE 3 +enum MotionTotoAction +{ + MT_ERROR = 0, + MT_WARNING = 1, + MT_INFO = 2, + MT_MESSAGE = 3 +}; class CMotionToto : public CMotion diff --git a/src/object/motion/motionvehicle.cpp b/src/object/motion/motionvehicle.cpp index 56eab8d..4bd91d0 100644 --- a/src/object/motion/motionvehicle.cpp +++ b/src/object/motion/motionvehicle.cpp @@ -43,10 +43,6 @@ -#define ARM_NEUTRAL_ANGLE1 110.0f*PI/180.0f -#define ARM_NEUTRAL_ANGLE2 -130.0f*PI/180.0f -#define ARM_NEUTRAL_ANGLE3 -50.0f*PI/180.0f - // Object's constructor. diff --git a/src/object/motion/motionworm.cpp b/src/object/motion/motionworm.cpp index dc33e6e..fc5dc35 100644 --- a/src/object/motion/motionworm.cpp +++ b/src/object/motion/motionworm.cpp @@ -43,10 +43,10 @@ -#define START_TIME 1000.0f // beginning of the relative time -#define TIME_UPDOWN 2.0f // time for up / down -#define DOWN_ALTITUDE 3.0f // underground distance -#define WORM_PART 7 // number of parts of a worm +const float START_TIME = 1000.0f; // beginning of the relative time +const float TIME_UPDOWN = 2.0f; // time for up / down +const float DOWN_ALTITUDE = 3.0f; // underground distance +const int WORM_PART = 7; // number of parts of a worm diff --git a/src/object/object.cpp b/src/object/object.cpp index 9fb7ae8..0f8eb29 100644 --- a/src/object/object.cpp +++ b/src/object/object.cpp @@ -91,11 +91,11 @@ #define ADJUST_ONBOARD false // true -> adjusts the camera ONBOARD -#define ADJUST_ARM false // true -> adjusts the manipulator arm -#define VIRUS_DELAY 60.0f // duration of virus infection -#define LOSS_SHIELD 0.24f // loss of the shield by shot -#define LOSS_SHIELD_H 0.10f // loss of the shield for humans -#define LOSS_SHIELD_M 0.02f // loss of the shield for the laying +#define ADJUST_ARM false // true -> adjusts the manipulator arm +const float VIRUS_DELAY = 60.0f; // duration of virus infection +const float LOSS_SHIELD = 0.24f; // loss of the shield by shot +const float LOSS_SHIELD_H = 0.10f; // loss of the shield for humans +const float LOSS_SHIELD_M = 0.02f; // loss of the shield for the laying #if ADJUST_ONBOARD static float debug_x = 0.0f; diff --git a/src/object/object.h b/src/object/object.h index b6f993a..88eac3d 100644 --- a/src/object/object.h +++ b/src/object/object.h @@ -42,11 +42,11 @@ class CScript; // The father of all parts must always be the part number zero! -#define OBJECTMAXPART 40 -#define MAXCRASHSPHERE 40 -#define OBJECTMAXDESELLIST 10 -#define OBJECTMAXINFO 10 -#define OBJECTMAXCMDLINE 20 +const int OBJECTMAXPART = 40; +const int MAXCRASHSPHERE = 40; +const int OBJECTMAXDESELLIST = 10; +const int OBJECTMAXINFO = 10; +const int OBJECTMAXCMDLINE = 20; enum ObjectType { @@ -303,7 +303,7 @@ enum ObjectMaterial OM_MINERAL = 5, // stone }; -typedef struct +struct ObjectPart { char bUsed; int object; // number of the object in CD3DEngine @@ -319,10 +319,9 @@ typedef struct D3DMATRIX matRotate; D3DMATRIX matTransform; D3DMATRIX matWorld; -} -ObjectPart; +}; -typedef struct +struct Character { float wheelFront; // position X of the front wheels float wheelBack; // position X of the back wheels @@ -330,15 +329,13 @@ typedef struct float wheelRight; // position Z of the right wheels float height; // normal height on top of ground D3DVECTOR posPower; // position of the battery -} -Character; +}; -typedef struct +struct Info { char name[20]; // name of the information float value; // value of the information -} -Info; +}; enum ExploType { diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index d072f66..c3a7752 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -81,7 +81,7 @@ #define CBOT_STACK true // saves the stack of programs CBOT -#define UNIT 4.0f +const float UNIT = 4.0f; diff --git a/src/object/robotmain.h b/src/object/robotmain.h index 893bd50..73f7bfc 100644 --- a/src/object/robotmain.h +++ b/src/object/robotmain.h @@ -87,7 +87,7 @@ class CDisplayInfo; class CSound; -typedef struct +struct EndTake { D3DVECTOR pos; float dist; @@ -97,26 +97,24 @@ typedef struct int lost; // lost if <= bool bImmediat; char message[100]; -} -EndTake; +}; -#define MAXNEWSCRIPTNAME 20 +const int MAXNEWSCRIPTNAME = 20; -typedef struct +struct NewScriptName { bool bUsed; ObjectType type; char name[40]; -} -NewScriptName; +}; -#define MAXSHOWLIMIT 5 -#define MAXSHOWPARTI 200 -#define SHOWLIMITTIME 20.0f +const int MAXSHOWLIMIT = 5; +const int MAXSHOWPARTI = 200; +const float SHOWLIMITTIME = 20.0f; -typedef struct +struct ShowLimit { bool bUsed; D3DVECTOR pos; @@ -126,17 +124,16 @@ typedef struct CObject* link; float duration; float time; -} -ShowLimit; +}; -#define SATCOM_HUSTON 0 -#define SATCOM_SAT 1 -#define SATCOM_OBJECT 2 -#define SATCOM_LOADING 3 -#define SATCOM_PROG 4 -#define SATCOM_SOLUCE 5 -#define SATCOM_MAX 6 +const int SATCOM_HUSTON = 0; +const int SATCOM_SAT = 1; +const int SATCOM_OBJECT = 2; +const int SATCOM_LOADING = 3; +const int SATCOM_PROG = 4; +const int SATCOM_SOLUCE = 5; +const int SATCOM_MAX = 6; diff --git a/src/object/task/task.h b/src/object/task/task.h index b85fa32..97ac819 100644 --- a/src/object/task/task.h +++ b/src/object/task/task.h @@ -20,6 +20,7 @@ #include "common/misc.h" +#include "math/old/math3d.h" class CInstanceManager; @@ -39,19 +40,19 @@ class CDisplayText; class CSound; -#define TAKE_DIST 6.0f // distance to an object to pick it -#define TAKE_DIST_OTHER 1.5f // additional distance if on friend +const float TAKE_DIST = 6.0f; // distance to an object to pick it +const float TAKE_DIST_OTHER = 1.5f; // additional distance if on friend -//?#define ARM_NEUTRAL_ANGLE1 155.0f*PI/180.0f -//?#define ARM_NEUTRAL_ANGLE2 -125.0f*PI/180.0f -//?#define ARM_NEUTRAL_ANGLE3 -45.0f*PI/180.0f -#define ARM_NEUTRAL_ANGLE1 110.0f*PI/180.0f -#define ARM_NEUTRAL_ANGLE2 -130.0f*PI/180.0f -#define ARM_NEUTRAL_ANGLE3 -50.0f*PI/180.0f +//?const float ARM_NEUTRAL_ANGLE1 = 155.0f*PI/180.0f; +//?const float ARM_NEUTRAL_ANGLE2 = -125.0f*PI/180.0f; +//?const float ARM_NEUTRAL_ANGLE3 = -45.0f*PI/180.0f; +const float ARM_NEUTRAL_ANGLE1 = 110.0f*PI/180.0f; +const float ARM_NEUTRAL_ANGLE2 = -130.0f*PI/180.0f; +const float ARM_NEUTRAL_ANGLE3 = -50.0f*PI/180.0f; -#define ARM_STOCK_ANGLE1 110.0f*PI/180.0f -#define ARM_STOCK_ANGLE2 -100.0f*PI/180.0f -#define ARM_STOCK_ANGLE3 -70.0f*PI/180.0f +const float ARM_STOCK_ANGLE1 = 110.0f*PI/180.0f; +const float ARM_STOCK_ANGLE2 = -100.0f*PI/180.0f; +const float ARM_STOCK_ANGLE3 = -70.0f*PI/180.0f; class CTask diff --git a/src/object/task/taskbuild.h b/src/object/task/taskbuild.h index 337edb7..1cced56 100644 --- a/src/object/task/taskbuild.h +++ b/src/object/task/taskbuild.h @@ -30,8 +30,8 @@ class CPhysics; -#define BUILDMARGIN 16.0f -#define TBMAXLIGHT 4 +const float BUILDMARGIN = 16.0f; +const int TBMAXLIGHT = 4; enum TaskBuildPhase diff --git a/src/object/task/taskfire.cpp b/src/object/task/taskfire.cpp index 02c4159..81becda 100644 --- a/src/object/task/taskfire.cpp +++ b/src/object/task/taskfire.cpp @@ -40,9 +40,9 @@ -#define ENERGY_FIRE (0.25f/2.5f) // energy consumed/shot -#define ENERGY_FIREr (0.25f/1.5f) // energy consumed/ray -#define ENERGY_FIREi (0.10f/2.5f) // energy consumed/organic +const float ENERGY_FIRE = (0.25f/2.5f); // energy consumed/shot +const float ENERGY_FIREr = (0.25f/1.5f); // energy consumed/ray +const float ENERGY_FIREi = (0.10f/2.5f); // energy consumed/organic // Object's constructor. diff --git a/src/object/task/taskgoto.cpp b/src/object/task/taskgoto.cpp index 7e4d3f1..c5ffaec 100644 --- a/src/object/task/taskgoto.cpp +++ b/src/object/task/taskgoto.cpp @@ -39,9 +39,9 @@ -#define FLY_DIST_GROUND 80.0f // minimum distance to remain on the ground -#define FLY_DEF_HEIGHT 50.0f // default flying height -#define BM_DIM_STEP 5.0f +const float FLY_DIST_GROUND = 80.0f; // minimum distance to remain on the ground +const float FLY_DEF_HEIGHT = 50.0f; // default flying height +const float BM_DIM_STEP = 5.0f; diff --git a/src/object/task/taskgoto.h b/src/object/task/taskgoto.h index acd79b6..498bff5 100644 --- a/src/object/task/taskgoto.h +++ b/src/object/task/taskgoto.h @@ -31,7 +31,7 @@ class CObject; -#define MAXPOINTS 500 +const int MAXPOINTS = 500; diff --git a/src/object/task/taskmanip.cpp b/src/object/task/taskmanip.cpp index 5df067c..36bc4ae 100644 --- a/src/object/task/taskmanip.cpp +++ b/src/object/task/taskmanip.cpp @@ -42,14 +42,14 @@ #include "object/task/taskmanip.h" -//?#define MARGIN_FRONT 2.0f -//?#define MARGIN_BACK 2.0f -//?#define MARGIN_FRIEND 2.0f -//?#define MARGIN_BEE 5.0f -#define MARGIN_FRONT 4.0f //OK 1.9 -#define MARGIN_BACK 4.0f //OK 1.9 -#define MARGIN_FRIEND 4.0f //OK 1.9 -#define MARGIN_BEE 5.0f //OK 1.9 +//?const float MARGIN_FRONT = 2.0f; +//?const float MARGIN_BACK = 2.0f; +//?const float MARGIN_FRIEND = 2.0f; +//?const float MARGIN_BEE = 5.0f; +const float MARGIN_FRONT = 4.0f; //OK 1.9 +const float MARGIN_BACK = 4.0f; //OK 1.9 +const float MARGIN_FRIEND = 4.0f; //OK 1.9 +const float MARGIN_BEE = 5.0f; //OK 1.9 diff --git a/src/object/task/taskrecover.cpp b/src/object/task/taskrecover.cpp index 798540b..cb47bce 100644 --- a/src/object/task/taskrecover.cpp +++ b/src/object/task/taskrecover.cpp @@ -40,8 +40,8 @@ #include "object/task/taskrecover.h" -#define ENERGY_RECOVER 0.25f // energy consumed by recovery -#define RECOVER_DIST 11.8f +const float ENERGY_RECOVER = 0.25f; // energy consumed by recovery +const float RECOVER_DIST = 11.8f; diff --git a/src/object/task/taskshield.cpp b/src/object/task/taskshield.cpp index 818a3a7..86e45df 100644 --- a/src/object/task/taskshield.cpp +++ b/src/object/task/taskshield.cpp @@ -41,7 +41,7 @@ #include "object/task/taskshield.h" -#define ENERGY_TIME 20.0f // maximum duration if full battery +const float ENERGY_TIME = 20.0f; // maximum duration if full battery diff --git a/src/object/task/taskshield.h b/src/object/task/taskshield.h index e78466e..5917158 100644 --- a/src/object/task/taskshield.h +++ b/src/object/task/taskshield.h @@ -30,8 +30,8 @@ class CPhysics; class CObject; -#define RADIUS_SHIELD_MIN 40.0f // minimal radius of the protected zone -#define RADIUS_SHIELD_MAX 100.0f // maximal radius of the protected zone +const float RADIUS_SHIELD_MIN = 40.0f; // minimum radius of the protected zone +const float RADIUS_SHIELD_MAX = 100.0f; // maximum radius of the protected zone enum TaskShieldPhase diff --git a/src/object/task/taskterraform.cpp b/src/object/task/taskterraform.cpp index a3403f0..1432c3e 100644 --- a/src/object/task/taskterraform.cpp +++ b/src/object/task/taskterraform.cpp @@ -44,8 +44,8 @@ #include "object/task/taskterraform.h" -#define ENERGY_TERRA 0.40f // energy consumed by blow -#define ACTION_RADIUS 400.0f +const float ENERGY_TERRA = 0.40f; // energy consumed by blow +const float ACTION_RADIUS = 400.0f; -- cgit v1.2.3-1-g7c22