Implementing the restructure changes

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • PowerWyrm
    replied
    Commit 5fbac3:

    I don't see how this change fixes anything, since square_open_door() and square_close_door() both call square_set_feat() which already does square_note_spot() and square_light_spot().

    Leave a comment:


  • PowerWyrm
    replied
    Commit 23ad55:

    Code:
    	if (player->upkeep->command_wrk == USE_QUIVER)
    		m->selections = "012345789";
    	else
    		m->selections = lower_case;
    Why not "6"?

    Leave a comment:


  • PowerWyrm
    replied
    Commit 5357c6:

    Code:
    void place_random_stairs(struct chunk *c, int y, int x)
    {
        int feat = randint0(100) < 50 ? FEAT_LESS : FEAT_MORE;
        if (square_canputitem(c, y, x) && !square_isplayertrap(c, y, x))
    		place_stairs(c, y, x, feat);
    }
    The check on square_isplayertrap() is redundant, since it's already done in square_canputitem():

    Code:
    bool square_canputitem(struct chunk *c, int y, int x) {
    	if (!square_isfloor(c, y, x))
    		return FALSE;
    	if (square_iswarded(c, y, x) || square_isplayertrap(c, y, x))
    		return FALSE;
    	return !square_object(c, y, x);
    }

    Leave a comment:


  • PowerWyrm
    replied
    Commit 4d9b69: monster base graphics parser loops on every race checking for any race that matches base race, but does a "parser_getint" each time; this should be done once before the loop.

    Code:
        byte attr;
        char chr;
    
        attr = (byte)parser_getint(p, "attr");
        chr = (char)parser_getint(p, "char");
    
        for (i = 0; i < z_info->r_max; i++)
        {
            struct monster_race *race = &r_info[i];
    
            if (race->base != mb) continue;
    
            monster_x_attr[race->ridx] = attr;
            monster_x_char[race->ridx] = chr;
        }

    Leave a comment:


  • PowerWyrm
    replied
    Originally posted by PowerWyrm
    inven_carry() and (possibly in the future for V, currently in my variant which has a limit on monster inventory size) monster_carry() can fail, leaving an allocated object unfreed. So some tests should be added:
    - if (!inven_carry(object)) delete object
    - if (!monster_carry(object) delete object
    - be sure object is not referenced afterwards (set object to NULL and check vs NULL)
    Note that inven_carry() failing means a lot of trouble, because it means a valid object disappears without any reason from a player's inventory or the floor. IMHO inven_carry() should never fail, or if it does, it should trigger an assertion. Then no check on the return value should be done.

    Note that monster_carry() failing means that the item picked up is removed from the world, which was the case before monster inventories were introduced. A check on the return value could be done.

    Leave a comment:


  • PowerWyrm
    replied
    inven_carry() and (possibly in the future for V, currently in my variant which has a limit on monster inventory size) monster_carry() can fail, leaving an allocated object unfreed. So some tests should be added:
    - if (!inven_carry(object)) delete object
    - if (!monster_carry(object) delete object
    - be sure object is not referenced afterwards (set object to NULL and check vs NULL)

    Leave a comment:


  • PowerWyrm
    replied
    Originally posted by PowerWyrm
    Everything ported up to Dec 31, 2014. This means I only have the changes from this year left to port

    Stuff seems to work fine except for one problem: the server crashes after generating a few levels with the Dungeon Master on a malloc() line. Probably a memory overwrite error somewhere, or a double free. I'll check it when everything is ported, in case it fixes itself.
    Everything ported up to Apr 02, 2015. I'm now storming through the remaining changes (most of them are bugs -- a lot coming from this thread ), only 10 pages left... and the above problem fixed itself too (was reusing somewhere an object freed with object_delete() without nullifying it first -- easily spotted with the MEM_POISON_FREE feature in DEBUG mode).

    Leave a comment:


  • PowerWyrm
    replied
    Fix for #1872 should also be amended.

    After the fix, you get effects IDed even when blind. I don't think you should learn an effect if you cannot see it. Also effect projection is partly shown when blind (at least it's the case for ball wands/rods).

    Leave a comment:


  • PowerWyrm
    replied
    Fix for #1867 is still incomplete.

    If you stand on a pile of items, select one (with 'e' or 'i' and then '-') and press 'g' from the context menu to pick it up, the game asks you again which item on the floor you want to pick up.

    I guess player_pickup_item() still should have an object as parameter, context should set the object as command argument and do_cmd_pickup() should retrieve that argument and pass it to player_pickup_item().

    Leave a comment:


  • PowerWyrm
    replied
    Copy/paste error in parse_room_height():

    Code:
    	/* Make sure rooms are no higher than the room profiles allow. */
    	for (i = 0; i < N_ELEMENTS(room_builders); i++)
    		if (streq("room template", room_builders[i].name))
    			break;
    	if (i == N_ELEMENTS(room_builders))
    		return PARSE_ERROR_NO_ROOM_FOUND;
    	if ([B][U]t->wid[/U][/B] > room_builders[i].max_height)
    		return PARSE_ERROR_VAULT_TOO_BIG;
    This should be t->hgt.

    Leave a comment:


  • PowerWyrm
    replied
    Found a bug in player_outfit():

    Code:
    		inven_carry(p, obj, TRUE, FALSE);
    		si->kind->everseen = TRUE;
    
    		/* Deduct the cost of the item from starting cash */
    		p->au -= object_value(obj, obj->number, FALSE);
    If the object given at birth stacks with another item, the "obj" pointer is deleted and the "object_value" line crashes.

    I don't think this happens in V, but it happened with my variant when giving extra stuff to the Dungeon Master character. Putting the cost deduction before giving the item to the inventory would fix the (potential) problem.

    Leave a comment:


  • PowerWyrm
    replied
    Commit 8e96eb changed balance drakes from color 'v' to 'V'. Why not use color 'P', which is used for Great Wyrm of Balance?

    Btw, Nightwings have ATTR_FLICKER, so keeping color 'v' was ok.

    Leave a comment:


  • PowerWyrm
    replied
    Everything ported up to Dec 31, 2014. This means I only have the changes from this year left to port

    Stuff seems to work fine except for one problem: the server crashes after generating a few levels with the Dungeon Master on a malloc() line. Probably a memory overwrite error somewhere, or a double free. I'll check it when everything is ported, in case it fixes itself.

    Leave a comment:


  • PowerWyrm
    replied
    "command_menu" in ui-context is never freed.

    Leave a comment:


  • PowerWyrm
    replied
    Originally posted by PowerWyrm
    Found out that wield_all() doesn't do what it's supposed to do so I'll probably have to implement all the pile-related changes before I can even think of testing the new code.
    Well the problem was because I was sending the object indices to the client before sending the actual objects. Now it works.

    Leave a comment:

Working...
😀
😂
🥰
😘
🤢
😎
😞
😡
👍
👎
☕