mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-11 07:38:36 +00:00
tabbify and cleaned up std issues and min/max problems.
This commit is contained in:
+23
-17
@@ -15,16 +15,36 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "debug.h"
|
||||
#include "EQPacket.h"
|
||||
#include "EQStream.h"
|
||||
#include "misc.h"
|
||||
#include "Mutex.h"
|
||||
#include "op_codes.h"
|
||||
#include "CRC16.h"
|
||||
|
||||
#include <string>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <time.h>
|
||||
#include <sys/types.h>
|
||||
#include <algorithm>
|
||||
|
||||
#if defined(ZONE) || defined(WORLD)
|
||||
#define RETRANSMITS
|
||||
#endif
|
||||
#ifdef RETRANSMITS
|
||||
#include "rulesys.h"
|
||||
#endif
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include <time.h>
|
||||
// have to undefine these since a macro version
|
||||
// is defined in windef.h (which windows includes)
|
||||
#undef min
|
||||
#undef max
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/time.h>
|
||||
@@ -33,20 +53,6 @@
|
||||
#include <fcntl.h>
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
#include "EQPacket.h"
|
||||
#include "EQStream.h"
|
||||
//#include "EQStreamFactory.h"
|
||||
#include "misc.h"
|
||||
#include "Mutex.h"
|
||||
#include "op_codes.h"
|
||||
#include "CRC16.h"
|
||||
|
||||
#if defined(ZONE) || defined(WORLD)
|
||||
#define RETRANSMITS
|
||||
#endif
|
||||
#ifdef RETRANSMITS
|
||||
#include "rulesys.h"
|
||||
#endif
|
||||
|
||||
//for logsys
|
||||
#define _L "%s:%d: "
|
||||
@@ -567,7 +573,7 @@ uint32 length;
|
||||
|
||||
while (used<length) {
|
||||
out=new EQProtocolPacket(OP_Fragment,nullptr,MaxLen-4);
|
||||
chunksize=std::min(length-used,MaxLen-6);
|
||||
chunksize= std::min(length-used,MaxLen-6);
|
||||
memcpy(out->pBuffer+2,tmpbuff+used,chunksize);
|
||||
out->size=chunksize+2;
|
||||
SequencedPush(out);
|
||||
|
||||
+26
-5
@@ -16,10 +16,6 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
|
||||
#include "debug.h"
|
||||
#include "StringUtil.h"
|
||||
#include "Item.h"
|
||||
@@ -29,6 +25,11 @@
|
||||
#include "shareddb.h"
|
||||
#include "classes.h"
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
|
||||
int32 NextItemInstSerialNumber = 1;
|
||||
|
||||
static inline int32 GetNextItemInstSerialNumber() {
|
||||
@@ -43,7 +44,7 @@ static inline int32 GetNextItemInstSerialNumber() {
|
||||
// NextItemInstSerialNumber is the next one to hand out.
|
||||
//
|
||||
// It is very unlikely to reach 2,147,483,647. Maybe we should call abort(), rather than wrapping back to 1.
|
||||
if(NextItemInstSerialNumber >= std::numeric_limits<uint32>::max())
|
||||
if(NextItemInstSerialNumber >= INT_MAX)
|
||||
NextItemInstSerialNumber = 1;
|
||||
else
|
||||
NextItemInstSerialNumber++;
|
||||
@@ -1051,6 +1052,26 @@ int16 Inventory::FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size, boo
|
||||
return SLOT_INVALID;
|
||||
}
|
||||
|
||||
void Inventory::dumpBagContents(ItemInst *inst, iter_inst *it) {
|
||||
iter_contents itb;
|
||||
|
||||
if (!inst || !inst->IsType(ItemClassContainer))
|
||||
return;
|
||||
|
||||
// Go through bag, if bag
|
||||
for (itb=inst->_begin(); itb!=inst->_end(); itb++) {
|
||||
ItemInst* baginst = itb->second;
|
||||
if(!baginst || !baginst->GetItem())
|
||||
continue;
|
||||
|
||||
std::string subSlot;
|
||||
StringFormat(subSlot," Slot %d: %s (%d)", Inventory::CalcSlotId((*it)->first, itb->first),
|
||||
baginst->GetItem()->Name, (baginst->GetCharges()<=0) ? 1 : baginst->GetCharges());
|
||||
std::cout << subSlot << std::endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Inventory::dumpItemCollection(const std::map<int16, ItemInst*> &collection) {
|
||||
iter_inst it;
|
||||
iter_contents itb;
|
||||
|
||||
+17
-13
@@ -15,21 +15,25 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "debug.h"
|
||||
#include "ProcLauncher.h"
|
||||
#ifdef _WINDOWS
|
||||
#include <windows.h>
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
ProcLauncher ProcLauncher::s_launcher;
|
||||
@@ -165,8 +169,8 @@ ProcLauncher::ProcRef ProcLauncher::Launch(Spec *&to_launch) {
|
||||
// Create the child process.
|
||||
|
||||
//glue together all the nice command line arguments
|
||||
string args(it->program);
|
||||
vector<string>::iterator cur, end;
|
||||
std::string args(it->program);
|
||||
std::vector<std::string>::iterator cur, end;
|
||||
cur = it->args.begin();
|
||||
end = it->args.end();
|
||||
for(; cur != end; cur++) {
|
||||
|
||||
Reference in New Issue
Block a user