Files @ r10688:9e216b0bd8ab
Branch filter:

Location: cpp/openttd-patchpack/source/src/cheat.cpp

truebrain
(svn r15006) -Codechange: throw a real instance of a class, instead of '0' (which can also be a throw from within a thread for what ever reason)
/* $Id$ */

/** @file cheat.cpp Handling (loading/saving/initializing) of cheats. */

#include "stdafx.h"
#include "cheat_type.h"

Cheats _cheats;

void InitializeCheats()
{
	memset(&_cheats, 0, sizeof(Cheats));
}

bool CheatHasBeenUsed()
{
	/* Cannot use lengthof because _cheats is of type Cheats, not Cheat */
	const Cheat *cht = (Cheat*)&_cheats;
	const Cheat *cht_last = &cht[sizeof(_cheats) / sizeof(Cheat)];

	for (; cht != cht_last; cht++) {
		if (cht->been_used) return true;
	}

	return false;
}