# cheat.cpp

Go to the documentation of this file.

    00001 /* $Id: cheat.cpp 14949 2009-01-10 00:31:47Z rubidium $ */
    00002
    00005 #include "stdafx.h"
    00006 #include "cheat_type.h"
    00007
    00008 Cheats _cheats;
    00009
    00010 void InitializeCheats()
    00011 {
    00012   memset(&_cheats, 0, sizeof(Cheats));
    00013 }
    00014
    00015 bool CheatHasBeenUsed()
    00016 {
    00017   /* Cannot use lengthof because _cheats is of type Cheats, not Cheat */
    00018   const Cheat *cht = (Cheat*)&_cheats;
    00019   const Cheat *cht_last = &cht[sizeof(_cheats) / sizeof(Cheat)];
    00020
    00021   for (; cht != cht_last; cht++) {
    00022     if (cht->been_used) return true;
    00023   }
    00024
    00025   return false;
    00026 }