Refactor to store the initial governor state when gamemode is entered

Rather than when gamemoded is started. As see in Issue #52.

	A small refactor here to ensure things stay consistent, especially
	to stop storing a pointer from get_gov_state that might have had
	it's memory changed at some point, confusingly.
This commit is contained in:
Marc Di Luzio
2018-05-15 16:28:33 +01:00
parent d9072607d9
commit 1c38a6047e
5 changed files with 31 additions and 41 deletions

View File

@@ -99,8 +99,9 @@ int fetch_governors(char governors[MAX_GOVERNORS][MAX_GOVERNOR_LENGTH])
*/
const char *get_gov_state(void)
{
/* Cached primary governor state */
/* Persistent governor state */
static char governor[64] = { 0 };
memset(governor, 0, sizeof(governor));
/* State for all governors */
char governors[MAX_GOVERNORS][MAX_GOVERNOR_LENGTH] = { { 0 } };