Only in src: Makefile Only in src: Makefile.linux Only in src: Makefile.normal Only in src: Makefile.solaris diff -c src/act_comm.c ../rom_win32/src/act_comm.c *** src/act_comm.c Thu May 28 09:23:48 1998 --- ../rom_win32/src/act_comm.c Thu Nov 26 23:11:42 1998 *************** *** 27,32 **** --- 27,35 ---- #if defined(macintosh) #include + #elif defined(WIN32) + #include + #include #else #include #include diff -c src/act_enter.c ../rom_win32/src/act_enter.c *** src/act_enter.c Thu May 28 10:37:33 1998 --- ../rom_win32/src/act_enter.c Thu Nov 26 23:11:42 1998 *************** *** 28,33 **** --- 28,36 ---- #if defined(macintosh) #include #include + #elif defined(WIN32) + #include + #include #else #include #include diff -c src/act_info.c ../rom_win32/src/act_info.c *** src/act_info.c Thu May 28 10:37:17 1998 --- ../rom_win32/src/act_info.c Thu Nov 26 23:11:42 1998 *************** *** 27,32 **** --- 27,36 ---- #if defined(macintosh) #include + #elif defined(WIN32) + #include + #include + #define NOCRYPT #else #include #include diff -c src/act_move.c ../rom_win32/src/act_move.c *** src/act_move.c Thu May 28 10:40:32 1998 --- ../rom_win32/src/act_move.c Thu Nov 26 23:11:42 1998 *************** *** 28,33 **** --- 28,36 ---- #if defined(macintosh) #include #include + #elif defined(WIN32) + #include + #include #else #include #include diff -c src/act_obj.c ../rom_win32/src/act_obj.c *** src/act_obj.c Thu May 28 10:11:12 1998 --- ../rom_win32/src/act_obj.c Thu Nov 26 23:11:42 1998 *************** *** 28,33 **** --- 28,36 ---- #if defined(macintosh) #include #include + #elif defined(WIN32) + #include + #include #else #include #include diff -c src/act_wiz.c ../rom_win32/src/act_wiz.c *** src/act_wiz.c Fri May 29 06:14:17 1998 --- ../rom_win32/src/act_wiz.c Thu Nov 26 23:11:42 1998 *************** *** 28,33 **** --- 28,36 ---- #if defined(macintosh) #include #include + #elif defined(WIN32) + #include + #include #else #include #include diff -c src/ban.c ../rom_win32/src/ban.c *** src/ban.c Sun May 24 08:27:09 1998 --- ../rom_win32/src/ban.c Thu Nov 26 23:11:42 1998 *************** *** 28,33 **** --- 28,36 ---- #if defined(macintosh) #include #include + #elif defined(WIN32) + #include + #include #else #include #include diff -c src/comm.c ../rom_win32/src/comm.c *** src/comm.c Thu May 28 10:25:22 1998 --- ../rom_win32/src/comm.c Thu Nov 26 23:11:42 1998 *************** *** 43,57 **** * -- Furey 26 Jan 1993 */ #if defined(macintosh) #include #else #include #include #endif #include - #include #include #include #include --- 43,64 ---- * -- Furey 26 Jan 1993 */ + #include + #if defined(macintosh) #include + #elif defined(WIN32) + #include + #include + #include + #include + #define NOCRYPT #else #include #include #endif #include #include #include #include *************** *** 86,92 **** #define __attribute(x) #endif ! #if defined(unix) #include #endif --- 93,99 ---- #define __attribute(x) #endif ! #if defined(unix) || defined(WIN32) #include #endif *************** *** 99,105 **** /* * Socket and TCP/IP stuff. */ ! #if defined(macintosh) || defined(MSDOS) const char echo_off_str [] = { '\0' }; const char echo_on_str [] = { '\0' }; const char go_ahead_str [] = { '\0' }; --- 106,112 ---- /* * Socket and TCP/IP stuff. */ ! #if defined(macintosh) || defined(MSDOS) || defined(WIN32) const char echo_off_str [] = { '\0' }; const char echo_on_str [] = { '\0' }; const char go_ahead_str [] = { '\0' }; *************** *** 291,297 **** int write args( ( int fd, char *buf, int nbyte ) ); #endif ! /* * Global variables. --- 298,312 ---- int write args( ( int fd, char *buf, int nbyte ) ); #endif ! #if defined(WIN32) ! #undef EINTR ! #undef EMFILE ! #define EINTR WSAEINTR ! #define EMFILE WSAEMFILE ! #define EWOULDBLOCK WSAEWOULDBLOCK ! #define MAXHOSTNAMELEN 32 ! #define close closesocket ! #endif /* * Global variables. *************** *** 317,323 **** bool write_to_descriptor args( ( int desc, char *txt, int length ) ); #endif ! #if defined(unix) void game_loop_unix args( ( int control ) ); int init_socket args( ( int port ) ); void init_descriptor args( ( int control ) ); --- 332,338 ---- bool write_to_descriptor args( ( int desc, char *txt, int length ) ); #endif ! #if defined(unix) || defined(WIN32) void game_loop_unix args( ( int control ) ); int init_socket args( ( int port ) ); void init_descriptor args( ( int control ) ); *************** *** 342,354 **** void stop_idling args( ( CHAR_DATA *ch ) ); void bust_a_prompt args( ( CHAR_DATA *ch ) ); - int main( int argc, char **argv ) { struct timeval now_time; int port; ! #if defined(unix) int control; #endif --- 357,368 ---- void stop_idling args( ( CHAR_DATA *ch ) ); void bust_a_prompt args( ( CHAR_DATA *ch ) ); int main( int argc, char **argv ) { struct timeval now_time; int port; ! #if defined(unix) || defined(WIN32) int control; #endif *************** *** 376,381 **** --- 390,423 ---- cecho2file( "log file", 1, stderr ); #endif + // change to area directory + #if defined(WIN32) + { + char fullfilename[MAX_PATH]; + char directory [MAX_PATH]; + char * p; + + if (!GetModuleFileName (NULL, fullfilename, sizeof (fullfilename))) + exit (1); + + // remove last part of file name to get working directory + + strcpy (directory, fullfilename); + + p = strrchr (directory, '\\'); + if (p) + *p = 0; + + strcat (directory, "\\area"); + + // make sure we are running in the "area" subdirectory + + _chdir (directory); + + printf ("Working directory now %s\n", directory); + } + #endif + /* * Reserve one channel for our use. */ *************** *** 412,418 **** game_loop_mac_msdos( ); #endif ! #if defined(unix) control = init_socket( port ); boot_db( ); sprintf( log_buf, "ROM is ready to rock on port %d.", port ); --- 454,482 ---- game_loop_mac_msdos( ); #endif ! #if defined(WIN32) ! { ! /* Initialise Windows sockets library */ ! ! unsigned short wVersionRequested = MAKEWORD(1, 1); ! WSADATA wsadata; ! int err; ! ! /* Need to include library: wsock32.lib for Windows Sockets */ ! err = WSAStartup(wVersionRequested, &wsadata); ! if (err) ! { ! fprintf(stderr, "Error %i on WSAStartup\n", err); ! exit(1); ! } ! ! /* standard termination signals */ ! // signal(SIGINT, (void *) bailout); ! // signal(SIGTERM, (void *) bailout); ! } ! #endif ! ! #if defined(unix) || defined(WIN32) control = init_socket( port ); boot_db( ); sprintf( log_buf, "ROM is ready to rock on port %d.", port ); *************** *** 421,426 **** --- 485,495 ---- close (control); #endif + #if defined(WIN32) + /* Shut down Windows sockets */ + WSACleanup(); /* clean up */ + #endif + /* * That's all, folks. */ *************** *** 431,437 **** ! #if defined(unix) int init_socket( int port ) { static struct sockaddr_in sa_zero; --- 500,506 ---- ! #if defined(unix) || defined(WIN32) int init_socket( int port ) { static struct sockaddr_in sa_zero; *************** *** 655,667 **** ! #if defined(unix) void game_loop_unix( int control ) { static struct timeval null_time; struct timeval last_time; signal( SIGPIPE, SIG_IGN ); gettimeofday( &last_time, NULL ); current_time = (time_t) last_time.tv_sec; --- 724,738 ---- ! #if defined(unix) || defined(WIN32) void game_loop_unix( int control ) { static struct timeval null_time; struct timeval last_time; + #if !defined(WIN32) signal( SIGPIPE, SIG_IGN ); + #endif gettimeofday( &last_time, NULL ); current_time = (time_t) last_time.tv_sec; *************** *** 836,846 **** stall_time.tv_usec = usecDelta; stall_time.tv_sec = secDelta; ! if ( select( 0, NULL, NULL, NULL, &stall_time ) < 0 ) { ! perror( "Game_loop: select: stall" ); exit( 1 ); } } } --- 907,921 ---- stall_time.tv_usec = usecDelta; stall_time.tv_sec = secDelta; ! #if defined(WIN32) ! Sleep( (stall_time.tv_sec * 1000L) + (stall_time.tv_usec / 1000L) ); ! #else ! if ( select( 0, NULL, NULL, NULL, &stall_time ) < 0 && errno != EINTR ) { ! perror( "game_loop: select: stall" ); exit( 1 ); } + #endif } } *************** *** 854,860 **** ! #if defined(unix) void init_descriptor( int control ) { char buf[MAX_STRING_LENGTH]; --- 929,935 ---- ! #if defined(unix) || defined(WIN32) void init_descriptor( int control ) { char buf[MAX_STRING_LENGTH]; *************** *** 863,868 **** --- 938,946 ---- struct hostent *from; int desc; int size; + #if defined(WIN32) + unsigned long arg = 1; + #endif size = sizeof(sock); getsockname( control, (struct sockaddr *) &sock, &size ); *************** *** 876,882 **** --- 954,964 ---- #define FNDELAY O_NDELAY #endif + #if defined(WIN32) + if ( ioctlsocket(desc, FIONBIO, &arg) == -1 ) + #else if ( fcntl( desc, F_SETFL, FNDELAY ) == -1 ) + #endif { perror( "New_descriptor: fcntl: FNDELAY" ); return; *************** *** 1065,1077 **** } #endif ! #if defined(MSDOS) || defined(unix) for ( ; ; ) { ! int nRead; nRead = read( d->descriptor, d->inbuf + iStart, sizeof(d->inbuf) - 10 - iStart ); if ( nRead > 0 ) { iStart += nRead; --- 1147,1167 ---- } #endif ! #if defined(MSDOS) || defined(unix) || defined(WIN32) for ( ; ; ) { ! int nRead, iErr; + #if defined(WIN32) + nRead = recv( d->descriptor, d->inbuf + iStart, + sizeof(d->inbuf) - 10 - iStart, 0 ); + iErr = WSAGetLastError (); + #else nRead = read( d->descriptor, d->inbuf + iStart, sizeof(d->inbuf) - 10 - iStart ); + iErr = errno; + #endif + if ( nRead > 0 ) { iStart += nRead; *************** *** 1083,1089 **** log_string( "EOF encountered on read." ); return FALSE; } ! else if ( errno == EWOULDBLOCK ) break; else { --- 1173,1179 ---- log_string( "EOF encountered on read." ); return FALSE; } ! else if ( iErr == EWOULDBLOCK ) break; else { *************** *** 1528,1534 **** --- 1618,1628 ---- for ( iStart = 0; iStart < length; iStart += nWrite ) { nBlock = UMIN( length - iStart, 4096 ); + #if defined(WIN32) + if ( ( nWrite = send( desc, txt + iStart, nBlock, 0 ) ) < 0 ) + #else if ( ( nWrite = write( desc, txt + iStart, nBlock ) ) < 0 ) + #endif { perror( "Write_to_descriptor" ); return FALSE; } } *************** *** 2570,2572 **** --- 2664,2678 ---- tp->tv_usec = 0; } #endif + + + #if defined(WIN32) + /* routines not in Windows runtime libraries */ + + void gettimeofday(struct timeval *tv, struct timezone *tz) + { + tv->tv_sec = time (0); + tv->tv_usec = 0; + } + + #endif diff -c src/db.c ../rom_win32/src/db.c *** src/db.c Sat May 30 08:22:58 1998 --- ../rom_win32/src/db.c Thu Nov 26 23:11:42 1998 *************** *** 32,37 **** --- 32,41 ---- #include #if defined(macintosh) #include + #elif defined(WIN32) + #include + #include + #define OLD_RAND #else #include #include *************** *** 967,972 **** --- 971,978 ---- case 3: pexit->exit_info = EX_ISDOOR | EX_NOPASS; break; case 4: pexit->exit_info = EX_ISDOOR|EX_NOPASS|EX_PICKPROOF; break; + default: pexit->exit_info = locks; break; + } pRoomIndex->exit[door] = pexit; *************** *** 2597,2603 **** magic = (int *) pMem; *magic = MAGIC_NUM; ! pMem += sizeof(*magic); return pMem; } --- 2603,2609 ---- magic = (int *) pMem; *magic = MAGIC_NUM; ! (char *) pMem += sizeof(*magic); return pMem; } *************** *** 2613,2619 **** int iList; int *magic; ! pMem -= sizeof(*magic); magic = (int *) pMem; if (*magic != MAGIC_NUM) --- 2619,2625 ---- int iList; int *magic; ! (char *) pMem -= sizeof(*magic); magic = (int *) pMem; if (*magic != MAGIC_NUM) *************** *** 2787,2792 **** --- 2793,2802 ---- return; } + #if defined(WIN32) + #pragma warning( disable: 4101) + #endif + void do_dump( CHAR_DATA *ch, char *argument ) { int count,count2,num_pcs,aff_count; *************** *** 2930,2935 **** --- 2940,2949 ---- fpReserve = fopen( NULL_FILE, "r" ); } + #if defined(WIN32) + #pragma warning( default: 4101) + #endif + /* diff -c src/db2.c ../rom_win32/src/db2.c *** src/db2.c Sun May 24 08:27:26 1998 --- ../rom_win32/src/db2.c Thu Nov 26 23:11:44 1998 *************** *** 32,37 **** --- 32,40 ---- #include #if defined(macintosh) #include + #elif defined(WIN32) + #include + #include #else #include #include *************** *** 449,455 **** case ('W') : pObjIndex->condition = 50; break; case ('D') : pObjIndex->condition = 25; break; case ('B') : pObjIndex->condition = 10; break; ! case ('R') : pObjIndex->condition = 0; break; default: pObjIndex->condition = 100; break; } --- 452,458 ---- case ('W') : pObjIndex->condition = 50; break; case ('D') : pObjIndex->condition = 25; break; case ('B') : pObjIndex->condition = 10; break; ! case ('R') : pObjIndex->condition = 0; break; default: pObjIndex->condition = 100; break; } diff -c src/flags.c ../rom_win32/src/flags.c *** src/flags.c Sun May 24 08:27:35 1998 --- ../rom_win32/src/flags.c Thu Nov 26 23:11:44 1998 *************** *** 28,33 **** --- 28,36 ---- #if defined(macintosh) #include #include + #elif defined(WIN32) + #include + #include #else #include #include diff -c src/healer.c ../rom_win32/src/healer.c *** src/healer.c Thu May 28 08:59:08 1998 --- ../rom_win32/src/healer.c Thu Nov 26 23:11:44 1998 *************** *** 28,33 **** --- 28,36 ---- #if defined(macintosh) #include #include + #elif defined(WIN32) + #include + #include #else #include #include diff -c src/merc.h ../rom_win32/src/merc.h *** src/merc.h Tue May 26 06:48:53 1998 --- ../rom_win32/src/merc.h Thu Nov 26 23:11:44 1998 *************** *** 2046,2051 **** --- 2046,2061 ---- #define NULL_FILE "/dev/null" /* To reserve one stream */ #endif + #if defined(WIN32) + #define PLAYER_DIR "..\\player\\" /* Player files */ + #define GOD_DIR "..\\gods\\" /* list of gods */ + #define TEMP_FILE "..\\player\\romtmp" + #define NULL_FILE "nul" /* To reserve one stream */ + #pragma warning( disable: 4018 4244 4761) + void gettimeofday(struct timeval *tv, struct timezone *tz); + void kill_timer(); + #endif + #define AREA_LIST "area.lst" /* List of areas*/ #define BUG_FILE "bugs.txt" /* For 'bug' and bug()*/ #define TYPO_FILE "typos.txt" /* For 'typo'*/ diff -c src/music.c ../rom_win32/src/music.c *** src/music.c Sun May 24 08:27:51 1998 --- ../rom_win32/src/music.c Thu Nov 26 23:11:44 1998 *************** *** 27,32 **** --- 27,35 ---- #if defined(macintosh) #include + #elif defined(WIN32) + #include + #include #else #include #include diff -c src/note.c ../rom_win32/src/note.c *** src/note.c Thu May 28 09:03:52 1998 --- ../rom_win32/src/note.c Thu Nov 26 23:11:44 1998 *************** *** 27,32 **** --- 27,35 ---- #if defined(macintosh) #include + #elif defined(WIN32) + #include + #include #else #include #include diff -c src/recycle.c ../rom_win32/src/recycle.c *** src/recycle.c Sun May 24 08:27:55 1998 --- ../rom_win32/src/recycle.c Thu Nov 26 23:11:44 1998 *************** *** 28,33 **** --- 28,36 ---- #if defined(macintosh) #include #include + #elif defined(WIN32) + #include + #include #else #include #include diff -c src/save.c ../rom_win32/src/save.c *** src/save.c Mon May 25 16:25:25 1998 --- ../rom_win32/src/save.c Fri Jan 29 13:38:42 1999 *************** *** 150,157 **** fwrite_pet(ch->pet,fp); fprintf( fp, "#END\n" ); } ! fclose( fp ); ! rename(TEMP_FILE,strsave); fpReserve = fopen( NULL_FILE, "r" ); return; } --- 150,160 ---- fwrite_pet(ch->pet,fp); fprintf( fp, "#END\n" ); } ! fclose( fp ); ! if (remove (strsave) != 0) /* NJG - remove old file so we can rename onto it */ ! perror( strsave ); ! if (rename(TEMP_FILE,strsave) != 0) ! perror( strsave ); fpReserve = fopen( NULL_FILE, "r" ); return; } *************** *** 539,545 **** --- 542,550 ---- bool load_char_obj( DESCRIPTOR_DATA *d, char *name ) { char strsave[MAX_INPUT_LENGTH]; + #if defined(unix) char buf[100]; + #endif CHAR_DATA *ch; FILE *fp; bool found; diff -c src/skills.c ../rom_win32/src/skills.c *** src/skills.c Thu May 28 10:32:11 1998 --- ../rom_win32/src/skills.c Thu Nov 26 23:11:44 1998 *************** *** 28,33 **** --- 28,36 ---- #if defined(macintosh) #include #include + #elif defined(WIN32) + #include + #include #else #include #include