EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
StationSvc.cpp
Go to the documentation of this file.
1 /*
2  ------------------------------------------------------------------------------------
3  LICENSE:
4  ------------------------------------------------------------------------------------
5  This file is part of EVEmu: EVE Online Server Emulator
6  Copyright 2006 - 2021 The EVEmu Team
7  For the latest information visit https://evemu.dev
8  ------------------------------------------------------------------------------------
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU Lesser General Public License as published by the Free Software
11  Foundation; either version 2 of the License, or (at your option) any later
12  version.
13 
14  This program is distributed in the hope that it will be useful, but WITHOUT
15  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public License along with
19  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
20  Place - Suite 330, Boston, MA 02111-1307, USA, or go to
21  http://www.gnu.org/copyleft/lesser.txt.
22  ------------------------------------------------------------------------------------
23  Author: Zhur
24 */
25 
26 #include "eve-server.h"
27 
28 #include "PyServiceCD.h"
29 #include "StaticDataMgr.h"
30 #include "cache/ObjCacheService.h"
31 #include "station/StationDataMgr.h"
32 #include "station/StationSvc.h"
33 
35 #include "Client.h"
36 
37 
39 
41 : PyService(mgr, "stationSvc"),
42  m_dispatch(new Dispatcher(this))
43 {
44  _SetCallDispatcher(m_dispatch);
45 
46  PyCallable_REG_CALL(StationSvc, GetStationItemBits);
47  PyCallable_REG_CALL(StationSvc, GetSolarSystem);
48  PyCallable_REG_CALL(StationSvc, GetStation);
49  PyCallable_REG_CALL(StationSvc, GetAllianceSystems);
50  PyCallable_REG_CALL(StationSvc, GetSystemsForAlliance);
51 }
52 
54  delete m_dispatch;
55 }
56 
57 PyResult StationSvc::Handle_GetStationItemBits(PyCallArgs &call) {
58  return stDataMgr.GetStationItemBits(call.client->GetStationID());
59 }
60 
61 PyResult StationSvc::Handle_GetSolarSystem(PyCallArgs &call) {
62  Call_SingleIntegerArg arg;
63  if (!arg.Decode(&call.tuple)) {
64  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
65  return nullptr;
66  }
67 
68  ObjectCachedMethodID method_id(GetName(), "GetSolarSystem");
69 
70  if(!m_manager->cache_service->IsCacheLoaded(method_id)) {
72 
73  m_manager->cache_service->GiveCache(method_id, (PyRep **)&t);
74  }
75 
77 }
78 
79 PyResult StationSvc::Handle_GetStation(PyCallArgs &call) {
80  Call_SingleIntegerArg arg;
81  if (!arg.Decode(&call.tuple)) {
82  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
83  return nullptr;
84  }
85 
86  return stDataMgr.GetStationPyData(arg.arg);
87 }
88 
89 //This is called when opening up the sov dashboard
90 PyResult StationSvc::Handle_GetAllianceSystems(PyCallArgs &call) {
91  sLog.White( "StationSvc::Handle_GetAllianceSystems()", "size= %u", call.tuple->size() );
92  call.Dump(SERVICE__CALL_DUMP);
93 
94  return svDataMgr.GetAllianceSystems();
95 }
96 
97 //This call is made by client when player opens 'Settled Systems' dropdown in alliance details ui
98 PyResult StationSvc::Handle_GetSystemsForAlliance(PyCallArgs &call) {
99  sLog.White( "StationSvc::Handle_GetSystemsForAlliance()", "size= %u", call.tuple->size() );
100  call.Dump(SERVICE__CALL_DUMP);
101  return nullptr;
102 }
Base Python wire object.
Definition: PyRep.h:66
Dispatcher *const m_dispatch
#define stDataMgr
size_t size() const
Definition: PyRep.h:591
static PyPackedRow * GetSolarSystem(uint32 ssid)
Definition: SystemDB.cpp:58
const char * GetName() const
Definition: PyService.h:54
PyCallable_Make_InnerDispatcher(StationSvc) StationSvc
Definition: StationSvc.cpp:38
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
#define codelog(type, fmt,...)
Definition: logsys.h:128
PyServiceMgr *const m_manager
Definition: PyService.h:91
Client *const client
Definition: PyCallable.h:49
#define PyCallable_REG_CALL(c, m)
Definition: PyServiceCD.h:78
void GiveCache(const PyRep *objectID, PyRep **contents)
Dispatcher *const m_dispatch
Definition: StationSvc.h:41
ObjCacheService * cache_service
Definition: PyServiceMgr.h:78
void Dump(LogType type) const
Definition: PyCallable.cpp:81
virtual ~StationSvc()
Definition: StationSvc.cpp:53
int32 GetStationID() const
Definition: Client.h:114
Packed row.
Definition: PyRep.h:961
#define svDataMgr
PyObject * MakeObjectCachedMethodCallResult(const PyRep *objectID, const char *versionCheck="run")
bool IsCacheLoaded(const PyRep *objectID) const
PyTuple * tuple
Definition: PyCallable.h:50