`RandomChance` type, and two new item fields: `MagicEffectChance`, `MagicEffectDuration`
[k8-i-v-a-n.git] / src / game / ivancommon.cpp
blob9a867ccf18cf6126b324974d57f508fd1a089f14
1 /*
3 * Iter Vehemens ad Necem (IVAN)
4 * Copyright (C) Timo Kiviluoto
5 * Released under the GNU General
6 * Public License
8 * See LICENSING which should be included
9 * along with this file for more details
12 #include <cstdio>
13 #include <cstring>
15 #include <cstdlib>
16 #include <exception> // for std::bad_alloc
17 #include <new>
19 /*#include "ivancommon.h"*/
22 void *operator new (std::size_t size) throw (std::bad_alloc) {
23 if (size > 0x1fffffff) {
24 //throw std::bad_alloc(); // ANSI/ISO compliant behavior
25 fprintf(stderr, "`new`: size > 0x1fffffff! (%u)\n", size);
26 *(int *)0 = 666;
28 void *p = calloc(1, size+64);
29 if (!p) {
30 fprintf(stderr, "`new`: out of memory for size=%u!\n", size);
31 *(int *)0 = 666;
32 //throw std::bad_alloc(); // ANSI/ISO compliant behavior
34 //fprintf(stderr, "GLOBAL NEW!\n");
35 return p;
39 void operator delete (void *p) throw () {
40 if (p) {
41 //fprintf(stderr, "GLOBAL DELETE!\n");
42 free(p);