diff --git a/.vs/ProjectSettings.json b/.vs/ProjectSettings.json new file mode 100644 index 0000000..0cf5ea5 --- /dev/null +++ b/.vs/ProjectSettings.json @@ -0,0 +1,3 @@ +{ + "CurrentProjectSetting": "No Configurations" +} \ No newline at end of file diff --git a/.vs/VSWorkspaceState.json b/.vs/VSWorkspaceState.json new file mode 100644 index 0000000..2200cc7 --- /dev/null +++ b/.vs/VSWorkspaceState.json @@ -0,0 +1,3 @@ +{ + "PreviewInSolutionExplorer": false +} \ No newline at end of file diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite new file mode 100644 index 0000000..11631d6 Binary files /dev/null and b/.vs/slnx.sqlite differ diff --git a/README.md b/README.md index b039796..0bda83a 100644 --- a/README.md +++ b/README.md @@ -1,148 +1,183 @@ -# Install - -## Questions? -Find us in Discord: https://discord.gg/yuDngyj - -## CentOS 7 - -### AWS -* Create a new EC2 instance in your region of choice. -* For now use CentOS. Technically any distro should work but Underlight uses CentOS for its SELinux capabilities. Note: Amazon doesn't have an AMI of its own for CentOS, but you can get it for free in the AMI Marketplace. -* Open ports 7500-7509 TCP in/out. -* Open port 80 if you want an HTTP server. -* Open all inbound/outbound UDP traffic. This will be necessary for agents. -* Log on as centos@ec2-blah.12.34.56.78 with the pem/ppk provided during setup of your instance. -* sudo adduser ulprod -* sudo su -* cd ~ulprod -* cat authorized_keys -* Now paste your public SSH key into here. It can be the same as the one for your root access but it SHOULDN'T BE, I mean are you INSANE? -* chmod 700 .ssh/ -* chmod 600 authorized_keys -* restorecon -R -v .ssh - -### Build Dependencies -- Run these as root! - -`yum install -y epel-release` - -`yum update -y` - -`yum groupinstall -y "Development Tools"` - -`yum install -y bind-utils network-tools pwgen \ - p7zip tcsh vim-enhanced screen telnet \ - wget pth pth-devel gdbm-devel gdbm dbi \ - zlib-devel asciidoc pkgconfig \ - python34 python34-setuptools perl-DBD-mysql` - -`easy_install-3.4 pip` - -### Ninja - -`cd /usr/src` - -`git clone git://github.com/ninja-build/ninja.git` - -`cd ninja` - -`git checkout release` - -`./configure.py --bootstrap` - -`./ninja rpm` - -`rpm -i ` - -Verify: `ninja` - -### Meson - -`pip3 install meson=0.44` - -Verify: `meson` - -### Install MariaDB - -`cd /etc/yum.repos.d` -`vim MariaDB.repo` -* Add this to that file in vim -`[mariadb] -name = MariaDB -baseurl = http://yum.mariadb.org/10.1/centos7-amd64 -gpgkey = https://yum.mariadb.org/RPM-GPG-KEY-MariaDB -gpgcheck = 1 -` - -`yum update -y` - -`yum install MariaDB-server MariaDB-client MariaDB-devel -y` - -`systemctl enable mariadb` - -`systemctl start mariadb` - -`mysql_secure_installation` - -Note: Be sure to remember the root password for MariaDB. This will be needed -for configuring the server after building. - -`cd /usr/lib64` -`ln -s libmysqlclient.so.18 libmysqlclient.so` - -`vi /etc/my.cnf.d/server.cnf` - -Uncomment the line bind-address=0.0.0.0 and enable skip-name-resolve - -``` - [mariadb] - ... - bind-address=0.0.0.0 - skip-name-resolve - ... -``` - -Restart MariaDB - -`systemctl restart mariadb` - -### Clone Repository & Build - -For security it is best to build and run server as a regular user. The -development environment user is 'uldev'. The test and production servers use -'ulprod'. The instructions following assume cloning and building will be done -from the current user home directory. - -`git clone https://github.com/openunderlight/ULServer` - -`cd $HOME/ulserver/build` - -`meson ..` - -`ninja` - -### Install Server - -`cd $HOME/ulserver/build/scripts` - -`./install.sh` - -Follow the prompts for entering the root password and IP address assignment. - -### Load Level Files - -Copy the server level files generated by the level editor to $HOME/lyra/src - -`cd $HOME/lyra/src` - -`make level` - -### Start Server - -`cd $HOME/lyra/bin` - -`./ulctl start` - -### Shutdown Server - -`cd $HOME/lyra/bin` -`./ulctl stop` +Install +Questions? +Find us in Discord: https://discord.gg/yuDngyj + +You may use AWS new ECT instance in region of choice or as I did for this virtualbox, instructions on my setup below: + +VIRTUALBOX ubuntu setup / config: + +Ubuntu 18.04 LTS https://www.ubuntu.com/download/server +Virtualbox 5.2.18r124319 https://www.virtualbox.org/wiki/Downloads + + +Following are my settings, yours may vary. + +Open Virtualbox Manager +Create New vm +Name: Ubuntu +Type: Linux +Version Ubuntu (64-bit) + +Memory Size: 8192 (or whatever you want to dedicate to it) + + +Create a virtual hard disk now +VDI +Dynamically Allocated + + +type in or select by clicking file folder icon, where you want your virtual hard disk to be created. +I choose D:\vboxdrive\ubuntu.vdi +yours may be C:\Users\whateveryourusernameis\VirtualBox VMs\ubuntu +or wherever you choose and have space. + +Select disk space you want to give it with slider bar or type it. +all in all should take up around 5.1gb installed but give space to grow +10gb should be a good starting point. + + +Now you should see your Ubuntu vm, Left click it once, then click on settings. +Click on network tab, click on attached to: drop down, select Bridged Adapter click ok. + + +You'll see a pop up, "Select start-up disk" +click on the little folder with green arrow, find and select +ubuntu-18.04.1-live-server-amd64.iso (or appropriate name) + + +Select English or whatever language prefered. + + +Install Ubuntu + + +select network + + +enter proxy server if you have one + + +mirror for alt install if you use it. + + +Use entire disk + + +select disk +done +The development environment user is 'uldev'. The test and production servers use +'ulprod'. The instructions following assume cloning and building will be done +from the current user home directory. + +name: ulprod +server name: ulprod +username: ulprod +pass: thisisabadpasswordchangeme +pass: thisisabadpasswordchangeme + +install any packages or popular "snaps" +selected none + + +Installation finished +reboot now + + + +Setting up UBUNTU for ul server: + +Login: ulprod +Pass: thisisabadpasswordchangeme + + +sudo apt update && sudo apt dist-upgrade && sudo apt autoremove +Pass:thisisabadpasswordchangeme + +sudo do-release-upgrade -d + +sudo apt-get update +reboot to make sure changes are applied if updated. + +sudo add-apt-repository main; +sudo add-apt-repository universe; +sudo add-apt-repository restricted; +sudo add-apt-repository multiverse; +sudo apt update +sudo apt upgrade +sudo apt update +sudo apt-get update +reboot to make sure changes are applied if updated. + +sudo apt-get install build-essential mtools python-pip python3-pip ninja-build meson libpth-dev libgdbm-dev tcsh libgdbm-dev pwgen -y +sudo apt update +reboot to make sure changes are applied if updated. + +Install MariaDB + +curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash +apt update +sudo apt install software-properties-common mariadb-server libmysqlclient-dev -y +mysql_secure_installation +Enter root password (KEEP THIS SAFE, and remember it please) + + + + + +lets check firewall and open ports. + +sudo ufw status +Status:inactive + +sudo ufw enable +Firewall is active and enabled on system startup + +sudo ufw allow 7500:7509/tcp +sudo ufw allow 1:65535/udp +sudo ufw allow 22/tcp +sudo ufw allow 3306/tcp + +confirm open ports .. +sudo ufw status + +Clone Repository & Build +For security it is best to build and run server as a regular user. The development environment user is 'uldev'. The test and production servers use 'ulprod'. The instructions following assume cloning and building will be done from the current user home directory. + +cd ~ + +git clone -b ubuntu_build https://github.com/christyganger/ULServer + +cd $HOME/ULServer/build + +meson .. + +ninja + +cd ~/ULServer/build/scripts + + + +sudo ./install.sh +enter the database root password you made before. + +Available IP addresses +127.0.0.1 + +cd ~/lyra/bin + +To start the server: +./ulctl start + +To stop the server: +./ulctl stop + +To verify it's running. +ps -ef | grep game + +to uninstall and (for whatever reason) the database and users of db ( can be repeated for each host if there are multiple entries for users in mysql.) +cd ~/ULServer/build/scripts/ +./uninstall.sh + +To reinstall +cd ~/ULServer/build/scripts/ +./install.sh diff --git a/build/scripts/install.sh b/build/scripts/install.sh index 848899f..4a618da 100755 --- a/build/scripts/install.sh +++ b/build/scripts/install.sh @@ -1,7 +1,13 @@ #!/bin/bash +if [ "$(id -u)" = "0" ]; then + echo "Please don't run as sudo" + exit 1 +fi + # Enables egrep-style extended pattern matching -shopt -s extglob +#shopt -s extglob +# replaced above by doing bin bash instead of tcsh # Required directories INSTALLDIR=$HOME/lyra @@ -23,7 +29,10 @@ install_binaries() { cp -v ../server/leveld/leveld $SBINDIR echo "Copying utility binaries" - cp -v ../util/!(*@exe) $BINDIR + # cp -v ../util/!(*@exe) $BINDIR + #above no longer works replacing with below + #swipped and modified below from https://stackoverflow.com/questions/44402916/copy-only-executable-files-cross-platform + find ../util/ -type f -exec test -x {} \; -exec cp -v {} "$BINDIR/" \; } install_scripts() { @@ -45,15 +54,16 @@ echo -n "Please enter the database root password:" read -s ROOTPASS echo -echo "Available IP addresses: " `hostname -I` +echo -e "Available IP addresses: " `hostname -I` +echo -e "If your using this computer for database use 127.0.0.1" echo -n "Please enter the database IP address:" read IPADDR # Initialize variables #IPADDR=`hostname -I` DBPORT=3306 -DBADMIN="support@underlight.com" -DBRETURNEMAIL="support@underlight.com" +DBADMIN="support@example.com" +DBRETURNEMAIL="support@example.com" DBKEY="H16 90293311ALKWEVB" DBSALT="3A" DBPASS=`pwgen 15 1` @@ -63,6 +73,7 @@ echo "Creating directories" mkdir -v -p $INSTALLDIR $SBINDIR $BINDIR $DBDIR $SRCDIR $VARDIR $LIBDIR mkdir -v -p $VARDIR/pid $VARDIR/log $VARDIR/text + install_binaries install_scripts @@ -91,6 +102,7 @@ done mysql -u root -p"$ROOTPASS" -e "UPDATE ul_server.server SET host_name = '$IPADDR'" + echo echo "Install complete" diff --git a/build/scripts/uninstall.sh b/build/scripts/uninstall.sh index ec038a9..6e3b3a2 100755 --- a/build/scripts/uninstall.sh +++ b/build/scripts/uninstall.sh @@ -1,12 +1,18 @@ #!/bin/bash -# Enables egrep-style extended pattern matching -shopt -s extglob +if [ "$(id -u)" = "0" ]; then + echo "Please don't run with sudo" + exit 1 +fi +DATABASES=(ul_billing ul_guild ul_item ul_level ul_player ul_server) echo -n "Please enter the database root password:" read -s ROOTPASS -DATABASES=(ul_billing ul_guild ul_item ul_level ul_player ul_server) +echo -e "Available IP ADDRESSES: "`hostname -I` +echo -e "it's possible it's localhost, or 127.0.0.1" +echo -n "What is the ip to your database server: " +read IPADDR # Required directories INSTALLDIR=$HOME/lyra @@ -15,7 +21,8 @@ rm -rf $INSTALLDIR for DATABASE in ${DATABASES[@]} do - mysql -u root -p"$ROOTPASS" -e "DROP DATABASE $DATABASE" + mysql -u root -p"$ROOTPASS" -e "DROP DATABASE $DATABASE" + mysql -u root -p"$ROOTPASS" -e "DROP USER $DATABASE@$IPADDR"; done echo diff --git a/include/LmParty.h b/include/LmParty.h index ec76c77..d3a72d7 100644 --- a/include/LmParty.h +++ b/include/LmParty.h @@ -1,6 +1,6 @@ // LmParty.h -*- C++ -*- -// $Id: LmParty.h,v 1.2 1997-11-17 14:05:12-08 jason Exp $ -// Copyright 1996-1997 Lyra LLC, All rights reserved. +// $Id: LmParty.h,v 1.6 1997-07-09 19:24:52-07 jason Exp $ +// Copyright 1996-1997 Lyra LLC, All rights reserved. // // "character party" class @@ -56,7 +56,6 @@ class LmParty { private: int index_of(lyra_id_t playerid) const; - lyra_id_t creatorid_; lyra_id_t leaderid_; int num_members_; diff --git a/include/LmParty.i b/include/LmParty.i index bc16d69..26bfe42 100644 --- a/include/LmParty.i +++ b/include/LmParty.i @@ -1,5 +1,5 @@ // LmParty.i -*- C++ -*- -// $Id: LmParty.i,v 1.2 1997-11-17 14:05:12-08 jason Exp $ +// $Id: LmParty.i,v 1.3 1997-07-18 16:04:59-07 jason Exp $ // Copyright 1996-1997 Lyra LLC, All rights reserved. // // optionally inlined methods/functions @@ -46,11 +46,6 @@ INLINE lyra_id_t LmParty::LeaderID() const return leaderid_; } -INLINE lyra_id_t LmParty::CreatorID() const -{ - return creatorid_; -} - INLINE lyra_id_t LmParty::PlayerID(int index) const { return members_[index]; diff --git a/include/LyraDefs.h b/include/LyraDefs.h index cb00cd1..d0ba7c5 100644 --- a/include/LyraDefs.h +++ b/include/LyraDefs.h @@ -62,7 +62,7 @@ struct ByteOrder { // global constants that don't belong anywhere else struct Lyra { enum { - GAME_VERSION = 11386, // build / protocol version number (MUST be 5 digits) + GAME_VERSION = 11388, // build / protocol version number (MUST be 5 digits) GAME_SUBVERSION = GAME_VERSION, ID_UNKNOWN = 0, // invalid id @@ -226,9 +226,9 @@ typedef unsigned int realmid_t; // backwards compatibility #endif // on Linux, include pth.h to use soft system call mapping for user-level threads -// on Win32, alias all of pth_ types and calls to use pthread_ +// on Win32, alias all of pth_ types and calls to use pthread_ #if !defined(WIN32) -#ifndef PTH_SYSCALL_SOFT +#ifndef PTH_SYSCALL_SOFT #define PTH_SYSCALL_SOFT 1 #endif #include diff --git a/include/lmparty.h b/include/lmparty.h index 51b18e8..d3a72d7 100644 --- a/include/lmparty.h +++ b/include/lmparty.h @@ -1,6 +1,6 @@ // LmParty.h -*- C++ -*- // $Id: LmParty.h,v 1.6 1997-07-09 19:24:52-07 jason Exp $ -// Copyright 1996-1997 Lyra LLC, All rights reserved. +// Copyright 1996-1997 Lyra LLC, All rights reserved. // // "character party" class @@ -47,6 +47,7 @@ class LmParty { bool IsFull() const; bool HasPlayer(lyra_id_t playerid) const; lyra_id_t LeaderID() const; + lyra_id_t CreatorID() const; lyra_id_t PlayerID(int index) const; void Dump(FILE* f, int indent = 0) const; @@ -55,7 +56,7 @@ class LmParty { private: int index_of(lyra_id_t playerid) const; - + lyra_id_t creatorid_; lyra_id_t leaderid_; int num_members_; lyra_id_t members_[MAX_PARTYSIZE]; diff --git a/libsrc/db/LmGlobalDB.h b/libsrc/db/LmGlobalDB.h index c1b1b7e..a4c008a 100644 --- a/libsrc/db/LmGlobalDB.h +++ b/libsrc/db/LmGlobalDB.h @@ -1,6 +1,6 @@ // LmGlobalDB.h -*- C++ -*- // $Id: LmGlobalDB.h,v 1.10 1997-12-05 14:50:48-08 jason Exp $ -// Copyright 1996-1997 Lyra LLC, All rights reserved. +// Copyright 1996-1997 Lyra LLC, All rights reserved. // // global properties "database" @@ -14,6 +14,7 @@ #include #include "LyraDefs.h" + // forward declarations // the class diff --git a/libsrc/db/LmPlayerNameMap.h b/libsrc/db/LmPlayerNameMap.h index 0e527ae..19aede2 100644 --- a/libsrc/db/LmPlayerNameMap.h +++ b/libsrc/db/LmPlayerNameMap.h @@ -1,6 +1,6 @@ // LmPlayerNameMap.h -*- C++ -*- // $Id: LmPlayerNameMap.h,v 1.4 1997-11-06 18:20:59-08 jason Exp $ -// Copyright 1996-1997 Lyra LLC, All rights reserved. +// Copyright 1996-1997 Lyra LLC, All rights reserved. // // map between player names/ids diff --git a/libsrc/liblyra.cbp b/libsrc/liblyra.cbp new file mode 100644 index 0000000..953e3f6 --- /dev/null +++ b/libsrc/liblyra.cbp @@ -0,0 +1,15 @@ + + + + + + diff --git a/libsrc/liblyra.layout b/libsrc/liblyra.layout new file mode 100644 index 0000000..a7c1ff1 --- /dev/null +++ b/libsrc/liblyra.layout @@ -0,0 +1,5 @@ + + + + + diff --git a/libsrc/liblyra.vcxproj b/libsrc/liblyra.vcxproj index f3377a4..e879bda 100644 --- a/libsrc/liblyra.vcxproj +++ b/libsrc/liblyra.vcxproj @@ -21,6 +21,7 @@ {CC05C14E-25B3-4A24-BB38-622B5979A7ED} MakeFileProj + 8.1 @@ -471,4 +472,4 @@ - \ No newline at end of file + diff --git a/libsrc/pth/PTh.cpp b/libsrc/pth/PTh.cpp index 6c4a8a0..f3ec933 100644 --- a/libsrc/pth/PTh.cpp +++ b/libsrc/pth/PTh.cpp @@ -55,7 +55,7 @@ int PTh::Create(const PThAttr* p_Attr) return pthread_create(&thread_, (p_Attr ? &p_Attr->attr_ : 0), entry, this); #else - // create the stack to be used for the thread + // create the stack to be used for the thread // we can't trust the pTh memory management! unsigned int stacksize; p_Attr->GetStackSize(&stacksize); diff --git a/libsrc/pth/PTh.h b/libsrc/pth/PTh.h index d822823..1d6c403 100644 --- a/libsrc/pth/PTh.h +++ b/libsrc/pth/PTh.h @@ -18,7 +18,7 @@ // PTh class -class PTh +class PTh { public: @@ -39,7 +39,7 @@ class PTh bool IsRunning() const; bool IsActive() const; - + #ifdef WIN32 pthread_t Thread() const; // return this thread's id static pthread_t Self(); // return caller's id diff --git a/libsrc/pth/PThAttr.h b/libsrc/pth/PThAttr.h index 8745181..1c6c38c 100644 --- a/libsrc/pth/PThAttr.h +++ b/libsrc/pth/PThAttr.h @@ -25,7 +25,7 @@ class PThAttr { // API methods int Init(); // scope is meaningless with pTh user sthreads - // int GetScope(int* contentionscope) + // int GetScope(int* contentionscope) // int SetScope(int contentionscope); const; // int SetDetachState(int detachstate); // int GetDetachState(int* detachstate) const; diff --git a/libsrc/pth/PThMutex.h b/libsrc/pth/PThMutex.h index 9f47140..cacdf94 100644 --- a/libsrc/pth/PThMutex.h +++ b/libsrc/pth/PThMutex.h @@ -36,7 +36,7 @@ class PThMutex { // the mutex object // pth_mutex_t mutex_; - + #ifdef WIN32 pthread_mutex_t mutex_; #else diff --git a/libsrc/server/LmMesgBufPool.h b/libsrc/server/LmMesgBufPool.h index 98e0862..6c9d242 100644 --- a/libsrc/server/LmMesgBufPool.h +++ b/libsrc/server/LmMesgBufPool.h @@ -13,6 +13,7 @@ #include + #include "LyraDefs.h" #include "PThMutex.h" diff --git a/libsrc/shared/LyraDefs.h b/libsrc/shared/LyraDefs.h index 6f9b087..8d4a705 100644 --- a/libsrc/shared/LyraDefs.h +++ b/libsrc/shared/LyraDefs.h @@ -62,7 +62,7 @@ struct ByteOrder { // global constants that don't belong anywhere else struct Lyra { enum { - GAME_VERSION = 11386, // build / protocol version number (MUST be 5 digits) + GAME_VERSION = 11388, // build / protocol version number (MUST be 5 digits) GAME_SUBVERSION = GAME_VERSION, ID_UNKNOWN = 0, // invalid id @@ -226,9 +226,9 @@ typedef unsigned int realmid_t; // backwards compatibility #endif // on Linux, include pth.h to use soft system call mapping for user-level threads -// on Win32, alias all of pth_ types and calls to use pthread_ +// on Win32, alias all of pth_ types and calls to use pthread_ #if !defined(WIN32) -#ifndef PTH_SYSCALL_SOFT +#ifndef PTH_SYSCALL_SOFT #define PTH_SYSCALL_SOFT 1 #endif #include "pth.h" diff --git a/libsrc/shared/lmparty.cpp b/libsrc/shared/lmparty.cpp index 4c9d4db..70bd66b 100644 --- a/libsrc/shared/lmparty.cpp +++ b/libsrc/shared/lmparty.cpp @@ -34,9 +34,11 @@ void LmParty::Create(lyra_id_t leaderid) { Empty(); leaderid_ = leaderid; + creatorid_ = leaderid; AddPlayer(leaderid); } + //// // Empty: empty party //// diff --git a/libsrc/shared/lmparty.i b/libsrc/shared/lmparty.i index 26bfe42..5bdacb8 100644 --- a/libsrc/shared/lmparty.i +++ b/libsrc/shared/lmparty.i @@ -1,6 +1,6 @@ // LmParty.i -*- C++ -*- // $Id: LmParty.i,v 1.3 1997-07-18 16:04:59-07 jason Exp $ -// Copyright 1996-1997 Lyra LLC, All rights reserved. +// Copyright 1996-1997 Lyra LLC, All rights reserved. // // optionally inlined methods/functions @@ -46,6 +46,10 @@ INLINE lyra_id_t LmParty::LeaderID() const return leaderid_; } +INLINE lyra_id_t LmParty::CreatorID() cost +{ + return creatorid_; + } INLINE lyra_id_t LmParty::PlayerID(int index) const { return members_[index]; diff --git a/libsrc/util/LmIdSet.h b/libsrc/util/LmIdSet.h index 00738f9..4c4b440 100644 --- a/libsrc/util/LmIdSet.h +++ b/libsrc/util/LmIdSet.h @@ -1,6 +1,6 @@ // LmIdSet.h -*- C++ -*- // $Id: LmIdSet.h,v 1.7 1997-08-05 14:58:03-07 jason Exp $ -// Copyright 1996-1997 Lyra LLC, All rights reserved. +// Copyright 1996-1997 Lyra LLC, All rights reserved. // // non-resizable set of lyra_id_t's @@ -19,7 +19,9 @@ #include #include #endif + #include + #include // class forward declarations diff --git a/libsrc/util/LmLocker.h b/libsrc/util/LmLocker.h index 5f852b8..0c7091f 100644 --- a/libsrc/util/LmLocker.h +++ b/libsrc/util/LmLocker.h @@ -1,6 +1,6 @@ // LmLocker.h -*- C++ -*- // $Id: LmLocker.h,v 1.5 1997-07-30 16:45:48-07 jason Exp $ -// Copyright 1996-1997 Lyra LLC, All rights reserved. +// Copyright 1996-1997 Lyra LLC, All rights reserved. // // object-locking class @@ -11,7 +11,9 @@ #pragma interface #endif + #include "LyraDefs.h" + #include "PThMutex.h" // the class diff --git a/meson.build b/meson.build index a2a6b35..9d35ef8 100644 --- a/meson.build +++ b/meson.build @@ -7,7 +7,7 @@ add_project_arguments( '-std=c++0x', '-DRELEASE', language: 'cpp') add_project_link_arguments('libLyra.a', language: 'cpp') -add_project_link_arguments('-rdynamic', '-L/usr/lib64/mysql', '-lmysqlclient', '-lz', '-lnsl', '-lm', '-lpth', '-lgdbm', language: 'cpp') +add_project_link_arguments('-rdynamic', '-L/usr/bin/mysql', '-lmysqlclient', '-lz', '-lnsl', '-lm', '-lpth', '-lgdbm', language: 'cpp') incdir = include_directories('include', '/usr/include/mysql') libmysqlflags = run_command('mysql_config', '--include').stdout().strip() diff --git a/server/gamed/GsLevelSet.h b/server/gamed/GsLevelSet.h index 6d4fd87..2bc85cb 100644 --- a/server/gamed/GsLevelSet.h +++ b/server/gamed/GsLevelSet.h @@ -1,6 +1,6 @@ // GsLevelSet.h -*- C++ -*- // $Id: GsLevelSet.h,v 1.5 1997-09-25 16:31:38-07 jason Exp $ -// Copyright 1996-1997 Lyra LLC, All rights reserved. +// Copyright 1996-1997 Lyra LLC, All rights reserved. // // levels in world @@ -14,7 +14,9 @@ #include #include + #include "LyraDefs.h" + #include "PThMutex.h" // class forward declarations diff --git a/server/gamed/GsLevelSet.h.bak b/server/gamed/GsLevelSet.h.bak new file mode 100644 index 0000000..614103f --- /dev/null +++ b/server/gamed/GsLevelSet.h.bak @@ -0,0 +1,65 @@ +// GsLevelSet.h -*- C++ -*- +// $Id: GsLevelSet.h,v 1.5 1997-09-25 16:31:38-07 jason Exp $ +// Copyright 1996-1997 Lyra LLC, All rights reserved. +// +// levels in world + +#ifndef INCLUDED_GsLevelSet +#define INCLUDED_GsLevelSet + +#ifdef __GNUC__ +#pragma interface +#endif + +#include +#include + +<<<<<<< HEAD +#include "../../libsrc/shared/LyraDefs.h" +======= +#include "LyraDefs.h" +>>>>>>> parent of 07f5efa... include path update +#include "PThMutex.h" + +// class forward declarations + +class GsMain; +class LmLevelDBC; + +// the class + +class GsLevelSet { + +public: + + GsLevelSet(GsMain* gsmain); + ~GsLevelSet(); + + const LmLevelDBC* LevelDBC(lyra_id_t levelid); + + bool CanGoto(lyra_id_t from_levelid, lyra_id_t from_roomid, lyra_id_t to_levelid, lyra_id_t to_roomid); + + void Dump(FILE* f, int indent = 0) const; + +private: + + // not implemented + GsLevelSet(const GsLevelSet&); + //operator=(const GsLevelSet&); + + LmLevelDBC* get_level(lyra_id_t levelid); + LmLevelDBC* load_level(lyra_id_t levelid) const; + + GsMain* main_; + + PThMutex lock_; + typedef std::list llist_t; + llist_t levels_; + +}; + +#ifdef USE_INLINE +#include "GsLevelSet.i" +#endif + +#endif /* INCLUDED_GsLevelSet */ diff --git a/server/gamed/GsPlayerSet.h b/server/gamed/GsPlayerSet.h index a0b01a6..1914547 100644 --- a/server/gamed/GsPlayerSet.h +++ b/server/gamed/GsPlayerSet.h @@ -14,7 +14,9 @@ #include #include + #include "LyraDefs.h" + #include "PThMutex.h" // class forward declarations diff --git a/server/gamed/GsPlayerThreadSet.h b/server/gamed/GsPlayerThreadSet.h index 5cc1327..f76fea2 100644 --- a/server/gamed/GsPlayerThreadSet.h +++ b/server/gamed/GsPlayerThreadSet.h @@ -10,7 +10,9 @@ #include #include + #include "LyraDefs.h" + #include "PThMutex.h" // class forward declarations diff --git a/server/gamed/gamed.cbp b/server/gamed/gamed.cbp new file mode 100644 index 0000000..953e3f6 --- /dev/null +++ b/server/gamed/gamed.cbp @@ -0,0 +1,15 @@ + + + + + + diff --git a/server/gamed/gamed.layout b/server/gamed/gamed.layout new file mode 100644 index 0000000..a7c1ff1 --- /dev/null +++ b/server/gamed/gamed.layout @@ -0,0 +1,5 @@ + + + + + diff --git a/server/gamed/gamed.vcxproj b/server/gamed/gamed.vcxproj index 50aeefa..a751db8 100644 --- a/server/gamed/gamed.vcxproj +++ b/server/gamed/gamed.vcxproj @@ -21,6 +21,9 @@ {F21A5C24-C144-4F9B-B131-3FBA3C97803C} MakeFileProj + + 8.1 + @@ -120,4 +123,4 @@ - \ No newline at end of file + diff --git a/server/leveld/LsCodexText.h b/server/leveld/LsCodexText.h index 7c57ead..c805205 100644 --- a/server/leveld/LsCodexText.h +++ b/server/leveld/LsCodexText.h @@ -10,6 +10,7 @@ #include #include "LyraDefs.h" + #include "PThMutex.h" // class forward declarations diff --git a/server/leveld/LsCodexText.h.bak b/server/leveld/LsCodexText.h.bak new file mode 100644 index 0000000..94a146c --- /dev/null +++ b/server/leveld/LsCodexText.h.bak @@ -0,0 +1,64 @@ +// LsCodexText.h -*- C++ -*- +// $Id: LsCodexText.h,v 1.1 1998-02-20 20:26:54-08 jason Exp $ +// Copyright 1996-1997 Lyra LLC, All rights reserved. +// +// codex generator text manager + +#ifndef INCLUDED_LsCodexText +#define INCLUDED_LsCodexText + +#include + +<<<<<<< HEAD +#include "../../libsrc/shared/LyraDefs.h" +======= +#include "LyraDefs.h" +>>>>>>> parent of 07f5efa... include path update +#include "PThMutex.h" + +// class forward declarations + +class LsMain; +class LsCodexTextImp; + +// class declarations + +class LsCodexText { + +public: + + enum { + MAX_LINES = 128 // max number of text possibilities + }; + +public: + + LsCodexText(LsMain* lsmain); + ~LsCodexText(); + + void Load(); + void CopyDescription(TCHAR* desc, int length); + + void Dump(FILE* f, int indent = 0) const; + +private: + + // not implemented + LsCodexText(const LsCodexText&); + //operator=(const LsCodexText&); + + LsMain* main_; + + // lock + PThMutex lock_; + + // implementation pointer + LsCodexTextImp* imp_; + +}; + +#ifdef USE_INLINE +#include "LsCodexText.i" +#endif + +#endif /* INCLUDED_LsCodexText */ diff --git a/server/leveld/LsLevelSerials.h b/server/leveld/LsLevelSerials.h index 1812552..735cc5e 100644 --- a/server/leveld/LsLevelSerials.h +++ b/server/leveld/LsLevelSerials.h @@ -10,7 +10,9 @@ #include #include + #include "LyraDefs.h" + #include "PThMutex.h" // forward declarations diff --git a/server/leveld/LsLevelState.h b/server/leveld/LsLevelState.h index 19ef3b4..98feb32 100644 --- a/server/leveld/LsLevelState.h +++ b/server/leveld/LsLevelState.h @@ -15,6 +15,7 @@ #include #include "LyraDefs.h" + #include "PThMutex.h" #include "LsLevelSerials.h" diff --git a/server/leveld/LsLevelState.h.bak b/server/leveld/LsLevelState.h.bak new file mode 100644 index 0000000..68d3e2e --- /dev/null +++ b/server/leveld/LsLevelState.h.bak @@ -0,0 +1,87 @@ +// LsLevelState.h -*- C++ -*- +// $Id: LsLevelState.h,v 1.14 1997-09-26 14:59:00-07 jason Exp $ +// Copyright 1996-1997 Lyra LLC, All rights reserved. +// +// dynamic level state class + +#ifndef INCLUDED_LsLevelState +#define INCLUDED_LsLevelState + +#ifdef __GNUC__ +#pragma interface +#endif + +#include +#include + +<<<<<<< HEAD +#include "../../libsrc/shared/LyraDefs.h" +======= +#include "LyraDefs.h" +>>>>>>> parent of 07f5efa... include path update +#include "PThMutex.h" +#include "LsLevelSerials.h" + +// forward declarations + +class LsMain; +class LsRoomState; +class LmLevelDBC; + +// the class + +class LsLevelState { + +public: + +public: + + LsLevelState(LsMain* lsmain); + ~LsLevelState(); + + void Init(void); + + int LoadFromDisk(); + int SaveToDisk(); + + int LoadFromDB(); + int SaveToDB(); + + LsRoomState* RoomState(lyra_id_t roomid) const; + LsRoomState* Room(int num) const; + + LsLevelSerials& Serials(); + + void RemovePlayer(lyra_id_t playerid, unsigned short realtime_id); + + void Dump(FILE* f, int indent = 0) const; + + unsigned short GetRealtimeID(lyra_id_t playerid); + void FreeRealtimeID(short realtime_id); + +private: + + // not implemented + //LsLeveState(const LsLevelState&); + //operator=(const LsLevelState&); + + // related objects + LsMain* main_; + const LmLevelDBC* dbc_; + + PThMutex lock_; + + // state of included rooms + int num_rooms_; + LsRoomState* rooms_; + + + // serial numbers owned by level + LsLevelSerials serials_; +}; + +#ifdef USE_INLINE +#include "LsLevelState.i" +#endif + +#endif /* INCLUDED_LsLevelState */ diff --git a/server/leveld/LsPlayer.cpp b/server/leveld/LsPlayer.cpp index a4a0076..1440ba1 100644 --- a/server/leveld/LsPlayer.cpp +++ b/server/leveld/LsPlayer.cpp @@ -11,7 +11,9 @@ #include #include "LsPlayer.h" + #include "LyraDefs.h" + #include "PThMutex.h" #include "LmDatabase.h" #include "LsMain.h" diff --git a/server/leveld/LsPlayerSet.h b/server/leveld/LsPlayerSet.h index 7a5805c..30aff33 100644 --- a/server/leveld/LsPlayerSet.h +++ b/server/leveld/LsPlayerSet.h @@ -14,7 +14,9 @@ #include #include + #include "LyraDefs.h" + #include "PThMutex.h" #include "LsPlayerList.h" diff --git a/server/leveld/leveld.cbp b/server/leveld/leveld.cbp new file mode 100644 index 0000000..953e3f6 --- /dev/null +++ b/server/leveld/leveld.cbp @@ -0,0 +1,15 @@ + + + + + + diff --git a/server/leveld/leveld.layout b/server/leveld/leveld.layout new file mode 100644 index 0000000..a7c1ff1 --- /dev/null +++ b/server/leveld/leveld.layout @@ -0,0 +1,5 @@ + + + + + diff --git a/server/leveld/leveld.vcxproj b/server/leveld/leveld.vcxproj index 445d48f..1b16f7c 100644 --- a/server/leveld/leveld.vcxproj +++ b/server/leveld/leveld.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -21,27 +21,28 @@ {B19A9659-65F0-4F8D-BC2A-25A41DD82F0C} MakeFileProj + 10.0.17763.0 Makefile true - v140 + v141 Makefile false - v140 + v141 Application true - v140 + v141 Application false - v140 + v141 diff --git a/server/masterd/Main.cpp b/server/masterd/Main.cpp index 6ebf04f..eba27e5 100644 --- a/server/masterd/Main.cpp +++ b/server/masterd/Main.cpp @@ -32,12 +32,12 @@ int _tmain(int argc, TCHAR** argv) _tprintf(_T("Usage: %s root_dir \n"), argv[0]); exit(1); } - + TCHAR* root_dir = argv[1]; bool debugging = false; if (argv[2]) debugging = true; - + if (!debugging) { // don't spawn new process if debugging LmUtil::DaemonStart(); diff --git a/server/masterd/MsMain.cpp b/server/masterd/MsMain.cpp index a784867..cfac8b5 100644 --- a/server/masterd/MsMain.cpp +++ b/server/masterd/MsMain.cpp @@ -91,13 +91,13 @@ int MsMain::Init(const TCHAR* root_dir) // get host IP address in string form //hostent* lphp = gethostbyname(hostname_); - + //in_addr* localIP = (in_addr*)lphp->h_addr; - + //char* hoststr = (char*)inet_ntoa((in_addr*)localIP); - + //_tcscpy(hostaddrstr_, hoststr); - + // create databases globaldb_ = LmNEW(LmGlobalDB(root_dir)); @@ -185,7 +185,7 @@ _stprintf(dfname, "ms_%lu_dump.%lu", pid_, time(NULL)); FILE* df =_tfopen(dumpfile, "w"); Dump(df); fclose(df); - } + } #endif if (rotate_logs_) { log_->Log(_T("%s: rotating log"), method); @@ -196,11 +196,11 @@ _stprintf(dfname, "ms_%lu_dump.%lu", pid_, time(NULL)); // log_->Log(_T("%s: checking server status at time %d"), method, time(NULL)); for (int i = 0; i < serverdbc_->NumServers(); ++i) { // if server arg1 is 0, it's an inactive server, don't try to connect - if (serverdbc_->Arg1(i) == 0) + if (serverdbc_->Arg1(i) == 0) continue; // we're really only worried about gamed's right now if (serverdbc_->ServerType(i) != LmServerDBC::ST_GAME) - continue; + continue; // create socket LmSocket sock; if (sock.Socket(LmSockType::Inet_Stream()) < 0) { @@ -278,7 +278,7 @@ _stprintf(dfname, "ms_%lu_dump.%lu", pid_, time(NULL)); //// void MsMain::get_status(LmSocket& sock) -{ +{ // this function is essentially a dummy, because whether or not we // can connect at all tells us if we're OK. However, if we do not // properly login and logout, we'll confused the gamed's and they @@ -495,7 +495,7 @@ void MsMain::handle_child_death(pid_t childpid, int status) int cstatus = WEXITSTATUS(status); // restart, but sleep a bit longer switch (cstatus) { - case Lyra::EXIT_CLOSED: + case Lyra::EXIT_CLOSED: log_->Log(_T("%s: child %lu exited normally, does not want a restart"), method, childpid); restart = false; case Lyra::EXIT_OK: @@ -557,7 +557,7 @@ void MsMain::handle_child_death(pid_t childpid, int status) if (pid == -1) { Log()->Error(": could not fork to launch fix_ghosts.pl : ", method, strerror(errno)); } - + if (pid == 0) { // child LmUtil::CloseAllDescriptors(); // close all files const TCHAR* rootdir = GlobalDB()->RootDir(); diff --git a/server/masterd/masterd.cbp b/server/masterd/masterd.cbp new file mode 100644 index 0000000..95bee80 --- /dev/null +++ b/server/masterd/masterd.cbp @@ -0,0 +1,59 @@ + + + + + + diff --git a/server/masterd/masterd.layout b/server/masterd/masterd.layout new file mode 100644 index 0000000..a7c1ff1 --- /dev/null +++ b/server/masterd/masterd.layout @@ -0,0 +1,5 @@ + + + + + diff --git a/server/masterd/masterd.vcxproj b/server/masterd/masterd.vcxproj index ae226f3..c328237 100644 --- a/server/masterd/masterd.vcxproj +++ b/server/masterd/masterd.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -21,27 +21,28 @@ {00DF16DE-2A67-481F-B04C-E1C62DA3EFB2} MakeFileProj + 10.0.17763.0 Makefile true - v140 + v141 Makefile false - v140 + v141 Application true - v140 + v141 Application false - v140 + v141 diff --git a/server/masterd/masterd.vcxproj.bak b/server/masterd/masterd.vcxproj.bak new file mode 100644 index 0000000..d632be9 --- /dev/null +++ b/server/masterd/masterd.vcxproj.bak @@ -0,0 +1,88 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {00DF16DE-2A67-481F-B04C-E1C62DA3EFB2} + MakeFileProj +<<<<<<< HEAD + 8.1 +======= +>>>>>>> parent of 07f5efa... include path update + + + + Makefile + true + v140 + + + Makefile + false + v140 + + + Application + true + v140 + + + Application + false + v140 + + + + + + + + + + + + + + + + + + + + + WIN32;_DEBUG;$(NMakePreprocessorDefinitions) + + + WIN32;NDEBUG;$(NMakePreprocessorDefinitions) + + + + + + + + + + + + + + + + \ No newline at end of file