network_server.c
changeset 3117 4c9e8842598e
parent 2952 58522ed8f0f1
child 3121 72fb0554f9f1
equal deleted inserted replaced
3116:b125bf75b4b0 3117:4c9e8842598e
  1186 
  1186 
  1187 // If this fails, check the array above with network_data.h
  1187 // If this fails, check the array above with network_data.h
  1188 assert_compile(lengthof(_network_server_packet) == PACKET_END);
  1188 assert_compile(lengthof(_network_server_packet) == PACKET_END);
  1189 
  1189 
  1190 
  1190 
  1191 extern const SettingDesc patch_settings[];
  1191 extern const SettingDesc _patch_settings[];
  1192 
  1192 
  1193 // This is a TEMPORARY solution to get the patch-settings
  1193 // This is a TEMPORARY solution to get the patch-settings
  1194 //  to the client. When the patch-settings are saved in the savegame
  1194 //  to the client. When the patch-settings are saved in the savegame
  1195 //  this should be removed!!
  1195 //  this should be removed!!
  1196 static void NetworkSendPatchSettings(NetworkClientState* cs)
  1196 static void NetworkSendPatchSettings(NetworkClientState* cs)
  1198 	const SettingDesc *item;
  1198 	const SettingDesc *item;
  1199 	Packet *p = NetworkSend_Init(PACKET_SERVER_MAP);
  1199 	Packet *p = NetworkSend_Init(PACKET_SERVER_MAP);
  1200 	NetworkSend_uint8(p, MAP_PACKET_PATCH);
  1200 	NetworkSend_uint8(p, MAP_PACKET_PATCH);
  1201 	// Now send all the patch-settings in a pretty order..
  1201 	// Now send all the patch-settings in a pretty order..
  1202 
  1202 
  1203 	item = patch_settings;
  1203 	item = _patch_settings;
  1204 
  1204 
  1205 	while (item->name != NULL) {
  1205 	for (; item->save.cmd != SL_END; item++) {
  1206 		switch (item->flags) {
  1206 		const void *var = ini_get_variable(&item->save, &_patches);
  1207 			case SDT_BOOL:
  1207 		switch (GetVarMemType(item->save.conv)) {
  1208 			case SDT_INT8:
  1208 			case SLE_VAR_BL:
  1209 			case SDT_UINT8:
  1209 			case SLE_VAR_I8:
  1210 				NetworkSend_uint8(p, *(uint8 *)item->ptr);
  1210 			case SLE_VAR_U8:
       
  1211 				NetworkSend_uint8(p, *(uint8 *)var);
  1211 				break;
  1212 				break;
  1212 			case SDT_INT16:
  1213 			case SLE_VAR_I16:
  1213 			case SDT_UINT16:
  1214 			case SLE_VAR_U16:
  1214 				NetworkSend_uint16(p, *(uint16 *)item->ptr);
  1215 				NetworkSend_uint16(p, *(uint16 *)var);
  1215 				break;
  1216 				break;
  1216 			case SDT_INT32:
  1217 			case SLE_VAR_I32:
  1217 			case SDT_UINT32:
  1218 			case SLE_VAR_U32:
  1218 				NetworkSend_uint32(p, *(uint32 *)item->ptr);
  1219 				NetworkSend_uint32(p, *(uint32 *)var);
  1219 				break;
  1220 				break;
  1220 		}
  1221 		}
  1221 		item++;
       
  1222 	}
  1222 	}
  1223 
  1223 
  1224 	NetworkSend_Packet(p, cs);
  1224 	NetworkSend_Packet(p, cs);
  1225 }
  1225 }
  1226 
  1226