Browse Source

- Removed deprecated console code.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9815 54d463be-8e91-2dee-dedb-b68131a5f0ec
FlavioJS 18 years ago
parent
commit
c46f3cf135
11 changed files with 23 additions and 85 deletions
  1. 1 0
      Changelog-Trunk.txt
  2. 4 4
      src/char/char.c
  3. 3 4
      src/char_sql/char.c
  4. 3 57
      src/common/socket.c
  5. 0 4
      src/common/socket.h
  6. 4 3
      src/login/login.c
  7. 3 3
      src/login_sql/login.c
  8. 1 1
      src/map/clif.c
  9. 3 3
      src/map/map.c
  10. 0 5
      src/map/pc.c
  11. 1 1
      src/map/script.c

+ 1 - 0
Changelog-Trunk.txt

@@ -4,6 +4,7 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 
 2007/02/07
 2007/02/07
+	* Removed deprecated console code.
 	* Moved CHAT_SIZE back to map.h because log_atcommand uses it on sql 
 	* Moved CHAT_SIZE back to map.h because log_atcommand uses it on sql 
 	  builds. (moved to clif.c in r9811) [FlavioJS]
 	  builds. (moved to clif.c in r9811) [FlavioJS]
 2007/02/06
 2007/02/06

+ 4 - 4
src/char/char.c

@@ -4439,10 +4439,10 @@ int do_init(int argc, char **argv) {
 	add_timer_interval(gettick() + autosave_interval, mmo_char_sync_timer, 0, 0, autosave_interval);
 	add_timer_interval(gettick() + autosave_interval, mmo_char_sync_timer, 0, 0, autosave_interval);
 
 
 	char_read_fame_list(); //Read fame lists.
 	char_read_fame_list(); //Read fame lists.
-	
-	if(console) {
-	    set_defaultconsoleparse(parse_console);
-	   	start_console();
+
+	if( console )
+	{
+		//##TODO invoke a CONSOLE_START plugin event
 	}
 	}
 
 
 	char_log("The char-server is ready (Server is listening on the port %d)." RETCODE, char_port);
 	char_log("The char-server is ready (Server is listening on the port %d)." RETCODE, char_port);

+ 3 - 4
src/char_sql/char.c

@@ -4319,10 +4319,9 @@ int do_init(int argc, char **argv){
 	if(char_gm_read)
 	if(char_gm_read)
 		read_gm_account();
 		read_gm_account();
 
 
-
-	if ( console ) {
-	    set_defaultconsoleparse(parse_console);
-	   	start_console();
+	if( console )
+	{
+		//##TODO invoke a CONSOLE_START plugin event
 	}
 	}
 
 
 	//Cleaning the tables for NULL entrys @ startup [Sirius]
 	//Cleaning the tables for NULL entrys @ startup [Sirius]

+ 3 - 57
src/common/socket.c

@@ -86,8 +86,6 @@ struct socket_data *session[FD_SETSIZE];
 static int null_parse(int fd);
 static int null_parse(int fd);
 static int (*default_func_parse)(int) = null_parse;
 static int (*default_func_parse)(int) = null_parse;
 
 
-static int null_console_parse(char *buf);
-static int (*default_console_parse)(char*) = null_console_parse;
 #ifndef MINICORE
 #ifndef MINICORE
 static int connect_check(unsigned int ip);
 static int connect_check(unsigned int ip);
 #else
 #else
@@ -344,38 +342,6 @@ int make_listen_port(int port)
 	return make_listen_bind(INADDR_ANY,port);
 	return make_listen_bind(INADDR_ANY,port);
 }
 }
 
 
-// Console Reciever [Wizputer]
-int console_recieve(int i)
-{
-	int n;
-	char *buf;
-
-	CREATE(buf, char, 64);
-
-	n = read(0, buf , 64);
-	if ( n < 0 )
-		ShowError("Console input read error\n");
-	else
-	{
-		ShowNotice ("Sorry, the console is currently non-functional.\n");
-//		session[0]->func_console(buf);
-	}
-
-	aFree(buf);
-	return 0;
-}
-
-void set_defaultconsoleparse(int (*defaultparse)(char*))
-{
-	default_console_parse = defaultparse;
-}
-
-static int null_console_parse(char *buf)
-{
-	ShowMessage("null_console_parse : %s\n",buf);
-	return 0;
-}
-
 // function parse table
 // function parse table
 // To-do: -- use dynamic arrays
 // To-do: -- use dynamic arrays
 //        -- add a register_parse_func();
 //        -- add a register_parse_func();
@@ -401,26 +367,6 @@ void func_parse_check (struct socket_data *sd)
 	sd->type = SESSION_RAW;
 	sd->type = SESSION_RAW;
 }
 }
 
 
-// Console Input [Wizputer]
-int start_console(void)
-{
-	//Until a better plan is came up with... can't be using session[0] anymore! [Skotlex]
-	ShowNotice("The console is currently nonfunctional.\n");
-	return 0;
-
-	FD_SET(0,&readfds);
-
-	if (!session[0]) {	// dummy socket already uses fd 0
-		CREATE(session[0], struct socket_data, 1);
-	}
-	memset(session[0],0,sizeof(*session[0]));
-
-	session[0]->func_recv = console_recieve;
-	session[0]->func_console = default_console_parse;
-
-	return 0;
-}
-
 int make_connection(long ip,int port)
 int make_connection(long ip,int port)
 {
 {
 	struct sockaddr_in server_address;
 	struct sockaddr_in server_address;
@@ -1249,8 +1195,9 @@ void socket_init(void)
 	// initialise last send-receive tick
 	// initialise last send-receive tick
 	last_tick = time(0);
 	last_tick = time(0);
 
 
-	// session[0] Was for the console (whatever that was?), but is now currently used for disconnected sessions of the map
-	// server, and as such, should hold enough buffer (it is a vacuum so to speak) as it is never flushed. [Skotlex]
+	// session[0] is for disconnected sessions of the map server, and as such, 
+	// should hold enough buffer (it is a vacuum so to speak) as it is never flushed. [Skotlex]
+	//##TODO "flush" this session periodically O.O [FlavioJS]
 	CREATE(session[0], struct socket_data, 1);
 	CREATE(session[0], struct socket_data, 1);
 	CREATE(session[0]->rdata, unsigned char, 2*rfifo_size);
 	CREATE(session[0]->rdata, unsigned char, 2*rfifo_size);
 	CREATE(session[0]->wdata, unsigned char, 2*wfifo_size);
 	CREATE(session[0]->wdata, unsigned char, 2*wfifo_size);
@@ -1272,7 +1219,6 @@ void socket_init(void)
 
 
 int session_isValid(int fd)
 int session_isValid(int fd)
 {	//End of Exam has pointed out that fd==0 is actually an unconnected session! [Skotlex]
 {	//End of Exam has pointed out that fd==0 is actually an unconnected session! [Skotlex]
-	//But this is not so true, it is used... for... something. The console uses it, would this not cause problems? [Skotlex]
 	return ( (fd>0) && (fd<FD_SETSIZE) && (NULL!=session[fd]) );
 	return ( (fd>0) && (fd<FD_SETSIZE) && (NULL!=session[fd]) );
 }
 }
 
 

+ 0 - 4
src/common/socket.h

@@ -121,7 +121,6 @@ struct socket_data{
 	int (*func_recv)(int);
 	int (*func_recv)(int);
 	int (*func_send)(int);
 	int (*func_send)(int);
 	int (*func_parse)(int);
 	int (*func_parse)(int);
-	int (*func_console)(char*);
 	void* session_data;
 	void* session_data;
 	void* session_data2;
 	void* session_data2;
 	enum SessionType type;
 	enum SessionType type;
@@ -168,10 +167,7 @@ extern void flush_fifo(int fd);
 extern void flush_fifos(void);
 extern void flush_fifos(void);
 extern void set_nonblocking(int fd, int yes);
 extern void set_nonblocking(int fd, int yes);
 
 
-int start_console(void);
-
 void set_defaultparse(int (*defaultparse)(int));
 void set_defaultparse(int (*defaultparse)(int));
-void set_defaultconsoleparse(int (*defaultparse)(char*));
 
 
 //Resolves the hostname and stores the string representation of the string in ip.
 //Resolves the hostname and stores the string representation of the string in ip.
 //Meant to simplify calls to gethostbyname without the need of all the
 //Meant to simplify calls to gethostbyname without the need of all the

+ 4 - 3
src/login/login.c

@@ -4186,9 +4186,10 @@ int do_init(int argc, char **argv) {
 		add_timer_func_list(sync_ip_addresses, "sync_ip_addresses");
 		add_timer_func_list(sync_ip_addresses, "sync_ip_addresses");
 		add_timer_interval(gettick() + ip_sync_interval, sync_ip_addresses, 0, 0, ip_sync_interval);
 		add_timer_interval(gettick() + ip_sync_interval, sync_ip_addresses, 0, 0, ip_sync_interval);
 	}
 	}
-	if(console) {
-		set_defaultconsoleparse(parse_console);
-	   	start_console();
+
+	if( console )
+	{
+		//##TODO invoke a CONSOLE_START plugin event
 	}
 	}
 
 
 	new_reg_tick=gettick();
 	new_reg_tick=gettick();

+ 3 - 3
src/login_sql/login.c

@@ -2393,9 +2393,9 @@ int do_init(int argc,char **argv){
 		add_timer_interval(gettick() + ip_sync_interval, sync_ip_addresses, 0, 0, ip_sync_interval);
 		add_timer_interval(gettick() + ip_sync_interval, sync_ip_addresses, 0, 0, ip_sync_interval);
 	}
 	}
 
 
-	if (console) {
-		set_defaultconsoleparse(parse_console);
-		start_console();
+	if( console )
+	{
+		//##TODO invoke a CONSOLE_START plugin event
 	}
 	}
 
 
 	new_reg_tick=gettick();
 	new_reg_tick=gettick();

+ 1 - 1
src/map/clif.c

@@ -4858,7 +4858,7 @@ int clif_displaymessage(const int fd, char* mes)
 	// invalid pointer?
 	// invalid pointer?
 	nullpo_retr(-1, mes);
 	nullpo_retr(-1, mes);
 	
 	
-	//Console [Wizputer] //Scrapped, as these are shared by disconnected players =X [Skotlex]
+	//Scrapped, as these are shared by disconnected players =X [Skotlex]
 	if (fd == 0)
 	if (fd == 0)
 		return 0;
 		return 0;
 	else {
 	else {

+ 3 - 3
src/map/map.c

@@ -3978,9 +3978,9 @@ int do_init(int argc, char *argv[]) {
 	//Done loading with the maps, no need for the grf module anymore.
 	//Done loading with the maps, no need for the grf module anymore.
 	grfio_final();
 	grfio_final();
 
 
-	if ( console ) {
-		set_defaultconsoleparse(parse_console);
-		start_console();
+	if( console )
+	{
+		//##TODO invoke a CONSOLE_START plugin event
 	}
 	}
 
 
 	if (battle_config.pk_mode == 1)
 	if (battle_config.pk_mode == 1)

+ 0 - 5
src/map/pc.c

@@ -77,11 +77,6 @@ int pc_isGM(struct map_session_data *sd) {
 	if(sd->bl.type!=BL_PC )
 	if(sd->bl.type!=BL_PC )
 		return 0;
 		return 0;
 
 
-
-	//For console [Wizputer] //Unfortunately the console is "broken" because it shares fd 0 with disconnected players. [Skotlex]
-//	if ( sd->fd == 0 )
-//	    return 99;
-
 	for(i = 0; i < GM_num; i++)
 	for(i = 0; i < GM_num; i++)
 		if (gm_account[i].account_id == sd->status.account_id)
 		if (gm_account[i].account_id == sd->status.account_id)
 			return gm_account[i].level;
 			return gm_account[i].level;

+ 1 - 1
src/map/script.c

@@ -250,7 +250,7 @@ enum {
 	MF_GUILDLOCK
 	MF_GUILDLOCK
 };
 };
 
 
-//Reports on the console the src of an script error.
+//Reports on the console the src of a script error.
 static void report_src(struct script_state *st) {
 static void report_src(struct script_state *st) {
 	struct block_list *bl;
 	struct block_list *bl;
 	if (!st->oid) return; //Can't report source.
 	if (!st->oid) return; //Can't report source.