summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJedzkie <jedzkie13@rocketmail.com>2018-04-02 00:54:53 +0800
committerJedzkie <jedzkie13@rocketmail.com>2018-04-02 12:58:03 +0800
commitd537339c5cd1aa89e512b6ccac225bdf0235ec88 (patch)
tree72d768790d8bdab1ee7268dc2444febf0264d6e0 /src
parent2a05dbfc2f62c6bbac7983dcec120502914567f1 (diff)
downloadhercules-d537339c5cd1aa89e512b6ccac225bdf0235ec88.tar.gz
hercules-d537339c5cd1aa89e512b6ccac225bdf0235ec88.tar.bz2
hercules-d537339c5cd1aa89e512b6ccac225bdf0235ec88.tar.xz
hercules-d537339c5cd1aa89e512b6ccac225bdf0235ec88.zip
Whitespace fixes
Diffstat (limited to 'src')
-rw-r--r--src/char/pincode.c46
1 files changed, 25 insertions, 21 deletions
diff --git a/src/char/pincode.c b/src/char/pincode.c
index 8f3df4584..01c1f482c 100644
--- a/src/char/pincode.c
+++ b/src/char/pincode.c
@@ -146,7 +146,7 @@ void pincode_change(int fd, struct char_session_data* sd)
if (strlen(sd->pincode) != 4)
return;
- safestrncpy(oldpin, RFIFOP(fd,6), sizeof(oldpin));
+ safestrncpy(oldpin, RFIFOP(fd, 6), sizeof(oldpin));
pincode->decrypt(sd->pincode_seed, oldpin);
if (!pincode->compare(fd, sd, oldpin)) {
@@ -178,7 +178,7 @@ void pincode_setnew(int fd, struct char_session_data* sd)
if (strlen(sd->pincode) == 4)
return;
- safestrncpy(newpin, RFIFOP(fd,6), sizeof(newpin));
+ safestrncpy(newpin, RFIFOP(fd, 6), sizeof(newpin));
pincode->decrypt(sd->pincode_seed, newpin);
if (pincode->check_blacklist && pincode->isBlacklisted(newpin)) {
@@ -239,41 +239,47 @@ void pincode_editstate(int fd, struct char_session_data *sd, enum pincode_edit_r
void pincode_loginstate(int fd, struct char_session_data* sd, enum pincode_login_response state)
{
nullpo_retv(sd);
+
WFIFOHEAD(fd, 12);
WFIFOW(fd, 0) = 0x8b9;
WFIFOL(fd, 2) = sd->pincode_seed = rnd() % 0xFFFF;
WFIFOL(fd, 6) = sd->account_id;
- WFIFOW(fd,10) = state;
- WFIFOSET(fd,12);
+ WFIFOW(fd, 10) = state;
+ WFIFOSET(fd, 12);
}
-void pincode_notifyLoginPinUpdate(int account_id, char* pin) {
+void pincode_notifyLoginPinUpdate(int account_id, char* pin)
+{
nullpo_retv(pin);
+
Assert_retv(chr->login_fd != -1);
- WFIFOHEAD(chr->login_fd,11);
- WFIFOW(chr->login_fd,0) = 0x2738;
- WFIFOL(chr->login_fd,2) = account_id;
- safestrncpy(WFIFOP(chr->login_fd,6), pin, 5);
- WFIFOSET(chr->login_fd,11);
+ WFIFOHEAD(chr->login_fd, 11);
+ WFIFOW(chr->login_fd, 0) = 0x2738;
+ WFIFOL(chr->login_fd, 2) = account_id;
+ safestrncpy(WFIFOP(chr->login_fd, 6), pin, 5);
+ WFIFOSET(chr->login_fd, 11);
}
-void pincode_notifyLoginPinError(int account_id) {
- WFIFOHEAD(chr->login_fd,6);
- WFIFOW(chr->login_fd,0) = 0x2739;
- WFIFOL(chr->login_fd,2) = account_id;
- WFIFOSET(chr->login_fd,6);
+void pincode_notifyLoginPinError(int account_id)
+{
+ WFIFOHEAD(chr->login_fd, 6);
+ WFIFOW(chr->login_fd, 0) = 0x2739;
+ WFIFOL(chr->login_fd, 2) = account_id;
+ WFIFOSET(chr->login_fd, 6);
}
-void pincode_decrypt(unsigned int userSeed, char* pin) {
+void pincode_decrypt(unsigned int userSeed, char* pin)
+{
int i;
- char tab[10] = {0,1,2,3,4,5,6,7,8,9};
+ char tab[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
nullpo_retv(pin);
+
for (i = 1; i < 10; i++) {
int pos;
userSeed = pincode->baseSeed + userSeed * pincode->multiplier;
pos = userSeed % (i + 1);
- if( i != pos ){
+ if (i != pos) {
tab[i] ^= tab[pos];
tab[pos] ^= tab[i];
tab[i] ^= tab[pos];
@@ -379,8 +385,7 @@ bool pincode_config_read(const char *filename, const struct config_t *config, bo
aFree(VECTOR_POP(duplicate));
}
VECTOR_CLEAR(duplicate);
- }
- else if (!imported) {
+ } else if (!imported) {
ShowError("Pincode Blacklist Check is enabled but there's no blacklist setting! Disabling check.\n");
pincode->check_blacklist = false;
}
@@ -430,5 +435,4 @@ void pincode_defaults(void)
pincode->compare = pincode_compare;
pincode->check = pincode_check;
pincode->config_read = pincode_config_read;
-
}