src/signs.cpp
changeset 9388 27b62a221d24
parent 9148 ba0f18cfc795
child 9734 eb7fab767c8e
equal deleted inserted replaced
9387:ede823d445f5 9388:27b62a221d24
    22 #include "oldpool_func.h"
    22 #include "oldpool_func.h"
    23 
    23 
    24 #include "table/strings.h"
    24 #include "table/strings.h"
    25 
    25 
    26 SignID _new_sign_id;
    26 SignID _new_sign_id;
    27 uint _total_signs;
       
    28 bool _sign_sort_dirty;
    27 bool _sign_sort_dirty;
    29 
    28 
    30 /* Initialize the sign-pool */
    29 /* Initialize the sign-pool */
    31 DEFINE_OLD_POOL_GENERIC(Sign, Sign)
    30 DEFINE_OLD_POOL_GENERIC(Sign, Sign)
    32 
    31 
   113 		UpdateSignVirtCoords(si);
   112 		UpdateSignVirtCoords(si);
   114 		MarkSignDirty(si);
   113 		MarkSignDirty(si);
   115 		InvalidateWindow(WC_SIGN_LIST, 0);
   114 		InvalidateWindow(WC_SIGN_LIST, 0);
   116 		_sign_sort_dirty = true;
   115 		_sign_sort_dirty = true;
   117 		_new_sign_id = si->index;
   116 		_new_sign_id = si->index;
   118 		_total_signs++;
       
   119 	}
   117 	}
   120 
   118 
   121 	return CommandCost();
   119 	return CommandCost();
   122 }
   120 }
   123 
   121 
   160 			MarkSignDirty(si);
   158 			MarkSignDirty(si);
   161 			delete si;
   159 			delete si;
   162 
   160 
   163 			InvalidateWindow(WC_SIGN_LIST, 0);
   161 			InvalidateWindow(WC_SIGN_LIST, 0);
   164 			_sign_sort_dirty = true;
   162 			_sign_sort_dirty = true;
   165 			_total_signs--;
       
   166 		}
   163 		}
   167 	}
   164 	}
   168 
   165 
   169 	return CommandCost();
   166 	return CommandCost();
   170 }
   167 }
   200  * Initialize the signs
   197  * Initialize the signs
   201  *
   198  *
   202  */
   199  */
   203 void InitializeSigns()
   200 void InitializeSigns()
   204 {
   201 {
   205 	_total_signs = 0;
       
   206 	_Sign_pool.CleanPool();
   202 	_Sign_pool.CleanPool();
   207 	_Sign_pool.AddBlockToPool();
   203 	_Sign_pool.AddBlockToPool();
   208 }
   204 }
   209 
   205 
   210 static const SaveLoad _sign_desc[] = {
   206 static const SaveLoad _sign_desc[] = {
   239  * Load all signs
   235  * Load all signs
   240  *
   236  *
   241  */
   237  */
   242 static void Load_SIGN()
   238 static void Load_SIGN()
   243 {
   239 {
   244 	_total_signs = 0;
       
   245 	int index;
   240 	int index;
   246 	while ((index = SlIterateArray()) != -1) {
   241 	while ((index = SlIterateArray()) != -1) {
   247 		Sign *si = new (index) Sign();
   242 		Sign *si = new (index) Sign();
   248 		SlObject(si, _sign_desc);
   243 		SlObject(si, _sign_desc);
   249 
       
   250 		_total_signs++;
       
   251 	}
   244 	}
   252 
   245 
   253 	_sign_sort_dirty = true;
   246 	_sign_sort_dirty = true;
   254 }
   247 }
   255 
   248