Recovered from microbel
This commit is contained in:
1
worldsrv/.cvsignore
Normal file
1
worldsrv/.cvsignore
Normal file
@@ -0,0 +1 @@
|
||||
worldsrv
|
||||
8
worldsrv/Makefile.am
Normal file
8
worldsrv/Makefile.am
Normal file
@@ -0,0 +1,8 @@
|
||||
INCLUDES = -I../common/include @X_CFLAGS@ @GL_CFLAGS@ @TIFF_CFLAGS@
|
||||
|
||||
bin_PROGRAMS = worldsrv
|
||||
|
||||
worldsrv_SOURCES = worldclimanager.C worldclimessage.C worldcliprotocol.C worldclisrvsocket.C worldgos.C worldsrv.C worldsrv_main.C worldsrvlistenerlist.C worldsrvmanager.C worldsrvmessage.C worldsrvobject.C worldsrvprotocol.C worldsrvsrvsocket.C worldsrvworld.C waupdateclientposition.C wacreateclientobject.C waremoveclientobject.C
|
||||
|
||||
worldsrv_LDADD = -L../common/lib/gos -lgos -L../common/lib/geometry -lgeometry -L../common/lib/texture -ltexture -lgos -L../common/lib/world -lworld -L../common/lib/srvcli -lsrvcli -L../common/lib/utils -lpvvmudutils -L../common/lib/crypto -lcrypto @TIFF_LIBS@ -ltiff -lm @NETLIBS@
|
||||
|
||||
357
worldsrv/Makefile.in
Normal file
357
worldsrv/Makefile.in
Normal file
@@ -0,0 +1,357 @@
|
||||
# Makefile.in generated automatically by automake 1.4 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
CC = @CC@
|
||||
CXX = @CXX@
|
||||
GL_CFLAGS = @GL_CFLAGS@
|
||||
GL_LIBS = @GL_LIBS@
|
||||
LEX = @LEX@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
NETLIBS = @NETLIBS@
|
||||
PACKAGE = @PACKAGE@
|
||||
RANLIB = @RANLIB@
|
||||
TIFF_CFLAGS = @TIFF_CFLAGS@
|
||||
TIFF_LIBS = @TIFF_LIBS@
|
||||
VERSION = @VERSION@
|
||||
YACC = @YACC@
|
||||
|
||||
INCLUDES = -I../common/include @X_CFLAGS@ @GL_CFLAGS@ @TIFF_CFLAGS@
|
||||
|
||||
bin_PROGRAMS = worldsrv
|
||||
|
||||
worldsrv_SOURCES = worldclimanager.C worldclimessage.C worldcliprotocol.C worldclisrvsocket.C worldgos.C worldsrv.C worldsrv_main.C worldsrvlistenerlist.C worldsrvmanager.C worldsrvmessage.C worldsrvobject.C worldsrvprotocol.C worldsrvsrvsocket.C worldsrvworld.C waupdateclientposition.C wacreateclientobject.C waremoveclientobject.C
|
||||
|
||||
worldsrv_LDADD = -L../common/lib/gos -lgos -L../common/lib/geometry -lgeometry -L../common/lib/texture -ltexture -lgos -L../common/lib/world -lworld -L../common/lib/srvcli -lsrvcli -L../common/lib/utils -lpvvmudutils -L../common/lib/crypto -lcrypto @TIFF_LIBS@ -ltiff -lm @NETLIBS@
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_CLEAN_FILES =
|
||||
PROGRAMS = $(bin_PROGRAMS)
|
||||
|
||||
|
||||
DEFS = @DEFS@ -I. -I$(srcdir)
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
X_CFLAGS = @X_CFLAGS@
|
||||
X_LIBS = @X_LIBS@
|
||||
X_EXTRA_LIBS = @X_EXTRA_LIBS@
|
||||
X_PRE_LIBS = @X_PRE_LIBS@
|
||||
worldsrv_OBJECTS = worldclimanager.o worldclimessage.o \
|
||||
worldcliprotocol.o worldclisrvsocket.o worldgos.o worldsrv.o \
|
||||
worldsrv_main.o worldsrvlistenerlist.o worldsrvmanager.o \
|
||||
worldsrvmessage.o worldsrvobject.o worldsrvprotocol.o \
|
||||
worldsrvsrvsocket.o worldsrvworld.o waupdateclientposition.o \
|
||||
wacreateclientobject.o waremoveclientobject.o
|
||||
worldsrv_DEPENDENCIES =
|
||||
worldsrv_LDFLAGS =
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
|
||||
CXXLD = $(CXX)
|
||||
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@
|
||||
DIST_COMMON = Makefile.am Makefile.in TODO
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = gtar
|
||||
GZIP_ENV = --best
|
||||
DEP_FILES = .deps/wacreateclientobject.P .deps/waremoveclientobject.P \
|
||||
.deps/waupdateclientposition.P .deps/worldclimanager.P \
|
||||
.deps/worldclimessage.P .deps/worldcliprotocol.P \
|
||||
.deps/worldclisrvsocket.P .deps/worldgos.P .deps/worldsrv.P \
|
||||
.deps/worldsrv_main.P .deps/worldsrvlistenerlist.P \
|
||||
.deps/worldsrvmanager.P .deps/worldsrvmessage.P .deps/worldsrvobject.P \
|
||||
.deps/worldsrvprotocol.P .deps/worldsrvsrvsocket.P \
|
||||
.deps/worldsrvworld.P
|
||||
SOURCES = $(worldsrv_SOURCES)
|
||||
OBJECTS = $(worldsrv_OBJECTS)
|
||||
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .C .S .c .o .s
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --foreign worldsrv/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
||||
mostlyclean-binPROGRAMS:
|
||||
|
||||
clean-binPROGRAMS:
|
||||
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
|
||||
|
||||
distclean-binPROGRAMS:
|
||||
|
||||
maintainer-clean-binPROGRAMS:
|
||||
|
||||
install-binPROGRAMS: $(bin_PROGRAMS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(bindir)
|
||||
@list='$(bin_PROGRAMS)'; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
|
||||
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
|
||||
else :; fi; \
|
||||
done
|
||||
|
||||
uninstall-binPROGRAMS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(bin_PROGRAMS)'; for p in $$list; do \
|
||||
rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
|
||||
done
|
||||
|
||||
.s.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
.S.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.o core *.core
|
||||
|
||||
clean-compile:
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
maintainer-clean-compile:
|
||||
|
||||
worldsrv: $(worldsrv_OBJECTS) $(worldsrv_DEPENDENCIES)
|
||||
@rm -f worldsrv
|
||||
$(CXXLINK) $(worldsrv_LDFLAGS) $(worldsrv_OBJECTS) $(worldsrv_LDADD) $(LIBS)
|
||||
.C.o:
|
||||
$(CXXCOMPILE) -c $<
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
here=`pwd` && cd $(srcdir) \
|
||||
&& mkid -f$$here/ID $$unique $(LISP)
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|
||||
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
|
||||
|
||||
mostlyclean-tags:
|
||||
|
||||
clean-tags:
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID
|
||||
|
||||
maintainer-clean-tags:
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = worldsrv
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||
distdir=`cd $(distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --foreign worldsrv/Makefile
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pr $$/$$file $(distdir)/$$file; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
|
||||
|
||||
-include $(DEP_FILES)
|
||||
|
||||
mostlyclean-depend:
|
||||
|
||||
clean-depend:
|
||||
|
||||
distclean-depend:
|
||||
-rm -rf .deps
|
||||
|
||||
maintainer-clean-depend:
|
||||
|
||||
%.o: %.c
|
||||
@echo '$(COMPILE) -c $<'; \
|
||||
$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||
@-cp .deps/$(*F).pp .deps/$(*F).P; \
|
||||
tr ' ' '\012' < .deps/$(*F).pp \
|
||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||
>> .deps/$(*F).P; \
|
||||
rm .deps/$(*F).pp
|
||||
|
||||
%.lo: %.c
|
||||
@echo '$(LTCOMPILE) -c $<'; \
|
||||
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
|
||||
< .deps/$(*F).pp > .deps/$(*F).P; \
|
||||
tr ' ' '\012' < .deps/$(*F).pp \
|
||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||
>> .deps/$(*F).P; \
|
||||
rm -f .deps/$(*F).pp
|
||||
|
||||
%.o: %.C
|
||||
@echo '$(CXXCOMPILE) -c $<'; \
|
||||
$(CXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||
@-cp .deps/$(*F).pp .deps/$(*F).P; \
|
||||
tr ' ' '\012' < .deps/$(*F).pp \
|
||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||
>> .deps/$(*F).P; \
|
||||
rm .deps/$(*F).pp
|
||||
|
||||
%.lo: %.C
|
||||
@echo '$(LTCXXCOMPILE) -c $<'; \
|
||||
$(LTCXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
|
||||
< .deps/$(*F).pp > .deps/$(*F).P; \
|
||||
tr ' ' '\012' < .deps/$(*F).pp \
|
||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||
>> .deps/$(*F).P; \
|
||||
rm -f .deps/$(*F).pp
|
||||
info-am:
|
||||
info: info-am
|
||||
dvi-am:
|
||||
dvi: dvi-am
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
installcheck-am:
|
||||
installcheck: installcheck-am
|
||||
install-exec-am: install-binPROGRAMS
|
||||
install-exec: install-exec-am
|
||||
|
||||
install-data-am:
|
||||
install-data: install-data-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
install: install-am
|
||||
uninstall-am: uninstall-binPROGRAMS
|
||||
uninstall: uninstall-am
|
||||
all-am: Makefile $(PROGRAMS)
|
||||
all-redirect: all-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(bindir)
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-compile \
|
||||
mostlyclean-tags mostlyclean-depend mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
clean-am: clean-binPROGRAMS clean-compile clean-tags clean-depend \
|
||||
clean-generic mostlyclean-am
|
||||
|
||||
clean: clean-am
|
||||
|
||||
distclean-am: distclean-binPROGRAMS distclean-compile distclean-tags \
|
||||
distclean-depend distclean-generic clean-am
|
||||
|
||||
distclean: distclean-am
|
||||
|
||||
maintainer-clean-am: maintainer-clean-binPROGRAMS \
|
||||
maintainer-clean-compile maintainer-clean-tags \
|
||||
maintainer-clean-depend maintainer-clean-generic \
|
||||
distclean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
|
||||
.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
|
||||
maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
|
||||
mostlyclean-compile distclean-compile clean-compile \
|
||||
maintainer-clean-compile tags mostlyclean-tags distclean-tags \
|
||||
clean-tags maintainer-clean-tags distdir mostlyclean-depend \
|
||||
distclean-depend clean-depend maintainer-clean-depend info-am info \
|
||||
dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
|
||||
install-exec install-data-am install-data install-am install \
|
||||
uninstall-am uninstall all-redirect all-am all installdirs \
|
||||
mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
8
worldsrv/TODO
Normal file
8
worldsrv/TODO
Normal file
@@ -0,0 +1,8 @@
|
||||
Ny quit kode!
|
||||
-Når signal kaller quit så avsluttes bare timekeeper loopen.
|
||||
Dette gjør at det ikke blir lagt merke til at worldsrv avslutter i
|
||||
pvvmudsrv. Må fikses på samme måte som samme file blir fikset i GOS.
|
||||
|
||||
Use gosAddress when connection to GOS!
|
||||
-Connecting to localhost don't use gosAddress given in MsgGOSInfo.
|
||||
|
||||
30
worldsrv/wacreateclientobject.C
Normal file
30
worldsrv/wacreateclientobject.C
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#include "pvvmud.H"
|
||||
#include "wacreateclientobject.H"
|
||||
|
||||
CWACreateClientObject::CWACreateClientObject( DWORD objectId, DWORD geometryId, DWORD parentId, const CPosition & position ,const CDirection & direction )
|
||||
:CWACreateObject("object",objectId,geometryId,parentId,position,direction){
|
||||
}
|
||||
|
||||
int CWACreateClientObject::animate( DWORD time ){
|
||||
cdebug << "CWACreateClientObject::animate ( " << time << " ) I just send on message to the client :)" << endl;
|
||||
return FALSE;
|
||||
}
|
||||
32
worldsrv/wacreateclientobject.H
Normal file
32
worldsrv/wacreateclientobject.H
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _WACREATECLIENTOBJECT_H
|
||||
#define _WACREATECLIENTOBJECT_H
|
||||
|
||||
#include "wacreateobject.H"
|
||||
|
||||
class CWACreateClientObject : public CWACreateObject {
|
||||
public:
|
||||
CWACreateClientObject( DWORD objectId , DWORD geometryId, DWORD parentId, const CPosition & position, const CDirection & direction);
|
||||
|
||||
virtual int animate( DWORD time );
|
||||
};
|
||||
|
||||
#endif // _WACREATECLIENTOBJECT_H
|
||||
30
worldsrv/waremoveclientobject.C
Normal file
30
worldsrv/waremoveclientobject.C
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#include "pvvmud.H"
|
||||
#include "waremoveclientobject.H"
|
||||
|
||||
CWARemoveClientObject::CWARemoveClientObject( DWORD objectId, DWORD parentId )
|
||||
:CWARemoveObject(objectId,parentId){
|
||||
}
|
||||
|
||||
int CWARemoveClientObject::animate( DWORD time ){
|
||||
cdebug << "CWARemoveClientObject::animate ( " << time << " ) I just send on message to the client :)" << endl;
|
||||
return FALSE;
|
||||
}
|
||||
32
worldsrv/waremoveclientobject.H
Normal file
32
worldsrv/waremoveclientobject.H
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _WAREMOVECLIENTOBJECT_H
|
||||
#define _WAREMOVECLIENTOBJECT_H
|
||||
|
||||
#include "waremoveobject.H"
|
||||
|
||||
class CWARemoveClientObject : public CWARemoveObject {
|
||||
public:
|
||||
CWARemoveClientObject( DWORD objectId , DWORD parentId );
|
||||
|
||||
virtual int animate( DWORD time );
|
||||
};
|
||||
|
||||
#endif // _WAREMOVECLIENTOBJECT_H
|
||||
30
worldsrv/waupdateclientposition.C
Normal file
30
worldsrv/waupdateclientposition.C
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#include "pvvmud.H"
|
||||
#include "waupdateclientposition.H"
|
||||
|
||||
CWAUpdateClientPosition::CWAUpdateClientPosition( DWORD objectId, const CPosition & position )
|
||||
:CWAUpdatePosition(objectId,position){
|
||||
}
|
||||
|
||||
int CWAUpdateClientPosition::animate( DWORD time ){
|
||||
cdebug << "CWAUpdateClientPosition::animate ( " << time << " ) I just send on message to the client :)" << endl;
|
||||
return FALSE;
|
||||
}
|
||||
32
worldsrv/waupdateclientposition.H
Normal file
32
worldsrv/waupdateclientposition.H
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _WAUPDATECLIENTPOSITION_H
|
||||
#define _WAUPDATECLIENTPOSITION_H
|
||||
|
||||
#include "waupdateposition.H"
|
||||
|
||||
class CWAUpdateClientPosition : public CWAUpdatePosition {
|
||||
CPosition m_position;
|
||||
public:
|
||||
CWAUpdateClientPosition( DWORD objectId, const CPosition & position );
|
||||
virtual int animate( DWORD time );
|
||||
};
|
||||
|
||||
#endif // _WAUPDATECLIENTPOSITION_H
|
||||
170
worldsrv/worldclimanager.C
Normal file
170
worldsrv/worldclimanager.C
Normal file
@@ -0,0 +1,170 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#include "pvvmud.H"
|
||||
#include <iostream.h>
|
||||
#include "worldclimanager.H"
|
||||
|
||||
static int currGOSCliManagerId = 0;
|
||||
|
||||
CWorldCliManager::CWorldCliManager(CWorldSrv * worldSrv, CWorldCliProtocol * protocol):CManager(protocol){
|
||||
char name[16];
|
||||
m_worldSrv = worldSrv;
|
||||
m_id = ++currGOSCliManagerId;
|
||||
m_quit = FALSE;
|
||||
m_masterCell = NULL;
|
||||
sprintf(name,"Client %i",m_id);
|
||||
getProtocol()->setName(name);
|
||||
setName(name);
|
||||
}
|
||||
|
||||
CWorldCliManager::~CWorldCliManager(){
|
||||
|
||||
// Unregister all listeners in world
|
||||
changeMasterCell(-1);
|
||||
|
||||
}
|
||||
|
||||
CWorldSrvObject * CWorldCliManager::getMasterCell(){
|
||||
return m_masterCell;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Message in
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// changeMasterCell
|
||||
// Arguments :
|
||||
// newMasterCellId : New master cell or -1 to unregister all listeners
|
||||
//
|
||||
void CWorldCliManager::changeMasterCell(DWORD newMasterCellId){
|
||||
|
||||
CWorldSrvObject* newMasterCell = NULL;
|
||||
|
||||
// Find oldCells
|
||||
|
||||
cout << "Change MasterCell from : ";
|
||||
if (m_masterCell != NULL) cout << m_masterCell->getObjectId();
|
||||
else cout << "-1";
|
||||
cout << " to " << newMasterCellId << "\nOld cells:";
|
||||
|
||||
CIntArray oldCells;
|
||||
if (m_masterCell != NULL){
|
||||
cout << " " << m_masterCell->getObjectId();
|
||||
oldCells.add( m_masterCell->getObjectId() );
|
||||
CCellPVS * pvs = m_masterCell->getPVS();
|
||||
if (pvs != NULL){
|
||||
CObjectListItem * item = pvs->getFirstPVCell();
|
||||
while (item != NULL){
|
||||
DWORD cellId = ((CPVCell*)item->getObject())->getCellId();
|
||||
cout << " " << cellId;
|
||||
oldCells.add( cellId );
|
||||
item = item->getNext();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Find newCells
|
||||
|
||||
cout << "\nNew cells:";
|
||||
|
||||
CIntArray newCells;
|
||||
if (newMasterCellId != ID_UNKNOWN){
|
||||
cout << " " << newMasterCellId;
|
||||
newCells.add( newMasterCellId );
|
||||
newMasterCell = (CWorldSrvObject*)getWorld()->getObject(newMasterCellId);
|
||||
CCellPVS * pvs = newMasterCell->getPVS();
|
||||
if (pvs != NULL){
|
||||
CObjectListItem * item = pvs->getFirstPVCell();
|
||||
while (item != NULL){
|
||||
DWORD cellId = ((CPVCell*)item->getObject())->getCellId();
|
||||
cout << " " << cellId;
|
||||
newCells.add( cellId );
|
||||
item = item->getNext();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cout << "\n";
|
||||
|
||||
CIntArray addCells = newCells.substracSet( oldCells );
|
||||
CIntArray updateCells = oldCells.unionSet( newCells );
|
||||
CIntArray deleteCells = oldCells.substracSet( newCells );
|
||||
|
||||
int num,ii;
|
||||
CWorldSrvObject * cell;
|
||||
|
||||
cout << "Delete cells: ";
|
||||
num = deleteCells.getNumElements();
|
||||
for (ii = 0; ii < num; ii++) cout << " " << deleteCells.get(ii);
|
||||
cout << "\nAdd cells: ";
|
||||
num = addCells.getNumElements();
|
||||
for (ii = 0; ii < num; ii++) cout << " " << addCells.get(ii);
|
||||
cout << "\nUpdate cells: ";
|
||||
num = updateCells.getNumElements();
|
||||
for (ii = 0; ii < num; ii++) cout << " " << updateCells.get(ii);
|
||||
cout << "\n";
|
||||
|
||||
m_masterCell = newMasterCell;
|
||||
|
||||
num = updateCells.getNumElements();
|
||||
while (num-- > 0){
|
||||
cell = (CWorldSrvObject*)getWorld()->getObject(updateCells.get(num));
|
||||
if (cell != NULL) cell->updateListener(this);
|
||||
}
|
||||
|
||||
num = addCells.getNumElements();
|
||||
while (num-- > 0){
|
||||
cell = (CWorldSrvObject*)getWorld()->getObject(addCells.get(num));
|
||||
if (cell != NULL) cell->addListener(this);
|
||||
}
|
||||
|
||||
num = deleteCells.getNumElements();
|
||||
while (num-- > 0){
|
||||
cell = (CWorldSrvObject*)getWorld()->getObject(deleteCells.get(num));
|
||||
if (cell != NULL) cell->removeListener(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CWorldCliManager::recivePing(BYTE sequenceNumber){
|
||||
DWORD time = getWorld()->getTime();
|
||||
cdebug << "Send pong: sequence number " << (int)sequenceNumber
|
||||
<< " server time : " << time << endl;
|
||||
getProtocol()->sendPong(sequenceNumber,time);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Message out
|
||||
|
||||
void CWorldCliManager::sendAnimation(CWorldAnimation * animation){
|
||||
getProtocol()->sendAnimation(animation);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Utility functions
|
||||
|
||||
void CWorldCliManager::quit(){
|
||||
cout << "Client marked quit\n";
|
||||
m_quit = TRUE;
|
||||
}
|
||||
|
||||
int CWorldCliManager::getQuit(){
|
||||
return m_quit;
|
||||
}
|
||||
56
worldsrv/worldclimanager.H
Normal file
56
worldsrv/worldclimanager.H
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _WORLDCLIMANAGER_H
|
||||
#define _WORLDCLIMANAGER_H
|
||||
|
||||
#include "worldsrv.H"
|
||||
#include "worldcliprotocol.H"
|
||||
#include "manager.H"
|
||||
#include "listener.H"
|
||||
|
||||
class CWorldCliManager: public CManager, public CListener {
|
||||
CWorldSrv * m_worldSrv;
|
||||
int m_id;
|
||||
int m_quit;
|
||||
CWorldSrvObject * m_masterCell;
|
||||
public:
|
||||
CWorldCliManager(CWorldSrv * worldSrv, CWorldCliProtocol * protocol);
|
||||
virtual ~CWorldCliManager();
|
||||
|
||||
CWorldSrv * getWorldSrv(){ return m_worldSrv; }
|
||||
int getId(){ return m_id; }
|
||||
CWorldCliProtocol * getProtocol() { return (CWorldCliProtocol*)getCommunicate(); }
|
||||
CWorldSrvWorld* getWorld(){ return getWorldSrv()->getWorld(); }
|
||||
|
||||
CWorldSrvObject * getMasterCell();
|
||||
|
||||
// Messages in
|
||||
void changeMasterCell(DWORD newMasterCellId);
|
||||
void recivePing(BYTE sequenceNumber);
|
||||
|
||||
// Messages out
|
||||
void sendAnimation(CWorldAnimation * animation);
|
||||
|
||||
virtual void quit();
|
||||
int getQuit();
|
||||
|
||||
};
|
||||
|
||||
#endif // _WORLDCLIMANAGER_H
|
||||
68
worldsrv/worldclimessage.C
Normal file
68
worldsrv/worldclimessage.C
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#include "pvvmud.H"
|
||||
#include <iostream.h>
|
||||
#include "worldclimessage.H"
|
||||
#include "worldclimanager.H"
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* CMsgWorldCliChangeMasterCell
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
CMsgWorldCliChangeMasterCell::CMsgWorldCliChangeMasterCell():CMsgChangeMasterCell(){
|
||||
}
|
||||
|
||||
CMsgWorldCliChangeMasterCell * CMsgWorldCliChangeMasterCell::createMsg(){
|
||||
return new CMsgWorldCliChangeMasterCell();
|
||||
}
|
||||
|
||||
int CMsgWorldCliChangeMasterCell::executeMsg(){
|
||||
cout << "Execute MsgWorldCliChangeMasterCell: " << getNewMasterCellId() << "\n";
|
||||
CWorldCliManager * manager = (CWorldCliManager*)getManager();
|
||||
manager->changeMasterCell(getNewMasterCellId());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* CMsgWorldCliPing
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
CMsgWorldCliPing::CMsgWorldCliPing():CMsgPing(){
|
||||
}
|
||||
|
||||
CMsgWorldCliPing * CMsgWorldCliPing::createMsg(){
|
||||
return new CMsgWorldCliPing();
|
||||
}
|
||||
|
||||
int CMsgWorldCliPing::executeMsg(){
|
||||
cout << "Execute MsgWorldCliPing: " << (int)getSequenceNumber() << "\n";
|
||||
CWorldCliManager * manager = (CWorldCliManager*)getManager();
|
||||
manager->recivePing(getSequenceNumber());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
41
worldsrv/worldclimessage.H
Normal file
41
worldsrv/worldclimessage.H
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _WORLDCLIMESSAGE_H
|
||||
#define _WORLDCLIMESSAGE_H
|
||||
|
||||
#include "msgworld.H"
|
||||
#include "msgsrvcli.H"
|
||||
|
||||
class CMsgWorldCliChangeMasterCell : public CMsgChangeMasterCell {
|
||||
public:
|
||||
CMsgWorldCliChangeMasterCell();
|
||||
static CMsgWorldCliChangeMasterCell * createMsg();
|
||||
virtual int executeMsg();
|
||||
};
|
||||
|
||||
class CMsgWorldCliPing : public CMsgPing {
|
||||
public:
|
||||
CMsgWorldCliPing();
|
||||
static CMsgWorldCliPing * createMsg();
|
||||
virtual int executeMsg();
|
||||
};
|
||||
|
||||
|
||||
#endif // _WORLDCLIMESSAGE_H
|
||||
52
worldsrv/worldcliprotocol.C
Normal file
52
worldsrv/worldcliprotocol.C
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#include "pvvmud.H"
|
||||
#include "worldcliprotocol.H"
|
||||
#include "worldclimanager.H"
|
||||
#include "worldclimessage.H"
|
||||
|
||||
CWorldCliProtocol::CWorldCliProtocol(CSocket * socket,CTimeKeeper * timeKeeper)
|
||||
:CCommunicate(socket,timeKeeper) {
|
||||
|
||||
addMsg((MsgCreateFunc_t)CMsgWorldCliChangeMasterCell::createMsg);
|
||||
addMsg((MsgCreateFunc_t)CMsgWorldCliPing::createMsg);
|
||||
|
||||
}
|
||||
|
||||
void CWorldCliProtocol::quit(){
|
||||
CWorldCliManager * manager = (CWorldCliManager*)getManager();
|
||||
manager->quit();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CWorldCliProtocol::sendAnimation( CWorldAnimation * animation ){
|
||||
CMessage * msg = animation->createMessage();
|
||||
sendMessage(msg,TRUE);
|
||||
}
|
||||
|
||||
|
||||
void CWorldCliProtocol::sendPong( BYTE sequenceNumber, DWORD serverTime ){
|
||||
CMsgPong * msg = new CMsgPong(sequenceNumber,serverTime);
|
||||
sendMessage(msg,TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
38
worldsrv/worldcliprotocol.H
Normal file
38
worldsrv/worldcliprotocol.H
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _WORLDCLIPROTOCOL_H
|
||||
#define _WORLDCLIPROTOCOL_H
|
||||
|
||||
#include "communicate.H"
|
||||
#include "socket.H"
|
||||
#include "worldsrvworld.H"
|
||||
|
||||
class CWorldCliProtocol: public CCommunicate {
|
||||
|
||||
public:
|
||||
CWorldCliProtocol(CSocket * socket, CTimeKeeper * timeKeeper);
|
||||
virtual void quit();
|
||||
|
||||
void sendAnimation(CWorldAnimation * animation);
|
||||
void sendPong( BYTE sequenceNumber, DWORD serverTime );
|
||||
|
||||
};
|
||||
|
||||
#endif // _WORLDCLIPROTOCOL_H
|
||||
49
worldsrv/worldclisrvsocket.C
Normal file
49
worldsrv/worldclisrvsocket.C
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#include "pvvmud.H"
|
||||
#include <iostream.h>
|
||||
#include "worldsrv.H"
|
||||
#include "worldclisrvsocket.H"
|
||||
#include "worldcliprotocol.H"
|
||||
#include "worldclimanager.H"
|
||||
|
||||
|
||||
CWorldCliSrvSocket::CWorldCliSrvSocket(CWorldSrv * worldSrv, char *addr,
|
||||
int port, CTimeKeeper * timeKeeper): CServerSocket(addr,port){
|
||||
m_timeKeeper = timeKeeper;
|
||||
m_worldSrv = worldSrv;
|
||||
m_timeKeeper->addFd(getFileDescriptor(),this,TIMEKEEPER_IN);
|
||||
}
|
||||
|
||||
int CWorldCliSrvSocket::timeKeeperFD(int event){
|
||||
CSocket * socket = accept();
|
||||
socket->setNonBlocking();
|
||||
CWorldCliManager * manager = new CWorldCliManager(m_worldSrv,new CWorldCliProtocol(socket,m_timeKeeper));
|
||||
cout << "New client (" << manager->getId() << "): ";
|
||||
try {
|
||||
cout << socket->getAddress().getHostName() << "\n";
|
||||
} catch (CException * e){
|
||||
cout << "Error: Resolving client hostname\n";
|
||||
delete e;
|
||||
}
|
||||
m_worldSrv->addCliManager(manager);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
41
worldsrv/worldclisrvsocket.H
Normal file
41
worldsrv/worldclisrvsocket.H
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _WORLDCLISRVSOCKET_H
|
||||
#define _WORLDCLISRVSOCKET_H
|
||||
|
||||
#include "socket.H"
|
||||
#include "timekeeper.H"
|
||||
|
||||
class CWorldSrv;
|
||||
|
||||
class CWorldCliSrvSocket : public CServerSocket, public CTimeKeeperItem {
|
||||
CWorldSrv * m_worldSrv;
|
||||
CTimeKeeper * m_timeKeeper;
|
||||
int m_quit;
|
||||
public:
|
||||
CWorldCliSrvSocket(CWorldSrv * worldSrv, char *addr,int port,CTimeKeeper * timeKeeper);
|
||||
|
||||
int getQuit(){ return m_quit; }
|
||||
|
||||
virtual int timeKeeperFD(int event);
|
||||
|
||||
};
|
||||
|
||||
#endif // _WORLDCLISRVSOCKET_H
|
||||
47
worldsrv/worldgos.C
Normal file
47
worldsrv/worldgos.C
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#include "pvvmud.H"
|
||||
#include "worldgos.H"
|
||||
#include "worldsrv.H"
|
||||
|
||||
CWorldGOS::CWorldGOS(CWorldSrv * worldSrv,CTimeKeeper * timeKeeper,CInetAddress *gosAddress):CGOS(timeKeeper,gosAddress
|
||||
){
|
||||
m_worldSrv = worldSrv;
|
||||
}
|
||||
|
||||
void CWorldGOS::error(){
|
||||
}
|
||||
|
||||
void CWorldGOS::geometry(CGeometry * geometry){
|
||||
// m_worldSrv->addGeometry(geometry);
|
||||
delete geometry;
|
||||
}
|
||||
|
||||
void CWorldGOS::material(CMaterial * material){
|
||||
// m_worldSrv->addMaterial(material);
|
||||
delete material;
|
||||
}
|
||||
|
||||
void CWorldGOS::texture(CTexture * texture){
|
||||
// m_worldSrv->addTexture(texture);
|
||||
delete texture;
|
||||
}
|
||||
|
||||
|
||||
39
worldsrv/worldgos.H
Normal file
39
worldsrv/worldgos.H
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _WORLDGOS_H
|
||||
#define _WORLDGOS_H
|
||||
|
||||
#include "gos.H"
|
||||
|
||||
class CWorldSrv;
|
||||
|
||||
class CWorldGOS : public CGOS {
|
||||
CWorldSrv * m_worldSrv;
|
||||
public:
|
||||
CWorldGOS(CWorldSrv * worldSrv,CTimeKeeper * timeKeeper,CInetAddress *gosAddress);
|
||||
|
||||
virtual void error();
|
||||
virtual void geometry(CGeometry * geometry);
|
||||
virtual void material(CMaterial * material);
|
||||
virtual void texture(CTexture * texture);
|
||||
|
||||
};
|
||||
|
||||
#endif // _WORLDGOS_H
|
||||
273
worldsrv/worldsrv.C
Normal file
273
worldsrv/worldsrv.C
Normal file
@@ -0,0 +1,273 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#include "pvvmud.H"
|
||||
#include <iostream.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#include "socket.H"
|
||||
#include "worldsrv.H"
|
||||
#include "worldclimanager.H"
|
||||
#include "worldsrvmanager.H"
|
||||
#include "inetaddress.H"
|
||||
|
||||
CWorldSrv::CWorldSrv(COption *option){
|
||||
|
||||
m_timeKeeper = new CTimeKeeper();
|
||||
m_cliManagerList = new CObjectList();
|
||||
m_srvManager = NULL;
|
||||
m_worldGOS = NULL;
|
||||
m_srvSocket = NULL;
|
||||
m_world = new CWorldSrvWorld();
|
||||
|
||||
CClientSocket * socket = NULL;
|
||||
try {
|
||||
CInetAddress server(option->getString("server"),SERVER_WORLDSRV_PORT);
|
||||
|
||||
socket = new CClientSocket(server.getAddress(),server.getPort());
|
||||
socket->setNonBlocking();
|
||||
cout << "WorldSrv Server manager connected\n";
|
||||
addSrvManager( new CWorldSrvManager(this, new CWorldSrvProtocol(socket,m_timeKeeper)));
|
||||
} catch (CSocketException * e){
|
||||
cout << "Failed to connect to server!\n";
|
||||
delete e;
|
||||
startSrvSocket();
|
||||
}
|
||||
|
||||
try {
|
||||
m_cliSocket = new CWorldCliSrvSocket(this,option->getString("address"),option->getInt("port"),m_timeKeeper);
|
||||
} catch (CSocketException * e){
|
||||
cout << "Failed to create client SrvSocket!\n";
|
||||
delete e;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
m_timeKeeper->addHeartBeat(512,this);
|
||||
|
||||
}
|
||||
|
||||
CWorldSrv::~CWorldSrv(){
|
||||
|
||||
m_timeKeeper->rmHeartBeat(this);
|
||||
|
||||
m_cliManagerList->deleteAll();
|
||||
delete m_cliManagerList;
|
||||
|
||||
if (m_srvManager != NULL) delete m_srvManager;
|
||||
|
||||
m_cliSocket->close();
|
||||
delete m_cliSocket;
|
||||
|
||||
stopSrvSocket();
|
||||
|
||||
delete m_timeKeeper;
|
||||
|
||||
if (m_worldGOS != NULL) delete m_worldGOS;
|
||||
|
||||
}
|
||||
|
||||
void CWorldSrv::setGOS(CInetAddress & gosAddress){
|
||||
cout << "Connecting to GOS: gosAddress not used!\n";
|
||||
if (m_worldGOS != NULL) delete m_worldGOS;
|
||||
try {
|
||||
m_worldGOS = new CWorldGOS(this,m_timeKeeper,&gosAddress);
|
||||
} catch (CException *e) {
|
||||
cout << *e << "Error : in CWorldGOS\n";
|
||||
}
|
||||
}
|
||||
|
||||
CInetAddress &CWorldSrv::getAddress(){
|
||||
return m_cliSocket->getLocalAddress();
|
||||
}
|
||||
|
||||
int CWorldSrv::timeKeeperHB(){
|
||||
// cout << "Heart beat\n";
|
||||
|
||||
if (m_world != NULL) m_world->animate();
|
||||
|
||||
// If clients are marked with quit remove them
|
||||
CObjectListItem * item = m_cliManagerList->getFirst();
|
||||
while (item != NULL){
|
||||
CWorldCliManager * cliManager = (CWorldCliManager*)item->getObject();
|
||||
item = item->getNext();
|
||||
|
||||
if (cliManager->getQuit()){
|
||||
int id = cliManager->getId();
|
||||
removeCliManager(cliManager);
|
||||
cout << "Client " << id << " deleted\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ((m_srvSocket != NULL) && (m_srvSocket->getQuit())){
|
||||
stopSrvSocket();
|
||||
}
|
||||
|
||||
if (m_srvManager != NULL){
|
||||
|
||||
if ( m_srvManager->getQuit()){
|
||||
removeSrvManager(m_srvManager);
|
||||
cout << "WorldSrv Server manager deleted\n";
|
||||
} else {
|
||||
m_srvManager->sendPing();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CWorldSrv::addCliManager(CWorldCliManager * cliManager){
|
||||
m_cliManagerList->addLast((CObject*)cliManager);
|
||||
}
|
||||
|
||||
void CWorldSrv::removeCliManager(CWorldCliManager * cliManager){
|
||||
m_cliManagerList->remove((CObject*)cliManager);
|
||||
delete cliManager;
|
||||
}
|
||||
|
||||
void CWorldSrv::addSrvManager(CWorldSrvManager * srvManager){
|
||||
if (m_srvManager != NULL){
|
||||
cout << "WARNING: Multiple servers connected!!\nDeleting old server\n";
|
||||
delete m_srvManager;
|
||||
}
|
||||
m_srvManager = srvManager;
|
||||
}
|
||||
|
||||
void CWorldSrv::removeSrvManager(CWorldSrvManager * srvManager){
|
||||
if (srvManager != m_srvManager){
|
||||
cout << "WARNING: Removing a not assigned server!\n";
|
||||
delete srvManager;
|
||||
} else {
|
||||
delete m_srvManager;
|
||||
m_srvManager = NULL;
|
||||
startSrvSocket();
|
||||
}
|
||||
}
|
||||
|
||||
void CWorldSrv::startSrvSocket(){
|
||||
if (m_srvSocket != NULL){
|
||||
cout << "WARNING: Server SrvSocket started!\n";
|
||||
}
|
||||
try {
|
||||
m_srvSocket = new CWorldSrvSrvSocket(this,WORLDSRV_SERVER_PORT,m_timeKeeper);
|
||||
cout << "Server SrvSocket started\n";
|
||||
} catch (CSocketException * e){
|
||||
cout << "Failed to create server SrvSocket!\n";
|
||||
delete e;
|
||||
}
|
||||
}
|
||||
|
||||
void CWorldSrv::stopSrvSocket(){
|
||||
if (m_srvSocket != NULL){
|
||||
m_srvSocket->close();
|
||||
delete m_srvSocket;
|
||||
m_srvSocket = NULL;
|
||||
cout << "Server SrvSocket stoped\n";
|
||||
}
|
||||
}
|
||||
|
||||
void CWorldSrv::quit(){
|
||||
m_timeKeeper->stopLoop();
|
||||
}
|
||||
|
||||
void CWorldSrv::restart(){
|
||||
}
|
||||
|
||||
void CWorldSrv::run(){
|
||||
m_timeKeeper->mainLoop();
|
||||
}
|
||||
|
||||
void CWorldSrv::createWorld(){
|
||||
cout << "World created!\n";
|
||||
m_world->clearWorld();
|
||||
}
|
||||
|
||||
/*
|
||||
void CWorldSrv::addCell( DWORD cellId, DWORD geometryId ){
|
||||
cout << "Create cell " << cellId << "\n";
|
||||
m_world->addCell(cellId,geometryId);
|
||||
}
|
||||
|
||||
void CWorldSrv::removeCell( DWORD cellId ){
|
||||
cout << "Delete cell " << cellId << "\n";
|
||||
m_world->removeCell(cellId);
|
||||
}
|
||||
*/
|
||||
|
||||
void CWorldSrv::addObject( DWORD objectId, DWORD geometryId, DWORD parentId,
|
||||
const CPosition & position, const CDirection & direction ){
|
||||
|
||||
cout << "Create object " << objectId << " with geometry " << geometryId
|
||||
<< " parent: ";
|
||||
(parentId != 0xFFFFFFFF ? cout << parentId : cout << -1 );
|
||||
cout << " position " << position << " direction " << direction << "\n";
|
||||
|
||||
m_world->createObject(parentId,"object",objectId,geometryId,position,direction);
|
||||
}
|
||||
|
||||
void CWorldSrv::removeObject( DWORD objectId, DWORD parentId ){
|
||||
|
||||
cout << "Delete object " << objectId << " with parent ";
|
||||
(parentId != 0xFFFFFFFF ? cout << parentId : cout << -1 );
|
||||
cout << "\n";
|
||||
|
||||
m_world->removeObject(objectId,parentId);
|
||||
|
||||
}
|
||||
|
||||
void CWorldSrv::addPVCell( DWORD cellId,
|
||||
DWORD PVCellId, const CPosition & position ){
|
||||
|
||||
cout << "Add PVCell " << PVCellId << " to cell " << cellId
|
||||
<< " with position " << position;
|
||||
|
||||
if (m_world->addPVCell(cellId,PVCellId,position)==NULL){
|
||||
cout << " : Failed";
|
||||
}
|
||||
|
||||
cout << "\n";
|
||||
}
|
||||
|
||||
void CWorldSrv::updatePosition( DWORD objectId, const CPosition& position){
|
||||
cout << "Update position to object " << objectId << " position "
|
||||
<< position << "\n";
|
||||
m_world->updatePosition( objectId, position );
|
||||
}
|
||||
|
||||
void CWorldSrv::updateDirection( DWORD objectId, const CDirection& direction){
|
||||
cout << "Update direction to object " << objectId << " direction "
|
||||
<< direction << "\n";
|
||||
m_world->updateDirection( objectId, direction );
|
||||
}
|
||||
|
||||
void CWorldSrv::updateHierarchy( DWORD objectId, DWORD parentId){
|
||||
cout << "Update hierarchy to object " << objectId << ". New parent "
|
||||
<< parentId << "\n";
|
||||
m_world->updateHierarchy( objectId, parentId );
|
||||
}
|
||||
|
||||
void CWorldSrv::rotate( DWORD objectId, const CDirection& angleSpeed){
|
||||
cout << "Rotate object " << objectId << " with angle speed "
|
||||
<< angleSpeed << "\n";
|
||||
m_world->rotate( objectId, angleSpeed );
|
||||
}
|
||||
|
||||
89
worldsrv/worldsrv.H
Normal file
89
worldsrv/worldsrv.H
Normal file
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _WORLDSRV_H
|
||||
#define _WORLDSRV_H
|
||||
|
||||
#include "timekeeper.H"
|
||||
#include "worldclisrvsocket.H"
|
||||
#include "worldsrvsrvsocket.H"
|
||||
#include "objectlist.H"
|
||||
#include "worldgos.H"
|
||||
#include "worldsrvworld.H"
|
||||
#include "option.H"
|
||||
|
||||
class CWorldCliManager;
|
||||
class CWorldSrvManager;
|
||||
|
||||
class CWorldSrv : public CTimeKeeperItem {
|
||||
|
||||
CTimeKeeper * m_timeKeeper;
|
||||
|
||||
CWorldCliSrvSocket * m_cliSocket;
|
||||
CWorldSrvSrvSocket * m_srvSocket;
|
||||
|
||||
CObjectList * m_cliManagerList;
|
||||
// Don't allow a list of servers
|
||||
CWorldSrvManager * m_srvManager;
|
||||
|
||||
CWorldGOS * m_worldGOS;
|
||||
|
||||
CWorldSrvWorld * m_world;
|
||||
|
||||
public:
|
||||
CWorldSrv(COption *option);
|
||||
virtual ~CWorldSrv();
|
||||
|
||||
CWorldSrvWorld* getWorld(){ return m_world; }
|
||||
|
||||
void setGOS(CInetAddress & gosAddress);
|
||||
|
||||
CInetAddress &getAddress();
|
||||
|
||||
DWORD getTime();
|
||||
|
||||
virtual int timeKeeperHB();
|
||||
|
||||
void addCliManager( CWorldCliManager * cliManager );
|
||||
void removeCliManager( CWorldCliManager * cliManager );
|
||||
|
||||
void addSrvManager( CWorldSrvManager * srvManager );
|
||||
void removeSrvManager( CWorldSrvManager * srvManager );
|
||||
|
||||
void startSrvSocket();
|
||||
void stopSrvSocket();
|
||||
|
||||
void quit();
|
||||
void restart();
|
||||
void run();
|
||||
|
||||
void createWorld();
|
||||
// void addCell( DWORD cellId, DWORD geometryId );
|
||||
// void removeCell( DWORD cellId );
|
||||
void addObject( DWORD objectId, DWORD geometryId, DWORD parentId,
|
||||
const CPosition & position, const CDirection & direction );
|
||||
void removeObject( DWORD objectId, DWORD parentId );
|
||||
void addPVCell( DWORD cellId, DWORD PVCellId, const CPosition & position );
|
||||
void updatePosition( DWORD objectId, const CPosition& position);
|
||||
void updateDirection( DWORD objectId, const CDirection& direction);
|
||||
void updateHierarchy( DWORD objectId, DWORD parentId);
|
||||
void rotate( DWORD objectId, const CDirection& angleSpeed);
|
||||
};
|
||||
|
||||
#endif // _WORLDSRV_H
|
||||
66
worldsrv/worldsrv_main.C
Normal file
66
worldsrv/worldsrv_main.C
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#include "pvvmud.H"
|
||||
#include <signal.h>
|
||||
#include <iostream.h>
|
||||
#include "worldsrv.H"
|
||||
#include "option.H"
|
||||
|
||||
CWorldSrv * worldsrv;
|
||||
|
||||
void signalhandler(int signum){
|
||||
switch(signum){
|
||||
case SIGINT:
|
||||
cout << "Recieved sigint: Closing server!\n";
|
||||
worldsrv->quit();
|
||||
break;
|
||||
case SIGHUP:
|
||||
cout << "Recieved sighup: Restarting server!\n";
|
||||
worldsrv->restart();
|
||||
signal(SIGHUP, signalhandler);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char * argv[]){
|
||||
|
||||
COption option;
|
||||
|
||||
option.setValue("address",'a',"localhost");
|
||||
option.setValue("port",'p',WORLDSRV_CLIENT_PORT);
|
||||
option.setValue("server",'s',"localhost");
|
||||
|
||||
option.loadOption("worldsrv.conf");
|
||||
option.parseArguments(argc,argv);
|
||||
|
||||
// Create World server and run
|
||||
worldsrv = new CWorldSrv(&option);
|
||||
|
||||
// Install signal handlers
|
||||
signal(SIGINT, signalhandler);
|
||||
signal(SIGHUP, signalhandler);
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
|
||||
worldsrv->run();
|
||||
|
||||
delete worldsrv;
|
||||
|
||||
exit(0);
|
||||
}
|
||||
44
worldsrv/worldsrvlistenerlist.C
Normal file
44
worldsrv/worldsrvlistenerlist.C
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#include "pvvmud.H"
|
||||
#include "worldsrvlistenerlist.H"
|
||||
#include "worldclimanager.H"
|
||||
|
||||
CWorldSrvListenerList::CWorldSrvListenerList(){
|
||||
}
|
||||
|
||||
void CWorldSrvListenerList::add( CWorldCliManager * listener ){
|
||||
addLast((CObject*)listener);
|
||||
}
|
||||
|
||||
void CWorldSrvListenerList::remove( CWorldCliManager * listener ){
|
||||
CObjectList::remove((CObject*)listener);
|
||||
}
|
||||
|
||||
void CWorldSrvListenerList::sendAnimation( CWorldAnimation * animation ){
|
||||
CObjectListItem * item = getFirst();
|
||||
while (item != NULL){
|
||||
CWorldCliManager * listener = (CWorldCliManager*)item->getObject();
|
||||
item = item->getNext();
|
||||
listener->sendAnimation( animation );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
46
worldsrv/worldsrvlistenerlist.H
Normal file
46
worldsrv/worldsrvlistenerlist.H
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _WORLDSRVLISTENERLIST_H
|
||||
#define _WORLDSRVLISTENERLIST_H
|
||||
|
||||
#include "objectlist.H"
|
||||
#include "worldsrvworld.H"
|
||||
|
||||
class CWorldCliManager;
|
||||
|
||||
class CWorldSrvListenerList : private CObjectList, public CListener {
|
||||
|
||||
public:
|
||||
CWorldSrvListenerList();
|
||||
|
||||
void add( CWorldCliManager * listener );
|
||||
void remove( CWorldCliManager * listener );
|
||||
|
||||
// Abstract function from CListener
|
||||
void sendAnimation( CWorldAnimation * animation );
|
||||
|
||||
// void addObject( CWorldObject * object );
|
||||
// void removeObject( CWorldObject * object );
|
||||
// void updatePosition( CWorldObject * object );
|
||||
// void updateDirection( CWorldObject * object );
|
||||
|
||||
};
|
||||
|
||||
#endif // _WORLDSRVLISTENERLIST_H
|
||||
112
worldsrv/worldsrvmanager.C
Normal file
112
worldsrv/worldsrvmanager.C
Normal file
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#include <iostream>
|
||||
#include "pvvmud.H"
|
||||
#include "worldsrvmanager.H"
|
||||
#include "msgserver.H"
|
||||
#include "msgsrvcli.H"
|
||||
|
||||
|
||||
CWorldSrvManager::CWorldSrvManager(CWorldSrv * worldSrv, CWorldSrvProtocol * protocol):CManager(protocol){
|
||||
m_worldSrv = worldSrv;
|
||||
m_quit = FALSE;
|
||||
getProtocol()->setName("Server");
|
||||
|
||||
m_pingPong = new CPingPong(MAXPINGPONG);
|
||||
m_pingCounter = 0;
|
||||
m_pingCounterMax = 0;
|
||||
|
||||
}
|
||||
|
||||
CWorldSrvManager::~CWorldSrvManager(){
|
||||
delete m_pingPong;
|
||||
}
|
||||
|
||||
CWorldSrv * CWorldSrvManager::getWorldSrv(){
|
||||
return m_worldSrv;
|
||||
}
|
||||
|
||||
CWorldSrvWorld * CWorldSrvManager::getWorld(){
|
||||
return m_worldSrv->getWorld();
|
||||
}
|
||||
|
||||
CWorldSrvProtocol * CWorldSrvManager::getProtocol(){
|
||||
return (CWorldSrvProtocol*)getCommunicate();
|
||||
}
|
||||
|
||||
void CWorldSrvManager::quit(){
|
||||
cout << "Server marked quit\n";
|
||||
m_quit = TRUE;
|
||||
}
|
||||
|
||||
int CWorldSrvManager::getQuit(){
|
||||
return m_quit;
|
||||
}
|
||||
|
||||
void CWorldSrvManager::hello(){
|
||||
cout << "Hello from server\n";
|
||||
CWorldSrvProtocol * protocol = getProtocol();
|
||||
protocol->sendMessage(new CMsgServerLogin( m_worldSrv->getAddress() ),TRUE);
|
||||
|
||||
sendPing();
|
||||
}
|
||||
|
||||
void CWorldSrvManager::GOSInfo(CInetAddress & gosAddress){
|
||||
cout << "GOS address from server\n";
|
||||
m_worldSrv->setGOS(gosAddress);
|
||||
}
|
||||
|
||||
void CWorldSrvManager::sendPing(){
|
||||
|
||||
m_pingCounter++;
|
||||
|
||||
if (m_pingCounter > m_pingCounterMax){
|
||||
if (m_pingCounterMax < MAXPINGPONG)
|
||||
m_pingCounterMax = m_pingCounter;
|
||||
m_pingCounter = 0;
|
||||
|
||||
DWORD sendTime = getWorld()->getTime();
|
||||
|
||||
BYTE sequenceNumber = m_pingPong->sendPing(sendTime);
|
||||
|
||||
cout << "PING: " << (int)sequenceNumber
|
||||
<< " time " << sendTime << endl;
|
||||
|
||||
CWorldSrvProtocol * protocol = getProtocol();
|
||||
protocol->sendMessage(new CMsgPing( sequenceNumber ),TRUE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CWorldSrvManager::pong(BYTE sequenceNumber, DWORD serverTime){
|
||||
DWORD reciveTime = getWorld()->getTime();
|
||||
|
||||
long timediff = m_pingPong->recivePong(reciveTime,sequenceNumber,serverTime);
|
||||
|
||||
cout << "PONG: sequence number " << (int)sequenceNumber
|
||||
<< " serverTime " << serverTime
|
||||
<< " recive time " << reciveTime
|
||||
<< " time diff " << timediff << endl;
|
||||
|
||||
cout << "Ping info " << *m_pingPong << endl;
|
||||
|
||||
getWorld()->fixTime(timediff);
|
||||
|
||||
}
|
||||
57
worldsrv/worldsrvmanager.H
Normal file
57
worldsrv/worldsrvmanager.H
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _WORLDSRVMANAGER_H
|
||||
#define _WORLDSRVMANAGER_H
|
||||
|
||||
#include "worldsrv.H"
|
||||
#include "worldsrvprotocol.H"
|
||||
#include "manager.H"
|
||||
#include "pingpong.H"
|
||||
|
||||
#define MAXPINGPONG 21
|
||||
|
||||
class CWorldSrvManager: public CManager {
|
||||
CWorldSrv * m_worldSrv;
|
||||
int m_quit;
|
||||
|
||||
CPingPong * m_pingPong;
|
||||
int m_pingCounter;
|
||||
int m_pingCounterMax;
|
||||
|
||||
public:
|
||||
CWorldSrvManager(CWorldSrv * worldSrv, CWorldSrvProtocol * protocol);
|
||||
virtual ~CWorldSrvManager();
|
||||
|
||||
CWorldSrv * getWorldSrv();
|
||||
CWorldSrvWorld * getWorld();
|
||||
CWorldSrvProtocol * getProtocol();
|
||||
|
||||
virtual void quit();
|
||||
int getQuit();
|
||||
|
||||
void hello();
|
||||
void GOSInfo(CInetAddress & gosAddress);
|
||||
|
||||
void sendPing();
|
||||
void pong(BYTE sequenceNumber, DWORD serverTime);
|
||||
|
||||
};
|
||||
|
||||
#endif // _WORLDSRVMANAGER_H
|
||||
256
worldsrv/worldsrvmessage.C
Normal file
256
worldsrv/worldsrvmessage.C
Normal file
@@ -0,0 +1,256 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#include "pvvmud.H"
|
||||
#include "worldsrvmessage.H"
|
||||
#include "worldsrv.H"
|
||||
#include "worldsrvmanager.H"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// MsgWorldSrvHello
|
||||
|
||||
CMsgWorldSrvHello::CMsgWorldSrvHello():CMsgHello(){
|
||||
}
|
||||
|
||||
CMsgWorldSrvHello * CMsgWorldSrvHello::createMsg(){
|
||||
return new CMsgWorldSrvHello();
|
||||
}
|
||||
|
||||
|
||||
int CMsgWorldSrvHello::executeMsg(){
|
||||
CWorldSrvManager * manager = (CWorldSrvManager*)getManager();
|
||||
manager->hello();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// MsgWorldSrvGOSInfo
|
||||
|
||||
CMsgWorldSrvGOSInfo::CMsgWorldSrvGOSInfo():CMsgGOSInfo(){
|
||||
}
|
||||
|
||||
CMsgWorldSrvGOSInfo * CMsgWorldSrvGOSInfo::createMsg(){
|
||||
return new CMsgWorldSrvGOSInfo();
|
||||
}
|
||||
|
||||
|
||||
int CMsgWorldSrvGOSInfo::executeMsg(){
|
||||
CWorldSrvManager * manager = (CWorldSrvManager*)getManager();
|
||||
manager->GOSInfo(*getGOSAddress());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// MsgWorldSrvCommand
|
||||
|
||||
CMsgWorldSrvCommand::CMsgWorldSrvCommand():CMsgCommand(){
|
||||
}
|
||||
|
||||
CMsgWorldSrvCommand * CMsgWorldSrvCommand::createMsg(){
|
||||
return new CMsgWorldSrvCommand();
|
||||
}
|
||||
|
||||
int CMsgWorldSrvCommand::executeMsg(){
|
||||
CWorldSrvManager * manager = (CWorldSrvManager*)getManager();
|
||||
switch (getCommand()){
|
||||
case MSGCOMMAND_ADDWORLD:
|
||||
manager->getWorldSrv()->createWorld();
|
||||
break;
|
||||
case MSGCOMMAND_REMOVEWORLD:
|
||||
cout << "CMsgWorldSrvCommand::executeMsg : Not implemented!!\n";
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// MsgWorldSrvCell
|
||||
|
||||
CMsgWorldSrvCell::CMsgWorldSrvCell():CMsgCell(){
|
||||
}
|
||||
|
||||
CMsgWorldSrvCell * CMsgWorldSrvCell::createMsg(){
|
||||
return new CMsgWorldSrvCell();
|
||||
}
|
||||
|
||||
int CMsgWorldSrvCell::executeMsg(){
|
||||
CWorldSrvManager * manager = (CWorldSrvManager*)getManager();
|
||||
manager->getWorldSrv()->addCell(getCellId(),getGeometryId());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// MsgWorldSrvRemoveCell
|
||||
|
||||
CMsgWorldSrvRemoveCell::CMsgWorldSrvRemoveCell():CMsgRemoveCell(){
|
||||
}
|
||||
|
||||
CMsgWorldSrvRemoveCell * CMsgWorldSrvRemoveCell::createMsg(){
|
||||
return new CMsgWorldSrvRemoveCell();
|
||||
}
|
||||
|
||||
int CMsgWorldSrvRemoveCell::executeMsg(){
|
||||
CWorldSrvManager * manager = (CWorldSrvManager*)getManager();
|
||||
manager->getWorldSrv()->removeCell(getCellId());
|
||||
return TRUE;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// MsgWorldSrvObject
|
||||
|
||||
CMsgWorldSrvObject::CMsgWorldSrvObject():CMsgObject(){
|
||||
}
|
||||
|
||||
CMsgWorldSrvObject * CMsgWorldSrvObject::createMsg(){
|
||||
return new CMsgWorldSrvObject();
|
||||
}
|
||||
|
||||
int CMsgWorldSrvObject::executeMsg(){
|
||||
CWorldSrvManager * manager = (CWorldSrvManager*)getManager();
|
||||
manager->getWorldSrv()->addObject(getObjectId(),getGeometryId(),getParentId(), getPosition(),getDirection());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// MsgWorldSrvRemoveObject
|
||||
|
||||
CMsgWorldSrvRemoveObject::CMsgWorldSrvRemoveObject():CMsgRemoveObject(){
|
||||
}
|
||||
|
||||
CMsgWorldSrvRemoveObject * CMsgWorldSrvRemoveObject::createMsg(){
|
||||
return new CMsgWorldSrvRemoveObject();
|
||||
}
|
||||
|
||||
int CMsgWorldSrvRemoveObject::executeMsg(){
|
||||
CWorldSrvManager * manager = (CWorldSrvManager*)getManager();
|
||||
manager->getWorldSrv()->removeObject(getObjectId(),getParentId());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// MsgWorldSrvPVCell
|
||||
|
||||
CMsgWorldSrvPVCell::CMsgWorldSrvPVCell():CMsgPVCell(){
|
||||
}
|
||||
|
||||
CMsgWorldSrvPVCell * CMsgWorldSrvPVCell::createMsg(){
|
||||
return new CMsgWorldSrvPVCell();
|
||||
}
|
||||
|
||||
int CMsgWorldSrvPVCell::executeMsg(){
|
||||
CWorldSrvManager * manager = (CWorldSrvManager*)getManager();
|
||||
manager->getWorldSrv()->addPVCell(getCellId(),getPVCellId(),getPosition());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// MsgWorldSrvUpdatePosition
|
||||
|
||||
CMsgWorldSrvUpdatePosition::CMsgWorldSrvUpdatePosition():CMsgUpdatePosition(){
|
||||
}
|
||||
|
||||
CMsgWorldSrvUpdatePosition * CMsgWorldSrvUpdatePosition::createMsg(){
|
||||
return new CMsgWorldSrvUpdatePosition();
|
||||
}
|
||||
|
||||
int CMsgWorldSrvUpdatePosition::executeMsg(){
|
||||
CWorldSrvManager * manager = (CWorldSrvManager*)getManager();
|
||||
manager->getWorldSrv()->updatePosition(getObjectId(),getPosition());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// MsgWorldSrvUpdateDirection
|
||||
|
||||
CMsgWorldSrvUpdateDirection::CMsgWorldSrvUpdateDirection():CMsgUpdateDirection(){
|
||||
}
|
||||
|
||||
CMsgWorldSrvUpdateDirection * CMsgWorldSrvUpdateDirection::createMsg(){
|
||||
return new CMsgWorldSrvUpdateDirection();
|
||||
}
|
||||
|
||||
int CMsgWorldSrvUpdateDirection::executeMsg(){
|
||||
CWorldSrvManager * manager = (CWorldSrvManager*)getManager();
|
||||
manager->getWorldSrv()->updateDirection(getObjectId(),getDirection());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// MsgWorldSrvUpdateHierarchy
|
||||
|
||||
CMsgWorldSrvUpdateHierarchy::CMsgWorldSrvUpdateHierarchy():CMsgUpdateHierarchy(){
|
||||
}
|
||||
|
||||
CMsgWorldSrvUpdateHierarchy * CMsgWorldSrvUpdateHierarchy::createMsg(){
|
||||
return new CMsgWorldSrvUpdateHierarchy();
|
||||
}
|
||||
|
||||
int CMsgWorldSrvUpdateHierarchy::executeMsg(){
|
||||
CWorldSrvManager * manager = (CWorldSrvManager*)getManager();
|
||||
manager->getWorldSrv()->updateHierarchy(getObjectId(),getParentId());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// MsgWorldSrvPong
|
||||
|
||||
CMsgWorldSrvPong::CMsgWorldSrvPong():CMsgPong(){
|
||||
}
|
||||
|
||||
CMsgWorldSrvPong * CMsgWorldSrvPong::createMsg(){
|
||||
return new CMsgWorldSrvPong();
|
||||
}
|
||||
|
||||
int CMsgWorldSrvPong::executeMsg(){
|
||||
CWorldSrvManager * manager = (CWorldSrvManager*)getManager();
|
||||
manager->pong(getSequenceNumber(),getServerTime());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// MsgWorldSrvRotate
|
||||
|
||||
CMsgWorldSrvRotate::CMsgWorldSrvRotate():CMsgRotate(){
|
||||
}
|
||||
|
||||
CMsgWorldSrvRotate * CMsgWorldSrvRotate::createMsg(){
|
||||
return new CMsgWorldSrvRotate();
|
||||
}
|
||||
|
||||
int CMsgWorldSrvRotate::executeMsg(){
|
||||
CWorldSrvManager * manager = (CWorldSrvManager*)getManager();
|
||||
manager->getWorldSrv()->rotate(getObjectId(),getAngleSpeed());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
119
worldsrv/worldsrvmessage.H
Normal file
119
worldsrv/worldsrvmessage.H
Normal file
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _WORLDSRVMESSAGE_H
|
||||
#define _WORLDSRVMESSAGE_H
|
||||
|
||||
#include "msgsrvcli.H"
|
||||
#include "msgworld.H"
|
||||
|
||||
class CMsgWorldSrvHello : public CMsgHello {
|
||||
public:
|
||||
CMsgWorldSrvHello();
|
||||
static CMsgWorldSrvHello * createMsg();
|
||||
virtual int executeMsg();
|
||||
};
|
||||
|
||||
class CMsgWorldSrvGOSInfo : public CMsgGOSInfo {
|
||||
public:
|
||||
CMsgWorldSrvGOSInfo();
|
||||
static CMsgWorldSrvGOSInfo * createMsg();
|
||||
virtual int executeMsg();
|
||||
};
|
||||
|
||||
class CMsgWorldSrvCommand : public CMsgCommand {
|
||||
public:
|
||||
CMsgWorldSrvCommand();
|
||||
static CMsgWorldSrvCommand * createMsg();
|
||||
virtual int executeMsg();
|
||||
};
|
||||
|
||||
/*
|
||||
class CMsgWorldSrvCell : public CMsgCell {
|
||||
public:
|
||||
CMsgWorldSrvCell();
|
||||
static CMsgWorldSrvCell * createMsg();
|
||||
virtual int executeMsg();
|
||||
};
|
||||
|
||||
class CMsgWorldSrvRemoveCell : public CMsgRemoveCell {
|
||||
public:
|
||||
CMsgWorldSrvRemoveCell();
|
||||
static CMsgWorldSrvRemoveCell * createMsg();
|
||||
virtual int executeMsg();
|
||||
};
|
||||
*/
|
||||
|
||||
class CMsgWorldSrvObject : public CMsgObject {
|
||||
public:
|
||||
CMsgWorldSrvObject();
|
||||
static CMsgWorldSrvObject * createMsg();
|
||||
virtual int executeMsg();
|
||||
};
|
||||
|
||||
class CMsgWorldSrvRemoveObject : public CMsgRemoveObject {
|
||||
public:
|
||||
CMsgWorldSrvRemoveObject();
|
||||
static CMsgWorldSrvRemoveObject * createMsg();
|
||||
virtual int executeMsg();
|
||||
};
|
||||
|
||||
class CMsgWorldSrvPVCell : public CMsgPVCell {
|
||||
public:
|
||||
CMsgWorldSrvPVCell();
|
||||
static CMsgWorldSrvPVCell * createMsg();
|
||||
virtual int executeMsg();
|
||||
};
|
||||
|
||||
class CMsgWorldSrvUpdatePosition : public CMsgUpdatePosition {
|
||||
public:
|
||||
CMsgWorldSrvUpdatePosition();
|
||||
static CMsgWorldSrvUpdatePosition * createMsg();
|
||||
virtual int executeMsg();
|
||||
};
|
||||
|
||||
class CMsgWorldSrvUpdateDirection : public CMsgUpdateDirection {
|
||||
public:
|
||||
CMsgWorldSrvUpdateDirection();
|
||||
static CMsgWorldSrvUpdateDirection * createMsg();
|
||||
virtual int executeMsg();
|
||||
};
|
||||
|
||||
class CMsgWorldSrvUpdateHierarchy : public CMsgUpdateHierarchy {
|
||||
public:
|
||||
CMsgWorldSrvUpdateHierarchy();
|
||||
static CMsgWorldSrvUpdateHierarchy * createMsg();
|
||||
virtual int executeMsg();
|
||||
};
|
||||
|
||||
class CMsgWorldSrvPong : public CMsgPong {
|
||||
public:
|
||||
CMsgWorldSrvPong();
|
||||
static CMsgWorldSrvPong * createMsg();
|
||||
virtual int executeMsg();
|
||||
};
|
||||
|
||||
class CMsgWorldSrvRotate : public CMsgRotate {
|
||||
public:
|
||||
CMsgWorldSrvRotate();
|
||||
static CMsgWorldSrvRotate * createMsg();
|
||||
virtual int executeMsg();
|
||||
};
|
||||
|
||||
#endif // _WORLDSRVMESSAGE_H
|
||||
146
worldsrv/worldsrvobject.C
Normal file
146
worldsrv/worldsrvobject.C
Normal file
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#include "pvvmud.H"
|
||||
#include "worldsrvobject.H"
|
||||
#include "worldclimanager.H"
|
||||
#include "worldsrvlistenerlist.H"
|
||||
#include "waupdateclientposition.H"
|
||||
#include "wacreateclientobject.H"
|
||||
#include "waremoveclientobject.H"
|
||||
|
||||
CWorldSrvObject::CWorldSrvObject(DWORD objectId, CWorldWorld * world, DWORD geometryId,const CPosition & position, const CDirection & direction ):CWorldObject(objectId,world,geometryId,position,direction){
|
||||
m_listenerList = new CWorldSrvListenerList();
|
||||
}
|
||||
|
||||
CWorldSrvObject::CWorldSrvObject(DWORD objectId, CWorldObject * parent, DWORD geometryId,const CPosition & position, const CDirection & direction ):CWorldObject(objectId,parent,geometryId,position,direction){
|
||||
m_listenerList = NULL;
|
||||
}
|
||||
|
||||
CWorldSrvObject::~CWorldSrvObject(){
|
||||
}
|
||||
|
||||
CPosition CWorldSrvObject::getPosition(CWorldSrvObject * masterCell){
|
||||
CPosition position = CWorldObject::getPosition();
|
||||
|
||||
if (masterCell != this) {
|
||||
CCellPVS * pvs = masterCell->getPVS();
|
||||
CObjectListItem * item = pvs->getFirstPVCell();
|
||||
while (item != NULL){
|
||||
CPVCell * pv = (CPVCell*)item->getObject();
|
||||
|
||||
if (pv->getCellId() == getObjectId()){
|
||||
position = pv->getPosition();
|
||||
break;
|
||||
}
|
||||
|
||||
item = item->getNext();
|
||||
}
|
||||
}
|
||||
|
||||
return position;
|
||||
}
|
||||
|
||||
void CWorldSrvObject::addListener(CWorldCliManager * listener){
|
||||
|
||||
cdebug << "CWorldSrvObject::addListener( " << listener->getName() << " ) to object " << getObjectId() << "\n";
|
||||
|
||||
m_listenerList->add(listener);
|
||||
|
||||
sendHierarchy(listener);
|
||||
|
||||
}
|
||||
|
||||
void CWorldSrvObject::sendHierarchy(CWorldCliManager * listener){
|
||||
|
||||
// Send object
|
||||
|
||||
CWACreateClientObject * wacreate = new CWACreateClientObject(getObjectId(),
|
||||
getGeometryId(),getParentId(),
|
||||
getPosition(listener->getMasterCell()),
|
||||
getDirection());
|
||||
|
||||
listener->sendAnimation( wacreate );
|
||||
|
||||
delete wacreate;
|
||||
|
||||
// Find and send animations
|
||||
|
||||
CWorldSrvWorld * world = (CWorldSrvWorld*)getWorld();
|
||||
world->sendObjectAnimation(getObjectId(),listener);
|
||||
|
||||
// Send sub objects
|
||||
|
||||
CObjectListItem * item = getFirst();
|
||||
while (item != NULL){
|
||||
CWorldSrvObject * object = (CWorldSrvObject*)item->getObject();
|
||||
item = item->getNext();
|
||||
|
||||
object->sendHierarchy(listener);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CWorldSrvObject::removeListener(CWorldCliManager * listener){
|
||||
m_listenerList->remove(listener);
|
||||
|
||||
CWorldWorld * world = getWorld();
|
||||
|
||||
CWARemoveClientObject * waremove = new CWARemoveClientObject(getObjectId(),
|
||||
getParentId());
|
||||
|
||||
listener->sendAnimation( waremove );
|
||||
|
||||
delete waremove;
|
||||
|
||||
}
|
||||
|
||||
void CWorldSrvObject::updateListener(CWorldCliManager * listener){
|
||||
|
||||
CWorldWorld * world = getWorld();
|
||||
CWAUpdateClientPosition * waupdate =
|
||||
new CWAUpdateClientPosition(getObjectId(),
|
||||
getPosition(listener->getMasterCell()));
|
||||
|
||||
listener->sendAnimation( waupdate );
|
||||
|
||||
delete waupdate;
|
||||
|
||||
}
|
||||
|
||||
CListener* CWorldSrvObject::getListener(){
|
||||
CWorldSrvObject * parent;
|
||||
|
||||
cdebug << "Object " << getObjectId() << " asked for listeners!\n";
|
||||
|
||||
if (m_listenerList != NULL) return m_listenerList;
|
||||
|
||||
parent = (CWorldSrvObject*)getParent();
|
||||
if (parent != NULL){
|
||||
return parent->getListener();
|
||||
}
|
||||
|
||||
cdebug << "Failed to find listener!\n";
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
54
worldsrv/worldsrvobject.H
Normal file
54
worldsrv/worldsrvobject.H
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _WORLDSRVOBJECT_H
|
||||
#define _WORLDSRVOBJECT_H
|
||||
|
||||
#include "worldobject.H"
|
||||
|
||||
class CWorldCliManager;
|
||||
class CWorldSrvListenerList;
|
||||
|
||||
class CWorldSrvObject : public CWorldObject {
|
||||
|
||||
CWorldSrvListenerList * m_listenerList;
|
||||
|
||||
public:
|
||||
CWorldSrvObject(DWORD objectId, CWorldWorld * world, DWORD geometryId,const CPosition & position, const CDirection & direction );
|
||||
CWorldSrvObject(DWORD objectId, CWorldObject * parent, DWORD geometryId,const CPosition & position, const CDirection & direction );
|
||||
virtual ~CWorldSrvObject();
|
||||
|
||||
CPosition getPosition(CWorldSrvObject * masterCell);
|
||||
|
||||
void addListener(CWorldCliManager * listener);
|
||||
void removeListener(CWorldCliManager * listener);
|
||||
void updateListener(CWorldCliManager * listener);
|
||||
|
||||
virtual CListener * getListener();
|
||||
|
||||
void sendHierarchy(CWorldCliManager * listener);
|
||||
|
||||
// void sendAddCell(CWorldCliManager * listener);
|
||||
// void sendRemoveCell(CWorldCliManager * listener);
|
||||
// void sendAddObject(CWorldCliManager * listener);
|
||||
// void sendRemoveObject(CWorldCliManager * listener);
|
||||
|
||||
};
|
||||
|
||||
#endif // _WORLDSRVOBJECT_H
|
||||
47
worldsrv/worldsrvprotocol.C
Normal file
47
worldsrv/worldsrvprotocol.C
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#include "pvvmud.H"
|
||||
#include "worldsrvprotocol.H"
|
||||
#include "worldsrvmanager.H"
|
||||
#include "worldsrvmessage.H"
|
||||
|
||||
CWorldSrvProtocol::CWorldSrvProtocol(CSocket * socket,CTimeKeeper * timeKeeper)
|
||||
:CCommunicate(socket,timeKeeper) {
|
||||
addMsg((MsgCreateFunc_t)CMsgWorldSrvHello::createMsg);
|
||||
addMsg((MsgCreateFunc_t)CMsgWorldSrvGOSInfo::createMsg);
|
||||
addMsg((MsgCreateFunc_t)CMsgWorldSrvCommand::createMsg);
|
||||
// addMsg((MsgCreateFunc_t)CMsgWorldSrvCell::createMsg);
|
||||
// addMsg((MsgCreateFunc_t)CMsgWorldSrvRemoveCell::createMsg);
|
||||
addMsg((MsgCreateFunc_t)CMsgWorldSrvObject::createMsg);
|
||||
addMsg((MsgCreateFunc_t)CMsgWorldSrvRemoveObject::createMsg);
|
||||
addMsg((MsgCreateFunc_t)CMsgWorldSrvPVCell::createMsg);
|
||||
addMsg((MsgCreateFunc_t)CMsgWorldSrvUpdatePosition::createMsg);
|
||||
addMsg((MsgCreateFunc_t)CMsgWorldSrvUpdateDirection::createMsg);
|
||||
addMsg((MsgCreateFunc_t)CMsgWorldSrvUpdateHierarchy::createMsg);
|
||||
addMsg((MsgCreateFunc_t)CMsgWorldSrvPong::createMsg);
|
||||
addMsg((MsgCreateFunc_t)CMsgWorldSrvRotate::createMsg);
|
||||
}
|
||||
|
||||
void CWorldSrvProtocol::quit(){
|
||||
CWorldSrvManager * manager = (CWorldSrvManager*)getManager();
|
||||
|
||||
manager->quit();
|
||||
}
|
||||
|
||||
35
worldsrv/worldsrvprotocol.H
Normal file
35
worldsrv/worldsrvprotocol.H
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _WORLDSRVPROTOCOL_H
|
||||
#define _WORLDSRVPROTOCOL_H
|
||||
|
||||
#include "communicate.H"
|
||||
#include "socket.H"
|
||||
|
||||
class CWorldSrvProtocol: public CCommunicate {
|
||||
|
||||
public:
|
||||
CWorldSrvProtocol(CSocket * socket, CTimeKeeper * timeKeeper);
|
||||
|
||||
virtual void quit();
|
||||
|
||||
};
|
||||
|
||||
#endif // _WORLDSRVPROTOCOL_H
|
||||
54
worldsrv/worldsrvsrvsocket.C
Normal file
54
worldsrv/worldsrvsrvsocket.C
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#include "pvvmud.H"
|
||||
#include <iostream.h>
|
||||
#include "worldsrv.H"
|
||||
#include "worldsrvsrvsocket.H"
|
||||
#include "worldsrvprotocol.H"
|
||||
#include "worldsrvmanager.H"
|
||||
|
||||
|
||||
CWorldSrvSrvSocket::CWorldSrvSrvSocket(CWorldSrv * worldSrv, int port, CTimeKeeper * timeKeeper): CServerSocket(port){
|
||||
m_timeKeeper = timeKeeper;
|
||||
m_worldSrv = worldSrv;
|
||||
m_quit = FALSE;
|
||||
m_timeKeeper->addFd(getFileDescriptor(),this,TIMEKEEPER_IN);
|
||||
}
|
||||
|
||||
int CWorldSrvSrvSocket::timeKeeperFD(int event){
|
||||
CSocket * socket = accept();
|
||||
socket->setNonBlocking();
|
||||
CWorldSrvManager * manager = new CWorldSrvManager(m_worldSrv,new CWorldSrvProtocol(socket,m_timeKeeper));
|
||||
cout << "New server: ";
|
||||
try {
|
||||
cout << socket->getAddress().getHostName() << "\n";
|
||||
} catch (CException * e){
|
||||
cout << "Error: Resolving client hostname\n";
|
||||
delete e;
|
||||
}
|
||||
m_worldSrv->addSrvManager(manager);
|
||||
|
||||
// Close srvSocket when server accepted
|
||||
close();
|
||||
m_quit = TRUE;
|
||||
|
||||
return FALSE; // REMOVE this timeKeeperItem from timeKeeper
|
||||
}
|
||||
|
||||
41
worldsrv/worldsrvsrvsocket.H
Normal file
41
worldsrv/worldsrvsrvsocket.H
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _WORLDSRVSRVSOCKET_H
|
||||
#define _WORLDSRVSRVSOCKET_H
|
||||
|
||||
#include "socket.H"
|
||||
#include "timekeeper.H"
|
||||
|
||||
class CWorldSrv;
|
||||
|
||||
class CWorldSrvSrvSocket : public CServerSocket, public CTimeKeeperItem {
|
||||
CWorldSrv * m_worldSrv;
|
||||
CTimeKeeper * m_timeKeeper;
|
||||
int m_quit;
|
||||
public:
|
||||
CWorldSrvSrvSocket(CWorldSrv * worldSrv, int port,CTimeKeeper * timeKeeper);
|
||||
|
||||
int getQuit(){ return m_quit; }
|
||||
|
||||
virtual int timeKeeperFD(int event);
|
||||
|
||||
};
|
||||
|
||||
#endif // _WORLDSRVSRVSOCKET_H
|
||||
54
worldsrv/worldsrvworld.C
Normal file
54
worldsrv/worldsrvworld.C
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#include "pvvmud.H"
|
||||
#include "worldsrvworld.H"
|
||||
#include "worldanimation.H"
|
||||
#include "worldclimanager.H"
|
||||
|
||||
CWorldSrvWorld::CWorldSrvWorld():CWorldWorld(){
|
||||
|
||||
}
|
||||
|
||||
CWorldSrvWorld::~CWorldSrvWorld(){
|
||||
}
|
||||
|
||||
CWorldObject * CWorldSrvWorld::newObject(char* objectName,DWORD objectId,
|
||||
CWorldObject * parent, DWORD geometryId,
|
||||
const CPosition & position, const CDirection & direction )
|
||||
{
|
||||
|
||||
if (parent == NULL)
|
||||
return new CWorldSrvObject(objectId,this,geometryId,position,direction);
|
||||
else
|
||||
return new CWorldSrvObject(objectId,parent,geometryId,position,direction);
|
||||
|
||||
}
|
||||
|
||||
CListener * CWorldSrvWorld::getListener(){
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void CWorldSrvWorld::sendObjectAnimation( DWORD objectId,
|
||||
CWorldCliManager * listener)
|
||||
{
|
||||
CWorldAnimationList * animationList = getAnimationList();
|
||||
animationList->sendObjectAnimation( objectId, listener );
|
||||
}
|
||||
|
||||
40
worldsrv/worldsrvworld.H
Normal file
40
worldsrv/worldsrvworld.H
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _WORLDSRVWORLD_H
|
||||
#define _WORLDSRVWORLD_H
|
||||
|
||||
#include "worldworld.H"
|
||||
#include "worldsrvobject.H"
|
||||
|
||||
class CWorldSrvWorld : public CWorldWorld {
|
||||
|
||||
public:
|
||||
CWorldSrvWorld();
|
||||
virtual ~CWorldSrvWorld();
|
||||
|
||||
virtual CWorldObject * newObject(char * objectName,DWORD objectId, CWorldObject * parent, DWORD geometryId,const CPosition & position, const CDirection & direction );
|
||||
|
||||
CListener * getListener();
|
||||
|
||||
void sendObjectAnimation(DWORD objectId,CWorldCliManager * listener);
|
||||
|
||||
};
|
||||
|
||||
#endif // _WORLDSRVWORLD_H
|
||||
Reference in New Issue
Block a user