Changeset 1449

Show
Ignore:
Timestamp:
06/22/09 20:13:18 (15 months ago)
Author:
ajps
Message:

Move the check for low mana when casting spells back into the 'effect' code from the 'UI'. What was I thinking?

Location:
trunk/src
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/cmd-obj.c

    r1448 r1449  
    401401static void obj_cast(object_type *o_ptr, int item) 
    402402{ 
    403         int spell; 
    404         const magic_type *s_ptr; 
    405         int dir; 
     403        int spell, dir; 
    406404 
    407405        cptr verb = ((cp_ptr->spell_book == TV_MAGIC_BOOK) ? "cast" : "recite"); 
    408     cptr noun = ((cp_ptr->spell_book == TV_MAGIC_BOOK) ? "spell" : "prayer"); 
     406        cptr noun = ((cp_ptr->spell_book == TV_MAGIC_BOOK) ? "spell" : "prayer"); 
    409407 
    410408        /* Track the object kind */ 
     
    418416                if (spell == -2) msg_format("You don't know any %ss in that book.", noun); 
    419417                return; 
    420         } 
    421  
    422         /* Get the spell */ 
    423         s_ptr = &mp_ptr->info[spell]; 
    424          
    425         /* Verify "dangerous" spells */ 
    426         if (s_ptr->smana > p_ptr->csp) 
    427         { 
    428                 /* Warning */ 
    429                 msg_format("You do not have enough mana to %s this %s.", verb, noun); 
    430                  
    431                 /* Flush input */ 
    432                 flush(); 
    433                  
    434                 /* Verify */ 
    435                 if (!get_check("Attempt it anyway? ")) return; 
    436418        } 
    437419 
  • trunk/src/cmd5.c

    r1437 r1449  
    569569        int i; 
    570570 
    571         cptr p = ((cp_ptr->spell_book == TV_MAGIC_BOOK) ? "spell" : "prayer"); 
     571        cptr verb = ((cp_ptr->spell_book == TV_MAGIC_BOOK) ? "cast" : "recite"); 
     572    cptr noun = ((cp_ptr->spell_book == TV_MAGIC_BOOK) ? "spell" : "prayer"); 
    572573 
    573574        /* Check the player can cast spells at all */ 
     
    586587                        if (spell_okay(spell, TRUE, FALSE)) 
    587588                        { 
     589                                /* Get the spell */ 
     590                                const magic_type *s_ptr = &mp_ptr->info[spell];  
     591                                 
     592                                /* Verify "dangerous" spells */ 
     593                                if (s_ptr->smana > p_ptr->csp) 
     594                                { 
     595                                        /* Warning */ 
     596                                        msg_format("You do not have enough mana to %s this %s.", verb, noun); 
     597                                         
     598                                        /* Flush input */ 
     599                                        flush(); 
     600                                         
     601                                        /* Verify */ 
     602                                        if (!get_check("Attempt it anyway? ")) return; 
     603                                } 
     604 
    588605                                /* Cast a spell */ 
    589606                                if (spell_cast(spell, dir)) 
     
    593610                        { 
    594611                                /* Spell is present, but player incapable. */ 
    595                                 msg_format("You cannot cast that %p.", p); 
     612                                msg_format("You cannot %s that %s.", verb, noun); 
    596613                        } 
    597614