Problems adding remort patch to quickmud

Posted by Ramzi on Sun 09 May 2004 07:32 PM — 16 posts, 83,589 views.

#0
when compiling my const.c file keeps getting errors.

it keeps telling me the initializer element is not constant
and the initializer element is not computable at load time
USA #1
Can you paste us the actual error messages and the offending code block? Just a vague error reference isnt doing much good unless you just want us to guess what might be wrong.
#2
mer.h:2362: warning: conflicting types for built-in function 'logf'
const.c:178: warning: missing braces around initiaizer
const.c:178: warning: (ner initialization for 'race_table[2]')
const.c:178: error: syntax error before '{' token
const.c:182: error: syntax error before nemeric constant
const.c:398: warning: initialization makes interger from pointer without a cast
const.c:398: error: initialzer element is not conputalbe at load time
const.c:398: error: (near initialization for 'class_table[0].remort_class')
const.c:398: error: initializer element is not constant
const.c:398: error: (ner initialization for 'class_table[0]')
USA #3
Please copy/paste instead of retyping it yourself.

Could you paste the lines of code it is referring to and let us know which ones have which line number?
#4
ok i feel as though i have tried all i can do with this
this code was written for rom 24b4 and i can not get it to run with quickmud. I was wondering if there is anyplace i can get a patch already designated for a rom 24b6 such as quickmud
#5
btw i tried to write the code in as it stated for the remort patch aka patch.remort.rom24b4 and have been using quickmud i know i stink but any help would be great
Australia #6
const.c:178: warning: missing braces around initiaizer

open up const.c and goto line 178, then cut and paste atleast 10 lines either side of it and post it here so we can see the code and point you in the right direction.

const.c:178: error: syntax error before '{' token

this error gives you an idea of where to start looking, but without the ability to see that line of code and a what lays befor it it is almost imposible to give any help at all. :)
#7
I got it i think got it to compile
was something stupid on my part.
thanks for your patients and understanding
#8
well i got my const.c file to compile here's the next problem
gcc -Wall -O -ggdb -DNOCRYPT -DQMFIXES -c -o obj/nanny.o nanny.c
In file included from nanny.c:52:
merc.h:2363: warning: conflicting types for built-in function `logf'
gcc -Wall -O -ggdb -DNOCRYPT -DQMFIXES -c -o obj/remort.o remort.c
In file included from remort.c:38:
merc.h:2363: warning: conflicting types for built-in function `logf'
remort.c: In function `do_remort':
remort.c:64: error: structure has no member named `confirm_remort'
remort.c:69: error: structure has no member named `confirm_remort'
remort.c:123: error: structure has no member named `confirm_remort'
#9
#if defined(macintosh)
#include <types.h>
#else
#include <sys/types.h>
#include <sys/time.h>
#endif
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include "merc.h"

void do_remor( CHAR_DATA *ch, char *argument )
{
send_to_char( "If you want to REMORT, you must spell it out.\n\r", ch );
return;
}

void do_remort( CHAR_DATA *ch, char *argument )
{
DESCRIPTOR_DATA *d;
char strsave[MAX_INPUT_LENGTH], player_name[MAX_INPUT_LENGTH];
char player_pwd[MAX_STRING_LENGTH], buf[MAX_STRING_LENGTH];

if ( IS_NPC(ch) || ( d = ch->desc ) == NULL )
return;

if ( ch->level < LEVEL_HERO && !IS_SET( ch->act, PLR_REMORT ) )
{
sprintf( buf,
"You must be level %d to remort.\n\r",
LEVEL_HERO );
send_to_char( buf, ch );
return;
}

if ( ch->pcdata->confirm_remort )
{
if ( argument[0] != '\0' )
{
send_to_char( "Remort status removed.\n\r", ch );
ch->pcdata->confirm_remort = FALSE;
return;
}
else
{
/*
* Get ready to delete the pfile, send a nice informational message.
*/
sprintf( strsave, "%s%s", PLAYER_DIR, capitalize( ch->name ) );
stop_fighting( ch, TRUE );
send_to_char( "You have chosen to remort. You will now be dropped in at the race\n\r", ch );
send_to_char( "selection section of character creation, and will be allowed to choose from\n\r", ch );
send_to_char( "a wider selection of races and classes.\n\r\n\r", ch );
send_to_char( "In the unlikely event that you are disconnected or the MUD\n\r", ch );
send_to_char( "crashes while you are creating your character, create a new character\n\r", ch );
send_to_char( "as normal and write a note to 'immortal'.\n\r", ch );
send_to_char( "\n\r[Hit Enter to Continue]\n\r", ch );
wiznet( "$N has remorted.", ch, NULL, 0, 0, 0 );

/*
* I quote:
* "After extract_char the ch is no longer valid!"
*/
sprintf( player_name, "%s", capitalize( ch->name ) );
sprintf( player_pwd, "%s", ch->pcdata->pwd );
extract_char( ch, TRUE );

/*
* Delete the pfile, but don't boot the character.
* Instead, do a load_char_obj to get a new ch,
* saving the password. Then,
* set the PLR_REMORT bit and drop the player in at
* CON_BEGIN_REMORT.
*/
unlink( strsave );
load_char_obj( d, player_name );
d->character->pcdata->pwd = str_dup( player_pwd );
if( !IS_SET( ch->act, PLR_REMORT ) )
SET_BIT( ch->act, PLR_REMORT );
d->connected = CON_BEGIN_REMORT;
return;
}
}

if ( argument[0] != '\0' )
{
send_to_char( "Just type remort. No argument.\n\r", ch );
return;
}

send_to_char("Type remort again to confirm this command.\n\r", ch );
send_to_char("WARNING: This command is irreversible.\n\r", ch );
send_to_char("Typing remort with an argument will undo remort status.\n\r",
ch );
ch->pcdata->confirm_remort = TRUE;
wiznet( "$N is contemplating remorting.",ch,NULL,0,0,get_trust(ch));
}
USA #10
You didnt add confirm_remort to your char data structure or you didnt call it confirm_remort in the character struct, hard to say which without seeing the struct.
#11
doh thanks
sorry about the late reply i have been away for a while
#12
Not to bring up a dead horse again. But as I see no post on the fix for this. I was wondering if someone could tell me how to fix the whole error: structure has no member named `history' the code is correct I just cant figure that error out.
As I added it to my code step by step:

Interp.h
DECLARE_DO_FUN( do_history );
DECLARE_DO_FUN( do_lookhist );

Interp.C
{ "history",    do_history,     POS_SLEEPING,   0,  LOG_NORMAL, 1 },
{ "lookhist",   do_lookhist,    POS_SLEEPING,   0,  LOG_NORMAL, 1 },

In Save.c
void fwrite_char( CHAR_DATA *ch, FILE *fp )
   if (ch->pcdata->history[0] != '\0' )
	fprintf( fp, "Hist %s~\n", ch->pcdata->history );

bool load_char_obj( DESCRIPTOR_DATA *d, char *name )
	ch->pcdata->history	= str_dup( "" );

fread_char( CHAR_DATA *ch, FILE *fp )
CASE 'H':
KEYS( "Hist",	ch->pcdata->history, fread_string( fp ) );

MERC.H -> in the pcdata structure
char *			history;

act_info.c

void do_history( CHAR_DATA *ch, char *argument )
{
    char buf[MSL], arg[MIL];

    if ( argument[0] != '\0' )
    {
	buf[0] = '\0';
	smash_tilde( argument );

    	if (argument[0] == '-')
    	{
            int len;
            bool found = FALSE;

            if (ch->pcdata->history == NULL || ch->pcdata->history[0] == '\0')
            {
                send_to_char("No lines left to remove.\n\r",ch);
                return;
            }

  			strcpy(buf,ch->pcdata->history);

            for (len = strlen(buf); len > 0; len--)
            {
                if (buf[len] == '\r')
                {
                    if (!found)  /* back it up */
                    {
                        if (len > 0)
                            len--;
                        found = TRUE;
                    }
                    else /* found the second one */
                    {
                        buf[len + 1] = '\0';
						free_string(ch->pcdata->history);
						ch->pcdata->history = str_dup(buf);
						send_to_char( "Your history is:\n\r", ch );
						page_to_char( ch->pcdata->history ? ch->pcdata->history :
						    "(None).\n\r", ch );
                        return;
                    }
                }
            }
            buf[0] = '\0';
			free_string(ch->pcdata->history);
			ch->pcdata->history = str_dup(buf);
			send_to_char("{RHistory cleared.{x\n\r",ch);
			return;
        }

		if ( argument[0] == '+' )
		{
		    if ( ch->pcdata->history != NULL )
				strcat( buf, ch->pcdata->history );

			argument++;

			while ( isspace(*argument) )
				argument++;
		}

    argument = one_argument( argument, arg );
    smash_tilde( argument );

    if ( !str_cmp( arg, "write") )
	{
		if ( argument[0] == '\0' )
	            string_append( ch, &ch->pcdata->history );
	    return;
	}

		if ( strlen(buf) >= 4096)
		{
			send_to_char( "History too long.\n\r", ch );
			return;
		}

		strcat( buf, argument );
		strcat( buf, "\n\r" );
		free_string( ch->pcdata->history );
		ch->pcdata->history = str_dup( buf );
	}

    send_to_char( "Your history is:\n\r", ch );
    page_to_char( ch->pcdata->history ? ch->pcdata->history : "(None).\n\r", ch );
    return;
}

void do_lookhist( CHAR_DATA *ch, char *argument )
{
  char arg1[MIL];
  CHAR_DATA *victim;

  argument = one_argument (argument, arg1);

  if (arg1[0] == '\0')
  {
      stc ("{rWhos history do you want to read?{x\n\r", ch);
      return;
  }

  if ((victim = get_char_world (ch, arg1)) == NULL)
  {
      stc ("{rThey aren't here.{x\n\r", ch);
      return;
  }

    stc( "Thier history is:\n\r", ch );
    page_to_char( victim->pcdata->history ? victim->pcdata->history : "(None).\n\r", ch );
    return;

}

Australia Forum Administrator #13
This is a new problem, right? This is the first reference to "history" in this thread.

Sounds like the pcdata structure does not have a "history" member. I don't know enough about the patch to say why, or how to fix it. I would look carefully at the patch instructions to see if you skipped a step.
#14
This is indeed a new prob. I did a search for 30 min's before I posted. If you would like to look at the instructions you can find them @ http://www.mudbytes.net/index.php?a=pastebin&s=view&pid=48738 this should be the text view (no download required). I checked my code and its the same. I recently added another code (after commenting out the history one) and I get the same error. Kinda annoying at 3 AM lol
USA #15
Sounds like you missed this step:
In MERC.H add this in the pcdata structure
     char *			history;