Skip to content

Commit 41b94d6

Browse files
committed
优化-规范化命名
优化-规范化命名
1 parent 8879161 commit 41b94d6

File tree

12 files changed

+40
-33
lines changed

12 files changed

+40
-33
lines changed

public/cpp/actor/actor_base/nguid.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,19 @@ namespace ngl
99
return (i64_actorid)lguid;
1010
}
1111

12+
int16_t nlogactor::m_localnum = 0;
13+
1214
nlogactor::nlogactor(ENUM_ACTOR avalue1, ELOG_TYPE avalue2) :
1315
m_value32(0)
1416
{
1517
m_value16[0] = avalue1;
1618
if (avalue2 == ELOG_TYPE::ELOG_LOCAL)
1719
{
18-
static int16_t lnum = (ttab_servers::tab()->m_type * 100 + ttab_servers::tab()->m_tcount);
19-
m_value16[1] = 0x8000 | lnum;
20+
if (m_localnum == 0)
21+
{
22+
m_localnum = (ttab_servers::tab()->m_type * 100 + ttab_servers::tab()->m_tcount);
23+
}
24+
m_value16[1] = 0x8000 | m_localnum;
2025
}
2126
else
2227
{

public/cpp/actor/actor_base/nguid.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,8 @@ namespace ngl
326326
int32_t m_value32;
327327
int16_t m_value16[2]; //ENUM_ACTOR aactortype, ELOG_TYPE alogtype
328328

329+
static int16_t m_localnum;
330+
329331
explicit nlogactor(int32_t avalue) :
330332
m_value32(avalue)
331333
{}

public/cpp/actor/actor_logic/game/actor_role.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ namespace ngl
8080
//# 聊天的转发类型
8181
ecross forward_type(const pbnet::PROBUFF_NET_CHAT& adata)
8282
{
83-
int lnow = localtime::gettime();
83+
int32_t lnow = (int32_t)localtime::gettime();
8484
if (lnow < m_info.notalkutc())
8585
{
8686
auto pro = std::make_shared<pbnet::PROBUFF_NET_ERROR>();

public/cpp/logic/public/public/brief/briefdb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ namespace ngl
5656
for (const std::pair<const nguid, data_modified<pbdb::db_brief>>& pair : data())
5757
{
5858
const pbdb::db_brief& lbrief = pair.second.getconst();
59-
std::format(
59+
(*lstream) << std::format(
6060
"++++++++++++++++++++++\n"
6161
"+m_id={}\n"
6262
"+m_lv={}\n"

public/cpp/logic/public/public/calendar/calendar.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ namespace ngl
7171

7272
auto lstream = log_error();
7373
(*lstream) << "actor_calendar###loaddb_finish" << std::endl;
74-
int32_t lnow = localtime::gettime();
74+
int32_t lnow = (int32_t)localtime::gettime();
7575
for (std::pair<const nguid, data_modified<pbdb::db_calendar> >& item : *lmap)
7676
{
7777
(*lstream) << std::format("calendar[{}]", item.first.id()) << std::endl;

public/cpp/logic/public/public/mail/mail.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ namespace ngl
107107
int32_t& lid = maxid(aroleid);
108108
lmail.set_m_id(++lid);
109109
lmail.set_m_tid(atid);
110-
lmail.set_m_createutc(localtime::gettime());
110+
lmail.set_m_createutc((int32_t)localtime::gettime());
111111
lmail.set_m_draw(false);
112112
lmail.set_m_read(false);
113113
lmail.set_m_prams(aparm);

public/cpp/logic/public/public/notice/notice.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ namespace ngl
7070
{
7171
static int32_t lasttime = 0;
7272
// Ê®·ÖÖÓË¢ÐÂÒ»´Î
73-
int32_t lnow = localtime::gettime();
73+
int32_t lnow = (int32_t)localtime::gettime();
7474
if (lasttime == 0 || lnow > (lasttime + (10 * localtime::MINUTES_SECOND)))
7575
{
7676
lasttime = lnow;

public/cpp/logic/public/public/ranklist/ranklist.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace ngl
4040
}
4141
else
4242
{
43-
m_time[atype] = localtime::gettime();
43+
m_time[atype] = (int32_t)localtime::gettime();
4444
}
4545
}
4646

@@ -204,7 +204,7 @@ namespace ngl
204204
{
205205
if (litem.equal_value(atype, itor->second) == false)
206206
{
207-
litem.m_time[atype] = localtime::gettime();
207+
litem.m_time[atype] = (int32_t)localtime::gettime();
208208
pbdb::db_ranklist* lpdata = get(abrief.m_id());
209209
litem.change(atype, *lpdata);
210210
return true;

public/cpp/logic/public/role/attribute/attribute_value.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ namespace ngl
8484
m_fightscore = 0;
8585
for (const auto& [key, value] : m_fight)
8686
{
87-
m_fightscore += fight(key, value);
87+
m_fightscore += fight(key, (double)value);
8888
}
8989
return m_fightscore;
9090
}
@@ -130,25 +130,25 @@ namespace ngl
130130
// 添加属性
131131
void set_attr(EnumAttribute atype, double avalues)
132132
{
133-
m_attr[atype] = avalues;
133+
m_attr[atype] = (int64_t)avalues;
134134
}
135135

136136
// 添加比例属性属性
137137
void set_rattr(EnumAttribute atype, double avalues)
138138
{
139-
m_rattr[atype] = avalues;
139+
m_rattr[atype] = (float)avalues;
140140
}
141141

142142
// 给父结点添加属性
143143
void set_father_rattr(EnumModule amodule, EnumAttribute atype, double avalues)
144144
{
145-
m_crattr[amodule][atype] = avalues;
145+
m_crattr[amodule][atype] = (float)avalues;
146146
}
147147

148148
// 获取属性
149149
double get_attr(EnumAttribute atype)
150150
{
151-
return m_attr[atype];
151+
return (double)m_attr[atype];
152152
}
153153

154154
// 获取比例属性属性

public/cpp/logic/public/template_tab/ttab_calendar.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -143,21 +143,21 @@ namespace ngl
143143

144144
static void init_week(int aid, std::vector<tweek>& aweek)
145145
{
146-
int32_t lnow = localtime::gettime();
146+
int32_t lnow = (int32_t)localtime::gettime();
147147
std::vector<int32_t> lvec;
148148
int32_t lid = 0;
149149
for (auto& item : aweek)
150150
{
151-
int lweekdaystart = localtime::getweekday(item.m_weekstart == localtime::WEEK_DAY ? 0: item.m_weekstart, 0, 0, 0);
152-
int lweekdayfinish = localtime::getweekday(item.m_weekfinish == localtime::WEEK_DAY ? 0 : item.m_weekfinish, 0, 0, 0);
151+
int32_t lweekdaystart = (int32_t)localtime::getweekday(item.m_weekstart == localtime::WEEK_DAY ? 0: item.m_weekstart, 0, 0, 0);
152+
int32_t lweekdayfinish = (int32_t)localtime::getweekday(item.m_weekfinish == localtime::WEEK_DAY ? 0 : item.m_weekfinish, 0, 0, 0);
153153

154154
std::pair<bool, int32_t> lpairopen = daysecond(item.m_opentime.c_str());
155155
std::pair<bool, int32_t> lpairclose = daysecond(item.m_closetime.c_str());
156156
if (lpairclose.first && lpairopen.first)
157157
{
158158
assert(lpairclose.second > lpairopen.second);
159-
int lbeg = lweekdaystart + lpairopen.second;
160-
int lend = lweekdayfinish + lpairclose.second;
159+
int32_t lbeg = lweekdaystart + lpairopen.second;
160+
int32_t lend = lweekdayfinish + lpairclose.second;
161161
assert(lend > lbeg);
162162
if (lnow > lend)
163163
{
@@ -172,7 +172,7 @@ namespace ngl
172172

173173
static void init_serveropen(int aid, std::vector<tserveropen>& atserveropen)
174174
{
175-
int32_t lnow = localtime::gettime();
175+
int32_t lnow = (int32_t)localtime::gettime();
176176
int32_t lopentime = sysconfig::open_servertime();
177177
int32_t lid = 0;
178178
for (auto& item : atserveropen)
@@ -198,11 +198,11 @@ namespace ngl
198198

199199
static void init_tregularslot(int aid, std::vector<tregularslot>& atregularslot)
200200
{
201-
int32_t lnow = localtime::gettime();
201+
int32_t lnow = (int32_t)localtime::gettime();
202202
for (auto& item : atregularslot)
203203
{
204-
int32_t lbeg = localtime::str2time(item.m_opentime.c_str(), "%Y-%m-%d %H:%M:%S");
205-
int32_t lclose = localtime::str2time(item.m_closetime.c_str(), "%Y-%m-%d %H:%M:%S");
204+
int32_t lbeg = (int32_t)localtime::str2time(item.m_opentime.c_str(), "%Y-%m-%d %H:%M:%S");
205+
int32_t lclose = (int32_t)localtime::str2time(item.m_closetime.c_str(), "%Y-%m-%d %H:%M:%S");
206206
if (lnow > lclose)
207207
continue;
208208
m_data[aid].add(lbeg, lclose);
@@ -223,7 +223,7 @@ namespace ngl
223223
data* lpdata = tools::findmap(m_data, aid);
224224
if (lpdata == nullptr)
225225
return false;
226-
int32_t lnow = localtime::gettime();
226+
int32_t lnow = (int32_t)localtime::gettime();
227227
for (int64_t item : lpdata->m_utc)
228228
{
229229
if (lnow >= data::beg(item) && lnow <= data::end(item))

0 commit comments

Comments
 (0)