comparison Player.cpp @ 1275:7569c88d9cb0

renamed a few unnamed functions
author Grumpy7
date Sat, 15 Jun 2013 06:51:04 +0200
parents 351bc06722f2
children f11651288371
comparison
equal deleted inserted replaced
1274:351bc06722f2 1275:7569c88d9cb0
198 198
199 199
200 //----- (00427730) -------------------------------------------------------- 200 //----- (00427730) --------------------------------------------------------
201 bool Player::CanCastSpell(unsigned int uRequiredMana) 201 bool Player::CanCastSpell(unsigned int uRequiredMana)
202 { 202 {
203 if (sMana >= uRequiredMana) 203 if (sMana >= (signed int)uRequiredMana)
204 { 204 {
205 sMana -= uRequiredMana; 205 sMana -= (signed int)uRequiredMana;
206 return true; 206 return true;
207 } 207 }
208 208
209 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); 209 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
210 return false; 210 return false;
264 unsigned int conditionIdx; // eax@1 264 unsigned int conditionIdx; // eax@1
265 int conditionTimeMultiplier; // esi@1 265 int conditionTimeMultiplier; // esi@1
266 int v6; // eax@8 266 int v6; // eax@8
267 signed int result; // qax@13 267 signed int result; // qax@13
268 signed int baseConditionMultiplier; // [sp+8h] [bp-8h]@4 268 signed int baseConditionMultiplier; // [sp+8h] [bp-8h]@4
269 269
270 conditionIdx = GetMajorConditionIdx(); 270 conditionIdx = GetMajorConditionIdx();
271 if ( conditionIdx >= 14 ) 271 if ( conditionIdx >= 14 && conditionIdx <= 16)
272 { 272 {
273 if ( conditionIdx <= 15 ) 273 if ( conditionIdx <= 15 )
274 { 274 {
275 baseConditionMultiplier = 5; 275 baseConditionMultiplier = 5;
276 } 276 }
278 { 278 {
279 baseConditionMultiplier = 10; 279 baseConditionMultiplier = 10;
280 } 280 }
281 conditionTimeMultiplier = GetConditionDayOfWeek(conditionIdx); 281 conditionTimeMultiplier = GetConditionDayOfWeek(conditionIdx);
282 } 282 }
283 else 283 else if (conditionIdx < 14)
284 { 284 {
285 baseConditionMultiplier = 1; 285 baseConditionMultiplier = 1;
286 conditionTimeMultiplier = 0; 286 conditionTimeMultiplier = 0;
287 for (int i = 0; i <= 13; i++) 287 for (int i = 0; i <= 13; i++)
288 { 288 {
291 conditionTimeMultiplier = v6; 291 conditionTimeMultiplier = v6;
292 } 292 }
293 if ( !conditionTimeMultiplier ) 293 if ( !conditionTimeMultiplier )
294 conditionTimeMultiplier = 1; 294 conditionTimeMultiplier = 1;
295 } 295 }
296 result = ((double)conditionTimeMultiplier * (double)baseConditionMultiplier * a2); 296 else{
297 conditionTimeMultiplier = 1;
298 baseConditionMultiplier = 1;
299 }
300 result = (int)((double)conditionTimeMultiplier * (double)baseConditionMultiplier * a2);
297 if ( result < 1 ) 301 if ( result < 1 )
298 result = 1; 302 result = 1;
299 return result; 303 return result;
300 } 304 }
301 305
303 int Player::GetPriceSell(int uRealValue, float price_multiplier) 307 int Player::GetPriceSell(int uRealValue, float price_multiplier)
304 { 308 {
305 signed int v3; // esi@1 309 signed int v3; // esi@1
306 signed int result; // eax@3 310 signed int result; // eax@3
307 311
308 v3 = (unsigned __int64)(signed __int64)((double)uRealValue / (price_multiplier + 2.0)) + uRealValue * GetMerchant() / 100; 312 v3 = (signed int)((signed __int64)((double)uRealValue / (price_multiplier + 2.0)) + uRealValue * GetMerchant() / 100);
309 if ( v3 > uRealValue ) 313 if ( v3 > uRealValue )
310 v3 = uRealValue; 314 v3 = uRealValue;
311 result = 1; 315 result = 1;
312 if ( v3 >= 1 ) 316 if ( v3 >= 1 )
313 result = v3; 317 result = v3;
315 } 319 }
316 320
317 //----- (004B8142) -------------------------------------------------------- 321 //----- (004B8142) --------------------------------------------------------
318 int Player::GetBuyingPrice(unsigned int uRealValue, float price_multiplier) 322 int Player::GetBuyingPrice(unsigned int uRealValue, float price_multiplier)
319 { 323 {
320 uint price = ((100 - GetMerchant()) * (uRealValue * price_multiplier)) / 100; 324 uint price = (uint)(((100 - GetMerchant()) * (uRealValue * price_multiplier)) / 100);
321 assert (price > 0); 325 assert (price > 0);
322 326
323 if (price < uRealValue) 327 if (price < uRealValue)
324 price = uRealValue; 328 price = uRealValue;
325 return price; 329 return price;
330 { 334 {
331 signed int v2; // esi@1 335 signed int v2; // esi@1
332 int v3; // ecx@1 336 int v3; // ecx@1
333 signed int result; // eax@3 337 signed int result; // eax@3
334 338
335 v2 = (signed __int64)(a2 * 50.0); 339 v2 = (signed int)(a2 * 50.0);
336 v3 = v2 * (100 - GetMerchant()) / 100; 340 v3 = v2 * (100 - GetMerchant()) / 100;
337 if ( v3 < v2 / 3 ) 341 if ( v3 < v2 / 3 )
338 v3 = v2 / 3; 342 v3 = v2 / 3;
339 result = 1; 343 result = 1;
340 if ( v3 >= 1 ) 344 if ( v3 >= 1 )
347 { 351 {
348 signed int v3; // esi@1 352 signed int v3; // esi@1
349 int v4; // ecx@1 353 int v4; // ecx@1
350 signed int result; // eax@3 354 signed int result; // eax@3
351 355
352 v3 = (signed __int64)((double)a2 / (6.0 - a3)); 356 v3 = (signed int)((double)a2 / (6.0 - a3));
353 v4 = v3 * (100 - GetMerchant()) / 100; 357 v4 = v3 * (100 - GetMerchant()) / 100;
354 if ( v4 < v3 / 3 ) 358 if ( v4 < v3 / 3 )
355 v4 = v3 / 3; 359 v4 = v3 / 3;
356 result = 1; 360 result = 1;
357 if ( v4 >= 1 ) 361 if ( v4 >= 1 )
358 result = v4; 362 result = v4;
359 return result; 363 return result;
360 } 364 }
361 365
362 //----- (004B8213) -------------------------------------------------------- 366 //----- (004B8213) --------------------------------------------------------
363 int Player::_4B8213(int a2, float a3) 367 int Player::GetBaseSellingPrice(int a2, float a3)
364 { 368 {
365 signed __int64 v3; // qax@1 369 signed int v3; // qax@1
366 370
367 v3 = (signed __int64)((double)a2 / (a3 + 2.0)); 371 v3 = (signed int)((double)a2 / (a3 + 2.0));
368 if ( (signed int)v3 < 1 ) 372 if ( v3 < 1 )
369 LODWORD(v3) = 1; 373 v3 = 1;
370 return v3; 374 return v3;
371 } 375 }
372 376
373 //----- (004B8233) -------------------------------------------------------- 377 //----- (004B8233) --------------------------------------------------------
374 int Player::_4B8233(int a2, float a3) 378 int Player::GetBaseBuyingPrice(int a2, float a3)
375 { 379 {
376 signed __int64 v3; // qax@1 380 signed int v3; // qax@1
377 381
378 v3 = (signed __int64)((double)a2 * a3); 382 v3 = (signed int)((double)a2 * a3);
379 if ( (signed int)v3 < 1 ) 383 if ( v3 < 1 )
380 LODWORD(v3) = 1; 384 v3 = 1;
381 return v3; 385 return v3;
382 } 386 }
383 387
384 //----- (004B824B) -------------------------------------------------------- 388 //----- (004B824B) --------------------------------------------------------
385 int Player::_4B824B(float a2) 389 int Player::GetBaseIdentifyPrice(float a2)
386 { 390 {
387 signed __int64 v2; // qax@1 391 signed int v2; // qax@1
388 392
389 v2 = (signed __int64)(a2 * 50.0); 393 v2 = (signed int)(a2 * 50.0);
390 if ( (signed int)v2 < 1 ) 394 if ( v2 < 1 )
391 LODWORD(v2) = 1; 395 v2 = 1;
392 return v2; 396 return v2;
393 } 397 }
394 398
395 //----- (004B8265) -------------------------------------------------------- 399 //----- (004B8265) --------------------------------------------------------
396 int Player::_4B8265(int a2, float a3) 400 int Player::GetBaseRepairPrice(int a2, float a3)
397 { 401 {
398 signed __int64 v3; // qax@1 402 signed int v3; // qax@1
399 403
400 v3 = (signed __int64)((double)a2 / (6.0 - a3)); 404 v3 = (signed int)((double)a2 / (6.0 - a3));
401 if ( (signed int)v3 < 1 ) 405 if ( v3 < 1 )
402 LODWORD(v3) = 1; 406 v3 = 1;
403 return v3; 407 return v3;
404 } 408 }
405 409
406 410
407 411