allow user_choice in prestart for invisible choices
This commit is contained in:
parent
e1a5bb89dc
commit
c9552c9a33
4 changed files with 9 additions and 3 deletions
|
@ -50,6 +50,7 @@ struct persist_choice: mp_sync::user_choice {
|
||||||
virtual config random_choice() const {
|
virtual config random_choice() const {
|
||||||
return config();
|
return config();
|
||||||
}
|
}
|
||||||
|
virtual bool is_visible() const { return false; }
|
||||||
};
|
};
|
||||||
|
|
||||||
static void get_global_variable(persist_context &ctx, const vconfig &pcfg)
|
static void get_global_variable(persist_context &ctx, const vconfig &pcfg)
|
||||||
|
|
|
@ -1125,14 +1125,12 @@ config mp_sync::get_user_choice(const std::string &name, const mp_sync::user_cho
|
||||||
WRN_REPLAY << "MP synchronization called during an unsynced context.";;
|
WRN_REPLAY << "MP synchronization called during an unsynced context.";;
|
||||||
return uch.query_user();
|
return uch.query_user();
|
||||||
}
|
}
|
||||||
if(is_too_early)
|
if(is_too_early && uch.is_visible())
|
||||||
{
|
{
|
||||||
//We are in a prestart event or even earlier.
|
//We are in a prestart event or even earlier.
|
||||||
//Although we are able to sync them, we cannot use query_user,
|
//Although we are able to sync them, we cannot use query_user,
|
||||||
//because we cannot (or shouldn't) put things on the screen inside a prestart event, this is true for SP and MP games.
|
//because we cannot (or shouldn't) put things on the screen inside a prestart event, this is true for SP and MP games.
|
||||||
//Quotation form event wiki: "For things displayed on-screen such as character dialog, use start instead"
|
//Quotation form event wiki: "For things displayed on-screen such as character dialog, use start instead"
|
||||||
//Note, that there are also user choices that don't require on-screen dialogs like [get_global_variable]
|
|
||||||
//TODO: find a solution in these cases.
|
|
||||||
return uch.random_choice();
|
return uch.random_choice();
|
||||||
}
|
}
|
||||||
//in start events it's unclear to decide on which side the function should be executed (default= side1 still).
|
//in start events it's unclear to decide on which side the function should be executed (default= side1 still).
|
||||||
|
|
|
@ -190,6 +190,9 @@ struct user_choice
|
||||||
virtual ~user_choice() {}
|
virtual ~user_choice() {}
|
||||||
virtual config query_user() const = 0;
|
virtual config query_user() const = 0;
|
||||||
virtual config random_choice() const = 0;
|
virtual config random_choice() const = 0;
|
||||||
|
///whether the choice is visible for the user like an advacement choice
|
||||||
|
///a non-visible choice is for example get_global_variable
|
||||||
|
virtual bool is_visible() const { return true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2677,6 +2677,10 @@ namespace {
|
||||||
{
|
{
|
||||||
return config();
|
return config();
|
||||||
}
|
}
|
||||||
|
//Although luas sync_choice can show a dialog, (and will in most cases)
|
||||||
|
//we return false to enable other possible things that do not contain UI things.
|
||||||
|
//it's in the responsbility of the umc dev to not show dialogs durign prestart events.
|
||||||
|
virtual bool is_visible() const { return false; }
|
||||||
};
|
};
|
||||||
}//unnamed namespace for lua_synchronize
|
}//unnamed namespace for lua_synchronize
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue