"warning: unterminated string literal" in utils/buildcat.py. + Discussion on directory structure

Bug #1397500 reported by GunChleoc
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
widelands
Fix Released
Undecided
Unassigned

Bug Description

When running utils/buildcat.py, we get some "warning: unterminated string literal" messages.

The script doesn't like strings like this in the .cc files:

const char kTerrainFragmentShader[] = R"(
#version 120

uniform sampler2D u_terrain_texture;

varying float var_brightness;
varying vec2 var_texture_position;

void main() {
 vec4 clr = texture2D(u_terrain_texture, var_texture_position);
 clr.rgb *= var_brightness;
 gl_FragColor = clr;
}
)";

Related branches

Revision history for this message
SirVer (sirver) wrote :

This is a gettext bug. cpp11 does define these strings as valid and gettext should parse them. I did not find a bug report for gettext or release notes for latest versions but maybe this is already fixed in newer versions.

We can work around the issue easily though: The shaders can be pulled out into data files (<program name>.vp for vertex shader and <program name>.fp for the fragment shade) and loaded at run time - that is how it is usually done and might be useful in the future when we need to modify them anyways on the fly for desktop GL und GL ES. It would also clean up the program files a bit. In which directory should they be put though?

Changed in widelands:
status: New → Incomplete
Revision history for this message
GunChleoc (gunchleoc) wrote :

I have filed a bug with gettext, just in case https://savannah.gnu.org/bugs/?43726

Regarding the directory, maybe we should consider having a separate data directory. Something like this:

build
cmake
data
-> campaigns
-> doc
-> global
-> i18n, including fonts
-> locale
-> maps
-> music
-> sound
-> pics
-> shaders
-> tribes
-> txts
-> world

po
scripting
src
test
utils

We also have a discussion on directory structure in a merge request: https://code.launchpad.net/~widelands-dev/widelands/cleanup_game_renderer/+merge/243124

Maybe we should consilidate te discussion in this bug?

summary: - "warning: unterminated string literal" in utils/buildcat.py
+ "warning: unterminated string literal" in utils/buildcat.py. +
+ Discussion on directory structure
Revision history for this message
SirVer (sirver) wrote :

I dislike data/. Everything is data.... doc/ is also not bundled so it should not go into data I guess.

How do other games layout their directory structure?

Revision history for this message
SirVer (sirver) wrote :

scripting/ should go into data/ though as it is needed to run the game.

Revision history for this message
GunChleoc (gunchleoc) wrote :

This is the actual gettext bug: https://savannah.gnu.org/bugs/?39499. It's still open at this time.

You see "data" a lot, which is how I came up with the idea. Some also keep media and image files outside the data directory. "data" might also be called "share", but "data" is more common.

build
cmake
data
-> campaigns
-> global
-> i18n, including fonts
-> locale
-> maps
-> music
-> scripting
-> sound
-> pics
-> shaders
-> tribes
-> txts
-> world

doc
po
src
test
utils

Revision history for this message
SirVer (sirver) wrote :

that looks reasonable. data_dir should then point to data/ .

GunChleoc (gunchleoc)
Changed in widelands:
assignee: nobody → GunChleoc (gunchleoc)
GunChleoc (gunchleoc)
Changed in widelands:
status: Incomplete → In Progress
milestone: none → build19-rc1
Revision history for this message
GunChleoc (gunchleoc) wrote :

Idea on fine-tinung the ui directories:

ui_sfmenu -> widelands/ui/menus
wui -> widelands/ui/game/
editor/*all_ui_stuff/ -> widelands/ui/editor/

Then mirror the structure in the images.

GunChleoc (gunchleoc)
Changed in widelands:
assignee: GunChleoc (gunchleoc) → nobody
GunChleoc (gunchleoc)
Changed in widelands:
status: In Progress → Fix Committed
GunChleoc (gunchleoc)
Changed in widelands:
status: Fix Committed → Fix Released
Revision history for this message
GunChleoc (gunchleoc) wrote :

Fixed in build19-rc1.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.