Mercurial > mm7
comparison Player.cpp @ 1271:5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
author | Grumpy7 |
---|---|
date | Sat, 15 Jun 2013 02:23:04 +0200 |
parents | 2e4a07ad5243 |
children | 19a4809e1da0 |
comparison
equal
deleted
inserted
replaced
1270:2e4a07ad5243 | 1271:5a3f48b370d5 |
---|---|
6365 } | 6365 } |
6366 | 6366 |
6367 //----- (004903C9) -------------------------------------------------------- | 6367 //----- (004903C9) -------------------------------------------------------- |
6368 PLAYER_SKILL_TYPE Player::GetSkillIdxByOrder(signed int order) | 6368 PLAYER_SKILL_TYPE Player::GetSkillIdxByOrder(signed int order) |
6369 { | 6369 { |
6370 PLAYER_SKILL_TYPE result; // eax@5 | 6370 int counter; // edx@5 |
6371 int v3; // edx@5 | 6371 bool canBeInactive; |
6372 char *v4; // ecx@5 | 6372 unsigned char requiredValue; |
6373 int v5; // esi@11 | 6373 signed int offset; |
6374 unsigned __int16 *v6; // edx@11 | 6374 |
6375 int v7; // esi@18 | 6375 if ( order <= 1 ) |
6376 unsigned __int16 *pActiveSkill; // edx@18 | 6376 { |
6377 | 6377 canBeInactive = false; |
6378 | 6378 requiredValue = 2; // 2 - primary skill |
6379 if ( order >= 0 ) | 6379 offset = 0; |
6380 { | 6380 } |
6381 | 6381 else if ( order <= 3 ) |
6382 if ( order <= 1 ) | 6382 { |
6383 { | 6383 canBeInactive = false; |
6384 result = (PLAYER_SKILL_TYPE)0; | 6384 requiredValue = 1; // 1 - available |
6385 v7 = 0; | 6385 offset = 2; |
6386 pActiveSkill = this->pActiveSkills; | 6386 } |
6387 for (int i = 0; i < 37; i++) | 6387 else if ( order <= 12 ) |
6388 { | 6388 { |
6389 if ( this->pActiveSkills[i] && pSkillAvailabilityPerClass[classType / 4][i] == 2 ) // 2 - primary skill | 6389 canBeInactive = true; |
6390 { | 6390 requiredValue = 1; // 1 - available |
6391 if ( v7 == order ) | 6391 offset = 4; |
6392 return (PLAYER_SKILL_TYPE)i; | 6392 } |
6393 ++v7; | 6393 else |
6394 } | 6394 { |
6395 } | 6395 return (PLAYER_SKILL_TYPE)37; |
6396 } | 6396 } |
6397 else | 6397 counter = 0; |
6398 { | 6398 for (int i = 0; i < 37; i++) |
6399 if ( order <= 3 ) | 6399 { |
6400 { | 6400 if ( (this->pActiveSkills[i] || canBeInactive) && pSkillAvailabilityPerClass[classType / 4][i] == requiredValue ) |
6401 result = (PLAYER_SKILL_TYPE)0; | 6401 { |
6402 v5 = 0; | 6402 if ( counter == order - offset ) |
6403 pActiveSkill = this->pActiveSkills; | 6403 return (PLAYER_SKILL_TYPE)i; |
6404 for (int i = 0; i < 37; i++) | 6404 ++counter; |
6405 { | 6405 } |
6406 if ( this->pActiveSkills[i] && pSkillAvailabilityPerClass[classType / 4][i] == 1 ) // 2 - primary skill | 6406 } |
6407 { | |
6408 if ( v5 == order - 2 ) | |
6409 return (PLAYER_SKILL_TYPE)i; | |
6410 ++v5; | |
6411 } | |
6412 } | |
6413 } | |
6414 else | |
6415 { | |
6416 if ( order <= 12 ) | |
6417 { | |
6418 v3 = 0; | |
6419 for (int i = 0; i < 37; i++) | |
6420 { | |
6421 if ( pSkillAvailabilityPerClass[classType / 4][i] == 1 ) | |
6422 { | |
6423 if ( v3 == order - 4 ) | |
6424 return (PLAYER_SKILL_TYPE)i; | |
6425 ++v3; | |
6426 } | |
6427 } | |
6428 } | |
6429 } | |
6430 } | |
6431 } | |
6432 return (PLAYER_SKILL_TYPE)37; | |
6433 } | 6407 } |
6434 | 6408 |
6435 | 6409 |
6436 | 6410 |
6437 //----- (0049048D) -------------------------------------------------------- | 6411 //----- (0049048D) -------------------------------------------------------- |