About the last Warcraft 3 and the input and output files

The last two bug, is a sort of weapons, only the row number of totalweapon, should be ranked 10, it is the size of the entire library of weapons, given the circumstances null pointer in the sort function.
Further, the reason had to be able to delete are deleted, a plurality of pointers to the same memory space allocation, i.e., back out of the new space and the pointer is assigned to the other, so that new deleted by other pointing out space is a problem. Remember to delete new delete only out of their own space if deleted other space will be a problem.
The read bmp file, encountered several problems in terms of memory:
one is the problem of dynamically allocated arrays. When 24 map dynamically allocated arrays (that is, the length of the array is variable, but did not assign a new) no problems (Dev), but the 32 allocated memory problems when he told me that,

as shown in Figure . Check on Stack Overflow, too much space is required. Then the group was asked about the original can not do with a variable length arrays, use so-called variable length arrays, you have to use new distribution space ...... Well, last semester did not learn. There is a new pit (which led me also to find most of the day), sizeof is not going to tell you the entire new space, the size of the manual you can only use new take time to fill the size of each element.
Be sure to carefully read ah! ! ! ! !

Guess you like

Origin blog.csdn.net/weixin_44288817/article/details/88776660