summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorPiotr Dziwinski <piotrdz@gmail.com>2012-06-11 17:28:27 +0200
committerPiotr Dziwinski <piotrdz@gmail.com>2012-06-11 17:28:27 +0200
commita8665d204255b4b0ad9ae6982f77ecd5e053c1b6 (patch)
tree5f7e58785f5175e7f067ffaf8f96d16272c92d1e /src/ui
parent8ffdf2583e4ea77731490dcaad51dbc08d7f26fa (diff)
downloadcolobot-a8665d204255b4b0ad9ae6982f77ecd5e053c1b6.tar.gz
colobot-a8665d204255b4b0ad9ae6982f77ecd5e053c1b6.tar.bz2
colobot-a8665d204255b4b0ad9ae6982f77ecd5e053c1b6.zip
Changed #defined constants to consts; typedef struct -> struct
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/button.cpp4
-rw-r--r--src/ui/color.cpp4
-rw-r--r--src/ui/control.h37
-rw-r--r--src/ui/displayinfo.cpp5
-rw-r--r--src/ui/displaytext.cpp2
-rw-r--r--src/ui/displaytext.h2
-rw-r--r--src/ui/edit.cpp14
-rw-r--r--src/ui/edit.h37
-rw-r--r--src/ui/interface.h2
-rw-r--r--src/ui/list.cpp2
-rw-r--r--src/ui/list.h4
-rw-r--r--src/ui/maindialog.cpp8
-rw-r--r--src/ui/maindialog.h14
-rw-r--r--src/ui/mainmap.cpp4
-rw-r--r--src/ui/map.h7
-rw-r--r--src/ui/scroll.h2
-rw-r--r--src/ui/slider.cpp4
-rw-r--r--src/ui/window.h2
18 files changed, 74 insertions, 80 deletions
diff --git a/src/ui/button.cpp b/src/ui/button.cpp
index 697122c..701971c 100644
--- a/src/ui/button.cpp
+++ b/src/ui/button.cpp
@@ -33,8 +33,8 @@
-#define DELAY1 0.4f
-#define DELAY2 0.1f
+const float DELAY1 = 0.4f;
+const float DELAY2 = 0.1f;
diff --git a/src/ui/color.cpp b/src/ui/color.cpp
index 8876d27..bf635ff 100644
--- a/src/ui/color.cpp
+++ b/src/ui/color.cpp
@@ -33,8 +33,8 @@
-#define DELAY1 0.4f
-#define DELAY2 0.1f
+const float DELAY1 = 0.4f;
+const float DELAY2 = 0.1f;
diff --git a/src/ui/control.h b/src/ui/control.h
index f36e7ba..8f677c7 100644
--- a/src/ui/control.h
+++ b/src/ui/control.h
@@ -32,23 +32,26 @@ class CParticule;
class CSound;
-#define STATE_ENABLE (1<<0) // active
-#define STATE_CHECK (1<<1) // pressed
-#define STATE_HILIGHT (1<<2) // overflown by mouse
-#define STATE_PRESS (1<<3) // pressed by mouse
-#define STATE_VISIBLE (1<<4) // visible
-#define STATE_DEAD (1<<5) // inaccessible (x)
-#define STATE_DEFAULT (1<<6) // actuated by RETURN
-#define STATE_OKAY (1<<7) // green point at the bottom right
-#define STATE_SHADOW (1<<8) // shadow
-#define STATE_GLINT (1<<9) // dynamic reflection
-#define STATE_CARD (1<<10) // tab
-#define STATE_EXTEND (1<<11) // extended mode
-#define STATE_SIMPLY (1<<12) // undecorated
-#define STATE_FRAME (1<<13) // framework highlighting
-#define STATE_WARNING (1<<14) // framework hatched yellow / black
-#define STATE_VALUE (1<<15) // displays the value
-#define STATE_RUN (1<<16) // running program
+enum ControlState
+{
+ STATE_ENABLE = (1<<0), // active
+ STATE_CHECK = (1<<1), // pressed
+ STATE_HILIGHT = (1<<2), // overflown by mouse
+ STATE_PRESS = (1<<3), // pressed by mouse
+ STATE_VISIBLE = (1<<4), // visible
+ STATE_DEAD = (1<<5), // inaccessible (x)
+ STATE_DEFAULT = (1<<6), // actuated by RETURN
+ STATE_OKAY = (1<<7), // green point at the bottom right
+ STATE_SHADOW = (1<<8), // shadow
+ STATE_GLINT = (1<<9), // dynamic reflection
+ STATE_CARD = (1<<10), // tab
+ STATE_EXTEND = (1<<11), // extended mode
+ STATE_SIMPLY = (1<<12), // undecorated
+ STATE_FRAME = (1<<13), // framework highlighting
+ STATE_WARNING = (1<<14), // framework hatched yellow / black
+ STATE_VALUE = (1<<15), // displays the value
+ STATE_RUN = (1<<16) // running program
+};
diff --git a/src/ui/displayinfo.cpp b/src/ui/displayinfo.cpp
index b30aeb1..a4e2131 100644
--- a/src/ui/displayinfo.cpp
+++ b/src/ui/displayinfo.cpp
@@ -950,12 +950,11 @@ CObject* CDisplayInfo::SearchToto()
// Creating the list of objects.
-typedef struct
+struct ObjectList
{
int total;
ObjectType type;
-}
-ObjectList;
+};
void ObjectAdd(ObjectList list[], ObjectType type)
{
diff --git a/src/ui/displaytext.cpp b/src/ui/displaytext.cpp
index eb5cbeb..a1307a3 100644
--- a/src/ui/displaytext.cpp
+++ b/src/ui/displaytext.cpp
@@ -43,7 +43,7 @@
-#define FONTSIZE 12.0f
+const float FONTSIZE = 12.0f;
diff --git a/src/ui/displaytext.h b/src/ui/displaytext.h
index 934fc50..2a2a6cb 100644
--- a/src/ui/displaytext.h
+++ b/src/ui/displaytext.h
@@ -37,7 +37,7 @@ enum TextType
TT_MESSAGE = 4,
};
-#define MAXDTLINE 4
+const int MAXDTLINE = 4;
class CDisplayText
diff --git a/src/ui/edit.cpp b/src/ui/edit.cpp
index 72c1137..92d190d 100644
--- a/src/ui/edit.cpp
+++ b/src/ui/edit.cpp
@@ -38,13 +38,13 @@
#include "ui/edit.h"
-#define MARGX (5.0f/640.0f)
-#define MARGY (5.0f/480.0f)
-#define MARGYS (4.0f/480.0f)
-#define MARGY1 (1.0f/480.0f)
-#define DELAY_DBCLICK 0.3f // time limit for double-click
-#define DELAY_SCROLL 0.1f // time limit for scroll
-#define BIG_FONT 1.6f // expansion for \b;
+const float MARGX = (5.0f/640.0f);
+const float MARGY = (5.0f/480.0f);
+const float MARGYS = (4.0f/480.0f);
+const float MARGY1 = (1.0f/480.0f);
+const float DELAY_DBCLICK = 0.3f; // time limit for double-click
+const float DELAY_SCROLL = 0.1f; // time limit for scroll
+const float BIG_FONT = 1.6f; // expansion for \b;
diff --git a/src/ui/edit.h b/src/ui/edit.h
index fb6d7ae..7ac6c53 100644
--- a/src/ui/edit.h
+++ b/src/ui/edit.h
@@ -28,15 +28,15 @@ class CScroll;
-#define EDITSTUDIOMAX 20000 // maximum number of characters in CBOT edit
-#define EDITLINEMAX 1000 // maximum total number of lines
-#define EDITIMAGEMAX 50 // maximum total number of lines with images
-#define EDITLINKMAX 100 // maximum number of links
-#define EDITHISTORYMAX 50 // max number of levels preserves
+const int EDITSTUDIOMAX = 20000; // maximum number of characters in CBOT edit
+const int EDITLINEMAX = 1000; // maximum total number of lines
+const int EDITIMAGEMAX = 50; // maximum total number of lines with images
+const int EDITLINKMAX = 100; // maximum number of links
+const int EDITHISTORYMAX = 50; // max number of levels preserves
-#define EDITUNDOMAX 20 // max number of successive undo
+const int EDITUNDOMAX = 20; // max number of successive undo
-typedef struct
+struct EditUndo
{
char* text; // original text
int len; // length of the text
@@ -44,8 +44,7 @@ typedef struct
int cursor2; // offset cursor
int lineFirst; // the first line displayed.
-}
-EditUndo;
+};
enum OperUndo
{
@@ -54,35 +53,31 @@ enum OperUndo
OPERUNDO_DELETE = 2, // deleting characters
};
-typedef struct
+struct ImageLine
{
char name[40]; // name of the image (without diagram \)
float offset; // vertical offset (v texture)
float height; // height of the part (dv texture)
float width; // width
-}
-ImageLine;
+};
-typedef struct
+struct HyperLink
{
char name[40]; // text file name (without help \)
char marker[20]; // name of the marker
-}
-HyperLink;
+};
-typedef struct
+struct HyperMarker
{
char name[20]; // name of the marker
int pos; // position in the text
-}
-HyperMarker;
+};
-typedef struct
+struct HyperHistory
{
char filename[50]; // full file name text
int firstLine; // rank of the first displayed line
-}
-HyperHistory;
+};
diff --git a/src/ui/interface.h b/src/ui/interface.h
index 45435c0..4c58997 100644
--- a/src/ui/interface.h
+++ b/src/ui/interface.h
@@ -43,7 +43,7 @@ class CTarget;
class CCamera;
-#define MAXCONTROL 100
+const int MAXCONTROL = 100;
class CInterface
diff --git a/src/ui/list.cpp b/src/ui/list.cpp
index c23aef9..be9dbda 100644
--- a/src/ui/list.cpp
+++ b/src/ui/list.cpp
@@ -36,7 +36,7 @@
-#define MARGING 4.0f
+const float MARGING = 4.0f;
diff --git a/src/ui/list.h b/src/ui/list.h
index 82fd470..ae55d35 100644
--- a/src/ui/list.h
+++ b/src/ui/list.h
@@ -28,8 +28,8 @@ class CButton;
class CScroll;
-#define LISTMAXDISPLAY 20 // maximum number of visible lines
-#define LISTMAXTOTAL 100 // maximum total number of lines
+const int LISTMAXDISPLAY = 20; // maximum number of visible lines
+const int LISTMAXTOTAL = 100; // maximum total number of lines
diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp
index 40ac4c9..175474d 100644
--- a/src/ui/maindialog.cpp
+++ b/src/ui/maindialog.cpp
@@ -61,15 +61,15 @@
-#define KEY_VISIBLE 6 // number of visible keys redefinable
+const int KEY_VISIBLE = 6; // number of visible keys redefinable
#if _SCHOOL & _TEEN
-#define KEY_TOTAL 13 // total number of keys redefinable
+const int KEY_TOTAL = 13; // total number of keys redefinable
#else
-#define KEY_TOTAL 21 // total number of keys redefinable
+const int KEY_TOTAL = 21; // total number of keys redefinable
#endif
-#define WELCOME_LENGTH 6.0f
+const int WELCOME_LENGTH = 6.0f;
diff --git a/src/ui/maindialog.h b/src/ui/maindialog.h
index 4062c8d..9173dde 100644
--- a/src/ui/maindialog.h
+++ b/src/ui/maindialog.h
@@ -34,25 +34,23 @@ class CParticule;
class CSound;
-#define USERLISTMAX 100
-#define MAXSCENE 1000
+const int USERLISTMAX = 100;
+const int MAXSCENE = 1000;
-typedef struct
+struct SceneInfo
{
char numTry;
char bPassed;
-}
-SceneInfo;
+};
-typedef struct
+struct GamerPerso
{
int face; // face
int glasses; // glasses
D3DCOLORVALUE colorHair; // hair color
D3DCOLORVALUE colorCombi; // spacesuit volor
D3DCOLORVALUE colorBand; // strips color
-}
-GamerPerso;
+};
diff --git a/src/ui/mainmap.cpp b/src/ui/mainmap.cpp
index 9575cbc..72452d8 100644
--- a/src/ui/mainmap.cpp
+++ b/src/ui/mainmap.cpp
@@ -40,8 +40,8 @@
-#define ZOOM_MIN 1.0f
-#define ZOOM_MAX 16.0f
+const float ZOOM_MIN = 1.0f;
+const float ZOOM_MAX = 16.0f;
diff --git a/src/ui/map.h b/src/ui/map.h
index 0a10dbf..f2df265 100644
--- a/src/ui/map.h
+++ b/src/ui/map.h
@@ -31,7 +31,7 @@ class CRobotMain;
-#define MAPMAXOBJECT 100
+const int MAPMAXOBJECT = 100;
enum MapColor
{
@@ -48,7 +48,7 @@ enum MapColor
MAPCOLOR_BBOX,
};
-typedef struct
+struct MapObject
{
char bUsed;
CObject* object;
@@ -56,8 +56,7 @@ typedef struct
ObjectType type;
FPOINT pos;
float dir;
-}
-MapObject;
+};
diff --git a/src/ui/scroll.h b/src/ui/scroll.h
index 738581a..67dc543 100644
--- a/src/ui/scroll.h
+++ b/src/ui/scroll.h
@@ -27,7 +27,7 @@ class CD3DEngine;
class CButton;
-#define SCROLL_WIDTH (15.0f/640.0f)
+const float SCROLL_WIDTH = (15.0f/640.0f);
diff --git a/src/ui/slider.cpp b/src/ui/slider.cpp
index f01cd3f..6c2a46a 100644
--- a/src/ui/slider.cpp
+++ b/src/ui/slider.cpp
@@ -35,8 +35,8 @@
-#define CURSOR_WIDTH (10.0f/640.0f)
-#define HOLE_WIDTH (5.0f/480.0f)
+const float CURSOR_WIDTH = (10.0f/640.0f);
+const float HOLE_WIDTH = (5.0f/480.0f);
diff --git a/src/ui/window.h b/src/ui/window.h
index 86ae6f2..b06fcfb 100644
--- a/src/ui/window.h
+++ b/src/ui/window.h
@@ -42,7 +42,7 @@ class CCompass;
class CTarget;
-#define MAXWINDOW 100
+const int MAXWINDOW = 100;
class CWindow : public CControl