Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upTileset loading refactoring #13151
Conversation
VlasovVitaly
added some commits
Aug 1, 2015
This comment has been minimized.
This comment has been minimized.
|
Not so sure about that ifdef, but works for me. Linux curses, sdl builds |
VlasovVitaly
added some commits
Aug 1, 2015
This comment has been minimized.
This comment has been minimized.
|
Ok. Test this on Linux with and without PREFIX, with make and cmake build. All working. So Request for comment and testers. Need tests on Windows (with and without CLion) and MacOSX |
VlasovVitaly
changed the title
[WIP] Tileset loading refactoring
[RFC] Tileset loading refactoring
Aug 1, 2015
This comment has been minimized.
This comment has been minimized.
If you're relying on all the tileset authors fixing this on their end instead of adding the required tweaks in this PR, things is going to break royally. :V |
This comment has been minimized.
This comment has been minimized.
|
We'll fix the ones we're including, but we can't cleanly allow a legacy On Sat, Aug 1, 2015 at 6:54 PM Chaosvolt notifications@github.com wrote:
|
This comment has been minimized.
This comment has been minimized.
|
Ah, so this will only be a hazard to modders making their own tilesets that haven't been PR'd, then? |
This comment has been minimized.
This comment has been minimized.
|
Yes. You can see the diff on this PR: it updates all the tilesets to use the correct kind of references, right from the first commit (2751bf3). |
This comment has been minimized.
This comment has been minimized.
|
Ah, right. Doh. >.< |
DavidKeaton
reviewed
Aug 1, 2015
| void options_data::add_value( const std::string &lvar, const std::string &lval, | ||
| std::string lvalname ) | ||
| { | ||
| static const std::string blank_value( 1, 001 ); |
This comment has been minimized.
This comment has been minimized.
DavidKeaton
Aug 1, 2015
Contributor
you could move this to the top of the source, so the entire source can reference the same one, as you use this more than once! :-)
This comment has been minimized.
This comment has been minimized.
VlasovVitaly
Aug 2, 2015
Author
Contributor
This piece of code is move on top. Was on bottom of file.
This comment has been minimized.
This comment has been minimized.
BevapDin
Aug 7, 2015
Contributor
Why exactly did you move the definitions of those options_data functions? They can be "used" once they have been declared (which happens in option.h, which is include at the very top of this file), the place of their definition does not matter at all. Have those functions actually been changed?
This comment has been minimized.
This comment has been minimized.
|
Hmm. Just realized, I have been finding yet more stuff I oughta add to a tileset update, which I was planning to do when I wasn't juggling half a dozen PRs. Though to avoid breaking stuff, I'll want to wait until after this is merged since it includes edits to tile_config. Good, gives me more time for spriting. I am going to dread the day I stop putting off making sprites for the animatronic and dinosaur mods. XP |
VlasovVitaly
changed the title
[RFC] Tileset loading refactoring
Tileset loading refactoring
Aug 2, 2015
VlasovVitaly
added some commits
Aug 2, 2015
This comment has been minimized.
This comment has been minimized.
|
Was merged with upstream. |
This comment has been minimized.
This comment has been minimized.
|
Doh? Such confuse, very derp. :V EDIT: You sure any of this has been merged? Doesn't look like it. |
This comment has been minimized.
This comment has been minimized.
|
Not merged into master, master merged into it to avoid any conflicts. |
This comment has been minimized.
This comment has been minimized.
|
Ah right. |
BevapDin
reviewed
Aug 7, 2015
| @@ -456,7 +500,81 @@ bool cOpt::operator!=(const std::string sCompare) const | |||
| return !(*this == sCompare); | |||
| } | |||
|
|
|||
| void initOptions() | |||
| /** Fill TILESETS mapping with values. | |||
| * Scans all directores in gfx directory for file named "tileset.txt". | |||
This comment has been minimized.
This comment has been minimized.
BevapDin
Aug 7, 2015
Contributor
Actually it scans the FILENAMES["gfxdir"] directory for files names FILENAMES["tileset-conf"]. Both entries of the FILENAMES map may contain any string, not just "gfx" and "tileset.txt".
This comment has been minimized.
This comment has been minimized.
VlasovVitaly
Aug 7, 2015
Author
Contributor
Yeah. Trying to make this description shorter. Guess it's better to fix that message.
BevapDin
reviewed
Aug 7, 2015
|
|
||
| fin.open( file.c_str() ); | ||
| if(!fin.is_open()) { | ||
| fin.close(); |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
VlasovVitaly
Aug 7, 2015
Author
Contributor
This is old behavior. Really i don't know why close() is calling. Will be fixed.
BevapDin
reviewed
Aug 7, 2015
|
|
||
| if(tileset_names == "") { | ||
| optionNames["deon"] = _("Deon's"); // more standards | ||
| optionNames["hoder"] = _("Hoder's"); |
This comment has been minimized.
This comment has been minimized.
BevapDin
Aug 7, 2015
Contributor
Hmmm, those are the only translated tileset names. The other tileset go untranslated. Either they should not be translated at all (they are names anyway), or the lang/extract_json_strings.py or lang/update_pot.sh need to be changed to extract the tileset names. See also line 554, where untranslated entries are added to optionNames.
This comment has been minimized.
This comment has been minimized.
VlasovVitaly
Aug 8, 2015
Author
Contributor
Hmm. I have found that several languages have own translation of "Deon's" and "Hoder's" strings.
I will add viewname to extractor in separate PR.
BevapDin
reviewed
Aug 7, 2015
| if (sOption.find("NAME") != std::string::npos) { | ||
| tileset_name = ""; | ||
| fin >> tileset_name; | ||
| if(first_tileset_name) { |
This comment has been minimized.
This comment has been minimized.
BevapDin
Aug 7, 2015
Contributor
Instead of having first_tileset_name (and setting it correctly), why don't you just check tileset_names.empty()? If it's empty, the current tileset is the first and no "," needs to be added.
This comment has been minimized.
This comment has been minimized.
BevapDin
reviewed
Aug 7, 2015
| */ | ||
| void load_tilejson_from_file(std::ifstream &f, const std::string &imagepath); | ||
| void load_tilejson_from_file(const std::string tileset_dir, std::ifstream &f, const std::string &image_path); |
This comment has been minimized.
This comment has been minimized.
BevapDin
Aug 7, 2015
Contributor
As you already made it const, it should also be a reference, not a copy. Just like image_path.
This comment has been minimized.
This comment has been minimized.
VlasovVitaly
Aug 7, 2015
Author
Contributor
Ok. i will fix that.
Where i can read about this difference. Any link?
kevingranade
merged commit ca58abb
into
CleverRaven:master
Aug 7, 2015
1 check passed
This comment has been minimized.
This comment has been minimized.
|
Ah delicious, more things to give me plenty of time to work on my tileset updates. Still only halfway done. XP |
This comment has been minimized.
This comment has been minimized.
|
Fixes from @BevapDin will be in separate PR. So at this moment paths in all new tileset must be related. |
This comment has been minimized.
This comment has been minimized.
So long as they don't give me the cold shoulder, I guess I'll do so. XP |
This comment has been minimized.
This comment has been minimized.
|
:p |
This comment has been minimized.
This comment has been minimized.
|
Posted a thread in Lab forum, hope that's the ideal spot in the forums for said warning. I've never actually mucked about on the IRC, so... |
This comment has been minimized.
This comment has been minimized.
|
Should be fairly easy to write a small script for conversion.. It's JSON, after all, can be read and written in any language. |
VlasovVitaly commentedAug 1, 2015
This is fix of #12800
After merging all tilesets authors MUST write path in config files strongly relative.
Tested on Linux.
TODO:
get_tile_information()and other function related to tilesets path.