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

use default layout instead of builtin if available #1144

Merged
merged 1 commit into from Jan 4, 2020

Conversation

@Gireen
Copy link
Member

Gireen commented Dec 26, 2019

If a layout named default is available it will be loaded when no other layout is specified.
The builtin layout is still available as *BUILTIN*

@illwieckz

This comment has been minimized.

Copy link
Member

illwieckz commented Dec 26, 2019

That's a good idea!

if( !*layout )
{
strcpy( layout, "default" );
if ( !trap_FS_FOpenFile( va( "layouts/%s/%s.dat", map, layout ), nullptr, fsMode_t::FS_READ ) ) {

This comment has been minimized.

Copy link
@slipher

slipher Dec 26, 2019

Contributor

I think this return value check is wrong. It returns -1 if the file doesn't exist.

This comment has been minimized.

Copy link
@Gireen

Gireen Dec 27, 2019

Author Member

this if statement should be true when no file exists

This comment has been minimized.

Copy link
@slipher

slipher Dec 27, 2019

Contributor

It's only true if the file exists but has a length of zero.

This comment has been minimized.

Copy link
@Gireen

Gireen Dec 27, 2019

Author Member

hm i think i get what you mean. i tried the code and strangely this works as intended 🤷‍♂️
but i just realized that this check is not necessary at this place

@Gireen

This comment has been minimized.

Copy link
Member Author

Gireen commented Dec 27, 2019

mappers should place there default layout in builtin.dat
while server admins can overwrite this with default.dat
and if nothing is available *BUILTIN* from the map is loaded

@illwieckz

This comment has been minimized.

Copy link
Member

illwieckz commented Dec 27, 2019

interesting, does the game code already know how to load layouts from dpk?

@Gireen

This comment has been minimized.

Copy link
Member Author

Gireen commented Dec 27, 2019

yes

@illwieckz

This comment has been minimized.

Copy link
Member

illwieckz commented Dec 27, 2019

Wow, that's amazing. So next step would be to make a cheat command to spawn as builder if there is no spawn. And the only required map entity would be player intermission… (we already have g_neverEnd cheat to load map without spawns).

Copy link
Contributor

slipher left a comment

LGTM. Maybe squash the commits

@@ -4268,7 +4268,7 @@ bool G_admin_restart( gentity_t *ent )
admin_log( teampref );

// cvars
trap_Cvar_Set( "g_layouts", builtin ? S_BUILTIN_LAYOUT : layout );
trap_Cvar_Set( "g_layouts", !*layout ? "" : layout );

This comment has been minimized.

Copy link
@slipher

slipher Dec 28, 2019

Contributor

This line is equivalent to setting the cvar to layout unconditionally.

@Gireen Gireen force-pushed the Gireen:defaultlayout branch from e2d3194 to cc79c8e Dec 31, 2019
@illwieckz illwieckz merged commit 7a98c4e into Unvanquished:master Jan 4, 2020
2 checks passed
2 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.