fix for windows in act.comm.c

Login to reply  Page: « < 1 of 1 > »
05 Feb 2010 - 18:062302
fix for windows in act.comm.c
The current release does not compile in windows.

This 6 line change makes it compile in windows simply by disabling Merriam Webster.
If anyone knows a way to fix this without disabling it outright please correct me.
(Though I doubt there is such a thing on windows operating systems.)

In act.comm.c, in ACMD(do_tell)

/* Yes, do_tell probably could be combined with whisper and ask, but it is
 * called frequently, and should IMHO be kept as tight as possible. */
ACMD(do_tell)
{
  struct char_data *vict = NULL;
  char buf[MAX_INPUT_LENGTH], buf2[MAX_INPUT_LENGTH];
- int i;
  half_chop(argument, buf, buf2);

  if (!*buf || !*buf2)
    send_to_char(ch, "Who do you wish to tell what??\r\n");
  else if (!strcmp(buf, "m-w")) {
+#ifdef CIRCLE_WINDOWS
+   /* getpid() is not portable */
    send_to_char(ch, "Sorry, that is not available in the windows port.\r\n");
+#else /* all other configurations */
+    int i;
    char word[MAX_INPUT_LENGTH], *p, *q;

    if (last_webster_teller != -1L) {
      if (GET_IDNUM(ch) == last_webster_teller) {
        send_to_char(ch, "You are still waiting for a response.\r\n");
        return;
      } else {
        send_to_char(ch, "Hold on, m-w is busy. Try again in a couple of seconds.\r\n");
        return;
      }
    }

    /* Only a-z and +/- allowed. */
    for (p = buf2, q = word; *p ; p++)
      if ((LOWER(*p) <= 'z' && LOWER(*p) >= 'a') || (*p == '+') || (*p == '-'))
        *q++ = *p;

    *q = '{{uie-code}}';

    if (!*word) {
      send_to_char(ch, "Sorry, only letters and +/- are allowed characters.\r\n");
      return;
    }
    snprintf(buf, sizeof(buf), "../bin/webster %s %d &", word, (int) getpid());
    i = system(buf);
    last_webster_teller = GET_IDNUM(ch);
    send_to_char(ch, "You look up '%s' in Merriam-Webster.\r\n", word);*/
+#endif /* platform specific part */
  } else if (GET_LEVEL(ch) < LVL_IMMORT && !(vict = get_player_vis(ch, buf, NULL, FIND_CHAR_WORLD)))
    send_to_char(ch, "%s", CONFIG_NOPERSON);
  else if (GET_LEVEL(ch) >= LVL_IMMORT && !(vict = get_char_vis(ch, buf, NULL, FIND_CHAR_WORLD)))
    send_to_char(ch, "%s", CONFIG_NOPERSON);
  else if (is_tell_ok(ch, vict))
    perform_tell(ch, vict, buf2);
}


__________________
The Augmented Dimension
( A fantasy hack/slash Circle 3.1 derivative )
frostmud.com 8228

Last edited by Kyle (05 Feb 2010 - 18:23)
05 Feb 2010 - 20:142303
You are compiling under what? MSVC? Cygwin? ...?


06 Feb 2010 - 00:472307
Will assume MSVC, as compiling under Cygwin isn't really what I'd classify as a Windows compilation (since no programs compiled under Cygwin will natively run on Windows without the use of Cygwin).


__________________

Dedicated DG Forum
06 Feb 2010 - 05:272308
Quote:

Will assume MSVC, as compiling under Cygwin isn't really what I'd classify as a Windows compilation (since no programs compiled under Cygwin will natively run on Windows without the use of Cygwin).


Agreed. It was with MSVC 2008 and I expect the same error with any future MSVC version. posid() is no problem if you compile with cygwin.


__________________
The Augmented Dimension
( A fantasy hack/slash Circle 3.1 derivative )
frostmud.com 8228
08 Feb 2010 - 00:342319
Added, thanks.


__________________
Rumble
The Builder Academy
tbamud.com 9091
09 Feb 2010 - 20:302324
Hi again,

I'm sure you caught the mistake but I made a typo in my OP.

+#ifdef CIRCLE_WINDOWS
+   /* getpid() is not portable */
    send_to_char(ch, "Sorry, that is not available in the windows port.\r\n");
+#else /* all other configurations */
+    int i;

should be

+#ifdef CIRCLE_WINDOWS
+   /* getpid() is not portable */
+   send_to_char(ch, "Sorry, that is not available in the windows port.\r\n");
+#else /* all other configurations */
+    int i;


__________________
The Augmented Dimension
( A fantasy hack/slash Circle 3.1 derivative )
frostmud.com 8228
09 Feb 2010 - 21:562325
I still don't see a typo :-P


__________________
Rumble
The Builder Academy
tbamud.com 9091
10 Feb 2010 - 06:302329
one of my "add" lines didn't have a + in front of it


__________________
The Augmented Dimension
( A fantasy hack/slash Circle 3.1 derivative )
frostmud.com 8228
11 Feb 2010 - 20:022330
oh, didn't even notice :-)


__________________
Rumble
The Builder Academy
tbamud.com 9091
Login to reply  Page: « < 1 of 1 > »