Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Compilation warnings in story_gui and script_story_page #8173

Merged

Conversation

@JGRennison
Copy link
Contributor

@JGRennison JGRennison commented May 27, 2020

Fix compilation warnings in story_gui.cpp and script/api/script_story_page.cpp

See: #7896

Warnings as output by gcc 9.2:

/home/jgr/openttd/trunk/src/script/api/script_story_page.cpp: In static member function ‘static ScriptStoryPage::StoryPageElementID ScriptStoryPage::NewElement(ScriptStoryPage::StoryPageID, ScriptStoryPage::StoryPageElementType, uint32, Text*)’:
/home/jgr/openttd/trunk/src/script/api/script_story_page.cpp:76:9: warning: enumeration value ‘SPET_TEXT’ not handled in switch [-Wswitch]
   76 |  switch (type) {
      |         ^
/home/jgr/openttd/trunk/src/script/api/script_story_page.cpp: In static member function ‘static bool ScriptStoryPage::UpdateElement(ScriptStoryPage::StoryPageElementID, uint32, Text*)’:
/home/jgr/openttd/trunk/src/script/api/script_story_page.cpp:117:9: warning: enumeration value ‘SPET_TEXT’ not handled in switch [-Wswitch]
  117 |  switch (type) {
      |         ^
/home/jgr/openttd/trunk/src/script/api/script_story_page.cpp:117:9: warning: enumeration value ‘SPET_END’ not handled in switch [-Wswitch]
/home/jgr/openttd/trunk/src/script/api/script_story_page.cpp:117:9: warning: enumeration value ‘INVALID_SPET’ not handled in switch [-Wswitch]
/home/jgr/openttd/trunk/src/story_gui.cpp: In member function ‘void StoryBookWindow::EnsureStoryPageElementLayout() const’:
/home/jgr/openttd/trunk/src/story_gui.cpp:462:31: warning: missing initializer for member ‘StoryBookWindow::LayoutCacheElement::bounds’ [-Wmissing-field-initializers]
  462 |     LayoutCacheElement ce{ pe };
      |                               ^
/home/jgr/openttd/trunk/src/story_gui.cpp:482:31: warning: missing initializer for member ‘StoryBookWindow::LayoutCacheElement::bounds’ [-Wmissing-field-initializers]
  482 |     LayoutCacheElement ce{ pe };
      |                               ^
/home/jgr/openttd/trunk/src/story_gui.cpp: In member function ‘virtual void StoryBookWindow::DrawWidget(const Rect&, int) const’:
/home/jgr/openttd/trunk/src/story_gui.cpp:748:16: warning: unused variable ‘height’ [-Wunused-variable]
  748 |      const int height = FONT_HEIGHT_NORMAL;
      |                ^~~~~~
/home/jgr/openttd/trunk/src/story_gui.cpp:750:16: warning: unused variable ‘bmargin’ [-Wunused-variable]
  750 |      const int bmargin = WD_BEVEL_BOTTOM + WD_FRAMETEXT_BOTTOM;
      |                ^~~~~~~
/home/jgr/openttd/trunk/src/story_gui.cpp:752:16: warning: unused variable ‘hmargin’ [-Wunused-variable]
  752 |      const int hmargin = width / 5;
      |
@nielsmh nielsmh merged commit f11cd8f into OpenTTD:master May 27, 2020
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants