Skip to content

Commit 5095cf4

Browse files
committed
Resolve warnings in headers
1 parent 7efcfc0 commit 5095cf4

File tree

5 files changed

+21
-17
lines changed

5 files changed

+21
-17
lines changed

src/bas_entity.hpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,17 @@ public :
3232
NORTH, SOUTH, EAST, WEST,
3333
NE, NW, SE, SW };
3434

35-
float x,y;
35+
float x{0};
36+
float y{0};
3637

37-
Entity() : x(0),y(0) {}
38-
Entity(int px,int py) : x(px),y(py) {}
39-
Entity(float px,float py) : x(px),y(py) {}
38+
Entity() = default;
39+
Entity(int px,int py) : x{static_cast<float>(px)},y{static_cast<float>(py)} {}
40+
Entity(float px,float py) : x{px},y{py} {}
4041
// get subcell coordinates
4142
int getSubX() const { return (int)(x*2); }
4243
int getSubY() const { return (int)(y*2); }
43-
void setPos(int x, int y) { this->x=x; this->y=y; }
44-
void setPos(float x, float y) { this->x=x; this->y=y; }
44+
void setPos(int new_x, int new_y) { x=new_x; y=new_y; }
45+
void setPos(float new_x, float new_y) { x=new_x; y=new_y; }
4546
Entity &addDir(Direction d) {
4647
static int xdirs[11] = { 0, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1};
4748
static int ydirs[11] = { 0, 0, 0, -1, 1, 0, 0, -1, -1, 1, 1};

src/mob_creature.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public :
9090
inline int getChar() const { return ch; }
9191
inline int getAttackDamages() const { return (int)attackDamages; }
9292
inline const Light *getLight() const { return light; }
93-
inline void setLight(Light *light) { this->light=light; }
93+
inline void setLight(Light *light_ptr) { light=light_ptr; }
9494
// resources
9595
inline void setLife(float value) { maxStatusResource[StatusResource::LIFE] = value; }
9696
inline void setMana(float value) { maxStatusResource[StatusResource::MANA] = value; }

src/mob_player.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public :
3838
void termLevel();
3939
void render(LightMap *lightMap);
4040
void setLightRange(float range) { light->range=range; }
41-
void setLightColor(TCODColor col) { light->color=col; }
41+
void setLightColor(TCODColor new_color) { light->color=new_color; }
4242
static bool getMoveKey(TCOD_key_t key,bool *up, bool *down, bool *left, bool *right);
4343
inline float getAverageSpeed() { return averageSpeed;}
4444
void computeStealth(float elapsed);

src/ui_dialog.hpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,17 @@ class UIListener;
4242

4343
class Widget {
4444
public :
45-
Widget() : x(0),y(0),w(0),h(0) {}
46-
Widget(int x, int y) : x(x),y(y) {}
47-
Widget(int x, int y, int w, int h) : x(x),y(y),w(w),h(h) {}
48-
void setPos(int x, int y) { this->x=x;this->y=y;}
49-
void setSize(int w, int h) { this->w=w;this->h=h;}
45+
Widget() = default;
46+
Widget(int x, int y) : x{x},y{y} {}
47+
Widget(int x, int y, int w, int h) : x{x},y{y},w{w},h{h} {}
48+
void setPos(int new_x, int new_y) { x=new_x;y=new_y;}
49+
void setSize(int new_w, int new_h) { w=new_w;h=new_h;}
5050
void addListener(UIListener *listener) { listeners.push(listener); }
5151
void removeListener(UIListener *listener) { listeners.removeFast(listener); }
52-
int x,y,w,h;
52+
int x{0};
53+
int y{0};
54+
int w{0};
55+
int h{0};
5356
protected :
5457
TCODList<UIListener *> listeners;
5558
void sendEvent(EWidgetEvent event);
@@ -123,8 +126,8 @@ protected :
123126
class Dialog : public UmbraWidget {
124127
public :
125128
Dialog() : flags(0),isMinimized(false),waitRelease(false) {}
126-
void keyboard (TCOD_key_t &key) { this->key=key; UmbraWidget::keyboard(key); }
127-
void mouse (TCOD_mouse_t &ms) { this->ms=ms; UmbraWidget::mouse(ms); }
129+
void keyboard (TCOD_key_t &key_event) { this->key=key_event; UmbraWidget::keyboard(key_event); }
130+
void mouse (TCOD_mouse_t &ms_event) { this->ms=ms_event; UmbraWidget::mouse(ms); }
128131
bool update (void);
129132
virtual bool update(float elapsed, TCOD_key_t &k, TCOD_mouse_t &mouse) = 0;
130133
void setMaximized();

src/util_textgen.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ protected :
9898
class RandomNameFunc : public ITextGeneratorFunc {
9999
public :
100100
RandomNameFunc(TCODRandom *rnRng) : rnRng(rnRng) {}
101-
const char * execute(const char *params) {
101+
const char * execute([[maybe_unused]] const char *params) {
102102
return NameGenerator::generateRandomName(rnRng);
103103
}
104104
protected :

0 commit comments

Comments
 (0)