mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 18:52:22 +00:00
Many fixes to regressions in perl and cleaning up the final interface
This commit is contained in:
@@ -2,7 +2,6 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
|
||||
|
||||
SET(common_sources
|
||||
BasePacket.cpp
|
||||
callback_manager.cpp
|
||||
classes.cpp
|
||||
Condition.cpp
|
||||
crash.cpp
|
||||
@@ -94,7 +93,6 @@ SET(common_headers
|
||||
BasePacket.h
|
||||
bodytypes.h
|
||||
breakdowns.h
|
||||
callback_manager.h
|
||||
classes.h
|
||||
common_profile.h
|
||||
Condition.h
|
||||
|
||||
+3
-13
@@ -65,7 +65,6 @@ ItemInst::ItemInst(const Item_Struct* item, int16 charges) {
|
||||
m_color = 0;
|
||||
m_merchantcount = 1;
|
||||
m_SerialNumber = GetNextItemInstSerialNumber();
|
||||
m_on_destroy = GetEQCallback("OnItemInstDestroy");
|
||||
}
|
||||
|
||||
ItemInst::ItemInst(SharedDatabase *db, uint32 item_id, int16 charges) {
|
||||
@@ -81,7 +80,6 @@ ItemInst::ItemInst(SharedDatabase *db, uint32 item_id, int16 charges) {
|
||||
m_color = 0;
|
||||
m_merchantcount = 1;
|
||||
m_SerialNumber = GetNextItemInstSerialNumber();
|
||||
m_on_destroy = GetEQCallback("OnItemInstDestroy");
|
||||
}
|
||||
|
||||
ItemInstQueue::~ItemInstQueue() {
|
||||
@@ -172,16 +170,12 @@ ItemInst::ItemInst(const ItemInst& copy)
|
||||
}
|
||||
m_SerialNumber = copy.m_SerialNumber;
|
||||
m_custom_data = copy.m_custom_data;
|
||||
m_on_destroy = copy.m_on_destroy;
|
||||
m_timers = copy.m_timers;
|
||||
}
|
||||
|
||||
// Clean up container contents
|
||||
ItemInst::~ItemInst()
|
||||
{
|
||||
if(m_on_destroy) {
|
||||
m_on_destroy(this);
|
||||
}
|
||||
|
||||
Clear();
|
||||
}
|
||||
|
||||
@@ -1685,7 +1679,7 @@ EvoItemInst::EvoItemInst(const EvoItemInst ©) {
|
||||
else
|
||||
m_scaledItem = nullptr;
|
||||
|
||||
m_on_destroy = GetEQCallback("OnItemInstDestroy");
|
||||
m_timers = copy.m_timers;
|
||||
}
|
||||
|
||||
EvoItemInst::EvoItemInst(const ItemInst &basecopy) {
|
||||
@@ -1725,7 +1719,7 @@ EvoItemInst::EvoItemInst(const ItemInst &basecopy) {
|
||||
m_activated = false;
|
||||
m_evolveInfo = nullptr;
|
||||
m_scaledItem = nullptr;
|
||||
m_on_destroy = copy->m_on_destroy;
|
||||
m_timers = copy->m_timers;
|
||||
}
|
||||
|
||||
EvoItemInst::EvoItemInst(const Item_Struct* item, int16 charges) {
|
||||
@@ -1746,13 +1740,9 @@ EvoItemInst::EvoItemInst(const Item_Struct* item, int16 charges) {
|
||||
m_activated = false;
|
||||
m_evolveInfo = nullptr;
|
||||
m_scaledItem = nullptr;
|
||||
m_on_destroy = GetEQCallback("OnItemInstDestroy");
|
||||
}
|
||||
|
||||
EvoItemInst::~EvoItemInst() {
|
||||
if(m_on_destroy) {
|
||||
m_on_destroy(this);
|
||||
}
|
||||
safe_delete(m_scaledItem);
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -37,7 +37,7 @@ class EvolveInfo; // Stores information about an evolving item family
|
||||
#include "../common/eq_packet_structs.h"
|
||||
#include "../common/eq_constants.h"
|
||||
#include "../common/item_struct.h"
|
||||
#include "callback_manager.h"
|
||||
#include "../common/timer.h"
|
||||
|
||||
// Helper typedefs
|
||||
typedef std::list<ItemInst*>::const_iterator iter_queue;
|
||||
@@ -266,8 +266,6 @@ public:
|
||||
m_instnodrop = false;
|
||||
m_merchantslot = 0;
|
||||
m_color = 0;
|
||||
|
||||
m_on_destroy = GetEQCallback("OnItemInstDestroy");
|
||||
}
|
||||
|
||||
ItemInst(const ItemInst& copy);
|
||||
@@ -381,6 +379,8 @@ public:
|
||||
inline int32 GetSerialNumber() const { return m_SerialNumber; }
|
||||
inline void SetSerialNumber(int32 id) { m_SerialNumber = id; }
|
||||
|
||||
std::map<std::string, Timer>& GetTimers() { return m_timers; }
|
||||
|
||||
protected:
|
||||
//////////////////////////
|
||||
// Protected Members
|
||||
@@ -407,7 +407,7 @@ protected:
|
||||
// Items inside of this item (augs or contents);
|
||||
std::map<uint8, ItemInst*> m_contents; // Zero-based index: min=0, max=9
|
||||
std::map<std::string, std::string> m_custom_data;
|
||||
eqemu_callback m_on_destroy;
|
||||
std::map<std::string, Timer> m_timers;
|
||||
};
|
||||
|
||||
class EvoItemInst: public ItemInst {
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
#include <map>
|
||||
#include "callback_manager.h"
|
||||
|
||||
std::map<std::string, eqemu_callback> callback_functions;
|
||||
|
||||
void RegisterEQCallback(std::string name, eqemu_callback func) {
|
||||
callback_functions[name] = func;
|
||||
}
|
||||
|
||||
eqemu_callback GetEQCallback(std::string name) {
|
||||
auto iter = callback_functions.find(name);
|
||||
if(iter == callback_functions.end()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return iter->second;
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
#ifndef EQEMU_CALLBACK_MANAGER_H
|
||||
#define EQEMU_CALLBACK_MANAGER_H
|
||||
|
||||
#include <string>
|
||||
#include <functional>
|
||||
|
||||
typedef std::function<void(void*)> eqemu_callback;
|
||||
|
||||
void RegisterEQCallback(std::string name, eqemu_callback func);
|
||||
eqemu_callback GetEQCallback(std::string name);
|
||||
|
||||
#endif
|
||||
@@ -30,6 +30,14 @@
|
||||
uint32 current_time = 0;
|
||||
uint32 last_time = 0;
|
||||
|
||||
Timer::Timer() {
|
||||
timer_time = 0;
|
||||
start_time = current_time;
|
||||
set_at_trigger = timer_time;
|
||||
pUseAcurateTiming = false;
|
||||
enabled = false;
|
||||
}
|
||||
|
||||
Timer::Timer(uint32 in_timer_time, bool iUseAcurateTiming) {
|
||||
timer_time = in_timer_time;
|
||||
start_time = current_time;
|
||||
|
||||
+1
-3
@@ -29,6 +29,7 @@
|
||||
class Timer
|
||||
{
|
||||
public:
|
||||
Timer();
|
||||
Timer(uint32 timer_time, bool iUseAcurateTiming = false);
|
||||
Timer(uint32 start, uint32 timer, bool iUseAcurateTiming);
|
||||
~Timer() { }
|
||||
@@ -62,9 +63,6 @@ private:
|
||||
// Instead of Check() setting the start_time = now,
|
||||
// it it sets it to start_time += timer_time
|
||||
bool pUseAcurateTiming;
|
||||
|
||||
// static uint32 current_time;
|
||||
// static uint32 last_time;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user