mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
1. Small corrections to hash code.
2. Use hash for dynnames. 3. On crash EDuke32 throws info about CON code. git-svn-id: https://svn.eduke32.com/eduke32@1031 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
af0ad5fb0a
commit
8ce121a895
8 changed files with 807 additions and 1537 deletions
|
@ -12177,7 +12177,7 @@ void HASH_free(struct HASH_table *t)
|
|||
int num;
|
||||
|
||||
if (t->items==NULL)return;
|
||||
// initprintf("*free\n");
|
||||
// initprintf("*free, num:%d\n",t->size);
|
||||
i=t->size-1;
|
||||
do
|
||||
{
|
||||
|
@ -12191,7 +12191,7 @@ void HASH_free(struct HASH_table *t)
|
|||
Bfree(tmp);
|
||||
num++;
|
||||
}
|
||||
// initprintf("Bucket #%4d: %3d\n",i,num);
|
||||
// initprintf("#%4d: %3d\t",i,num);
|
||||
}
|
||||
while (--i>=0);
|
||||
Bfree(t->items);
|
||||
|
@ -12287,15 +12287,13 @@ int HASH_find(struct HASH_table *t, const char *s)
|
|||
{
|
||||
struct HASH_item *cur;
|
||||
|
||||
// initprintf("{");
|
||||
if (t->items==NULL) {initprintf("HASH_findyy: not initalized\n");return -1;}
|
||||
if (t->items==NULL) {initprintf("HASH_find: not initalized\n");return -1;}
|
||||
cur=t->items[HASH_getcode(s)%t->size];
|
||||
while (cur)
|
||||
{
|
||||
if (Bstrcmp(s,cur->string)==0)return cur->key;
|
||||
cur=cur->next;
|
||||
}
|
||||
// initprintf("}");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -12303,7 +12301,6 @@ int HASH_findcase(struct HASH_table *t, const char *s)
|
|||
{
|
||||
struct HASH_item *cur;
|
||||
|
||||
// initprintf("{");
|
||||
if (t->items==NULL) {initprintf("HASH_findcase: not initalized\n");return -1;}
|
||||
cur=t->items[HASH_getcode(s)%t->size];
|
||||
while (cur)
|
||||
|
@ -12311,7 +12308,6 @@ int HASH_findcase(struct HASH_table *t, const char *s)
|
|||
if (Bstrcasecmp(s,cur->string)==0)return cur->key;
|
||||
cur=cur->next;
|
||||
}
|
||||
// initprintf("}");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -1843,7 +1843,7 @@ static symbol_t *findexactsymbol(const char *name)
|
|||
int i;
|
||||
if (!symbols) return NULL;
|
||||
|
||||
i = HASH_find(&osdsymbolsH,name);
|
||||
i = HASH_findcase(&osdsymbolsH,name);
|
||||
if (i > -1)
|
||||
{
|
||||
symbol_t *symb = osdsymbptrs[i];
|
||||
|
|
|
@ -57,7 +57,7 @@ int32 CONFIG_FunctionNameToNum(char * func)
|
|||
{
|
||||
int32 i;
|
||||
|
||||
i = HASH_find(&gamefuncH,func);
|
||||
i = HASH_findcase(&gamefuncH,func);
|
||||
if (i > -1)
|
||||
return i;
|
||||
return -1;
|
||||
|
|
|
@ -526,6 +526,7 @@ extern char ready2send;
|
|||
|
||||
// JBF 20040531: adding 16 extra to the script so we have some leeway
|
||||
// to (hopefully) safely abort when hitting the limit
|
||||
void scriptinfo();
|
||||
extern intptr_t *script,*scriptptr,*insptr,*labelcode,*labeltype;
|
||||
extern int labelcnt,defaultlabelcnt;
|
||||
extern int g_ScriptSize;
|
||||
|
|
|
@ -10551,6 +10551,7 @@ void backtomenu(void)
|
|||
void app_crashhandler(void)
|
||||
{
|
||||
closedemowrite();
|
||||
scriptinfo();
|
||||
sendquit();
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -958,6 +958,9 @@ struct HASH_table inputH = { INPUT_END, NULL };
|
|||
struct HASH_table actorH = { ACTOR_END, NULL };
|
||||
struct HASH_table tspriteH = { ACTOR_END, NULL };
|
||||
|
||||
void inithashnames();
|
||||
void freehashnames();
|
||||
|
||||
void inithash()
|
||||
{
|
||||
int i;
|
||||
|
@ -965,6 +968,7 @@ void inithash()
|
|||
HASH_init(&gamevarH);
|
||||
HASH_init(&arrayH);
|
||||
HASH_init(&labelH);
|
||||
inithashnames();
|
||||
|
||||
HASH_init(&keywH);
|
||||
for (i=NUMKEYWORDS-1;i>=0;i--)
|
||||
|
@ -1003,6 +1007,7 @@ void freehash()
|
|||
HASH_free(&arrayH);
|
||||
HASH_free(&labelH);
|
||||
HASH_free(&keywH);
|
||||
freehashnames();
|
||||
|
||||
HASH_free(§orH);
|
||||
HASH_free(&wallH);
|
||||
|
|
|
@ -47,6 +47,23 @@ extern int checkCON;
|
|||
|
||||
static int parse(void);
|
||||
|
||||
void scriptinfo()
|
||||
{
|
||||
if (script)
|
||||
{
|
||||
intptr_t *p;
|
||||
for (p=insptr-20;p<insptr+20;p++)
|
||||
{
|
||||
if (*p>>12&&(*p&0xFFF)<CON_END)
|
||||
initprintf("\n%5d: %5d %s ",p-script,*p>>12,keyw[*p&0xFFF]);
|
||||
else
|
||||
initprintf(" %d",*p);
|
||||
}
|
||||
initprintf("current actor: %d (%d)\n",g_i,g_sp->picnum);
|
||||
initprintf("line_num: %d, g_tw: %d\n",line_num,g_tw);
|
||||
}
|
||||
}
|
||||
|
||||
static void DoUserDef(int iSet, int lLabelID, int lVar2)
|
||||
{
|
||||
int lValue=0;
|
||||
|
@ -6883,6 +6900,7 @@ static int parse(void)
|
|||
case CON_ADDLOG:
|
||||
{
|
||||
insptr++;
|
||||
|
||||
OSD_Printf(OSDTEXT_GREEN "CONLOG: L=%d\n",line_num);
|
||||
break;
|
||||
}
|
||||
|
@ -8037,11 +8055,12 @@ static int parse(void)
|
|||
break;
|
||||
|
||||
default:
|
||||
OSD_Printf("fatal error: default processing: previous five values: %d, %d, %d, %d, %d, "
|
||||
/* OSD_Printf("fatal error: default processing: previous five values: %d, %d, %d, %d, %d, "
|
||||
"current opcode: %d, next five values: %d, %d, %d, %d, %d\ncurrent actor: %d (%d)\n",
|
||||
*(insptr-5),*(insptr-4),*(insptr-3),*(insptr-2),*(insptr-1),*insptr,*(insptr+1),
|
||||
*(insptr+2),*(insptr+3),*(insptr+4),*(insptr+5),g_i,g_sp->picnum);
|
||||
OSD_Printf("line_num: %d, g_tw: %d\n",line_num,g_tw);
|
||||
OSD_Printf("line_num: %d, g_tw: %d\n",line_num,g_tw);*/
|
||||
scriptinfo();
|
||||
|
||||
gameexit("An error has occurred in the EDuke32 CON executor.\n\n"
|
||||
"If you are an end user, please e-mail the file eduke32.log\n"
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue